madcatzinc@13
|
1 --~ Warcraft Plugin for Cyborg MMO7
|
madcatzinc@0
|
2 --~ Filename: RatPageController.lua
|
madcatzinc@0
|
3 --~ Description: Controller logic for the RatPage
|
madcatzinc@0
|
4 --~ Copyright (C) 2012 Mad Catz Inc.
|
madcatzinc@0
|
5 --~ Author: Christopher Hooks
|
madcatzinc@0
|
6
|
madcatzinc@0
|
7 --~ This program is free software; you can redistribute it and/or
|
madcatzinc@0
|
8 --~ modify it under the terms of the GNU General Public License
|
madcatzinc@0
|
9 --~ as published by the Free Software Foundation; either version 2
|
madcatzinc@0
|
10 --~ of the License, or (at your option) any later version.
|
madcatzinc@0
|
11
|
madcatzinc@0
|
12 --~ This program is distributed in the hope that it will be useful,
|
madcatzinc@0
|
13 --~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
madcatzinc@0
|
14 --~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
madcatzinc@0
|
15 --~ GNU General Public License for more details.
|
madcatzinc@0
|
16
|
madcatzinc@0
|
17 --~ You should have received a copy of the GNU General Public License
|
madcatzinc@0
|
18 --~ along with this program; if not, write to the Free Software
|
madcatzinc@0
|
19 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
madcatzinc@0
|
20
|
madcatzinc@4
|
21 CyborgMMO_RatPageController = {
|
madcatzinc@0
|
22 new = function()
|
madcatzinc@13
|
23 local self = {}
|
madcatzinc@13
|
24 CyborgMMO_RatPageModel.Instance().SetMode(1)
|
madcatzinc@0
|
25
|
madcatzinc@0
|
26 self.SlotClicked = function(slot)
|
madcatzinc@0
|
27 local slotObject = nil
|
madcatzinc@4
|
28 slotObject = CyborgMMO_RatPageModel.Instance().GetObjectOnButton(slot.Id)
|
madcatzinc@13
|
29 CyborgMMO_RatPageModel.Instance().SetObjectOnButton(slot.Id, CyborgMMO_RatPageModel.Instance().GetMode(), self.GetCursorObject())
|
madcatzinc@0
|
30
|
madcatzinc@13
|
31 if slotObject then
|
madcatzinc@13
|
32 slotObject.Pickup()
|
madcatzinc@0
|
33 end
|
madcatzinc@0
|
34 end
|
madcatzinc@0
|
35
|
madcatzinc@0
|
36 self.ModeClicked = function(mode)
|
madcatzinc@13
|
37 msg("Setting mode "..tostring(mode.Id))
|
madcatzinc@13
|
38 CyborgMMO_RatPageModel.Instance().SetMode(mode.Id)
|
madcatzinc@0
|
39 end
|
madcatzinc@0
|
40
|
madcatzinc@0
|
41 self.GetCursorObject = function()
|
madcatzinc@13
|
42 local cursorObject = nil
|
madcatzinc@13
|
43 if GetCursorInfo() then
|
madcatzinc@13
|
44 local type,detail,subdetail = GetCursorInfo()
|
madcatzinc@13
|
45 cursorObject = CyborgMMO_WowObject.Create(type, detail, subdetail)
|
madcatzinc@13
|
46 ClearCursor()
|
madcatzinc@0
|
47 end
|
madcatzinc@13
|
48 return cursorObject
|
madcatzinc@0
|
49 end
|
madcatzinc@13
|
50
|
madcatzinc@0
|
51 self.CallbackDropped = function(callbackObject)
|
madcatzinc@13
|
52 local slot = nil
|
madcatzinc@13
|
53 local observers = CyborgMMO_RatPageModel.Instance().GetAllObservers()
|
madcatzinc@13
|
54 for i=1,#observers do
|
madcatzinc@13
|
55 if MouseIsOver(observers[i]) then
|
madcatzinc@13
|
56 slot = observers[i]
|
madcatzinc@13
|
57 break
|
madcatzinc@0
|
58 end
|
madcatzinc@0
|
59 end
|
madcatzinc@13
|
60 if slot then
|
madcatzinc@13
|
61 CyborgMMO_RatPageModel.Instance().SetObjectOnButton(slot.Id, CyborgMMO_RatPageModel.Instance().GetMode(), callbackObject.wowObject)
|
madcatzinc@0
|
62 end
|
madcatzinc@0
|
63 end
|
madcatzinc@0
|
64
|
madcatzinc@0
|
65 self.Close = function()
|
madcatzinc@0
|
66 end
|
madcatzinc@0
|
67
|
madcatzinc@0
|
68 self.Open = function()
|
madcatzinc@0
|
69 end
|
madcatzinc@0
|
70
|
madcatzinc@13
|
71 return self
|
madcatzinc@0
|
72 end,
|
madcatzinc@0
|
73
|
madcatzinc@0
|
74 m_Instance = nil,
|
madcatzinc@0
|
75
|
madcatzinc@0
|
76 Instance = function()
|
madcatzinc@13
|
77 if not CyborgMMO_RatPageController.m_Instance then
|
madcatzinc@13
|
78 CyborgMMO_RatPageController.m_Instance = CyborgMMO_RatPageController.new()
|
madcatzinc@0
|
79 end
|
madcatzinc@13
|
80 return CyborgMMO_RatPageController.m_Instance
|
madcatzinc@13
|
81 end,
|
madcatzinc@0
|
82 }
|
madcatzinc@13
|
83
|