/[skyui_scripts]/branch/skyui_510/Source/ski_activeeffectswidget.psc
ViewVC logotype

Contents of /branch/skyui_510/Source/ski_activeeffectswidget.psc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Aug 12 15:05:05 2017 UTC (2 years, 2 months ago) by william
File size: 3889 byte(s)
commit scripts for skyui 5.1
1 scriptname SKI_ActiveEffectsWidget extends SKI_WidgetBase
2
3 ; SCRIPT VERSION ----------------------------------------------------------------------------------
4 ;
5 ; History
6 ;
7 ; 1: - Initial version
8 ;
9 ; 2: - Updated hudModes
10 ;
11 ; 3: - Added MinimumTimeLeft
12
13 int function GetVersion()
14 return 3
15 endFunction
16
17 ; PRIVATE VARIABLES -------------------------------------------------------------------------------
18
19 ; -- Version 1 --
20
21 ; Make sure defaults match those in ConfigMenuInstance
22 bool _enabled = false
23 float _effectSize = 48.0
24 int _groupEffectCount = 8
25 string _orientation = "vertical"
26
27 ; -- Version 3 --
28
29 int _minimumTimeLeft = 180
30
31 ; PROPERTIES --------------------------------------------------------------------------------------
32
33 bool Property Enabled
34 {Whether the active effects are displayed or not}
35 bool function get()
36 return _enabled
37 endFunction
38
39 function set(bool a_val)
40 _enabled = a_val
41 if (Ready)
42 UI.InvokeBool(HUD_MENU, WidgetRoot + ".setEnabled", _enabled)
43 endIf
44 endFunction
45 endProperty
46
47 float property EffectSize
48 {Size of each effect icon in pixels at a resolution of 1280x720}
49 float function get()
50 return _effectSize
51 endFunction
52
53 function set(float a_val)
54 _effectSize = a_val
55 if (Ready)
56 UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setEffectSize", _effectSize)
57 endIf
58 endFunction
59 endProperty
60
61 int property GroupEffectCount
62 {Maximum number of widgets displayed until a new group (column, or row) is created}
63 int function get()
64 return _groupEffectCount
65 endFunction
66
67 function set(int a_val)
68 _groupEffectCount = a_val
69 if (Ready)
70 UI.InvokeInt(HUD_MENU, WidgetRoot + ".setGroupEffectCount", _groupEffectCount)
71 endIf
72 endFunction
73 endProperty
74
75 string property Orientation
76 {The axis in which new effects will be added to after the total number of effects > GroupEffectCount}
77 string function get()
78 return _orientation
79 endFunction
80
81 function set(string a_val)
82 _orientation = a_val
83 if (Ready)
84 UI.InvokeString(HUD_MENU, WidgetRoot + ".setOrientation", _orientation)
85 endIf
86 endFunction
87 endProperty
88
89 int property MinimumTimeLeft
90 {The minimum time left for an effect to be displayed}
91 int function get()
92 return _minimumTimeLeft
93 endFunction
94
95 function set(int a_val)
96 _minimumTimeLeft = a_val
97 if (Ready)
98 UI.InvokeInt(HUD_MENU, WidgetRoot + ".setMinTimeLeft", _minimumTimeLeft)
99 endIf
100 endFunction
101 endProperty
102
103 ; INITIALIZATION ----------------------------------------------------------------------------------
104
105 ; @implements SKI_QuestBase
106 event OnVersionUpdate(int a_version)
107
108 ; Version 2
109 if (a_version >= 2 && CurrentVersion < 2)
110 Debug.Trace(self + ": Updating to script version 2")
111
112 string[] hudModes = new string[6]
113 hudModes[0] = "All"
114 hudModes[1] = "StealthMode"
115 hudModes[2] = "Favor"
116 hudModes[3] = "Swimming"
117 hudModes[4] = "HorseMode"
118 hudModes[5] = "WarHorseMode"
119
120 Modes = hudModes
121 endIf
122 endEvent
123
124 ; EVENTS ------------------------------------------------------------------------------------------
125
126 ; @override SKI_WidgetBase
127 event OnWidgetReset()
128 parent.OnWidgetReset()
129
130 ; Init numbers
131 float[] numberArgs = new float[4]
132 numberArgs[0] = _enabled as float
133 numberArgs[1] = _effectSize
134 numberArgs[2] = _groupEffectCount as float
135 numberArgs[3] = _minimumTimeLeft as float
136 UI.InvokeFloatA(HUD_MENU, WidgetRoot + ".initNumbers", numberArgs)
137
138 ; Init strings
139 string[] stringArgs = new string[1]
140 stringArgs[0] = _orientation
141 UI.InvokeStringA(HUD_MENU, WidgetRoot + ".initStrings", stringArgs)
142
143 ; Init commit
144 UI.Invoke(HUD_MENU, WidgetRoot + ".initCommit")
145 endEvent
146
147
148 ; FUNCTIONS ---------------------------------------------------------------------------------------
149
150 ; @overrides SKI_WidgetBase
151 string function GetWidgetSource()
152 return "skyui/activeeffects.swf"
153 endFunction
154
155 ; @overrides SKI_WidgetBase
156 string function GetWidgetType()
157 return "SKI_ActiveEffectsWidget"
158 endFunction

  ViewVC Help
Powered by ViewVC 1.1.22