vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function Tetris_GF_Toggle() |
2 | if(Tetris_GF:IsVisible()) then |
||
3 | Tetris_GF:Hide(); |
||
4 | Tetris_play_musik ("stop"); |
||
5 | else |
||
6 | Tetris_GF_SetFramesPos(); |
||
7 | Tetris_GF:Show(); |
||
8 | Tetris_play_musik ("game"); |
||
9 | end |
||
10 | end |
||
11 | |||
12 | function Tetris_GF_BF_Button_Click() |
||
13 | local ingame = Tetris["ingame"]; |
||
14 | local button = this:GetName(); |
||
15 | --nur reagieren wenn ingame |
||
16 | if (ingame == 1) then |
||
17 | --downbutton |
||
18 | if (button == "Tetris_GF_BF_d") then |
||
19 | Tetris_stone_move ("d"); |
||
20 | end |
||
21 | --upbutton |
||
22 | if (button == "Tetris_GF_BF_u") then |
||
23 | Tetris_stone_move ("u"); |
||
24 | end |
||
25 | --linksbutton |
||
26 | if (button == "Tetris_GF_BF_l") then |
||
27 | Tetris_stone_move ("l"); |
||
28 | end |
||
29 | --rechtsbutton |
||
30 | if (button == "Tetris_GF_BF_r") then |
||
31 | Tetris_stone_move ("r"); |
||
32 | end |
||
33 | end |
||
34 | end |
||
35 | |||
36 | function Tetris_GF_Button_Click() |
||
37 | local button = this:GetName(); |
||
38 | --close |
||
39 | if (button == "Tetris_GF_b_close") then |
||
40 | Tetris_gf_buttonclick ("close"); |
||
41 | end |
||
42 | --newgame |
||
43 | if (button == "Tetris_GF_b_newgame") then |
||
44 | Tetris_gf_buttonclick ("newgame"); |
||
45 | end |
||
46 | --pause |
||
47 | if (button == "Tetris_GF_b_pause") then |
||
48 | Tetris_gf_buttonclick ("pause"); |
||
49 | end |
||
50 | end |
||
51 | |||
52 | function Tetris_GF_gamewindow_falling_stone_Show () |
||
53 | --variablen holen und setzen |
||
54 | local stone = Tetris["game"]["s"]; |
||
55 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
56 | local textur = Tetris["options"]["texturenset"]; |
||
57 | --textur ändern |
||
58 | for s = 1, anz_s do |
||
59 | local s_pos = Tetris["game"]["s_temp"][s]; |
||
60 | getglobal("Tetris_"..s_pos):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\"..stone); |
||
61 | end |
||
62 | end |
||
63 | |||
64 | function Tetris_GF_gamewindow_falling_stone_Hide () |
||
65 | --variablen holen und setzen |
||
66 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
67 | local textur = Tetris["options"]["texturenset"]; |
||
68 | --textur ändern |
||
69 | for s = 1, anz_s do |
||
70 | local s_pos = Tetris["game"]["s_temp"][s]; |
||
71 | getglobal("Tetris_"..s_pos):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\0"); |
||
72 | end |
||
73 | end |
||
74 | |||
75 | --gamewindow und framegrösse einstellen |
||
76 | function Tetris_GF_create () |
||
77 | --variablen holen und setzen |
||
78 | local spalten = Tetris["game"]["x"]; |
||
79 | local zeilen = Tetris["game"]["y"]; |
||
80 | local b_hohe = Tetris["options"]["b_hohe"]; |
||
81 | local b_breite = Tetris["options"]["b_breite"]; |
||
82 | local abstand_x = Tetris["options"]["r_abstand_x"]; |
||
83 | local abstand_y = Tetris["options"]["r_abstand_y"]; |
||
84 | local faktor_x = Tetris["options"]["r_a-faktor_x"]; |
||
85 | local faktor_y = Tetris["options"]["r_a-faktor_y"]; |
||
86 | --GF grösse einstellen |
||
87 | local gf_h = 2*abstand_y+zeilen*b_hohe+faktor_y; |
||
88 | local gf_b = 2*abstand_x+spalten*b_breite+faktor_x; |
||
89 | --falls fenster zu klein |
||
90 | if (gf_h<455) then |
||
91 | abstand_y = abstand_y+(455-gf_h)/2; |
||
92 | Tetris_GF:SetHeight(455); |
||
93 | else |
||
94 | Tetris_GF:SetHeight(gf_h); |
||
95 | end |
||
96 | if (gf_b<410) then |
||
97 | abstand_x = abstand_x+(410-gf_b)/2; |
||
98 | Tetris_GF:SetWidth(410); |
||
99 | else |
||
100 | Tetris_GF:SetWidth(gf_b); |
||
101 | end |
||
102 | --gamewindow erstellen |
||
103 | for spalte = 1, spalten do --x position |
||
104 | for zeile = 1, zeilen do --y position |
||
105 | --stonename erstellen (position) |
||
106 | local x = spalte; |
||
107 | local y = zeile; |
||
108 | local stonename = "Tetris_x"..x.."y"..y..""; |
||
109 | --stonefeld verschieben, grösse anpassen und anzeigen |
||
110 | local x_pos = spalte*b_breite+abstand_x-b_breite; |
||
111 | local y_pos = zeile*b_hohe+abstand_y-b_hohe; |
||
112 | getglobal(stonename):SetParent("Tetris_GF"); |
||
113 | getglobal(stonename):SetPoint("BOTTOMLEFT", "Tetris_GF", "BOTTOMLEFT", ""..x_pos.."", ""..y_pos..""); |
||
114 | getglobal(stonename):SetHeight(b_hohe); |
||
115 | getglobal(stonename):SetWidth(b_breite); |
||
116 | getglobal(stonename):Show(); |
||
117 | end |
||
118 | end |
||
119 | end |
||
120 | |||
121 | function Tetris_GF_gamewindow_Update () |
||
122 | --variablen holen und setzen |
||
123 | local spalten = Tetris["game"]["x"]; |
||
124 | local zeilen = Tetris["game"]["y"]; |
||
125 | local textur = Tetris["options"]["texturenset"]; |
||
126 | |||
127 | --feldnummer aus fieldliste holen und setzen |
||
128 | for spalte = 1, spalten do |
||
129 | for zeile = 1, zeilen do |
||
130 | local f_nr = Tetris["game"]["feld"]["x"..spalte.."y"..zeile]; |
||
131 | getglobal("Tetris_x"..spalte.."y"..zeile):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\"..f_nr); |
||
132 | end |
||
133 | end |
||
134 | end |
||
135 | |||
136 | function Tetris_GF_gamewindow_Clear () |
||
137 | --variablen holen und setzen |
||
138 | local spalten = 50; |
||
139 | local zeilen = 50; |
||
140 | --alles löschen |
||
141 | for spalte = 1, spalten do |
||
142 | for zeile = 1, zeilen do |
||
143 | getglobal("Tetris_x"..spalte.."y"..zeile):SetParent("Tetris_TEMP"); |
||
144 | --getglobal("Tetris_x"..spalte.."y"..zeile):Hide(); |
||
145 | end |
||
146 | end |
||
147 | end |
||
148 | |||
149 | function Tetris_GF_NS_create () |
||
150 | --variablen holen und setzen |
||
151 | local spalten = Tetris["game"]["NS_x"]; |
||
152 | local zeilen = Tetris["game"]["NS_y"]; |
||
153 | local b_hohe = Tetris["options"]["b_NS_hohe"]; |
||
154 | local b_breite = Tetris["options"]["b_NS_breite"]; |
||
155 | local abstand_x = Tetris["options"]["r_NS_abstand_x"]; |
||
156 | local abstand_y = Tetris["options"]["r_NS_abstand_y"]; |
||
157 | local faktor_x = Tetris["options"]["r_a_NS-faktor_x"]; |
||
158 | local faktor_y = Tetris["options"]["r_a_NS-faktor_y"]; |
||
159 | --GF_NS grösse einstellen |
||
160 | local gf_h = 2*abstand_y+zeilen*b_hohe+faktor_y; |
||
161 | local gf_b = 2*abstand_x+spalten*b_breite+faktor_x; |
||
162 | Tetris_GF_NS:SetHeight(gf_h); |
||
163 | Tetris_GF_NS:SetWidth(gf_b); |
||
164 | --gamewindow erstellen |
||
165 | for spalte = 1, spalten do --x position |
||
166 | for zeile = 1, zeilen do --y position |
||
167 | --stonename erstellen (position) |
||
168 | local x = spalte; |
||
169 | local y = zeile; |
||
170 | local stonename = "Tetris_NS_x"..x.."y"..y..""; |
||
171 | --stonefeld verschieben, grösse anpassen und anzeigen |
||
172 | local x_pos = spalte*b_breite+abstand_x-b_breite; |
||
173 | local y_pos = zeile*b_hohe+abstand_y-b_hohe; |
||
174 | getglobal(stonename):SetPoint("BOTTOMLEFT", "Tetris_GF_NS", "BOTTOMLEFT", ""..x_pos.."", ""..y_pos..""); |
||
175 | getglobal(stonename):SetHeight(b_hohe); |
||
176 | getglobal(stonename):SetWidth(b_breite); |
||
177 | getglobal(stonename):Show(); |
||
178 | end |
||
179 | end |
||
180 | end |
||
181 | |||
182 | function Tetris_GF_NS_Show () |
||
183 | --variablen holen und setzen |
||
184 | local textur = Tetris["options"]["texturenset"]; |
||
185 | local stone = Tetris["game"]["s_next"]; |
||
186 | --anz. steine die dieser baustein hat holen |
||
187 | local info_anz_s = Tetris_baustein (stone, 1); |
||
188 | local anz_s = info_anz_s[2]; |
||
189 | |||
190 | --textur ändern |
||
191 | for s = 1, anz_s do |
||
192 | local s_pos = Tetris["game"]["s_NS_temp"][s]; |
||
193 | getglobal("Tetris_NS_"..s_pos):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\"..stone); |
||
194 | end |
||
195 | end |
||
196 | |||
197 | function Tetris_GF_NS_Clear () |
||
198 | --variablen holen und setzen |
||
199 | local textur = Tetris["options"]["texturenset"]; |
||
200 | local spalten = Tetris["game"]["NS_x"]; |
||
201 | local zeilen = Tetris["game"]["NS_y"]; |
||
202 | --textur ändern |
||
203 | for spalte = 1, spalten do |
||
204 | for zeile = 1, zeilen do |
||
205 | getglobal("Tetris_NS_x"..spalte.."y"..zeile):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\0"); |
||
206 | end |
||
207 | end |
||
208 | end |
||
209 | |||
210 | function Tetris_GF_Text_Score_Update () |
||
211 | --variablen holen und setzen |
||
212 | local points = Tetris["game"]["score"]["points"]; |
||
213 | local lvl = Tetris["game"]["score"]["lvl"]; |
||
214 | local line = Tetris["game"]["score"]["linie"]; |
||
215 | local UBS_points = Tetris_UBE_GF_SF_Text_Score_punkte; |
||
216 | local UBS_lvl = Tetris_UBE_GF_SF_Text_Score_lvl; |
||
217 | local UBS_line = Tetris_UBE_GF_SF_Text_Score_line; |
||
218 | |||
219 | --text updaten |
||
220 | Tetris_GF_SF_Text_Score:SetText(UBS_points.." "..points.."\n"..UBS_lvl.." "..lvl.."\n"..UBS_line.." "..line) |
||
221 | end |
||
222 | |||
223 | --Tetris_GF_SF |
||
224 | --Tetris_GF_BF |
||
225 | --Tetris_GF_NS |
||
226 | --Tetris_GF_b_pause |
||
227 | --Tetris_GF_b_newgame |
||
228 | |||
229 | function Tetris_GF_SetFramesPos () |
||
230 | --variablen holen und setzen |
||
231 | local SF_h = Tetris_GF_SF:GetHeight(); |
||
232 | local SF_b = Tetris_GF_SF:GetWidth(); |
||
233 | local BF_h = Tetris_GF_BF:GetHeight(); |
||
234 | local BF_b = Tetris_GF_BF:GetWidth(); |
||
235 | local NS_h = Tetris_GF_NS:GetHeight(); |
||
236 | local NS_b = Tetris_GF_NS:GetWidth(); |
||
237 | local r_a_x = Tetris["options"]["r_abstand_x"]; |
||
238 | local r_a_y = Tetris["options"]["r_abstand_y"]; |
||
239 | local faktor_x = Tetris["options"]["r_a-faktor_x"]; |
||
240 | local faktor_y = Tetris["options"]["r_a-faktor_y"]; |
||
241 | |||
242 | local SF_x = (r_a_x+faktor_x)/2-SF_b/2; |
||
243 | local BF_x = (r_a_x+faktor_x)/2-BF_b/2; |
||
244 | local NS_x = (r_a_x+faktor_x)/2-NS_b/2; |
||
245 | |||
246 | local NS_y = r_a_y+faktor_y+12; |
||
247 | local BF_y = 2*r_a_y+25; |
||
248 | |||
249 | getglobal("Tetris_GF_SF"):SetPoint("RIGHT", "Tetris_GF", "RIGHT", -SF_x, 0); |
||
250 | getglobal("Tetris_GF_BF"):SetPoint("BOTTOMRIGHT", "Tetris_GF", "BOTTOMRIGHT", -BF_x, BF_y); |
||
251 | getglobal("Tetris_GF_NS"):SetPoint("TOPRIGHT", "Tetris_GF", "TOPRIGHT", -NS_x, -NS_y); |
||
252 | |||
253 | getglobal("Tetris_GF_b_pause"):SetPoint("BOTTOMRIGHT", "Tetris_GF", "BOTTOMRIGHT", -BF_x-BF_b+70, r_a_y); |
||
254 | getglobal("Tetris_GF_b_newgame"):SetPoint("BOTTOMRIGHT", "Tetris_GF", "BOTTOMRIGHT", -BF_x, r_a_y); |
||
255 | |||
256 | end |
||
257 | |||
258 | function Tetris_GF_timer_Update () |
||
259 | local timer = Tetris["game"]["timer_go"]; |
||
260 | local pause = Tetris_UBE_GF_b_pause_pause; |
||
261 | local resume = Tetris_UBE_GF_b_pause_resume; |
||
262 | if (timer == 1) then |
||
263 | Tetris_GF_b_pause:SetText(pause); |
||
264 | Tetris_GF_BF_l:Enable(); |
||
265 | Tetris_GF_BF_u:Enable(); |
||
266 | Tetris_GF_BF_r:Enable(); |
||
267 | Tetris_GF_BF_d:Enable(); |
||
268 | end |
||
269 | if (timer == 0) then |
||
270 | Tetris_GF_b_pause:SetText(resume); |
||
271 | Tetris_GF_BF_l:Disable(); |
||
272 | Tetris_GF_BF_u:Disable(); |
||
273 | Tetris_GF_BF_r:Disable(); |
||
274 | Tetris_GF_BF_d:Disable(); |
||
275 | end |
||
276 | end |