vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- mauszeiger betritt sf
2 function wowon_sf_maus_OnEnter ()
3 if (wowon.game.ingame == true) then
4 wowon_timer_balken (true)
5 end
6 end
7  
8 -- mauszeiger verlässt sf
9 function wowon_sf_maus_OnLeave ()
10 wowon_timer_balken (false)
11 end
12  
13 -- mausklick
14 function wowon_sf_maus_OnClick()
15 if (wowon.game.ingame == true) then
16 wowon_event_mausklick ()
17 end
18 end
19  
20 -- neue pos. des balken berechnen
21 function wowon_sf_balken_move ()
22 -- fenster position
23 local x = wowon_sf:GetLeft()
24 -- cursor position
25 local cx = GetCursorPosition()
26 -- sf fensterbreite
27 local fx = wowon.game.feld.x
28 -- balkenbreite
29 local b = wowon.game.balken.b
30 -- scalegrösse
31 local sc = UIParent:GetScale()
32 -- scalegrösse kompensieren
33 cx = cx/sc
34  
35 -- maus ist im spielfeld
36 if not (cx<x) and not (cx>(fx+x)) then -- eigentlich unnötige sicherheitsabfrage, da maus auserhalb den timer wowon_balken deaktiviert
37 -- balken ist ganz links
38 if (cx<(x+b/2)) then
39 wowon.game.balken.x = b/2
40 -- balken ist ganz rechts
41 elseif (cx>(x+fx-b/2)) then
42 wowon.game.balken.x = fx-b/2
43 -- balken ist dazwischen
44 else
45 wowon.game.balken.x = cx-x
46 end
47 end
48 --wowon_debug(wowon.game.balken.x)
49 wowon_UI_sf_balken_move ()
50 end
51  
52 -- ball erstellen
53 function wowon_sf_ball_add (status)
54 -- s = startstatus des balles
55 -- überprüfen ob ein ball frei ist
56 if (wowon.game.ballfrei[1] == nil) then
57 wowon_UI_sf_ball_creat ()
58 end
59 -- erster freier ball nehmen
60 local b = wowon.game.ballfrei[1]
61 -- von der ballfrei liste entfernen
62 table.remove(wowon.game.ballfrei, 1)
63 -- zur balle liste hinzufügen
64 table.insert(wowon.game.balle, b)
65 -- ball table fürs game erstellen
66 wowon.game.ball[b] = {};
67 -- status des balles setzten
68 wowon.game.ball[b].s = status
69 -- starteigenschaften für startball (status = 1)
70 if (status == 1) then
71 wowon.game.ball[b].a = 4
72 wowon.game.ball[b].r = 10
73 end
74 wowon.game.ball[b].ss = 1
75 -- ball darstellen
76 wowon_UI_sf_ball_update (b)
77 -- ball zeigen und an startposition setzen
78 wowon_UI_sf_ball_start (b)
79 end
80  
81 -- ball freigeben
82 function wowon_sf_ball_start (b)
83 -- b = ballnummer
84 wowon.game.ball[b].x = wowon.game.balken.x
85 wowon.game.ball[b].y = wowon.game.feld.o+wowon.game.ball[b].r
86 wowon.game.ball[b].ss = 2
87 -- zufallsstartwinkel
88 local z = math.random(120)
89 if (z > 60) then
90 wowon.game.ball[b].w = z-60
91 else
92 wowon.game.ball[b].w = 360-z
93 end
94 --wowon_UI_sf_ball_update (b)
95 wowon_timer_ball (true, b)
96 end
97  
98 -- feldball freigeben
99 function wowon_sf_feldball_start (b)
100 -- b = ballnummer
101 wowon.game.ball[b].ss = 4
102 wowon.game.ball[b].a = 4
103 -- zufallsstartwinkel
104 wowon.game.ball[b].w = math.random(1, 360)
105 wowon_timer_ball (true, b)
106 end
107  
108 function wowon_sf_ball_move (b, b_lvl)
109 -- b = ballnummer
110 -- b_lvl = berechnungs-lvl
111  
112 -- neue position des balls berechnen
113 local w = wowon.game.ball[b].w
114 local a = wowon.game.ball[b].a/b_lvl
115  
116 wowon.game.ball[b].y = wowon.game.ball[b].y+math.cos(math.rad(w))*a
117 wowon.game.ball[b].x = wowon.game.ball[b].x+math.sin(math.rad(w))*a
118  
119 wowon_UI_ball_move(b)
120  
121 end
122  
123 function wowon_sf_ball_delet (b)
124 -- b = ballnummer
125  
126 -- von der balle liste entfernen
127 for i = 1, table.getn(wowon.game.balle) do
128 if (wowon.game.balle[i] == b) then
129 table.remove(wowon.game.balle, i)
130 break
131 end
132 end
133 -- zur ballfrei liste hinzufügen
134 table.insert(wowon.game.ballfrei, b)
135 -- balltimer deaktivieren
136 wowon_timer_ball (false, b)
137 -- ball verdecken
138 wowon_UI_sf_ball_hide (b)
139 end
140  
141  
142  
143 -- feld erstellen
144 function wowon_sf_feld_add (h, b, x, y, s, vr, vg, vb, va, fb)
145 -- s = feldstatus
146 -- h = höhe
147 -- b = breite
148 -- x = x pos
149 -- y = y pos
150 -- vr = rot
151 -- vg = grün
152 -- vb = blau
153 -- va = alpha
154 -- fb = feldball
155  
156 -- überprüfen ob ein feld frei ist
157 if (wowon.game.feldfrei[1] == nil) then
158 wowon_UI_sf_feld_creat ()
159 end
160 -- erster freier ball nehmen
161 local f = wowon.game.feldfrei[1]
162 -- von der feldfrei liste entfernen
163 table.remove(wowon.game.feldfrei, 1)
164 -- zur felder liste hinzufügen
165 table.insert(wowon.game.felder, f)
166 -- ball table fürs game erstellen
167 wowon.game.feld[f] = {};
168 -- daten eingeben
169 wowon.game.feld[f].h = h
170 wowon.game.feld[f].b = b
171 wowon.game.feld[f].x = x
172 wowon.game.feld[f].y = y
173 wowon.game.feld[f].s = s
174 -- farbe
175 if not (vr == nil) then
176 wowon.game.feld[f].vc = {};
177 wowon.game.feld[f].vc.r = vr
178 wowon.game.feld[f].vc.g = vg
179 wowon.game.feld[f].vc.b = vb
180 wowon.game.feld[f].vc.a = va
181 end
182  
183 -- feld darstellen
184 wowon_UI_sf_feld_update (f)
185 -- feld zeigen und setzen
186 wowon_UI_sf_feld_start (f)
187  
188 -- feldball
189 if not (fb == nil) then
190  
191 -- überprüfen ob ein ball frei ist
192 if (wowon.game.ballfrei[1] == nil) then
193 wowon_UI_sf_ball_creat ()
194 end
195 -- erster freier ball nehmen
196 local ball = wowon.game.ballfrei[1]
197 -- von der ballfrei liste entfernen
198 table.remove(wowon.game.ballfrei, 1)
199 -- zur balle liste hinzufügen
200 table.insert(wowon.game.balle, ball)
201  
202 -- ball table fürs game erstellen
203 wowon.game.ball[ball] = {};
204 -- status des f-balles setzten
205 wowon.game.ball[ball].s = fb
206 wowon.game.ball[ball].ss = 3
207 -- radius des f-balles
208 if (h > b) then
209 wowon.game.ball[ball].r = b/2
210 else
211 wowon.game.ball[ball].r = h/2
212 end
213 -- position des f-ball
214 wowon.game.ball[ball].y = y+h/2
215 wowon.game.ball[ball].x = x+b/2
216 -- ball darstellen
217 wowon_UI_sf_ball_update (ball)
218 -- ball zeigen und an startposition setzen
219 wowon_UI_sf_feldball_start (ball)
220  
221 -- im feld die f-ball nummer speichern
222 wowon.game.feld[f].fb = ball
223 end
224  
225 end
226  
227 function wowon_sf_feld_delet (f)
228 -- f = feldnummer
229  
230 -- von der felder liste entfernen
231 for i = 1, table.getn(wowon.game.felder) do
232 if (wowon.game.felder[i] == f) then
233 table.remove(wowon.game.felder, i)
234 break
235 end
236 end
237 -- zur feldfrei liste hinzufügen
238 table.insert(wowon.game.feldfrei, f)
239 -- feld verdecken
240 wowon_UI_GXF_sf ("felddelet", f)
241 end