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