Gruppe.cpp 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551
  1. #include "Gruppe.h"
  2. #include <Punkt.h>
  3. #include <Rahmen.h>
  4. #include "..\..\..\Global\Variablen.h"
  5. #include "..\..\..\Global\Initialisierung.h"
  6. #include "..\..\..\Leser\KartenLeser.h"
  7. #include <DateiSystem.h>
  8. #include <AlphaFeld.h>
  9. #include <ToolTip.h>
  10. #include <Globals.h>
  11. // Inhalt der GruppeEinladungAccount Klasse aus Gruppe.h
  12. // Konstruktor
  13. GruppeEinladungAccount::GruppeEinladungAccount( Schrift *zSchrift )
  14. {
  15. Bild *nachrichtBild = bilder->get( "data/client/bilder/chat.ltdb/nachricht.png" );
  16. Bild *neuSendenBild = bilder->get( "data/client/bilder/chat.ltdb/neusenden.png" );
  17. Bild *entfernenBild = bilder->get( "data/client/bilder/chat.ltdb/entfernen.png" );
  18. rahmen = new LRahmen();
  19. rahmen->setFarbe( 0xFFFFFFFF );
  20. rahmen->setRamenBreite( 1 );
  21. auswahl = new AlphaFeld();
  22. auswahl->setFarbe( 0x0000FF00 );
  23. auswahl->setStrength( -2 );
  24. auswahl->setPosition( 1, 1 );
  25. name = initTextFeld( 0, 5, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
  26. nachrichtSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  27. nachrichtSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  28. nachrichtSenden->setHintergrundBildZ( nachrichtBild );
  29. initToolTip( nachrichtSenden, "Nachricht senden.", zSchrift, hauptScreen );
  30. erneutSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  31. erneutSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  32. erneutSenden->setHintergrundBildZ( neuSendenBild );
  33. initToolTip( erneutSenden, "Einladung erneut senden.", zSchrift, hauptScreen );
  34. einladungAbbrechen = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  35. einladungAbbrechen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  36. einladungAbbrechen->setHintergrundBildZ( entfernenBild );
  37. initToolTip( einladungAbbrechen, "Einladung abbrechen.", zSchrift, hauptScreen );
  38. status = 0;
  39. knopfX = 500;
  40. tickVal = 0;
  41. mausIn = 0;
  42. remove = 0;
  43. gruppeId = 0;
  44. accountId = 0;
  45. admin = 0;
  46. höhe = 0;
  47. animation = 0x1;
  48. rend = 0;
  49. ref = 1;
  50. }
  51. // Destruktor
  52. GruppeEinladungAccount::~GruppeEinladungAccount()
  53. {
  54. rahmen->release();
  55. auswahl->release();
  56. name->release();
  57. nachrichtSenden->release();
  58. erneutSenden->release();
  59. einladungAbbrechen->release();
  60. }
  61. // nicht constant
  62. void GruppeEinladungAccount::setGruppeId( int gruppeId )
  63. {
  64. this->gruppeId = gruppeId;
  65. }
  66. void GruppeEinladungAccount::setAccountId( int id )
  67. {
  68. this->accountId = id;
  69. name->setText( infoClient->getSpielerName( id ) );
  70. rend = 1;
  71. }
  72. void GruppeEinladungAccount::setSize( int br )
  73. {
  74. if( this->br != br )
  75. rend = 1;
  76. this->br = br;
  77. if( knopfX == 500 )
  78. {
  79. knopfX = br;
  80. rend = 1;
  81. }
  82. }
  83. void GruppeEinladungAccount::setAbgelehnt()
  84. {
  85. status = 1;
  86. }
  87. void GruppeEinladungAccount::setAngenommen()
  88. {
  89. status = 2;
  90. }
  91. void GruppeEinladungAccount::setRemove()
  92. {
  93. animation &= ~0x1;
  94. }
  95. void GruppeEinladungAccount::setAdmin( int admin )
  96. {
  97. this->admin = admin;
  98. }
  99. bool GruppeEinladungAccount::tick( double tickVal )
  100. {
  101. rend |= name->tick( tickVal );
  102. rend |= nachrichtSenden->tick( tickVal );
  103. rend |= erneutSenden->tick( tickVal );
  104. rend |= einladungAbbrechen->tick( tickVal );
  105. this->tickVal += tickVal * 100;
  106. int val = (int)this->tickVal;
  107. if( val < 1 )
  108. {
  109. bool ret = rend;
  110. rend = 0;
  111. return ret;
  112. }
  113. if( val > 4 )
  114. val = 4;
  115. this->tickVal -= val;
  116. if( ( animation | 0x1 ) == animation )
  117. {
  118. if( höhe < 30 )
  119. {
  120. höhe += val;
  121. if( höhe > 30 )
  122. höhe = 30;
  123. rend = 1;
  124. }
  125. }
  126. else
  127. {
  128. if( höhe > 0 )
  129. {
  130. höhe -= val;
  131. if( höhe < 0 )
  132. höhe = 0;
  133. rend = 1;
  134. }
  135. }
  136. if( mausIn )
  137. {
  138. if( admin == loginClient->getAccountId() && !status )
  139. {
  140. if( knopfX > br - 60 )
  141. {
  142. knopfX -= val;
  143. if( knopfX < br - 60 )
  144. knopfX = br - 60;
  145. rend = 1;
  146. }
  147. }
  148. else if( admin == loginClient->getAccountId() && status != 2 )
  149. {
  150. if( knopfX > br - 40 )
  151. {
  152. knopfX -= val;
  153. if( knopfX < br - 40 )
  154. knopfX = br - 40;
  155. rend = 1;
  156. }
  157. }
  158. else
  159. {
  160. if( knopfX > br - 20 )
  161. {
  162. knopfX -= val;
  163. if( knopfX < br - 20 )
  164. knopfX = br - 20;
  165. rend = 1;
  166. }
  167. }
  168. }
  169. else
  170. {
  171. if( knopfX < br )
  172. {
  173. knopfX += val;
  174. if( knopfX > br )
  175. knopfX = br;
  176. rend = 1;
  177. }
  178. }
  179. switch( status )
  180. {
  181. case 1:
  182. if( 1 )
  183. {
  184. int r = ( rahmen->getFarbe() >> 16 ) & 0xFF;
  185. int g = ( rahmen->getFarbe() >> 8 ) & 0xFF;
  186. int b = rahmen->getFarbe() & 0xFF;
  187. if( r < 255 )
  188. {
  189. r += val;
  190. if( r > 255 )
  191. r = 255;
  192. rend = 1;
  193. }
  194. if( g > 0 )
  195. {
  196. g -= val;
  197. if( g < 0 )
  198. g = 0;
  199. rend = 1;
  200. }
  201. if( b > 0 )
  202. {
  203. b -= val;
  204. if( b < 0 )
  205. b = 0;
  206. rend = 1;
  207. }
  208. int f = ( ( r << 16 ) & 0xFF0000 ) | ( ( g << 8 ) & 0xFF00 ) | ( b & 0xFF );
  209. rahmen->setFarbe( ( rahmen->getFarbe() & 0xFF000000 ) | f );
  210. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF000000 ) | f );
  211. }
  212. break;
  213. case 2:
  214. if( 1 )
  215. {
  216. int r = ( rahmen->getFarbe() >> 16 ) & 0xFF;
  217. int g = ( rahmen->getFarbe() >> 8 ) & 0xFF;
  218. int b = rahmen->getFarbe() & 0xFF;
  219. if( r > 0 )
  220. {
  221. r -= val;
  222. if( r < 0 )
  223. r = 0;
  224. rend = 1;
  225. }
  226. if( g < 255 )
  227. {
  228. g += val;
  229. if( g > 255 )
  230. g = 255;
  231. rend = 1;
  232. }
  233. if( b > 0 )
  234. {
  235. b -= val;
  236. if( b < 0 )
  237. b = 0;
  238. rend = 1;
  239. }
  240. int f = ( ( r << 16 ) & 0xFF0000 ) | ( ( g << 8 ) & 0xFF00 ) | ( b & 0xFF );
  241. rahmen->setFarbe( ( rahmen->getFarbe() & 0xFF000000 ) | f );
  242. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF000000 ) | f );
  243. }
  244. break;
  245. }
  246. bool ret = rend;
  247. rend = 0;
  248. return ret;
  249. }
  250. void GruppeEinladungAccount::doPublicMausEreignis( MausEreignis & me )
  251. {
  252. if( me.mx < 0 || me.my < 0 || me.mx > br || me.my > höhe )
  253. mausIn = 0;
  254. else
  255. mausIn = 1;
  256. bool ak = !me.verarbeitet;
  257. nachrichtSenden->doPublicMausEreignis( me );
  258. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  259. erneutSenden->doPublicMausEreignis( me );
  260. aktion = ( me.verarbeitet && ak && !aktion ) ? 2 : aktion;
  261. einladungAbbrechen->doPublicMausEreignis( me );
  262. aktion = ( me.verarbeitet && ak && !status && !aktion ) ? 3 : aktion;
  263. if( me.id != ME_RLinks || !mausIn )
  264. return;
  265. switch( aktion )
  266. {
  267. case 1:
  268. nachLogin->zChatLeiste()->addChat( accountId, 0 );
  269. break;
  270. case 2:
  271. if( !anmeldungClient )
  272. anmeldungClient = mainClient->createAnmeldungServerClient();
  273. if( !anmeldungClient )
  274. {
  275. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  276. new Text( "Ok" ), 0 );
  277. }
  278. if( !anmeldungClient->verbinde() )
  279. {
  280. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  281. new Text( "Ok" ), 0 );
  282. }
  283. else
  284. {
  285. if( !anmeldungClient->gruppeSpielerEinladen( accountId, gruppeId ) )
  286. {
  287. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  288. new Text( "Ok" ), 0 );
  289. }
  290. anmeldungClient->trenne( 0 );
  291. }
  292. break;
  293. case 3:
  294. if( !anmeldungClient )
  295. anmeldungClient = mainClient->createAnmeldungServerClient();
  296. if( !anmeldungClient )
  297. {
  298. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  299. new Text( "Ok" ), 0 );
  300. }
  301. if( !anmeldungClient->verbinde() )
  302. {
  303. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  304. new Text( "Ok" ), 0 );
  305. }
  306. else
  307. {
  308. if( !anmeldungClient->gruppeEinladungAbbrechen( accountId, gruppeId ) )
  309. {
  310. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  311. new Text( "Ok" ), 0 );
  312. }
  313. anmeldungClient->trenne( 0 );
  314. }
  315. break;
  316. }
  317. }
  318. void GruppeEinladungAccount::render( int y, Bild & zrObj )
  319. {
  320. if( !zrObj.setDrawOptions( 0, y, br, höhe ) )
  321. return;
  322. rahmen->setSize( br, höhe );
  323. rahmen->render( zrObj );
  324. int rbr = rahmen->getRBreite();
  325. if( !zrObj.setDrawOptions( rbr, rbr, br - rbr * 2, höhe - rbr * 2 ) )
  326. {
  327. zrObj.releaseDrawOptions();
  328. return;
  329. }
  330. auswahl->setSize( br - rbr * 2, höhe - rbr * 2 );
  331. auswahl->render( zrObj );
  332. nachrichtSenden->setPosition( knopfX, 5 );
  333. nachrichtSenden->render( zrObj );
  334. erneutSenden->setPosition( knopfX + 20, 5 );
  335. erneutSenden->render( zrObj );
  336. einladungAbbrechen->setPosition( knopfX + 40, 5 );
  337. einladungAbbrechen->render( zrObj );
  338. name->render( zrObj );
  339. zrObj.releaseDrawOptions();
  340. zrObj.releaseDrawOptions();
  341. }
  342. // constant
  343. bool GruppeEinladungAccount::getRemove() const
  344. {
  345. return remove;
  346. }
  347. int GruppeEinladungAccount::getAccountId() const
  348. {
  349. return accountId;
  350. }
  351. int GruppeEinladungAccount::getHeight() const
  352. {
  353. return höhe;
  354. }
  355. // Reference Counting
  356. GruppeEinladungAccount *GruppeEinladungAccount::getThis()
  357. {
  358. ref++;
  359. return this;
  360. }
  361. GruppeEinladungAccount *GruppeEinladungAccount::release()
  362. {
  363. ref--;
  364. if( !ref )
  365. delete this;
  366. return 0;
  367. }
  368. // Inhalt der GruppeEinladungListe Klasse aus Gruppe.h
  369. // Konstruktor
  370. GruppeEinladungListe::GruppeEinladungListe( Schrift * zSchrift )
  371. {
  372. schrift = zSchrift->getThis();
  373. Bild *maximierenBild = bilder->get( "data/client/bilder/chat.ltdb/maximieren.png" );
  374. pos = Punkt( 200, 0 );
  375. gr = Punkt( 150, 350 );
  376. rahmen = new LRahmen();
  377. rahmen->setRamenBreite( 1 );
  378. rahmen->setFarbe( 0xFFFFFFFF );
  379. rahmen->setSize( 150, 350 );
  380. einladenName = initTextFeld( 5, 5, 115, 20, zSchrift, TextFeld::Style::TextFeld, "" );
  381. initToolTip( einladenName, "Name des Spielers den du einladen möchtest.", zSchrift, hauptScreen );
  382. einladen = initKnopf( 125, 5, 20, 20, 0, 0, "" );
  383. einladen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  384. einladen->setHintergrundBildZ( maximierenBild );
  385. initToolTip( einladen, "Diesen Spieler einladen.", zSchrift, hauptScreen );
  386. scroll = new VScrollBar();
  387. accounts = new RCArray< GruppeEinladungAccount >();
  388. einladungHöhe = 0;
  389. tickVal = 0;
  390. anzahl = 0;
  391. gruppeId = 0;
  392. admin = 0;
  393. rend = 0;
  394. ref = 1;
  395. }
  396. // Destruktor
  397. GruppeEinladungListe::~GruppeEinladungListe()
  398. {
  399. rahmen->release();
  400. einladenName->release();
  401. einladen->release();
  402. scroll->release();
  403. accounts->release();
  404. schrift->release();
  405. }
  406. // nicht constant
  407. void GruppeEinladungListe::reset()
  408. {
  409. einladenName->setText( "" );
  410. scroll->update( 0, 0 );
  411. einladungHöhe = 0;
  412. tickVal = 0;
  413. accounts->leeren();
  414. anzahl = 0;
  415. gruppeId = 0;
  416. admin = 0;
  417. rend = 1;
  418. }
  419. void GruppeEinladungListe::setGruppeId( int gruppeId )
  420. {
  421. this->gruppeId = gruppeId;
  422. for( int i = 0; i < anzahl; i++ )
  423. accounts->z( i )->setGruppeId( gruppeId );
  424. }
  425. void GruppeEinladungListe::addAccount( int id )
  426. {
  427. for( int i = 0; i < anzahl; i++ )
  428. {
  429. GruppeEinladungAccount *tmp = accounts->z( i );
  430. if( tmp->getAccountId() == id )
  431. tmp->setRemove();
  432. }
  433. GruppeEinladungAccount * tmp = new GruppeEinladungAccount( schrift );
  434. tmp->setGruppeId( gruppeId );
  435. tmp->setAccountId( id );
  436. tmp->setAdmin( admin );
  437. accounts->add( tmp, anzahl );
  438. anzahl++;
  439. rend = 1;
  440. }
  441. void GruppeEinladungListe::setAbgelehnt( int id )
  442. {
  443. for( int i = 0; i < anzahl; i++ )
  444. {
  445. GruppeEinladungAccount *tmp = accounts->z( i );
  446. if( tmp && tmp->getAccountId() == id )
  447. {
  448. tmp->setAbgelehnt();
  449. break;
  450. }
  451. }
  452. }
  453. void GruppeEinladungListe::setAngenommen( int id )
  454. {
  455. for( int i = 0; i < anzahl; i++ )
  456. {
  457. GruppeEinladungAccount *tmp = accounts->z( i );
  458. if( tmp && tmp->getAccountId() == id )
  459. {
  460. tmp->setAngenommen();
  461. break;
  462. }
  463. }
  464. }
  465. void GruppeEinladungListe::remove( int id )
  466. {
  467. for( int i = 0; i < anzahl; i++ )
  468. {
  469. GruppeEinladungAccount *tmp = accounts->z( i );
  470. if( tmp && tmp->getAccountId() == id )
  471. {
  472. tmp->setRemove();
  473. break;
  474. }
  475. }
  476. }
  477. void GruppeEinladungListe::setAdmin( int admin )
  478. {
  479. this->admin = admin;
  480. for( int i = 0; i < anzahl; i++ )
  481. {
  482. GruppeEinladungAccount *tmp = accounts->z( i );
  483. if( tmp )
  484. tmp->setAdmin( admin );
  485. }
  486. }
  487. bool GruppeEinladungListe::tick( double tickVal )
  488. {
  489. rend |= einladenName->tick( tickVal );
  490. rend |= einladen->tick( tickVal );
  491. rend |= scroll->getRend();
  492. this->tickVal += tickVal * 100;
  493. int val = (int)this->tickVal;
  494. if( val < 1 )
  495. {
  496. bool ret = rend;
  497. rend = 0;
  498. return ret;
  499. }
  500. if( val > 4 )
  501. val = 4;
  502. this->tickVal -= val;
  503. if( admin == loginClient->getAccountId() )
  504. {
  505. if( einladungHöhe < 30 )
  506. {
  507. einladungHöhe += val;
  508. if( einladungHöhe > 30 )
  509. einladungHöhe = 30;
  510. rend = 1;
  511. }
  512. }
  513. else
  514. {
  515. if( einladungHöhe > 0 )
  516. {
  517. einladungHöhe -= val;
  518. if( einladungHöhe < 0 )
  519. einladungHöhe = 0;
  520. rend = 1;
  521. }
  522. }
  523. for( int i = 0; i < anzahl; i++ )
  524. {
  525. GruppeEinladungAccount *tmp = accounts->z( i );
  526. if( tmp )
  527. rend |= tmp->tick( tickVal );
  528. }
  529. for( int i = 0; i < anzahl; i++ )
  530. {
  531. GruppeEinladungAccount *tmp = accounts->z( i );
  532. if( !tmp->getHeight() )
  533. {
  534. accounts->remove( i );
  535. anzahl--;
  536. rend = 1;
  537. }
  538. }
  539. bool ret = rend;
  540. rend = 0;
  541. return ret;
  542. }
  543. void GruppeEinladungListe::doPublicMausEreignis( MausEreignis & me )
  544. {
  545. int tmpX = me.mx;
  546. int tmpY = me.my;
  547. me.mx -= pos.x;
  548. me.my -= pos.y;
  549. if( einladungHöhe == 30 )
  550. {
  551. einladenName->doPublicMausEreignis( me );
  552. bool ak = !me.verarbeitet;
  553. einladen->doPublicMausEreignis( me );
  554. if( me.verarbeitet && ak )
  555. {
  556. if( me.id == ME_RLinks )
  557. {
  558. if( einladenName->zText()->getLength() )
  559. {
  560. int accountId = infoClient->getAccountId( einladenName->zText()->getText() );
  561. if( accountId )
  562. {
  563. if( !anmeldungClient )
  564. anmeldungClient = mainClient->createAnmeldungServerClient();
  565. if( !anmeldungClient )
  566. {
  567. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  568. new Text( "Ok" ), 0 );
  569. }
  570. if( !anmeldungClient->verbinde() )
  571. {
  572. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  573. new Text( "Ok" ), 0 );
  574. }
  575. else
  576. {
  577. if( !anmeldungClient->gruppeSpielerEinladen( accountId, gruppeId ) )
  578. {
  579. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  580. new Text( "Ok" ), 0 );
  581. }
  582. else
  583. {
  584. einladenName->setText( "" );
  585. einladenName->setAuswahl( 0, 0 );
  586. rend = 1;
  587. }
  588. anmeldungClient->trenne( 0 );
  589. }
  590. }
  591. else
  592. {
  593. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Der Account wurde nicht gefunden." ),
  594. new Text( "Ok" ), 0 );
  595. }
  596. }
  597. }
  598. return;
  599. }
  600. }
  601. scroll->doMausMessage( 134, 1 + einladungHöhe, 15, 348 - einladungHöhe, me );
  602. me.my -= einladungHöhe + 1;
  603. for( int i = 0; i < anzahl; i++ )
  604. {
  605. GruppeEinladungAccount *tmp = accounts->z( i );
  606. if( tmp )
  607. {
  608. tmp->doPublicMausEreignis( me );
  609. if( tmp->getRemove() )
  610. {
  611. accounts->remove( i );
  612. anzahl--;
  613. rend = 1;
  614. }
  615. me.my -= tmp->getHeight();
  616. }
  617. }
  618. me.mx = tmpX;
  619. me.my = tmpY;
  620. }
  621. void GruppeEinladungListe::doTastaturEreignis( TastaturEreignis & te )
  622. {
  623. bool b = !te.verarbeitet;
  624. einladenName->doTastaturEreignis( te );
  625. if( te.verarbeitet && b && te.id == TE_Release && te.taste == T_Enter )
  626. {
  627. if( einladenName->zText()->getLength() )
  628. {
  629. int accountId = infoClient->getAccountId( einladenName->zText()->getText() );
  630. if( accountId )
  631. {
  632. if( !anmeldungClient )
  633. anmeldungClient = mainClient->createAnmeldungServerClient();
  634. if( !anmeldungClient )
  635. {
  636. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  637. new Text( "Ok" ), 0 );
  638. }
  639. if( !anmeldungClient->verbinde() )
  640. {
  641. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  642. new Text( "Ok" ), 0 );
  643. }
  644. else
  645. {
  646. if( !anmeldungClient->gruppeSpielerEinladen( accountId, gruppeId ) )
  647. {
  648. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  649. new Text( "Ok" ), 0 );
  650. }
  651. else
  652. {
  653. einladenName->setText( "" );
  654. einladenName->setAuswahl( 0, 0 );
  655. rend = 1;
  656. }
  657. anmeldungClient->trenne( 0 );
  658. }
  659. }
  660. else
  661. {
  662. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Der Account wurde nicht gefunden." ),
  663. new Text( "Ok" ), 0 );
  664. }
  665. }
  666. }
  667. }
  668. void GruppeEinladungListe::render( Bild & zRObj )
  669. {
  670. if( !zRObj.setDrawOptions( pos, gr ) )
  671. return;
  672. rahmen->render( zRObj );
  673. int rbr = rahmen->getRBreite();
  674. if( einladungHöhe )
  675. {
  676. if( zRObj.setDrawOptions( rbr, rbr, gr.x - rbr * 2, einladungHöhe - rbr * 2 ) )
  677. {
  678. einladenName->render( zRObj );
  679. einladen->render( zRObj );
  680. zRObj.releaseDrawOptions();
  681. }
  682. }
  683. if( !zRObj.setDrawOptions( rbr, einladungHöhe + rbr, gr.x - rbr * 2, gr.y - rbr * 2 ) )
  684. {
  685. zRObj.releaseDrawOptions();
  686. return;
  687. }
  688. scroll->render( 134, 0, 15, 348 - einladungHöhe, zRObj );
  689. int höhe = 0;
  690. for( int i = 0; i < anzahl; i++ )
  691. {
  692. GruppeEinladungAccount *tmp = accounts->z( i );
  693. if( tmp )
  694. {
  695. tmp->setSize( gr.x - 15 - rbr * 2 );
  696. tmp->render( höhe - scroll->getScroll(), zRObj );
  697. höhe += tmp->getHeight();
  698. }
  699. }
  700. scroll->update( höhe, gr.y - rbr * 2 - einladungHöhe );
  701. zRObj.releaseDrawOptions();
  702. zRObj.releaseDrawOptions();
  703. }
  704. // constant
  705. // Reference Counting
  706. GruppeEinladungListe *GruppeEinladungListe::getThis()
  707. {
  708. ref++;
  709. return this;
  710. }
  711. GruppeEinladungListe *GruppeEinladungListe::release()
  712. {
  713. ref--;
  714. if( !ref )
  715. delete this;
  716. return 0;
  717. }
  718. // Inhalt der GruppeAccountDaten Klasse aus Gruppe.h
  719. // Konstruktor
  720. GruppeAccountDaten::GruppeAccountDaten( Schrift * zSchrift )
  721. {
  722. Bild *nachrichtBild = bilder->get( "data/client/bilder/chat.ltdb/nachricht.png" );
  723. Bild *einladungBild = bilder->get( "data/client/bilder/chat.ltdb/neuerfreund.png" );
  724. Bild *ansehenBild = bilder->get( "data/client/bilder/chat.ltdb/ansehen.png" );
  725. Bild *entfernenBild = bilder->get( "data/client/bilder/chat.ltdb/entfernen.png" );
  726. rahmen = new LRahmen();
  727. rahmen->setFarbe( 0xFFFFFFFF );
  728. rahmen->setRamenBreite( 1 );
  729. auswahl = new AlphaFeld();
  730. auswahl->setFarbe( 0x0000FF00 );
  731. auswahl->setStrength( -2 );
  732. auswahl->setPosition( 1, 1 );
  733. name = initTextFeld( 1, 6, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
  734. punkte = initTextFeld( 101, 6, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "0p" );
  735. nachrichtSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  736. nachrichtSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  737. nachrichtSenden->setHintergrundBildZ( nachrichtBild );
  738. initToolTip( nachrichtSenden, "Nachricht senden.", zSchrift, hauptScreen );
  739. freundEinladung = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  740. freundEinladung->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  741. freundEinladung->setHintergrundBildZ( einladungBild );
  742. initToolTip( freundEinladung, "Freundeseinladung senden.", zSchrift, hauptScreen );
  743. accountAnsehen = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  744. accountAnsehen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  745. accountAnsehen->setHintergrundBildZ( ansehenBild );
  746. initToolTip( accountAnsehen, "Account ansehen.", zSchrift, hauptScreen );
  747. kick = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  748. kick->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  749. kick->setHintergrundBildZ( entfernenBild );
  750. initToolTip( kick, "Diesen Spieler kicken.", zSchrift, hauptScreen );
  751. tickVal = 0;
  752. mausIn = 0;
  753. remove = 0;
  754. gruppeId = 0;
  755. accountId = 0;
  756. admin = 0;
  757. höhe = 0;
  758. animation = 0x1;
  759. rend = 0;
  760. ref = 1;
  761. }
  762. // Destruktor
  763. GruppeAccountDaten::~GruppeAccountDaten()
  764. {
  765. rahmen->release();
  766. auswahl->release();
  767. name->release();
  768. punkte->release();
  769. nachrichtSenden->release();
  770. freundEinladung->release();
  771. accountAnsehen->release();
  772. kick->release();
  773. }
  774. // nicht constant
  775. void GruppeAccountDaten::setGruppeId( int gruppeId )
  776. {
  777. this->gruppeId = gruppeId;
  778. }
  779. void GruppeAccountDaten::setAccountId( int id )
  780. {
  781. accountId = id;
  782. name->setText( infoClient->getSpielerName( id ) );
  783. punkte->setText( "" );
  784. punkte->zText()->append( infoClient->getSpielerPunkte( id, infoClient->getSpielId( infoClient->getGruppenKarteId( gruppeId ) ) ) );
  785. punkte->zText()->append( "p" );
  786. rend = 1;
  787. }
  788. void GruppeAccountDaten::setSize( int x )
  789. {
  790. if( br != x )
  791. {
  792. br = x;
  793. rend = 1;
  794. }
  795. }
  796. void GruppeAccountDaten::entfernen()
  797. {
  798. animation &= ~0x1;
  799. }
  800. void GruppeAccountDaten::setAdmin( int admin )
  801. {
  802. this->admin = admin;
  803. rend = 1;
  804. }
  805. bool GruppeAccountDaten::tick( double tickVal )
  806. {
  807. rend |= name->tick( tickVal );
  808. rend |= punkte->tick( tickVal );
  809. rend |= nachrichtSenden->tick( tickVal );
  810. rend |= accountAnsehen->tick( tickVal );
  811. rend |= freundEinladung->tick( tickVal );
  812. rend |= kick->tick( tickVal );
  813. this->tickVal += tickVal * 100;
  814. int val = (int)this->tickVal;
  815. if( val < 1 )
  816. {
  817. bool ret = rend;
  818. rend = 0;
  819. return ret;
  820. }
  821. if( val > 4 )
  822. val = 4;
  823. this->tickVal -= val;
  824. if( admin == accountId )
  825. {
  826. int r = ( auswahl->getFarbe() >> 16 ) & 0xFF;
  827. if( r < 200 )
  828. {
  829. r += val;
  830. if( r > 200 )
  831. r = 200;
  832. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF00FFFF ) | ( ( r << 16 ) & 0xFF0000 ) );
  833. rend = 1;
  834. }
  835. }
  836. else
  837. {
  838. int r = ( auswahl->getFarbe() >> 16 ) & 0xFF;
  839. if( r > 0 )
  840. {
  841. if( r - val < 0 )
  842. r = 0;
  843. else
  844. r -= val;
  845. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF00FFFF ) | ( ( r << 16 ) & 0xFF0000 ) );
  846. rend = 1;
  847. }
  848. }
  849. if( ( animation | 0x1 ) == animation )
  850. {
  851. if( höhe < 30 )
  852. {
  853. höhe += val;
  854. if( höhe > 30 )
  855. höhe = 30;
  856. rend = 1;
  857. }
  858. if( mausIn )
  859. {
  860. if( höhe < 50 )
  861. {
  862. höhe += val;
  863. if( höhe > 50 )
  864. höhe = 50;
  865. rend = 1;
  866. }
  867. int a = ( auswahl->getFarbe() >> 24 ) & 0xFF;
  868. if( a < 50 )
  869. {
  870. a += val;
  871. if( a > 50 )
  872. a = 50;
  873. auswahl->setFarbe( ( ( a << 24 ) & 0xFF000000 ) | ( auswahl->getFarbe() & 0xFFFFFF ) );
  874. rend = 1;
  875. }
  876. }
  877. else
  878. {
  879. if( höhe > 30 )
  880. {
  881. höhe -= val;
  882. if( höhe < 30 )
  883. höhe = 30;
  884. rend = 1;
  885. }
  886. int a = ( auswahl->getFarbe() >> 24 ) & 0xFF;
  887. if( a > 0 )
  888. {
  889. if( a - val < 0 )
  890. a = 0;
  891. else
  892. a -= val;
  893. auswahl->setFarbe( ( ( a << 24 ) & 0xFF000000 ) | ( auswahl->getFarbe() & 0xFFFFFF ) );
  894. rend = 1;
  895. }
  896. }
  897. if( accountId != loginClient->getAccountId() )
  898. {
  899. if( nachrichtSenden->getBreite() < 20 )
  900. {
  901. nachrichtSenden->setSize( nachrichtSenden->getBreite() + val, nachrichtSenden->getHeight() );
  902. if( nachrichtSenden->getBreite() > 20 )
  903. nachrichtSenden->setSize( 20, nachrichtSenden->getHeight() );
  904. rend = 1;
  905. }
  906. }
  907. else
  908. {
  909. if( nachrichtSenden->getBreite() > 0 )
  910. {
  911. nachrichtSenden->setSize( nachrichtSenden->getBreite() - val, nachrichtSenden->getHeight() );
  912. if( nachrichtSenden->getBreite() < 0 )
  913. nachrichtSenden->setSize( 0, nachrichtSenden->getHeight() );
  914. rend = 1;
  915. }
  916. }
  917. if( accountAnsehen->getBreite() < 20 )
  918. {
  919. accountAnsehen->setSize( accountAnsehen->getBreite() + val, accountAnsehen->getHeight() );
  920. if( accountAnsehen->getBreite() > 20 )
  921. accountAnsehen->setSize( 20, accountAnsehen->getHeight() );
  922. rend = 1;
  923. }
  924. if( accountId == loginClient->getAccountId() || nachLogin->zFreundesListe()->istFreund( accountId ) )
  925. {
  926. if( freundEinladung->getBreite() > 0 )
  927. {
  928. freundEinladung->setSize( freundEinladung->getBreite() - val, freundEinladung->getHeight() );
  929. if( freundEinladung->getBreite() < 0 )
  930. freundEinladung->setSize( 0, freundEinladung->getHeight() );
  931. rend = 1;
  932. }
  933. }
  934. else
  935. {
  936. if( freundEinladung->getBreite() < 20 )
  937. {
  938. freundEinladung->setSize( freundEinladung->getBreite() + val, freundEinladung->getHeight() );
  939. if( freundEinladung->getBreite() > 20 )
  940. freundEinladung->setSize( 20, freundEinladung->getHeight() );
  941. rend = 1;
  942. }
  943. }
  944. if( accountId == loginClient->getAccountId() || admin != loginClient->getAccountId() )
  945. {
  946. if( kick->getBreite() > 0 )
  947. {
  948. kick->setSize( kick->getBreite() - val, kick->getHeight() );
  949. if( kick->getBreite() < 0 )
  950. kick->setSize( 0, kick->getHeight() );
  951. rend = 1;
  952. }
  953. }
  954. else
  955. {
  956. if( kick->getBreite() < 20 )
  957. {
  958. kick->setSize( kick->getBreite() + val, kick->getHeight() );
  959. if( kick->getBreite() > 20 )
  960. kick->setSize( 20, kick->getHeight() );
  961. rend = 1;
  962. }
  963. }
  964. }
  965. else
  966. {
  967. if( höhe > 0 )
  968. {
  969. höhe -= val;
  970. if( höhe <= 0 )
  971. {
  972. höhe = 0;
  973. remove = 1;
  974. }
  975. rend = 1;
  976. }
  977. }
  978. bool ret = rend;
  979. rend = 0;
  980. return ret;
  981. }
  982. void GruppeAccountDaten::doPublicMausEreignis( MausEreignis & me )
  983. {
  984. if( me.mx < 0 || me.my < 0 || me.mx > br || me.my > höhe )
  985. mausIn = 0;
  986. else
  987. mausIn = 1;
  988. bool ak = !me.verarbeitet;
  989. nachrichtSenden->doPublicMausEreignis( me );
  990. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  991. accountAnsehen->doPublicMausEreignis( me );
  992. aktion = ( me.verarbeitet && ak && !aktion ) ? 2 : aktion;
  993. freundEinladung->doPublicMausEreignis( me );
  994. aktion = ( me.verarbeitet && ak && !aktion ) ? 3 : aktion;
  995. kick->doPublicMausEreignis( me );
  996. aktion = ( me.verarbeitet && ak && !aktion ) ? 4 : aktion;
  997. if( me.id != ME_RLinks )
  998. return;
  999. switch( aktion )
  1000. {
  1001. case 1:
  1002. nachLogin->zChatLeiste()->addChat( accountId, 0 );
  1003. break;
  1004. case 2:
  1005. if( nachLogin->zAccountAnsehenFenster()->setSpielerDetails( accountId, 2 ) )
  1006. {
  1007. MausEreignis me = { ME_RLinks, 0, 0, 0, 1 };
  1008. nachLogin->zTitelLeiste()->druckAccountAnsehen( me );
  1009. }
  1010. break;
  1011. case 3:
  1012. chatClient->freundesAnfrage( accountId );
  1013. break;
  1014. case 4:
  1015. if( !anmeldungClient )
  1016. anmeldungClient = mainClient->createAnmeldungServerClient();
  1017. if( !anmeldungClient )
  1018. {
  1019. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1020. new Text( "Ok" ), 0 );
  1021. }
  1022. if( !anmeldungClient->verbinde() )
  1023. {
  1024. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1025. new Text( "Ok" ), 0 );
  1026. }
  1027. else
  1028. {
  1029. if( !anmeldungClient->kickSpielerAusGruppe( accountId, gruppeId ) )
  1030. {
  1031. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1032. new Text( "Ok" ), 0 );
  1033. }
  1034. anmeldungClient->trenne( 0 );
  1035. }
  1036. break;
  1037. }
  1038. }
  1039. void GruppeAccountDaten::render( int y, Bild & zrObj )
  1040. {
  1041. if( !zrObj.setDrawOptions( 0, y, br, höhe ) )
  1042. return;
  1043. rahmen->setSize( br, höhe );
  1044. rahmen->render( zrObj );
  1045. int rbr = rahmen->getRBreite();
  1046. auswahl->setPosition( rbr, rbr );
  1047. auswahl->setSize( br - rbr * 2, höhe - rbr * 2 );
  1048. auswahl->render( zrObj );
  1049. name->render( zrObj );
  1050. punkte->render( zrObj );
  1051. if( !zrObj.setDrawOptions( rbr, rbr, br - rbr * 2, höhe - rbr * 2 ) )
  1052. {
  1053. zrObj.releaseDrawOptions();
  1054. return;
  1055. }
  1056. int b = kick->getBreite();
  1057. kick->setPosition( br - rbr - b, 30 );
  1058. kick->render( zrObj );
  1059. b += freundEinladung->getBreite();
  1060. freundEinladung->setPosition( br - rbr - b, 30 );
  1061. freundEinladung->render( zrObj );
  1062. b += accountAnsehen->getBreite();
  1063. accountAnsehen->setPosition( br - rbr - b, 30 );
  1064. accountAnsehen->render( zrObj );
  1065. b += nachrichtSenden->getBreite();
  1066. nachrichtSenden->setPosition( br - rbr - b, 30 );
  1067. nachrichtSenden->render( zrObj );
  1068. zrObj.releaseDrawOptions();
  1069. zrObj.releaseDrawOptions();
  1070. }
  1071. // constant
  1072. bool GruppeAccountDaten::getRemove() const
  1073. {
  1074. return remove;
  1075. }
  1076. int GruppeAccountDaten::getAccountId() const
  1077. {
  1078. return accountId;
  1079. }
  1080. int GruppeAccountDaten::getHeight() const
  1081. {
  1082. return höhe;
  1083. }
  1084. // Reference Counting
  1085. GruppeAccountDaten *GruppeAccountDaten::getThis()
  1086. {
  1087. ref++;
  1088. return this;
  1089. }
  1090. GruppeAccountDaten *GruppeAccountDaten::release()
  1091. {
  1092. ref--;
  1093. if( !ref )
  1094. delete this;
  1095. return 0;
  1096. }
  1097. // Inhalt der GruppeAccountListe Klasse aus Gruppe.h
  1098. // Konstruktor
  1099. GruppeAccountListe::GruppeAccountListe( Schrift * zSchrift )
  1100. {
  1101. schrift = zSchrift->getThis();
  1102. pos = Punkt( 0, 0 );
  1103. gr = Punkt( 200, 350 );
  1104. rahmen = new LRahmen();
  1105. rahmen->setFarbe( 0xFFFFFFFF );
  1106. rahmen->setRamenBreite( 1 );
  1107. rahmen->setSize( 200, 350 );
  1108. scroll = new VScrollBar();
  1109. accounts = new RCArray< GruppeAccountDaten >();
  1110. anzahl = 0;
  1111. gruppeId = 0;
  1112. admin = 0;
  1113. rend = 0;
  1114. ref = 1;
  1115. }
  1116. // Destruktor
  1117. GruppeAccountListe::~GruppeAccountListe()
  1118. {
  1119. schrift->release();
  1120. rahmen->release();
  1121. scroll->release();
  1122. accounts->release();
  1123. }
  1124. // nicht constant
  1125. void GruppeAccountListe::reset()
  1126. {
  1127. accounts->leeren();
  1128. anzahl = 0;
  1129. gruppeId = 0;
  1130. admin = 0;
  1131. rend = 1;
  1132. }
  1133. void GruppeAccountListe::setGruppeId( int gruppeId )
  1134. {
  1135. this->gruppeId = gruppeId;
  1136. for( int i = 0; i < anzahl; i++ )
  1137. accounts->z( i )->setGruppeId( gruppeId );
  1138. }
  1139. void GruppeAccountListe::addAccount( int id )
  1140. {
  1141. GruppeAccountDaten *tmp = new GruppeAccountDaten( schrift );
  1142. tmp->setGruppeId( gruppeId );
  1143. tmp->setAccountId( id );
  1144. tmp->setAdmin( admin );
  1145. accounts->add( tmp, anzahl );
  1146. anzahl++;
  1147. rend = 1;
  1148. }
  1149. void GruppeAccountListe::removeAccount( int id )
  1150. {
  1151. for( int i = 0; i < anzahl; i++ )
  1152. {
  1153. GruppeAccountDaten *tmp = accounts->z( i );
  1154. if( tmp && tmp->getAccountId() == id )
  1155. {
  1156. tmp->entfernen();
  1157. break;
  1158. }
  1159. }
  1160. }
  1161. void GruppeAccountListe::setAdmin( int admin )
  1162. {
  1163. this->admin = admin;
  1164. for( int i = 0; i < anzahl; i++ )
  1165. {
  1166. GruppeAccountDaten *tmp = accounts->z( i );
  1167. if( tmp )
  1168. tmp->setAdmin( admin );
  1169. }
  1170. }
  1171. bool GruppeAccountListe::tick( double tickVal )
  1172. {
  1173. rend |= scroll->getRend();
  1174. for( int i = 0; i < anzahl; i++ )
  1175. {
  1176. GruppeAccountDaten *tmp = accounts->z( i );
  1177. if( tmp )
  1178. rend |= tmp->tick( tickVal );
  1179. }
  1180. bool ret = rend;
  1181. rend = 0;
  1182. return ret;
  1183. }
  1184. void GruppeAccountListe::doPublicMausEreignis( MausEreignis & me )
  1185. {
  1186. int tmpX = me.mx;
  1187. int tmpY = me.my;
  1188. me.mx -= pos.x;
  1189. me.my -= pos.y;
  1190. scroll->doMausMessage( 184, 1, 15, 248, me );
  1191. for( int i = 0; i < anzahl; i++ )
  1192. {
  1193. GruppeAccountDaten *tmp = accounts->z( i );
  1194. if( tmp )
  1195. {
  1196. tmp->doPublicMausEreignis( me );
  1197. me.my -= tmp->getHeight();
  1198. if( tmp->getRemove() )
  1199. {
  1200. accounts->remove( i );
  1201. anzahl--;
  1202. i--;
  1203. rend = 1;
  1204. }
  1205. }
  1206. }
  1207. me.mx = tmpX;
  1208. me.my = tmpY;
  1209. }
  1210. void GruppeAccountListe::render( Bild & zRObj )
  1211. {
  1212. if( !zRObj.setDrawOptions( pos, gr ) )
  1213. return;
  1214. rahmen->render( zRObj );
  1215. int rbr = rahmen->getRBreite();
  1216. scroll->render( gr.x - 15 - rbr, 1, 15, gr.y - rbr * 2, zRObj );
  1217. if( !zRObj.setDrawOptions( rbr, rbr, gr.x - rbr * 2, gr.y - rbr * 2 ) )
  1218. {
  1219. zRObj.releaseDrawOptions();
  1220. return;
  1221. }
  1222. int höhe = 0;
  1223. for( int i = 0; i < anzahl; i++ )
  1224. {
  1225. GruppeAccountDaten *tmp = accounts->z( i );
  1226. if( tmp )
  1227. {
  1228. tmp->setSize( gr.x - 15 - rbr * 2 );
  1229. tmp->render( höhe - scroll->getScroll(), zRObj );
  1230. höhe += tmp->getHeight();
  1231. }
  1232. }
  1233. zRObj.releaseDrawOptions();
  1234. zRObj.releaseDrawOptions();
  1235. scroll->update( höhe, gr.y - rbr * 2 );
  1236. }
  1237. // constant
  1238. // Reference Counting
  1239. GruppeAccountListe *GruppeAccountListe::getThis()
  1240. {
  1241. ref++;
  1242. return this;
  1243. }
  1244. GruppeAccountListe *GruppeAccountListe::release()
  1245. {
  1246. ref--;
  1247. if( !ref )
  1248. delete this;
  1249. return 0;
  1250. }
  1251. // Inhalt der GruppeChat Klasse aus Gruppe.h
  1252. // Konstruktor
  1253. GruppeChat::GruppeChat( Schrift * zSchrift )
  1254. {
  1255. Bild *sendenBild = bilder->get( "data/client/bilder/chat.ltdb/senden.png" );
  1256. pos = Punkt( 0, 350 );
  1257. gr = Punkt( 750, 200 );
  1258. rahmen = new LRahmen();
  1259. rahmen->setFarbe( 0xFFFFFFFF );
  1260. rahmen->setRamenBreite( 1 );
  1261. rahmen->setSize( 750, 200 );
  1262. nachricht = initTextFeld( 2, 176, 724, 20, zSchrift, TextFeld::Style::TextFeld, "" );
  1263. initToolTip( nachricht, "Nachricht an die Gruppe senden.", zSchrift, hauptScreen );
  1264. senden = initKnopf( 726, 176, 20, 20, 0, 0, "" );
  1265. senden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  1266. senden->setHintergrundBildZ( sendenBild );
  1267. initToolTip( senden, "Diese Nachricht an die Gruppe senden.", zSchrift, hauptScreen );
  1268. verlauf = initTextFeld( 2, 2, 746, 174, zSchrift, TextFeld::Style::TextGebiet, "" );
  1269. verlauf->removeStyle( TextFeld::Style::Erlaubt );
  1270. verlauf->updateVScroll();
  1271. verlauf->setVertikalKlickScroll( 5 );
  1272. gruppeId = 0;
  1273. rend = 0;
  1274. ref = 1;
  1275. }
  1276. // Destruktor
  1277. GruppeChat::~GruppeChat()
  1278. {
  1279. rahmen->release();
  1280. nachricht->release();
  1281. senden->release();
  1282. verlauf->release();
  1283. }
  1284. // nicht constant
  1285. void GruppeChat::reset()
  1286. {
  1287. gruppeId = 0;
  1288. verlauf->setText( "" );
  1289. verlauf->updateVScroll();
  1290. nachricht->setText( "" );
  1291. rend = 1;
  1292. }
  1293. void GruppeChat::setGruppeId( int gruppeId )
  1294. {
  1295. this->gruppeId = gruppeId;
  1296. }
  1297. void GruppeChat::gruppeNachricht( const char *nachricht )
  1298. {
  1299. verlauf->addZeile( nachricht );
  1300. verlauf->updateVScroll();
  1301. rend = 1;
  1302. }
  1303. bool GruppeChat::tick( double tickVal )
  1304. {
  1305. rend |= verlauf->tick( tickVal );
  1306. rend |= nachricht->tick( tickVal );
  1307. rend |= senden->tick( tickVal );
  1308. bool ret = rend;
  1309. rend = 0;
  1310. return ret;
  1311. }
  1312. void GruppeChat::doPublicMausEreignis( MausEreignis & me )
  1313. {
  1314. me.mx -= pos.x;
  1315. me.my -= pos.y;
  1316. verlauf->doPublicMausEreignis( me );
  1317. nachricht->doPublicMausEreignis( me );
  1318. bool ak = !me.verarbeitet;
  1319. senden->doPublicMausEreignis( me );
  1320. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  1321. if( me.id != ME_RLinks )
  1322. {
  1323. me.mx += pos.x;
  1324. me.my += pos.y;
  1325. return;
  1326. }
  1327. if( aktion )
  1328. {
  1329. if( !anmeldungClient )
  1330. anmeldungClient = mainClient->createAnmeldungServerClient();
  1331. if( !anmeldungClient )
  1332. {
  1333. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1334. new Text( "Ok" ), 0 );
  1335. }
  1336. if( !anmeldungClient->verbinde() )
  1337. {
  1338. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1339. new Text( "Ok" ), 0 );
  1340. }
  1341. else
  1342. {
  1343. if( anmeldungClient->gruppeNachricht( gruppeId, nachricht->zText()->getText() ) )
  1344. {
  1345. nachricht->setText( "" );
  1346. nachricht->setAuswahl( 0, 0 );
  1347. rend = 1;
  1348. }
  1349. else
  1350. {
  1351. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1352. new Text( "Ok" ), 0 );
  1353. }
  1354. anmeldungClient->trenne( 0 );
  1355. }
  1356. }
  1357. me.mx += pos.x;
  1358. me.my += pos.y;
  1359. }
  1360. void GruppeChat::doTastaturEreignis( TastaturEreignis & te )
  1361. {
  1362. bool b = te.verarbeitet;
  1363. nachricht->doTastaturEreignis( te );
  1364. if( te.verarbeitet && !b && te.id == TE_Release && te.taste == T_Enter )
  1365. {
  1366. if( !anmeldungClient )
  1367. anmeldungClient = mainClient->createAnmeldungServerClient();
  1368. if( !anmeldungClient )
  1369. {
  1370. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1371. new Text( "Ok" ), 0 );
  1372. }
  1373. if( !anmeldungClient->verbinde() )
  1374. {
  1375. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1376. new Text( "Ok" ), 0 );
  1377. }
  1378. else
  1379. {
  1380. if( anmeldungClient->gruppeNachricht( gruppeId, nachricht->zText()->getText() ) )
  1381. {
  1382. nachricht->setText( "" );
  1383. nachricht->setAuswahl( 0, 0 );
  1384. rend = 1;
  1385. }
  1386. else
  1387. {
  1388. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1389. new Text( "Ok" ), 0 );
  1390. }
  1391. anmeldungClient->trenne( 0 );
  1392. }
  1393. }
  1394. }
  1395. void GruppeChat::render( Bild & zRObj )
  1396. {
  1397. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  1398. return;
  1399. verlauf->render( zRObj );
  1400. nachricht->render( zRObj );
  1401. senden->render( zRObj );
  1402. zRObj.releaseDrawOptions();
  1403. }
  1404. // constant
  1405. // Reference Counting
  1406. GruppeChat *GruppeChat::getThis()
  1407. {
  1408. ref++;
  1409. return this;
  1410. }
  1411. GruppeChat *GruppeChat::release()
  1412. {
  1413. ref--;
  1414. if( !ref )
  1415. delete this;
  1416. return 0;
  1417. }
  1418. // Inhalt der GruppeAnmeldung Klasse aus Gruppe.h
  1419. // Konstruktor
  1420. GruppeAnmeldung::GruppeAnmeldung( Schrift * zSchrift )
  1421. {
  1422. pos = Punkt( 750, 350 );
  1423. gr = Punkt( 200, 200 );
  1424. rahmen = new LRahmen();
  1425. rahmen->setFarbe( 0xFFFFFFFF );
  1426. rahmen->setRamenBreite( 1 );
  1427. rahmen->setSize( 200, 200 );
  1428. spielerHinzufügen = initKontrollKnopf( 25, 45, 150, 20, zSchrift, KontrollKnopf::Style::Normal, "Spieler hinzufügen" );
  1429. spielerHinzufügen->removeStyle( KontrollKnopf::Style::Erlaubt );
  1430. spielerHinzufügen->setMausEreignis( _ret1ME );
  1431. initToolTip( spielerHinzufügen, "Es werden nur Spieler aus dieser Gruppe mit ins Spiel kommen.", zSchrift, hauptScreen );
  1432. angemeldet = initKontrollKnopf( 25, 75, 150, 20, zSchrift, KontrollKnopf::Style::Normal, "in Warteschlange" );
  1433. angemeldet->removeStyle( KontrollKnopf::Style::Erlaubt );
  1434. angemeldet->setMausEreignis( _ret1ME );
  1435. initToolTip( angemeldet, "Die Gruppe befindet sich momentan nicht in der Warteschlange.", zSchrift, hauptScreen );
  1436. zeit = initTextFeld( 0, 105, 200, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Zeit in Warteschlange: " );
  1437. gruppeVerlassen = initKnopf( 40, 135, 120, 20, zSchrift, Knopf::Style::Normal, "Gruppe verlassen" );
  1438. admin = 0;
  1439. time = 0;
  1440. gruppeId = 0;
  1441. rend = 0;
  1442. ref = 1;
  1443. }
  1444. // Destruktor
  1445. GruppeAnmeldung::~GruppeAnmeldung()
  1446. {
  1447. rahmen->release();
  1448. spielerHinzufügen->release();
  1449. angemeldet->release();
  1450. zeit->release();
  1451. gruppeVerlassen->release();
  1452. }
  1453. // nicht constant
  1454. void GruppeAnmeldung::reset()
  1455. {
  1456. spielerHinzufügen->removeStyle( KontrollKnopf::Style::Selected );
  1457. angemeldet->removeStyle( KontrollKnopf::Style::Selected );
  1458. admin = 0;
  1459. time = 0;
  1460. gruppeId = 0;
  1461. rend = 1;
  1462. }
  1463. void GruppeAnmeldung::setGruppeId( int gruppeId )
  1464. {
  1465. this->gruppeId = gruppeId;
  1466. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, infoClient->getGruppeSpielerHinzufügen( gruppeId ) );
  1467. rend = 1;
  1468. }
  1469. void GruppeAnmeldung::setAdmin( int admin )
  1470. {
  1471. this->admin = admin;
  1472. if( admin == loginClient->getAccountId() )
  1473. {
  1474. spielerHinzufügen->addStyle( KontrollKnopf::Style::Erlaubt );
  1475. angemeldet->addStyle( KontrollKnopf::Style::Erlaubt );
  1476. }
  1477. else
  1478. {
  1479. spielerHinzufügen->removeStyle( KontrollKnopf::Style::Erlaubt );
  1480. angemeldet->removeStyle( KontrollKnopf::Style::Erlaubt );
  1481. }
  1482. rend = 1;
  1483. }
  1484. void GruppeAnmeldung::setSpielerHinzufügen( bool spielerHinzufügen )
  1485. {
  1486. this->spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen );
  1487. // TODO
  1488. /*if( spielerHinzufügen )
  1489. this->spielerHinzufügen->zToolTip()->setText( "Es kommen auch andere Spieler mit ins Spiel,\ndie nicht in dieser Gruppe sind." );
  1490. else
  1491. this->spielerHinzufügen->zToolTip()->setText( "Es werden nur Spieler aus dieser Gruppe mit ins Spiel kommen." );*/
  1492. rend = 1;
  1493. }
  1494. void GruppeAnmeldung::setAngemeldet( bool angemeldet )
  1495. {
  1496. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet );
  1497. // TODO
  1498. /*
  1499. if( angemeldet )
  1500. this->angemeldet->zToolTip()->setText( "Die Gruppe befindet sich in der Warteschlange." );
  1501. else
  1502. this->angemeldet->zToolTip()->setText( "Die Gruppe befindet sich momentan nicht in der Warteschlange." );*/
  1503. time = 0;
  1504. rend = 1;
  1505. }
  1506. void GruppeAnmeldung::zurückInWarteschlange( int stunden, int minuten, int sekunden )
  1507. {
  1508. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, 1 );
  1509. time = sekunden + minuten * 60 + stunden * 60 * 60;
  1510. rend = 1;
  1511. }
  1512. void GruppeAnmeldung::spielGefunden()
  1513. {
  1514. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, 0 );
  1515. time = 0;
  1516. rend = 1;
  1517. }
  1518. bool GruppeAnmeldung::tick( double tickVal )
  1519. {
  1520. if( angemeldet->hatStyle( KontrollKnopf::Style::Selected ) )
  1521. {
  1522. if( (int)( time / 1 ) != (int)( ( time + tickVal ) / 1 ) )
  1523. rend = 1;
  1524. time += tickVal;
  1525. }
  1526. if( rend )
  1527. {
  1528. zeit->setText( "Zeit in Warteschlange: " );
  1529. zeit->zText()->append( (int)( time / 60 / 60 ) );
  1530. zeit->zText()->append( ":" );
  1531. zeit->zText()->append( (int)( time / 60 ) % 60 );
  1532. zeit->zText()->append( ":" );
  1533. zeit->zText()->append( (int)( time ) % 60 );
  1534. }
  1535. rend |= spielerHinzufügen->tick( tickVal );
  1536. rend |= angemeldet->tick( tickVal );
  1537. rend |= gruppeVerlassen->tick( tickVal );
  1538. bool ret = rend;
  1539. rend = 0;
  1540. return ret;
  1541. }
  1542. void GruppeAnmeldung::doPublicMausEreignis( MausEreignis & me )
  1543. {
  1544. me.mx -= pos.x;
  1545. me.my -= pos.y;
  1546. bool ak = !me.verarbeitet;
  1547. int aktion = 0;
  1548. if( admin == loginClient->getAccountId() )
  1549. {
  1550. spielerHinzufügen->doPublicMausEreignis( me );
  1551. aktion = ( me.verarbeitet && admin == loginClient->getAccountId() && ak ) ? 1 : aktion;
  1552. angemeldet->doPublicMausEreignis( me );
  1553. aktion = ( me.verarbeitet && admin == loginClient->getAccountId() && ak && !aktion ) ? 2 : aktion;
  1554. }
  1555. gruppeVerlassen->doPublicMausEreignis( me );
  1556. aktion = ( me.verarbeitet && ak && !aktion ) ? 3 : aktion;
  1557. if( me.id != ME_RLinks )
  1558. {
  1559. me.mx += pos.x;
  1560. me.my += pos.y;
  1561. return;
  1562. }
  1563. switch( aktion )
  1564. {
  1565. case 1:
  1566. if( !anmeldungClient )
  1567. anmeldungClient = mainClient->createAnmeldungServerClient();
  1568. if( !anmeldungClient )
  1569. {
  1570. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1571. new Text( "Ok" ), 0 );
  1572. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1573. rend = 1;
  1574. }
  1575. if( !anmeldungClient->verbinde() )
  1576. {
  1577. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1578. new Text( "Ok" ), 0 );
  1579. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1580. rend = 1;
  1581. }
  1582. else
  1583. {
  1584. if( !anmeldungClient->gruppeSpielStarten( gruppeId, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) ) )
  1585. {
  1586. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1587. rend = 1;
  1588. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1589. new Text( "Ok" ), 0 );
  1590. }
  1591. anmeldungClient->trenne( 0 );
  1592. }
  1593. break;
  1594. case 2:
  1595. if( !anmeldungClient )
  1596. anmeldungClient = mainClient->createAnmeldungServerClient();
  1597. if( !anmeldungClient )
  1598. {
  1599. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1600. new Text( "Ok" ), 0 );
  1601. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1602. rend = 1;
  1603. }
  1604. if( !anmeldungClient->verbinde() )
  1605. {
  1606. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1607. new Text( "Ok" ), 0 );
  1608. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1609. rend = 1;
  1610. }
  1611. else
  1612. {
  1613. if( angemeldet->hatStyle( KontrollKnopf::Style::Selected ) )
  1614. {
  1615. if( !anmeldungClient->gruppeAnmelden( gruppeId ) )
  1616. {
  1617. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1618. rend = 1;
  1619. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1620. new Text( "Ok" ), 0 );
  1621. }
  1622. }
  1623. else
  1624. {
  1625. if( !anmeldungClient->gruppeAbmelden( gruppeId ) )
  1626. {
  1627. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1628. rend = 1;
  1629. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1630. new Text( "Ok" ), 0 );
  1631. }
  1632. }
  1633. anmeldungClient->trenne( 0 );
  1634. }
  1635. break;
  1636. case 3:
  1637. if( !anmeldungClient )
  1638. anmeldungClient = mainClient->createAnmeldungServerClient();
  1639. if( !anmeldungClient )
  1640. {
  1641. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( mainClient->getLetzterFehler() ),
  1642. new Text( "Ok" ), 0 );
  1643. rend = 1;
  1644. }
  1645. if( !anmeldungClient->verbinde() )
  1646. {
  1647. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1648. new Text( "Ok" ), 0 );
  1649. rend = 1;
  1650. }
  1651. else
  1652. {
  1653. if( anmeldungClient->gruppeVerlassen( gruppeId ) )
  1654. nachLogin->zSpielenFenster()->gruppeVerlassen();
  1655. else
  1656. {
  1657. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungClient->getLetzterFehler() ),
  1658. new Text( "Ok" ), 0 );
  1659. }
  1660. anmeldungClient->trenne( 0 );
  1661. }
  1662. break;
  1663. }
  1664. me.mx += pos.x;
  1665. me.my += pos.y;
  1666. }
  1667. void GruppeAnmeldung::render( Bild & zRObj )
  1668. {
  1669. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  1670. return;
  1671. rahmen->render( zRObj );
  1672. spielerHinzufügen->render( zRObj );
  1673. angemeldet->render( zRObj );
  1674. zeit->render( zRObj );
  1675. gruppeVerlassen->render( zRObj );
  1676. zRObj.releaseDrawOptions();
  1677. }
  1678. // constant
  1679. // Reference Counting
  1680. GruppeAnmeldung *GruppeAnmeldung::getThis()
  1681. {
  1682. ref++;
  1683. return this;
  1684. }
  1685. GruppeAnmeldung *GruppeAnmeldung::release()
  1686. {
  1687. ref--;
  1688. if( !ref )
  1689. delete this;
  1690. return 0;
  1691. }
  1692. void GruppeKarteKSGSAktion( void *p, RCArray< KSGSVariable > * parameter, KSGSVariable * *retVal )
  1693. {
  1694. if( !p )
  1695. return;
  1696. ( (GruppeKarte *)p )->ksgsAktion( parameter, retVal );
  1697. }
  1698. // Inhalt der GruppeKarte Klasse aus Gruppe.h
  1699. // Konstruktor
  1700. GruppeKarte::GruppeKarte( Schrift * zSchrift )
  1701. : Thread()
  1702. {
  1703. schrift = zSchrift->getThis();
  1704. tr = new TextRenderer( schrift->getThis() );
  1705. pos = Punkt( 350, 0 );
  1706. gr = Punkt( 600, 350 );
  1707. rahmen = new LRahmen();
  1708. rahmen->setFarbe( 0xFFFFFFFF );
  1709. rahmen->setRamenBreite( 1 );
  1710. rahmen->setSize( 350, 350 );
  1711. rahmen->setPosition( 248, 0 );
  1712. info = 0;
  1713. ksgs = Framework::getDLLRegister()->ladeDLL( "KSGScript.dll", "data/bin/KSGScript.dll" );
  1714. if( ksgs )
  1715. {
  1716. KSGSGetZeichnung getKSGScript = (KSGSGetZeichnung)GetProcAddress( ksgs, KSGS_START_FUNKTION );
  1717. if( getKSGScript )
  1718. {
  1719. info = getKSGScript();
  1720. info->setBildschirmZ( hauptScreen->getThis() );
  1721. info->setSchriftZ( schrift->getThis() );
  1722. info->setSize( 248, 350 );
  1723. info->setRückrufParam( this );
  1724. info->setRückrufFunktion( GruppeKarteKSGSAktion );
  1725. }
  1726. else
  1727. {
  1728. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ),
  1729. new Text( "Der Einstiegspunkt '" KSGS_START_FUNKTION "' in der DLL-Datei "
  1730. "'data/bin/KSGScript.dll' konnte nicht gefunden werden." ),
  1731. new Text( "Ok" ), 0 );
  1732. }
  1733. }
  1734. else
  1735. {
  1736. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ),
  1737. new Text( "Die DLL-Datei 'data/bin/KSGScript.dll' konnte nicht geladen werden." ),
  1738. new Text( "Ok" ), 0 );
  1739. }
  1740. hintergrund = 0;
  1741. fehler = 0;
  1742. alpha1 = 0;
  1743. alpha2 = 0;
  1744. ladenZeit = 0;
  1745. tickVal = 0;
  1746. ladeBild = 0;
  1747. karteId = 0;
  1748. gruppeId = 0;
  1749. exit = 0;
  1750. geladen = 0;
  1751. rend = 0;
  1752. }
  1753. // Destruktor
  1754. GruppeKarte::~GruppeKarte()
  1755. {
  1756. rahmen->release();
  1757. if( info )
  1758. {
  1759. info->zurücksetzen();
  1760. info->release();
  1761. }
  1762. if( hintergrund )
  1763. hintergrund->release();
  1764. if( fehler )
  1765. fehler->release();
  1766. if( schrift )
  1767. schrift->release();
  1768. tr->release();
  1769. if( ksgs )
  1770. Framework::getDLLRegister()->releaseDLL( "KSGScript.dll" );
  1771. }
  1772. // nicht constant
  1773. void GruppeKarte::reset()
  1774. {
  1775. if( info )
  1776. info->zurücksetzen();
  1777. if( hintergrund )
  1778. hintergrund = hintergrund->release();
  1779. if( fehler )
  1780. fehler = (TextFeld *)fehler->release();
  1781. if( run )
  1782. {
  1783. exit = 1;
  1784. warteAufThread( 5000 );
  1785. if( run )
  1786. ende();
  1787. }
  1788. geladen = 0;
  1789. alpha1 = 0;
  1790. alpha2 = 0;
  1791. ladenZeit = 0;
  1792. tickVal = 0;
  1793. ladeBild = 0;
  1794. karteId = 0;
  1795. gruppeId = 0;
  1796. exit = 0;
  1797. rend = 1;
  1798. }
  1799. void GruppeKarte::ksgsAktion( RCArray< KSGSVariable > * parameter, KSGSVariable * *retVal )
  1800. {
  1801. }
  1802. void GruppeKarte::setGruppeId( int gruppeId )
  1803. {
  1804. this->gruppeId = gruppeId;
  1805. if( run )
  1806. {
  1807. exit = 1;
  1808. warteAufThread( 5000 );
  1809. if( run )
  1810. ende();
  1811. exit = 0;
  1812. }
  1813. geladen = 0;
  1814. rend = 1;
  1815. start();
  1816. }
  1817. bool GruppeKarte::tick( double tickVal )
  1818. {
  1819. if( !gruppeId )
  1820. return 0;
  1821. if( info )
  1822. rend |= info->tick( tickVal );
  1823. ladenZeit += tickVal;
  1824. if( ladenZeit >= 1 / 30.0 )
  1825. {
  1826. ladenZeit -= 1 / 30.0;
  1827. if( ladeAnimation &&ladeAnimation->zAnimationData() )
  1828. {
  1829. if( alpha1 )
  1830. rend = 1;
  1831. ladeBild++;
  1832. if( ladeBild >= ladeAnimation->zAnimationData()->getBildAnzahl() )
  1833. ladeBild = 0;
  1834. }
  1835. }
  1836. this->tickVal += tickVal * 300;
  1837. int val = (int)this->tickVal;
  1838. if( val < 1 )
  1839. {
  1840. bool ret = rend;
  1841. rend = 0;
  1842. return ret;
  1843. }
  1844. if( val > 10 )
  1845. val = 10;
  1846. this->tickVal -= val;
  1847. if( !geladen && !fehler )
  1848. {
  1849. if( alpha1 != 255 || alpha2 != 0 )
  1850. rend = 1;
  1851. if( alpha1 + val > 255 )
  1852. alpha1 = 255;
  1853. else
  1854. alpha1 += val;
  1855. if( alpha2 - val < 0 )
  1856. alpha2 = 0;
  1857. else
  1858. alpha2 -= val;
  1859. }
  1860. else
  1861. {
  1862. if( alpha1 != 0 || alpha2 != 255 )
  1863. rend = 1;
  1864. if( alpha1 - val < 0 )
  1865. alpha1 = 0;
  1866. else
  1867. alpha1 -= val;
  1868. if( alpha2 + val > 255 )
  1869. alpha2 = 255;
  1870. else
  1871. alpha2 += val;
  1872. }
  1873. bool ret = rend;
  1874. rend = 0;
  1875. return ret;
  1876. }
  1877. void GruppeKarte::doPublicMausEreignis( MausEreignis & me )
  1878. {
  1879. me.mx -= pos.x;
  1880. me.my -= pos.y;
  1881. if( info )
  1882. info->doPublicMausEreignis( me );
  1883. me.mx += pos.x;
  1884. me.my += pos.y;
  1885. }
  1886. void GruppeKarte::render( Bild & zrObj )
  1887. {
  1888. int x = pos.x;
  1889. int y = pos.y;
  1890. if( !zrObj.setDrawOptions( x, y, gr.x, gr.y ) )
  1891. return;
  1892. if( alpha1 != 0 && ladeAnimation && ladeAnimation->zAnimationData() )
  1893. {
  1894. Bild *tmp = ladeAnimation->zAnimationData()->zBild( ladeBild );
  1895. if( tmp )
  1896. {
  1897. zrObj.setAlpha( alpha1 );
  1898. zrObj.drawBild( gr.x / 2 - tmp->getBreite() / 2, gr.y / 2 - tmp->getHeight() / 2, tmp->getBreite(), tmp->getHeight(), *tmp );
  1899. zrObj.releaseAlpha();
  1900. }
  1901. }
  1902. if( alpha2 != 0 )
  1903. {
  1904. zrObj.setAlpha( alpha2 );
  1905. if( geladen )
  1906. {
  1907. if( info )
  1908. info->render( zrObj );
  1909. rahmen->render( zrObj );
  1910. zrObj.drawBild( 248 + rahmen->getRBreite(), rahmen->getRBreite(),
  1911. rahmen->getBreite() - rahmen->getRBreite() * 2, rahmen->getHeight() - rahmen->getRBreite() * 2, *hintergrund );
  1912. }
  1913. else if( fehler )
  1914. fehler->render( zrObj );
  1915. zrObj.releaseAlpha();
  1916. }
  1917. zrObj.releaseDrawOptions();
  1918. }
  1919. void GruppeKarte::thread()
  1920. {
  1921. if( info )
  1922. info->zurücksetzen();
  1923. if( hintergrund )
  1924. hintergrund = hintergrund->release();
  1925. if( fehler )
  1926. fehler = (TextFeld *)fehler->release();
  1927. karteId = infoClient->getGruppenKarteId( gruppeId );
  1928. if( !karteId )
  1929. {
  1930. run = 0;
  1931. return;
  1932. }
  1933. KartenLeser *karte = KartenLeser::getInstance();
  1934. karte->lock();
  1935. karte->setKarteId( karteId );
  1936. hintergrund = karte->getKartenVorschauBild();
  1937. if( exit )
  1938. {
  1939. if( hintergrund )
  1940. hintergrund = hintergrund->release();
  1941. karte->unlock();
  1942. karte->release();
  1943. run = 0;
  1944. return;
  1945. }
  1946. if( !hintergrund )
  1947. {
  1948. Text *f = new Text( karte->getLetzterFehler() );
  1949. tr->setSchriftSize( 12 );
  1950. int br = tr->getTextBreite( f->getText() );
  1951. int hö = tr->getTextHeight( f->getText() );
  1952. fehler = initTextFeld( gr.x / 2 - ( br + 10 ) / 2, gr.y / 2 - ( hö + 4 ) / 2, br + 10, hö + 4,
  1953. schrift, TextFeld::Style::Text | TextFeld::Style::Center, f->getText() );
  1954. f->release();
  1955. karte->unlock();
  1956. karte->release();
  1957. run = 0;
  1958. return;
  1959. }
  1960. bool ok = 0;
  1961. if( info )
  1962. {
  1963. if( !karte->getKartenBeschreibung() )
  1964. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Beschreibung nicht gefunden." ), new Text( "Ok" ) );
  1965. else
  1966. {
  1967. Text *pf = karte->getKartePfad();
  1968. *pf += "beschreibung.ksgs";
  1969. info->setScriptDatei( pf );
  1970. ok = info->neuLaden();
  1971. KSGSVariable *var = info->startFunktion( info->getFunktionId( "_in_gruppe" ), new RCArray< KSGSVariable >() );
  1972. if( var )
  1973. var->release();
  1974. }
  1975. }
  1976. if( !ok )
  1977. {
  1978. Text *f = new Text( karte->getLetzterFehler() );
  1979. tr->setSchriftSize( 12 );
  1980. int br = tr->getTextBreite( f->getText() );
  1981. int hö = tr->getTextHeight( f->getText() );
  1982. fehler = initTextFeld( gr.x / 2 - ( br + 10 ) / 2, gr.y / 2 - ( hö + 4 ) / 2, br + 10, hö + 4,
  1983. schrift, TextFeld::Style::Text | TextFeld::Style::Center, f->getText() );
  1984. f->release();
  1985. karte->unlock();
  1986. karte->release();
  1987. run = 0;
  1988. return;
  1989. }
  1990. karte->unlock();
  1991. karte->release();
  1992. geladen = 1;
  1993. run = 0;
  1994. rend = 1;
  1995. }
  1996. // constant
  1997. int GruppeKarte::getKarteId() const
  1998. {
  1999. return karteId;
  2000. }
  2001. // löscht das objekt wenn es nicht mehr gebraucht wird und beendet den Thread
  2002. Thread *GruppeKarte::release()
  2003. {
  2004. if( ref == 2 && run )
  2005. {
  2006. exit = 1;
  2007. warteAufThread( 5000 );
  2008. if( run )
  2009. ende();
  2010. }
  2011. return Thread::release();
  2012. }
  2013. // Inhalt der GruppeSpielGefunden Klasse aus Gruppe.h
  2014. // Konstruktor
  2015. GruppeSpielGefunden::GruppeSpielGefunden( Schrift * zSchrift )
  2016. {
  2017. pos = Punkt( 375, 235 );
  2018. gr = Punkt( 200, 90 );
  2019. spielGefunden = initFenster( 0, 0, 200, 90, zSchrift, Fenster::Style::Sichtbar | Fenster::Style::Rahmen | Fenster::Style::Titel, "Spiel gefunden" );
  2020. zeit = initTextFeld( 0, 30, 200, 20, zSchrift, TextFeld::Style::Text, "Verbleibende Zeit: 10" );
  2021. warte = initTextFeld( 0, 60, 200, 20, zSchrift, TextFeld::Style::Text & ~TextFeld::Style::Sichtbar, "Warte auf andere Spieler. . ." );
  2022. annehmen = initKnopf( 50, 60, 100, 20, zSchrift, Knopf::Style::Normal, "beitreten" );
  2023. alpha = 0;
  2024. time = 0;
  2025. sichtbar = 0;
  2026. tickVal = 0;
  2027. rend = 0;
  2028. ref = 1;
  2029. }
  2030. // Destruktor
  2031. GruppeSpielGefunden::~GruppeSpielGefunden()
  2032. {
  2033. spielGefunden->release();
  2034. zeit->release();
  2035. warte->release();
  2036. annehmen->release();
  2037. }
  2038. // nicht constant
  2039. void GruppeSpielGefunden::reset()
  2040. {
  2041. zeit->setText( "Verbleibende Zeit: 10" );
  2042. alpha = 0;
  2043. time = 0;
  2044. sichtbar = 0;
  2045. warte->removeStyle( TextFeld::Style::Sichtbar );
  2046. annehmen->addStyle( Knopf::Style::Sichtbar );
  2047. rend = 1;
  2048. }
  2049. void GruppeSpielGefunden::setSichtbar( bool sichtbar )
  2050. {
  2051. warte->removeStyle( TextFeld::Style::Sichtbar );
  2052. annehmen->addStyle( Knopf::Style::Sichtbar );
  2053. this->sichtbar = sichtbar;
  2054. rend = 1;
  2055. }
  2056. void GruppeSpielGefunden::setVerbleibendeZeit( int sekunden )
  2057. {
  2058. if( time != sekunden )
  2059. rend = 1;
  2060. time = sekunden;
  2061. }
  2062. bool GruppeSpielGefunden::tick( double tickVal )
  2063. {
  2064. if( rend )
  2065. {
  2066. zeit->setText( "Verbleibende Zeit: " );
  2067. zeit->zText()->append( (int)time );
  2068. }
  2069. rend |= annehmen->tick( tickVal );
  2070. this->tickVal += tickVal * 300;
  2071. int val = (int)this->tickVal;
  2072. if( val < 1 )
  2073. {
  2074. bool ret = rend;
  2075. rend = 0;
  2076. return ret;
  2077. }
  2078. if( val > 10 )
  2079. val = 10;
  2080. this->tickVal -= val;
  2081. if( sichtbar )
  2082. {
  2083. if( alpha < 255 )
  2084. {
  2085. if( alpha + val > 255 )
  2086. alpha = 255;
  2087. else
  2088. alpha += val;
  2089. rend = 1;
  2090. }
  2091. }
  2092. else
  2093. {
  2094. if( alpha )
  2095. {
  2096. if( alpha - val < 0 )
  2097. alpha = 0;
  2098. else
  2099. alpha -= val;
  2100. rend = 1;
  2101. }
  2102. }
  2103. bool ret = rend;
  2104. rend = 0;
  2105. return ret;
  2106. }
  2107. void GruppeSpielGefunden::doPublicMausEreignis( MausEreignis & me )
  2108. {
  2109. me.mx -= pos.x;
  2110. me.my -= pos.y;
  2111. bool ver = me.verarbeitet;
  2112. annehmen->doPublicMausEreignis( me );
  2113. if( me.verarbeitet && !ver && me.id == ME_RLinks )
  2114. {
  2115. if( spielClient->spielErstelltAnnehmen() )
  2116. {
  2117. annehmen->removeStyle( Knopf::Style::Sichtbar );
  2118. warte->addStyle( TextFeld::Style::Sichtbar );
  2119. rend = 1;
  2120. }
  2121. else if( nachLogin &&nachLogin->zSpielenFenster() )
  2122. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielClient->getLetzterFehler() ), new Text( "Ok" ), 0 );
  2123. }
  2124. me.mx += pos.x;
  2125. me.my += pos.y;
  2126. }
  2127. void GruppeSpielGefunden::render( Bild & zRObj )
  2128. {
  2129. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  2130. return;
  2131. zRObj.setAlpha( alpha );
  2132. spielGefunden->render( zRObj );
  2133. zeit->render( zRObj );
  2134. warte->render( zRObj );
  2135. annehmen->render( zRObj );
  2136. zRObj.releaseAlpha();
  2137. zRObj.releaseDrawOptions();
  2138. }
  2139. // constant
  2140. bool GruppeSpielGefunden::istSichtbar() const
  2141. {
  2142. return sichtbar;
  2143. }
  2144. // Reference Counting
  2145. GruppeSpielGefunden *GruppeSpielGefunden::getThis()
  2146. {
  2147. ref++;
  2148. return this;
  2149. }
  2150. GruppeSpielGefunden *GruppeSpielGefunden::release()
  2151. {
  2152. ref--;
  2153. if( !ref )
  2154. delete this;
  2155. return 0;
  2156. }
  2157. // Inhalt der GruppeFenster Klasse aus Gruppe.h
  2158. // Konstruktor
  2159. GruppeFenster::GruppeFenster( Schrift * zSchrift )
  2160. {
  2161. pos = Punkt( 0, 0 );
  2162. gr = Punkt( 950, 550 );
  2163. anmeldung = new GruppeAnmeldung( zSchrift );
  2164. chat = new GruppeChat( zSchrift );
  2165. accounts = new GruppeAccountListe( zSchrift );
  2166. einladungen = new GruppeEinladungListe( zSchrift );
  2167. karte = new GruppeKarte( zSchrift );
  2168. spiel = new GruppeSpielGefunden( zSchrift );
  2169. alpha = 0;
  2170. sichtbar = 0;
  2171. tickVal = 0;
  2172. rend = 0;
  2173. ref = 1;
  2174. }
  2175. // Destruktor
  2176. GruppeFenster::~GruppeFenster()
  2177. {
  2178. anmeldung->release();
  2179. chat->release();
  2180. accounts->release();
  2181. einladungen->release();
  2182. karte->release();
  2183. spiel->release();
  2184. }
  2185. // nicht constant
  2186. void GruppeFenster::setGruppeId( int id )
  2187. {
  2188. gruppeId = id;
  2189. anmeldung->setGruppeId( id );
  2190. chat->setGruppeId( id );
  2191. accounts->setGruppeId( id );
  2192. einladungen->setGruppeId( id );
  2193. karte->setGruppeId( id );
  2194. spiel->setSichtbar( 0 );
  2195. if( id )
  2196. {
  2197. int adminId = infoClient->getGruppeAdminId( id );
  2198. nachLogin->zFreundesListe()->zeigeEinladeKnopf( adminId == loginClient->getAccountId() );
  2199. setAdmin( adminId );
  2200. }
  2201. rend = 1;
  2202. }
  2203. void GruppeFenster::setSichtbar( bool sichtbar )
  2204. {
  2205. this->sichtbar = sichtbar;
  2206. rend = 1;
  2207. }
  2208. void GruppeFenster::chatNachricht( const char *nachricht )
  2209. {
  2210. chat->gruppeNachricht( nachricht );
  2211. }
  2212. void GruppeFenster::neuerSpieler( int accountId )
  2213. {
  2214. einladungen->setAngenommen( accountId );
  2215. accounts->addAccount( accountId );
  2216. }
  2217. void GruppeFenster::spielerVerlässt( int accountId )
  2218. {
  2219. accounts->removeAccount( accountId );
  2220. anmeldung->setAngemeldet( 0 );
  2221. }
  2222. void GruppeFenster::neueEinladung( int accountId )
  2223. {
  2224. einladungen->addAccount( accountId );
  2225. }
  2226. void GruppeFenster::einladungEntfernt( int accountId )
  2227. {
  2228. einladungen->remove( accountId );
  2229. }
  2230. void GruppeFenster::einladungAbgelehnt( int accountId )
  2231. {
  2232. einladungen->setAbgelehnt( accountId );
  2233. }
  2234. void GruppeFenster::setSpielerHinzufügen( bool sh )
  2235. {
  2236. anmeldung->setSpielerHinzufügen( sh );
  2237. }
  2238. void GruppeFenster::setAngemeldet( bool angemeldet )
  2239. {
  2240. anmeldung->setAngemeldet( angemeldet );
  2241. }
  2242. void GruppeFenster::spielGefunden()
  2243. {
  2244. anmeldung->spielGefunden();
  2245. spiel->setSichtbar( 1 );
  2246. rend = 1;
  2247. }
  2248. void GruppeFenster::verbleibendeZeit( int sekunden )
  2249. {
  2250. spiel->setVerbleibendeZeit( sekunden );
  2251. }
  2252. void GruppeFenster::spielGefundenAbbruch()
  2253. {
  2254. spiel->setSichtbar( 0 );
  2255. }
  2256. void GruppeFenster::zurückInWarteschlange( int stunden, int minuten, int sekunden )
  2257. {
  2258. anmeldung->zurückInWarteschlange( stunden, minuten, sekunden );
  2259. }
  2260. void GruppeFenster::setAdmin( int accountId )
  2261. {
  2262. anmeldung->setAdmin( accountId );
  2263. accounts->setAdmin( accountId );
  2264. einladungen->setAdmin( accountId );
  2265. }
  2266. void GruppeFenster::kick()
  2267. {
  2268. }
  2269. void GruppeFenster::reset()
  2270. {
  2271. accounts->reset();
  2272. einladungen->reset();
  2273. karte->reset();
  2274. chat->reset();
  2275. anmeldung->reset();
  2276. spiel->reset();
  2277. }
  2278. bool GruppeFenster::tick( double tickVal )
  2279. {
  2280. if( !spiel->istSichtbar() )
  2281. {
  2282. rend |= anmeldung->tick( tickVal );
  2283. rend |= chat->tick( tickVal );
  2284. rend |= accounts->tick( tickVal );
  2285. rend |= einladungen->tick( tickVal );
  2286. rend |= karte->tick( tickVal );
  2287. }
  2288. rend |= spiel->tick( tickVal );
  2289. this->tickVal += tickVal * 300;
  2290. int val = (int)this->tickVal;
  2291. if( val < 1 )
  2292. {
  2293. bool ret = rend;
  2294. rend = 0;
  2295. return ret;
  2296. }
  2297. if( val > 10 )
  2298. val = 10;
  2299. this->tickVal -= val;
  2300. if( sichtbar )
  2301. {
  2302. if( spiel->istSichtbar() )
  2303. {
  2304. if( alpha > 0x70 )
  2305. {
  2306. if( alpha - val < 0x70 )
  2307. alpha = 0x70;
  2308. else
  2309. alpha -= val;
  2310. rend = 1;
  2311. }
  2312. else if( alpha < 0x70 )
  2313. {
  2314. if( alpha + val > 0x70 )
  2315. alpha = 0x70;
  2316. else
  2317. alpha += val;
  2318. rend = 1;
  2319. }
  2320. }
  2321. else
  2322. {
  2323. if( alpha < 255 )
  2324. {
  2325. if( alpha + val > 255 )
  2326. alpha = 255;
  2327. else
  2328. alpha += val;
  2329. rend = 1;
  2330. }
  2331. }
  2332. }
  2333. else
  2334. {
  2335. if( alpha > 0 )
  2336. {
  2337. if( alpha - val < 0 )
  2338. alpha = 0;
  2339. else
  2340. alpha -= val;
  2341. rend = 1;
  2342. if( !alpha )
  2343. reset();
  2344. }
  2345. }
  2346. bool ret = rend;
  2347. rend = 0;
  2348. return ret;
  2349. }
  2350. void GruppeFenster::doPublicMausEreignis( MausEreignis & me )
  2351. {
  2352. if( !spiel->istSichtbar() )
  2353. {
  2354. anmeldung->doPublicMausEreignis( me );
  2355. chat->doPublicMausEreignis( me );
  2356. accounts->doPublicMausEreignis( me );
  2357. einladungen->doPublicMausEreignis( me );
  2358. karte->doPublicMausEreignis( me );
  2359. }
  2360. spiel->doPublicMausEreignis( me );
  2361. }
  2362. void GruppeFenster::doTastaturEreignis( TastaturEreignis & te )
  2363. {
  2364. if( !spiel->istSichtbar() )
  2365. {
  2366. chat->doTastaturEreignis( te );
  2367. einladungen->doTastaturEreignis( te );
  2368. }
  2369. }
  2370. void GruppeFenster::render( Bild & zRObj )
  2371. {
  2372. if( alpha )
  2373. {
  2374. int x = pos.x;
  2375. int y = pos.y;
  2376. if( !zRObj.setDrawOptions( x, y, gr.x, gr.y ) )
  2377. return;
  2378. unsigned char tmpAlpha = zRObj.getAlpha();
  2379. zRObj.setAlpha( alpha );
  2380. anmeldung->render( zRObj );
  2381. chat->render( zRObj );
  2382. accounts->render( zRObj );
  2383. einladungen->render( zRObj );
  2384. karte->render( zRObj );
  2385. zRObj.releaseAlpha();
  2386. spiel->render( zRObj );
  2387. zRObj.releaseDrawOptions();
  2388. }
  2389. }
  2390. // constant
  2391. int GruppeFenster::getGruppeId() const
  2392. {
  2393. return gruppeId;
  2394. }
  2395. int GruppeFenster::getKarteId() const
  2396. {
  2397. return karte ? karte->getKarteId() : 0;
  2398. }
  2399. // Reference Counting
  2400. GruppeFenster *GruppeFenster::getThis()
  2401. {
  2402. ref++;
  2403. return this;
  2404. }
  2405. GruppeFenster *GruppeFenster::release()
  2406. {
  2407. ref--;
  2408. if( !ref )
  2409. delete this;
  2410. return 0;
  2411. }