madcatzinc@0
|
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@0
|
23 local self = {};
|
madcatzinc@4
|
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@4
|
29 CyborgMMO_RatPageModel.Instance().SetObjectOnButton(slot.Id, CyborgMMO_RatPageModel.Instance().GetMode(), self.GetCursorObject());
|
madcatzinc@0
|
30
|
madcatzinc@0
|
31 if(slotObject ~= nil) then
|
madcatzinc@0
|
32 slotObject.Pickup();
|
madcatzinc@0
|
33 end
|
madcatzinc@0
|
34
|
madcatzinc@0
|
35 end
|
madcatzinc@0
|
36
|
madcatzinc@0
|
37 self.ModeClicked = function(mode)
|
madcatzinc@0
|
38 msg("Setting mode "..tostring(mode.Id));
|
madcatzinc@4
|
39 CyborgMMO_RatPageModel.Instance().SetMode(mode.Id);
|
madcatzinc@0
|
40 end
|
madcatzinc@0
|
41
|
madcatzinc@0
|
42 self.GetCursorObject = function()
|
madcatzinc@0
|
43 local cursorObject = nil;
|
madcatzinc@0
|
44 if(nil ~= GetCursorInfo()) then
|
madcatzinc@0
|
45 local type, detail, subdetail = GetCursorInfo();
|
madcatzinc@4
|
46 cursorObject = CyborgMMO_WowObject.Create(type, detail, subdetail);
|
madcatzinc@0
|
47 ClearCursor();
|
madcatzinc@0
|
48 end
|
madcatzinc@0
|
49 return cursorObject;
|
madcatzinc@0
|
50 end
|
madcatzinc@0
|
51
|
madcatzinc@0
|
52 self.CallbackDropped = function(callbackObject)
|
madcatzinc@0
|
53 local slot = nil;
|
madcatzinc@4
|
54 local observers = CyborgMMO_RatPageModel.Instance().GetAllObservers();
|
madcatzinc@0
|
55 for i = 1, (# observers) do
|
madcatzinc@0
|
56 if(MouseIsOver(observers[i])) then
|
madcatzinc@0
|
57 slot = observers[i];
|
madcatzinc@0
|
58 break;
|
madcatzinc@0
|
59 end
|
madcatzinc@0
|
60 end
|
madcatzinc@0
|
61 if(nil ~= slot) then
|
madcatzinc@4
|
62 CyborgMMO_RatPageModel.Instance().SetObjectOnButton(slot.Id, CyborgMMO_RatPageModel.Instance().GetMode(), callbackObject.wowObject);
|
madcatzinc@0
|
63 end
|
madcatzinc@0
|
64 end
|
madcatzinc@0
|
65
|
madcatzinc@0
|
66
|
madcatzinc@0
|
67
|
madcatzinc@0
|
68 self.Close = function()
|
madcatzinc@0
|
69
|
madcatzinc@0
|
70 end
|
madcatzinc@0
|
71
|
madcatzinc@0
|
72 self.Open = function()
|
madcatzinc@0
|
73 end
|
madcatzinc@0
|
74
|
madcatzinc@0
|
75 return self;
|
madcatzinc@0
|
76 end,
|
madcatzinc@0
|
77
|
madcatzinc@0
|
78 m_Instance = nil,
|
madcatzinc@0
|
79
|
madcatzinc@0
|
80 Instance = function()
|
madcatzinc@4
|
81 if(nil == CyborgMMO_RatPageController.m_Instance) then
|
madcatzinc@4
|
82 CyborgMMO_RatPageController.m_Instance = CyborgMMO_RatPageController.new();
|
madcatzinc@0
|
83 end
|
madcatzinc@4
|
84 return CyborgMMO_RatPageController.m_Instance;
|
madcatzinc@0
|
85 end
|
madcatzinc@0
|
86 }
|