comparison OptionView.lua @ 5:8428fa7cf0e4

Updated the profile to use macros and rename all the variables and functions with the prefix CyborgMMO. Added a tooltip to inform the user to assign the profile.
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Tue, 29 May 2012 10:26:40 +0000
parents d186f8cd5000
children 6cb9a2936580
comparison
equal deleted inserted replaced
4:d186f8cd5000 5:8428fa7cf0e4
35 local mode = 1 35 local mode = 1
36 while(index > 13) do 36 while(index > 13) do
37 mode = mode + 1 37 mode = mode + 1
38 index = index - 13 38 index = index - 13
39 end 39 end
40 local buttonStr = StringTable[("CyborgMMO_OptionPageRebindMouseRow"..index.."Name")] 40 local buttonStr = CyborgMMO_StringTable[("CyborgMMO_OptionPageRebindMouseRow"..index.."Name")]
41 41
42 getglobal("CyborgMMO_BindingFrameButtonName"):SetText(buttonStr.." Mode "..mode) 42 getglobal("CyborgMMO_BindingFrameButtonName"):SetText(buttonStr.." Mode "..mode)
43 getglobal("CyborgMMO_BindingFrameKey"):SetText(StringTable["CyborgMMO_CurrentBinding"].." "..WowCommands[CyborgMMO_GetButtonIndex(lastButton)]) 43 getglobal("CyborgMMO_BindingFrameKey"):SetText(CyborgMMO_StringTable["CyborgMMO_CurrentBinding"].." "..CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)])
44 CyborgMMO_BindingFrame:Show() 44 CyborgMMO_BindingFrame:Show()
45 45
46 end 46 end
47 47
48 function CyborgMMO_GetBindingButtonText(name) 48 function CyborgMMO_GetBindingButtonText(name)
49 if(nil == WowCommands) then 49 if(nil == CyborgMMO_WowCommands) then
50 CyborgMMO_LoadWowCommands(); 50 CyborgMMO_LoadWowCommands();
51 end 51 end
52 52
53 local binding = WowCommands[CyborgMMO_GetButtonIndex(name)] 53 local binding = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(name)]
54 getglobal(name):SetText(binding) 54 getglobal(name):SetText(binding)
55 end 55 end
56 56
57 function CyborgMMO_GetButtonIndex(name) 57 function CyborgMMO_GetButtonIndex(name)
58 local row,mode = string.find(name,"Mode") 58 local row,mode = string.find(name,"Mode")
59 local modeStr = string.sub(name, mode +1,mode+2) 59 local modeStr = string.sub(name, mode +1,mode+2)
60 local rowStr = string.sub(name, row-1,row-1) 60 local rowStr = string.sub(name, row-1,row-1)
61 return (CyborgMMO_GetNumberFromHexLetter(rowStr) + ((CyborgMMO_GetNumberFromHexLetter(modeStr) - 1) * 13)) 61 return (CyborgMMO_GetNumberFromHexLetter(rowStr) + ((CyborgMMO_GetNumberFromHexLetter(modeStr) - 1) * 13))
62 end
63
64 function CyborgMMO_ShowProfileTooltip(self)
65 local red, green, blue, _ = self:GetVertexColor()
66 if((red == 0) and (green == 0) and (blue == 0)) then
67 GameTooltip:SetOwner(self:GetParent(), "ANCHOR_RIGHT");
68 GameTooltip:SetText(CyborgMMO_StringTable["CyborgMMO_ToolTipLine1"], nil, nil, nil, nil, 1);
69 GameTooltip:AddLine(nil, 0.8, 1.0, 0.8);
70 GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine2"], 0.8, 1.0, 0.8);
71 GameTooltip:AddLine(nil, 0.8, 1.0, 0.8);
72 GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine3"], 0.8, 1.0, 0.8);
73 GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine4"], 0.8, 1.0, 0.8);
74 GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine5"], 0.8, 1.0, 0.8);
75 GameTooltip:AddLine(nil, 0.8, 1.0, 0.8);
76 GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine6"], 0.8, 1.0, 0.8);
77 GameTooltip:Show();
78 end
79 end
80
81 function CyborgMMO_HideProfileTooltip(self)
82 GameTooltip:Hide();
62 end 83 end
63 84
64 function CyborgMMO_GetNumberFromHexLetter(str) 85 function CyborgMMO_GetNumberFromHexLetter(str)
65 local number = 0 86 local number = 0
66 if("A" == str) then 87 if("A" == str) then
80 end 101 end
81 return number 102 return number
82 end 103 end
83 104
84 function CyborgMMO_SetNewKeybind(keyOrButton) 105 function CyborgMMO_SetNewKeybind(keyOrButton)
85 local previous = WowCommands[CyborgMMO_GetButtonIndex(lastButton)] 106 local previous = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)]
86 WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton; 107 CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton;
87 CyborgMMO_GetBindingButtonText(lastButton); 108 CyborgMMO_GetBindingButtonText(lastButton);
88 CyborgMMO_BindingFrame:Hide() 109 CyborgMMO_BindingFrame:Hide()
89 CyborgMMO_RatPageModel.Instance().LoadData() 110 CyborgMMO_RatPageModel.Instance().LoadData()
90 end 111 end
91 112