vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --wird beim laden ausgeführt |
2 | function wowon_OnLoad() |
||
3 | --slash command |
||
4 | SLASH_WoWonid1 = "/wowon" |
||
5 | SLASH_WoWonid2 = "/wowonid" |
||
6 | SlashCmdList["WoWonid"] = function(msg) |
||
7 | wowon_cmd(msg) |
||
8 | end |
||
9 | |||
10 | wowon = {} |
||
11 | wowon.debug = true |
||
12 | wowon.ui_created = false |
||
13 | |||
14 | -- tempräre datenbank des aktuellen spiels |
||
15 | wowon.game = {}; |
||
16 | wowon.game.ingame = false; |
||
17 | wowon.game.ballfrei = {} |
||
18 | wowon.game.balle = {} |
||
19 | wowon.game.feldfrei = {} |
||
20 | wowon.game.felder = {} |
||
21 | wowon.game.gfx = {} |
||
22 | |||
23 | |||
24 | |||
25 | end |
||
26 | |||
27 | --eventhandler |
||
28 | function wowon_OnEvent() |
||
29 | |||
30 | end |
||
31 | |||
32 | --slashcommand |
||
33 | function wowon_cmd(msg) |
||
34 | |||
35 | if (wowon.ui_created == false) then |
||
36 | wowon_new_game () |
||
37 | wowon_hf:Show() |
||
38 | else |
||
39 | if (wowon_hf:IsShown()) then |
||
40 | wowon_exit_game () |
||
41 | wowon_hf:Hide() |
||
42 | else |
||
43 | wowon_new_game () |
||
44 | wowon_hf:Show() |
||
45 | end |
||
46 | end |
||
47 | end |
||
48 | |||
49 | function wowon_debug (x) |
||
50 | --x = debug text |
||
51 | if (wowon.debug) then |
||
52 | Sea.IO.banner(x) |
||
53 | end |
||
54 | end |
||
55 | |||
56 | function wowon_UI_setup () |
||
57 | |||
58 | local x = wowon.game.feld.x |
||
59 | local y = wowon.game.feld.y |
||
60 | -- offset unten (bereich des balken) / ballfreiheit ist demnach x*(y-o) |
||
61 | wowon.game.feld.o = 50 |
||
62 | |||
63 | -- offset des sf und pf zu hf |
||
64 | local r = 10 |
||
65 | local o = 25 |
||
66 | local u = r/2 |
||
67 | local m = 10 |
||
68 | |||
69 | -- höhe von pf |
||
70 | local hpf = 50 |
||
71 | |||
72 | -- grösse des hf_titel |
||
73 | local h = 40 |
||
74 | local b = 150 |
||
75 | |||
76 | if (wowon.ui_created == false) then |
||
77 | |||
78 | -- hauptframe (titel) |
||
79 | CreateFrame("Frame", "wowon_hf") |
||
80 | wowon_hf:EnableMouse(true) |
||
81 | wowon_hf:SetMovable(true) |
||
82 | wowon_hf:SetScript("OnMouseDown", function() if (arg1 == "LeftButton") then this:StartMoving() end end) |
||
83 | wowon_hf:SetScript("OnMouseUp", function() if (arg1 == "LeftButton") then this:StopMovingOrSizing() end end) |
||
84 | |||
85 | wowon_hf:CreateTexture("wowon_hf_textur", "BACKGROUND") |
||
86 | wowon_hf_textur:SetTexture(0, 0, 0, 1) |
||
87 | wowon_hf:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 25, insets = { left = 6, right = 6, top = 6, bottom = 6 }}); |
||
88 | |||
89 | wowon_hf:CreateFontString("wowon_hf_text") |
||
90 | wowon_hf_text:SetFontObject(GameFontNormal) |
||
91 | --wowon_hf_text:SetText("hf_text") |
||
92 | wowon_hf_text:SetText("WoWonid") |
||
93 | |||
94 | CreateFrame("Frame", "wowon_hf_rf") |
||
95 | wowon_hf_rf:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 25, insets = { left = 6, right = 6, top = 6, bottom = 6 }}); |
||
96 | |||
97 | CreateFrame("Frame", "wowon_sf") |
||
98 | wowon_sf:EnableMouse(true) |
||
99 | wowon_sf:SetScript("OnEnter", function() wowon_sf_maus_OnEnter() end) |
||
100 | wowon_sf:SetScript("OnLeave", function() wowon_sf_maus_OnLeave() end) |
||
101 | wowon_sf:SetScript("OnMouseDown", function() if (arg1 == "LeftButton") then wowon_sf_maus_OnClick() end end) |
||
102 | wowon_sf:CreateTexture("wowon_sf_textur", "BACKGROUND") |
||
103 | wowon_sf_textur:SetAllPoints(wowon_sf) |
||
104 | wowon_sf_textur:SetTexture(0.2, 0.5, 1, 0.5) -- muss noch besser bestimmt werden |
||
105 | wowon_sf:CreateTexture("wowon_sf_balken", "ARTWORK") |
||
106 | |||
107 | wowon_sf:CreateFontString("wowon_sf_text", "OVERLAY") |
||
108 | wowon_sf_text:SetFont("Fonts\\FRIZQT__.TTF", 46); |
||
109 | wowon_sf_text:SetText("sf_text") |
||
110 | wowon_sf_text:SetShadowColor(0,0,0,1) |
||
111 | wowon_sf_text:SetShadowOffset(4,-4) |
||
112 | |||
113 | --struktur und frame-level |
||
114 | wowon_hf:SetParent("UIParent") |
||
115 | wowon_hf_rf:SetParent("wowon_hf") |
||
116 | wowon_sf:SetParent("wowon_hf_rf") |
||
117 | |||
118 | wowon_hf:SetFrameLevel(2) |
||
119 | wowon_hf_rf:SetFrameLevel(1) |
||
120 | wowon_sf:SetFrameLevel(3) |
||
121 | wowon_pf:SetFrameLevel(4) |
||
122 | |||
123 | wowon.ui_created = true |
||
124 | end |
||
125 | |||
126 | |||
127 | -- hf setup |
||
128 | wowon_hf:SetHeight(h) |
||
129 | wowon_hf:SetWidth(b) |
||
130 | wowon_hf:SetPoint("CENTER", 0, y/2) |
||
131 | |||
132 | wowon_hf_text:SetPoint("CENTER", 0, 0) |
||
133 | |||
134 | wowon_hf_textur:SetHeight(h-12) |
||
135 | wowon_hf_textur:SetWidth(b-12) |
||
136 | wowon_hf_textur:SetPoint("CENTER", 0, 0) |
||
137 | |||
138 | wowon_hf_rf:SetHeight(y+o+hpf+u+m) |
||
139 | wowon_hf_rf:SetWidth(x+2*r) |
||
140 | wowon_hf_rf:SetPoint("TOP", "wowon_hf", 0, -15); |
||
141 | |||
142 | wowon_sf:SetHeight(y) |
||
143 | wowon_sf:SetWidth(x) |
||
144 | wowon_sf:SetPoint("TOP", "wowon_hf_rf", "TOP", 0, -o) |
||
145 | wowon_sf_text:SetPoint("CENTER", 0, 0) |
||
146 | wowon_sf_text:Hide() |
||
147 | |||
148 | wowon_pf:SetHeight(hpf) |
||
149 | wowon_pf:SetWidth(x+r) |
||
150 | wowon_pf:SetParent("wowon_hf") |
||
151 | wowon_pf:SetPoint("TOP", "wowon_hf_rf", "TOP", 0, -m-o-y) |
||
152 | |||
153 | end |
||
154 | |||
155 | function wowon_new_game () |
||
156 | |||
157 | if (wowon.game.ingame == true) then |
||
158 | wowon_exit_game () |
||
159 | end |
||
160 | |||
161 | -- neuest game |
||
162 | wowonid_set_lvl (999) |
||
163 | wowon.game.ingame = true |
||
164 | |||
165 | |||
166 | end |
||
167 | |||
168 | |||
169 | -- spiel beenden, timer stoppen, felder/bälle wieder freigeben |
||
170 | function wowon_exit_game () |
||
171 | |||
172 | for i = 1, table.getn(wowon.game.balle) do |
||
173 | if (wowon.game.ball[wowon.game.balle[i]].ss == 2) or (wowon.game.ball[wowon.game.balle[i]].ss == 4) then |
||
174 | wowon_timer_ball (false, wowon.game.balle[i]) |
||
175 | end |
||
176 | table.insert(wowon.game.ballfrei, wowon.game.balle[i]) |
||
177 | end |
||
178 | wowon.game.balle = {} |
||
179 | |||
180 | -- gxf effekte beenden |
||
181 | table.foreach(wowon.game.gfx, wowon_UI_GXF_sf_stop_all) |
||
182 | wowon.game.gfx = {} |
||
183 | |||
184 | for i = 1, table.getn(wowon.game.felder) do |
||
185 | table.insert(wowon.game.feldfrei, wowon.game.felder[i]) |
||
186 | end |
||
187 | wowon.game.felder = {} |
||
188 | |||
189 | -- balken timer |
||
190 | wowon_timer_balken (false) |
||
191 | |||
192 | wowon.game.ingame = false |
||
193 | |||
194 | end |