1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480 |
- #include "AccountHistorie.h"
- #include "../../../Global/Initialisierung.h"
- #include "../../../Leser/KartenLeser.h"
- #include "../../../Global/Variablen.h"
- #include <Text.h>
- #include <Rahmen.h>
- #include <DateiSystem.h>
- #include <Zeit.h>
- #include <Punkt.h>
- #include <Globals.h>
- typedef AccountHistorieStatistikV* ( *AHSSDLLStart )( void );
- typedef AufzeichnungV* ( *AHSADLLStart )( void );
- // Inahlt der AHSpielStatistik Klasse aus AccountHistorie.h
- // Konstruktor
- AHSpielStatistik::AHSpielStatistik( Schrift *schrift )
- : Thread(),
- schrift( schrift )
- {
- statistikF = initFenster( 10, 40, 780, 450, schrift, Fenster::Style::Sichtbar | Fenster::Style::Titel | Fenster::Style::TitelBuffered | Fenster::Style::Rahmen, "Spiel Ergebnis" );
- laden = (Animation2D*)ladeAnimation->dublizieren();
- laden->setSichtbar( 0 );
- laden->setPosition( 380, 245 );
- dllName = new Text( "" );
- dllHandle = 0;
- alpha = 0;
- sichtbar = 0;
- statistik = 0;
- tickVal = 0;
- }
- // Destruktor
- AHSpielStatistik::~AHSpielStatistik()
- {
- statistikF->release();
- if( dllHandle )
- reset();
- dllName->release();
- schrift->release();
- laden->release();
- }
- // nicht constant
- void AHSpielStatistik::reset()
- {
- if( run )
- warteAufThread( INFINITE );
- if( dllHandle )
- {
- if( statistik )
- statistik = statistik->release();
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- }
- bool AHSpielStatistik::ladeDaten( int spielId, int karteId )
- {
- if( dllHandle )
- reset();
- KartenLeser *reader = KartenLeser::getInstance();
- reader->lock();
- reader->setKarteId( karteId );
- Text *pfad = reader->getSpielPfad();
- if( !pfad )
- {
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( reader->getLetzterFehler() ), new Text( "Ok" ) );
- reader->unlock();
- reader->release();
- return 0;
- }
- pfad->append( "bin/" );
- Text *spielArtName = reader->getSpielName();
- if( !spielArtName )
- {
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( reader->getLetzterFehler() ), new Text( "Ok" ) );
- reader->unlock();
- reader->release();
- pfad->release();
- return 0;
- }
- pfad->append( spielArtName->getText() );
- pfad->append( ".dll" );
- reader->unlock();
- reader->release();
- dllName->setText( "Spiele/" );
- dllName->append( spielArtName->getText() );
- dllName->append( ".dll" );
- spielArtName->release();
- dllHandle = Framework::getDLLRegister()->ladeDLL( *dllName, *pfad );
- if( !dllHandle )
- {
- Text *msg = new Text( "Die DLL Datei '" );
- msg->append( pfad->getText() );
- msg->append( "' konnte nicht geladen werden." );
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), msg, new Text( "Ok" ) );
- pfad->release();
- return 0;
- }
- AHSSDLLStart startFunk = (AHSSDLLStart)GetProcAddress( dllHandle, "GetAccountHistorieStatistik" );
- if( !startFunk )
- {
- if( dllHandle )
- {
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- Text *msg = new Text( "Die Funktion 'GetAccountHistorieStatistik' konnte in der DLL Datei '" );
- msg->append( pfad->getText() );
- msg->append( "' nicht gefunden werden." );
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), msg, new Text( "Ok" ) );
- pfad->release();
- return 0;
- }
- pfad->release();
- statistik = startFunk();
- if( !statistik )
- {
- if( dllHandle )
- {
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Für diese Spielart ist keine genauere Ansicht der Spiel Ergebnisse verfügbar." ), new Text( "Ok" ) );
- return 0;
- }
- this->spielId = spielId;
- statistik->setSchrift( schrift->getThis() );
- statistik->setBildschirm( hauptScreen );
- start();
- return 1;
- }
- void AHSpielStatistik::thread()
- {
- laden->setSichtbar( 1 );
- KSGClient::HistorieServerClient *historieClient = infoClient->createHistorieServerClient( spielId );
- if( !historieClient )
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( infoClient->getLetzterFehler() ), new Text( "Ok" ) );
- else
- {
- if( !historieClient->downloadSpielHistorie() )
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( historieClient->getLetzterFehler() ), new Text( "Ok" ) );
- else
- {
- statistik->ladeDaten( spielId );
- if( sichtbar )
- statistik->setSichtbar( 1 );
- laden->setSichtbar( 0 );
- historieClient->release();
- return;
- }
- historieClient->release();
- }
- laden->setSichtbar( 0 );
- setSichtbar( 0 );
- }
- void AHSpielStatistik::setPosition( int x, int y )
- {
- statistikF->setPosition( x, y );
- }
- void AHSpielStatistik::setSichtbar( bool sichtbar )
- {
- if( !statistik )
- return;
- if( !run )
- statistik->setSichtbar( sichtbar );
- this->sichtbar = sichtbar;
- if( sichtbar && !alpha )
- alpha = 1;
- }
- void AHSpielStatistik::doMausEreignis( MausEreignis &me )
- {
- if( !statistik || alpha != 255 )
- return;
- me.mx -= 1 + statistikF->getX();
- me.my -= 20 + statistikF->getY();
- statistik->doMausEreignis( me );
- if( statistik->wurdeGeschlossen() )
- setSichtbar( 0 );
- me.mx += 1 + statistikF->getX();
- me.my += 20 + statistikF->getY();
- }
- void AHSpielStatistik::doTastaturEreignis( TastaturEreignis &te )
- {
- if( !statistik || alpha != 255 )
- return;
- statistik->doTastaturEreignis( te );
- }
- bool AHSpielStatistik::tick( double tickVal )
- {
- if( !statistik || !alpha )
- return 0;
- bool ret = statistik->tick( tickVal );
- ret |= laden->tick( tickVal );
- this->tickVal += tickVal * 150;
- int val = ( int )this->tickVal;
- this->tickVal -= val;
- if( val )
- {
- if( sichtbar && alpha != 255 )
- {
- if( alpha + val > 255 )
- alpha = 255;
- else
- alpha += (unsigned char)val;
- ret = 1;
- }
- if( !sichtbar && alpha )
- {
- if( alpha - val < 0 )
- alpha = 0;
- else
- alpha -= (unsigned char)val;
- if( !alpha && statistik->istNochSichtbar() )
- alpha = 1;
- ret = 1;
- }
- }
- return ret;
- }
- void AHSpielStatistik::render( Bild &zRObj )
- {
- if( !statistik || !alpha )
- return;
- zRObj.setAlpha( alpha );
- statistikF->render( zRObj );
- if( !zRObj.setDrawOptions( statistikF->getX() + 1, statistikF->getY() + 21, statistikF->getBreite() - 2, statistikF->getHeight() - 22 ) )
- {
- zRObj.releaseAlpha();
- return;
- }
- statistik->render( zRObj );
- zRObj.releaseDrawOptions();
- laden->render( zRObj );
- zRObj.releaseAlpha();
- }
- // constant
- bool AHSpielStatistik::istNochSichtbar() const
- {
- if( alpha )
- return 1;
- return statistik ? statistik->istNochSichtbar() : 0;
- }
- // löscht das objekt wenn es nicht mehr gebraucht wird und beendet den Thread
- Thread *AHSpielStatistik::release()
- {
- if( ref == 2 && run )
- warteAufThread( INFINITE );
- return Thread::release();
- }
- // Inahlt der AHSpielVideo Klasse aus AccountHistorie.h
- // Konstruktor
- AHSpielVideo::AHSpielVideo( Schrift *schrift )
- : Thread(),
- schrift( schrift )
- {
- videoF = initFenster( 10, 40, 780, 450, schrift, Fenster::Style::Sichtbar | Fenster::Style::Titel | Fenster::Style::TitelBuffered | Fenster::Style::Rahmen, "Spiel Aufzeichnung" );
- laden = (Animation2D*)ladeAnimation->dublizieren();
- laden->setSichtbar( 0 );
- laden->setPosition( 380, 245 );
- dllName = new Text( "" );
- dllHandle = 0;
- alpha = 0;
- sichtbar = 0;
- video = 0;
- tickVal = 0;
- }
- // Destruktor
- AHSpielVideo::~AHSpielVideo()
- {
- videoF->release();
- if( dllHandle )
- reset();
- dllName->release();
- schrift->release();
- laden->release();
- }
- // nicht constant
- void AHSpielVideo::reset()
- {
- if( run )
- warteAufThread( INFINITE );
- if( dllHandle )
- {
- if( video )
- video = video->release();
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- }
- bool AHSpielVideo::ladeDaten( int spielId, int karteId )
- {
- if( dllHandle )
- reset();
- KartenLeser *reader = KartenLeser::getInstance();
- reader->lock();
- reader->setKarteId( karteId );
- Text *pfad = reader->getSpielPfad();
- if( !pfad )
- {
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( reader->getLetzterFehler() ), new Text( "Ok" ) );
- reader->unlock();
- reader->release();
- return 0;
- }
- pfad->append( "bin/" );
- Text *spielArtName = reader->getSpielName();
- if( !spielArtName )
- {
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( reader->getLetzterFehler() ), new Text( "Ok" ) );
- reader->unlock();
- reader->release();
- pfad->release();
- return 0;
- }
- pfad->append( spielArtName->getText() );
- pfad->append( ".dll" );
- reader->unlock();
- reader->release();
- dllName->setText( "Spiele/" );
- dllName->append( spielArtName->getText() );
- dllName->append( ".dll" );
- spielArtName->release();
- dllHandle = Framework::getDLLRegister()->ladeDLL( *dllName, *pfad );
- if( !dllHandle )
- {
- Text *msg = new Text( "Die DLL Datei '" );
- msg->append( pfad->getText() );
- msg->append( "' konnte nicht geladen werden." );
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), msg, new Text( "Ok" ) );
- pfad->release();
- return 0;
- }
- AHSADLLStart startFunk = (AHSADLLStart)GetProcAddress( dllHandle, "GetAufzeichnung" );
- if( !startFunk )
- {
- if( dllHandle )
- {
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- Text *msg = new Text( "Die Funktion 'GetAufzeichnung' konnte in der DLL Datei '" );
- msg->append( pfad->getText() );
- msg->append( "' nicht gefunden werden." );
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), msg, new Text( "Ok" ) );
- pfad->release();
- return 0;
- }
- pfad->release();
- video = startFunk();
- if( !video )
- {
- if( dllHandle )
- {
- Framework::getDLLRegister()->releaseDLL( *dllName );
- dllHandle = 0;
- }
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Für diese Spielart ist keine Aufzeichnung verfügbar." ), new Text( "Ok" ) );
- return 0;
- }
- this->spielId = spielId;
- video->setSchrift( schrift->getThis() );
- video->setBildschirm( hauptScreen );
- start();
- return 1;
- }
- void AHSpielVideo::thread()
- {
- laden->setSichtbar( 1 );
- KSGClient::HistorieServerClient *historieClient = infoClient->createHistorieServerClient( spielId );
- if( !historieClient->downloadSpielHistorie() )
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( historieClient->getLetzterFehler() ), new Text( "Ok" ) );
- historieClient->release();
- video->ladeSpiel( spielId );
- laden->setSichtbar( 0 );
- if( sichtbar )
- {
- nachLogin->setSpielAufzeichnung( video->getThis() );
- aktion = 7; // Aufzeichnung betreten
- }
- run = 0;
- }
- void AHSpielVideo::setSichtbar( bool sichtbar )
- {
- if( !video )
- return;
- if( sichtbar && !run )
- {
- nachLogin->setSpielAufzeichnung( video->getThis() );
- aktion = 7; // Aufzeichnung betreten
- }
- this->sichtbar = sichtbar;
- if( sichtbar && !alpha )
- alpha = 1;
- }
- bool AHSpielVideo::tick( double tickVal )
- {
- if( !video || !alpha )
- return 0;
- if( video->hatVerlassen( 0 ) && sichtbar )
- setSichtbar( 0 );
- bool ret = laden->tick( tickVal );
- this->tickVal += tickVal * 150;
- int val = ( int )this->tickVal;
- this->tickVal -= val;
- if( val )
- {
- if( sichtbar && alpha != 255 )
- {
- if( alpha + val > 255 )
- alpha = 255;
- else
- alpha += (unsigned char)val;
- ret = 1;
- }
- if( !sichtbar && alpha )
- {
- if( alpha - val < 0 )
- alpha = 0;
- else
- alpha -= (unsigned char)val;
- ret = 1;
- }
- }
- return ret;
- }
- void AHSpielVideo::render( Bild &zRObj )
- {
- if( !video || !alpha )
- return;
- if( !zRObj.setDrawOptions( 0, 0, videoF->getBreite() + 10, videoF->getHeight() + 40 ) )
- return;
- zRObj.setAlpha( alpha );
- videoF->render( zRObj );
- laden->render( zRObj );
- zRObj.releaseAlpha();
- zRObj.releaseDrawOptions();
- }
- // constant
- bool AHSpielVideo::istNochSichtbar() const
- {
- return alpha != 0;
- }
- // löscht das objekt wenn es nicht mehr gebraucht wird und beendet den Thread
- Thread *AHSpielVideo::release()
- {
- if( ref == 2 && run )
- warteAufThread( INFINITE );
- return Thread::release();
- }
- // Inhalt der AHSLETeamListeSpieler Klasse aus AccountHistorie.h
- // Konstruktor
- AHSLETeamListeSpieler::AHSLETeamListeSpieler( Schrift *zSchrift, char *name, int punkte, char *status, int farbe, int br )
- : nameTF( initTextFeld( 5, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, name ) ),
- punkteTF( initTextFeld( 110, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Punkte: " ) += punkte ) ),
- statusTF( initTextFeld( 215, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, status ) ),
- ram( new LRahmen() ),
- ref( 1 )
- {
- TextRenderer tr( zSchrift->getThis() );
- tr.setSchriftSize( 12 );
- nameTF->setSize( tr.getTextBreite( nameTF->zText()->getText() ) + 5, 20 );
- punkteTF->setSize( tr.getTextBreite( punkteTF->zText()->getText() ) + 5, 20 );
- statusTF->setSize( tr.getTextBreite( statusTF->zText()->getText() ) + 5, 20 );
- if( nameTF->getBreite() > 100 )
- punkteTF->setPosition( 10 + nameTF->getBreite(), 0 );
- if( punkteTF->getX() + punkteTF->getBreite() > 210 )
- statusTF->setPosition( punkteTF->getX() + punkteTF->getBreite() + 5, 0 );
- ram->setFarbe( farbe );
- ram->setSize( br, 20 );
- ram->setRamenBreite( 1 );
- }
- // Destruktor
- AHSLETeamListeSpieler::~AHSLETeamListeSpieler()
- {
- nameTF->release();
- punkteTF->release();
- statusTF->release();
- ram->release();
- }
- // nicht constant
- void AHSLETeamListeSpieler::render( int yOff, Bild &zRObj )
- {
- if( !zRObj.setDrawOptions( 2, yOff, ram->getBreite(), ram->getHeight() ) )
- return;
- nameTF->render( zRObj );
- punkteTF->render( zRObj );
- statusTF->render( zRObj );
- ram->render( zRObj );
- zRObj.releaseDrawOptions();
- }
- // cnstant
- // Reference Counting
- AHSLETeamListeSpieler *AHSLETeamListeSpieler::getThis()
- {
- ref++;
- return this;
- }
- AHSLETeamListeSpieler *AHSLETeamListeSpieler::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
- // Inhalt der AHSLETeamListeTeam Klasse aus AccountHistorie.h
- // Konstruktor
- AHSLETeamListeTeam::AHSLETeamListeTeam( Schrift *zSchrift, char *name, int sAnz, char *status, int farbe, int br )
- : nameTF( initTextFeld( 5, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, name ) ),
- sAnzahlTF( initTextFeld( 110, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Spieleranzahl: " ) += sAnz ) ),
- statusTF( initTextFeld( 215, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, status ) ),
- ram( new LRahmen() ),
- members( new RCArray< AHSLETeamListeSpieler >() ),
- ref( 1 )
- {
- TextRenderer tr( zSchrift->getThis() );
- tr.setSchriftSize( 12 );
- nameTF->setSize( tr.getTextBreite( nameTF->zText()->getText() ) + 5, 20 );
- sAnzahlTF->setSize( tr.getTextBreite( sAnzahlTF->zText()->getText() ) + 5, 20 );
- statusTF->setSize( tr.getTextBreite( statusTF->zText()->getText() ) + 5, 20 );
- if( nameTF->getBreite() > 100 )
- sAnzahlTF->setPosition( 10 + nameTF->getBreite(), 0 );
- if( sAnzahlTF->getX() + sAnzahlTF->getBreite() > 210 )
- statusTF->setPosition( sAnzahlTF->getX() + sAnzahlTF->getBreite() + 5, 0 );
- ram->setFarbe( farbe );
- ram->setSize( br, 20 );
- ram->setRamenBreite( 1 );
- }
- // Destruktor
- AHSLETeamListeTeam::~AHSLETeamListeTeam()
- {
- nameTF->release();
- sAnzahlTF->release();
- statusTF->release();
- ram->release();
- members->release();
- }
- // nicht constant
- void AHSLETeamListeTeam::addSpieler( AHSLETeamListeSpieler *s )
- {
- members->add( s );
- int maxHö = 20;
- int anz = members->getEintragAnzahl();
- if( anz )
- maxHö += 4 + 20 * anz;
- ram->setSize( ram->getBreite(), maxHö );
- }
- void AHSLETeamListeTeam::render( int xOff, int yOff, Bild &zRObj )
- {
- if( !zRObj.setDrawOptions( xOff, yOff, ram->getBreite(), ram->getHeight() ) )
- return;
- nameTF->render( zRObj );
- sAnzahlTF->render( zRObj );
- statusTF->render( zRObj );
- ram->render( zRObj );
- yOff = 22;
- int anz = members->getEintragAnzahl();
- for( int i = 0; i < anz; i++ )
- {
- members->z( i )->render( yOff, zRObj );
- yOff += 20;
- }
- zRObj.releaseDrawOptions();
- }
- // constant
- int AHSLETeamListeTeam::getHeight() const
- {
- return ram->getHeight();
- }
- // Reference Counting
- AHSLETeamListeTeam *AHSLETeamListeTeam::getThis()
- {
- ref++;
- return this;
- }
- AHSLETeamListeTeam *AHSLETeamListeTeam::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
- // Inhalt der AHSLETeamListe Klasse aus AccountHistorie.h
- // Konstruktor
- AHSLETeamListe::AHSLETeamListe( int xPos )
- : members( new RCArray< AHSLETeamListeTeam >() ),
- xPos( xPos ),
- ref( 1 )
- {
- }
- // Destruktor
- AHSLETeamListe::~AHSLETeamListe()
- {
- members->release();
- }
- // nicht constant
- void AHSLETeamListe::addTeam( AHSLETeamListeTeam *t )
- {
- members->add( t );
- }
- void AHSLETeamListe::render( Bild &zRObj )
- {
- int y = 25;
- int anz = members->getEintragAnzahl();
- for( int i = 0; i < anz; i++ )
- {
- members->z( i )->render( xPos, y, zRObj );
- y += members->z( i )->getHeight();
- }
- }
- // constant
- int AHSLETeamListe::getHeight() const
- {
- int anz = members->getEintragAnzahl();
- int hö = 0;
- for( int i = 0; i < anz; i++ )
- hö += members->z( i )->getHeight();
- return hö;
- }
- int AHSLETeamListe::getBreite() const
- {
- return 730 - xPos;
- }
- // Reference Counting
- AHSLETeamListe *AHSLETeamListe::getThis()
- {
- ref++;
- return this;
- }
- AHSLETeamListe *AHSLETeamListe::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
- // Inhalt der AHSpielListeEintrag Klasse aus AccountHistorie.h
- // Konstruktor
- AHSpielListeEintrag::AHSpielListeEintrag( int id, int karteId, Schrift *zSchrift, char *spiel, char *karte, char *datum, char *status,
- char *dauer, char *spielStatus, char *gewinner, int sAnzahl )
- : spielTF( initTextFeld( 5, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Spiel: " ) += spiel ) ),
- karteTF( initTextFeld( 110, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Karte: " ) += karte ) ),
- datumTF( initTextFeld( 215, 0, 180, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Datum: " ) += datum ) ),
- statusTF( initTextFeld( 400, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, Text( "Status: " ) += status ) ),
- spiel( new Text( spiel ) ),
- karte( new Text( karte ) ),
- datum( new Text( datum ) ),
- status( new Text( status ) ),
- detailsK( initKnopf( 715, 0, 20, 20, 0, 0, "" ) ),
- dauerTF( initTextFeld( 5, 25, 100, 20, zSchrift, TextFeld::Style::Text, Text( "Dauer: " ) += dauer ) ),
- spielStatusTF( initTextFeld( 5, 45, 100, 20, zSchrift, TextFeld::Style::Text, Text( "Status: " ) += spielStatus ) ),
- gewinnerTF( initTextFeld( 5, 65, 100, 20, zSchrift, TextFeld::Style::Text, Text( "Gewinner: " ) += gewinner ) ),
- sAnzahlTF( initTextFeld( 5, 85, 100, 20, zSchrift, TextFeld::Style::Text, Text( "Spieleranzahl: " ) += sAnzahl ) ),
- statistikK( initKnopf( 5, 105, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Statistik" ) ),
- videoK( initKnopf( 5, 130, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Aufzeichnung" ) ),
- liste( 0 ),
- ram( new LRahmen() ),
- ausklappen( bilder->get( "data/client/bilder/account.ltdb/ausklappen.png" ) ),
- einklappen( bilder->get( "data/client/bilder/account.ltdb/einklappen.png" ) ),
- id( id ),
- karteId( karteId ),
- tickVal( 0 ),
- aktion( 0 ),
- maxHö( 155 ),
- ref( 1 )
- {
- detailsK->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
- detailsK->setHintergrundBildZ( ausklappen->getThis() );
- initToolTip( detailsK, "Details anzeigen.", zSchrift, hauptScreen );
- TextRenderer tr( zSchrift->getThis() );
- tr.setSchriftSize( 12 );
- spielTF->setSize( tr.getTextBreite( spielTF->zText()->getText() ) + 5, 20 );
- karteTF->setSize( tr.getTextBreite( karteTF->zText()->getText() ) + 5, 20 );
- datumTF->setSize( tr.getTextBreite( datumTF->zText()->getText() ) + 5, 20 );
- statusTF->setSize( tr.getTextBreite( statusTF->zText()->getText() ) + 5, 20 );
- dauerTF->setSize( tr.getTextBreite( dauerTF->zText()->getText() ), 20 );
- spielStatusTF->setSize( tr.getTextBreite( spielStatusTF->zText()->getText() ), 20 );
- gewinnerTF->setSize( tr.getTextBreite( gewinnerTF->zText()->getText() ), 20 );
- sAnzahlTF->setSize( tr.getTextBreite( sAnzahlTF->zText()->getText() ), 20 );
- if( spielTF->getBreite() > 100 )
- karteTF->setPosition( 10 + spielTF->getBreite(), 0 );
- if( karteTF->getX() + karteTF->getBreite() > 210 )
- datumTF->setPosition( karteTF->getX() + karteTF->getBreite() + 5, 0 );
- if( datumTF->getX() + datumTF->getBreite() > 395 )
- statusTF->setPosition( datumTF->getX() + datumTF->getBreite() + 5, 0 );
- ram->setFarbe( 0xFFFFFFFF );
- ram->setSize( 735, 20 );
- ram->setRamenBreite( 1 );
- int br = dauerTF->getBreite();
- br = br > spielStatusTF->getBreite() ? br : spielStatusTF->getBreite();
- br = br > gewinnerTF->getBreite() ? br : gewinnerTF->getBreite();
- br = br > sAnzahlTF->getBreite() ? br : sAnzahlTF->getBreite();
- statistikK->setSize( br, statistikK->getHeight() );
- videoK->setSize( br, videoK->getHeight() );
- liste = new AHSLETeamListe( br + 10 );
- }
- // Destruktor
- AHSpielListeEintrag::~AHSpielListeEintrag()
- {
- spielTF->release();
- karteTF->release();
- datumTF->release();
- statusTF->release();
- spiel->release();
- karte->release();
- datum->release();
- status->release();
- detailsK->release();
- dauerTF->release();
- spielStatusTF->release();
- gewinnerTF->release();
- sAnzahlTF->release();
- statistikK->release();
- videoK->release();
- liste->release();
- ram->release();
- einklappen->release();
- ausklappen->release();
- }
- // nicht constant
- void AHSpielListeEintrag::addTeam( AHSLETeamListeTeam *t )
- {
- liste->addTeam( t );
- maxHö = liste->getHeight();
- maxHö = 155 > maxHö + 30 ? 155 : maxHö + 30;
- }
- bool AHSpielListeEintrag::tick( double tickVal )
- {
- bool ret = detailsK->tick( tickVal );
- ret |= statistikK->tick( tickVal );
- ret |= videoK->tick( tickVal );
- this->tickVal += tickVal * 150;
- int val = ( int )this->tickVal;
- this->tickVal -= val;
- if( val )
- {
- if( detailsK->zHintergrundBild() == ausklappen && ram->getHeight() != 20 )
- {
- if( ram->getHeight() - val < 20 )
- ram->setSize( ram->getBreite(), 20 );
- else
- ram->setSize( ram->getBreite(), ram->getHeight() - val );
- ret = 1;
- }
- if( detailsK->zHintergrundBild() == einklappen )
- {
- if( ram->getHeight() > maxHö )
- {
- if( ram->getHeight() - val < maxHö )
- ram->setSize( ram->getBreite(), maxHö );
- else
- ram->setSize( ram->getBreite(), ram->getHeight() - val );
- ret = 1;
- }
- if( ram->getHeight() < maxHö )
- {
- if( ram->getHeight() + val > maxHö )
- ram->setSize( ram->getBreite(), maxHö );
- else
- ram->setSize( ram->getBreite(), ram->getHeight() + val );
- ret = 1;
- }
- }
- }
- return ret;
- }
- void AHSpielListeEintrag::doMausEreignis( MausEreignis &me )
- {
- bool meVera = 0;
- bool meVeraTmp = 0;
- if( me.mx < 0 || me.my < 0 || me.mx >= ram->getBreite() || me.my >= ram->getHeight() )
- {
- meVeraTmp = me.verarbeitet;
- me.verarbeitet = 1;
- meVera = 1;
- }
- int vera = me.verarbeitet;
- detailsK->doMausEreignis( me );
- if( !vera && me.verarbeitet && me.id == ME_RLinks )
- {
- if( detailsK->zHintergrundBild() == einklappen )
- detailsK->setHintergrundBildZ( ausklappen->getThis() );
- else
- detailsK->setHintergrundBildZ( einklappen->getThis() );
- }
- vera = me.verarbeitet;
- statistikK->doMausEreignis( me );
- if( !vera && me.verarbeitet && me.id == ME_RLinks )
- aktion = 1;
- vera = me.verarbeitet;
- videoK->doMausEreignis( me );
- if( !vera && me.verarbeitet && me.id == ME_RLinks )
- aktion = 2;
- if( meVera )
- me.verarbeitet = meVeraTmp;
- }
- void AHSpielListeEintrag::render( int yOff, Bild &zRObj )
- {
- if( !zRObj.setDrawOptions( 5, yOff, ram->getBreite(), ram->getHeight() ) )
- return;
- ram->render( zRObj );
- if( ram->getHeight() > 20 )
- zRObj.drawLinieH( 1, 20, ram->getBreite() - 2, ram->getFarbe() );
- if( !zRObj.setDrawOptions( 1, 1, ram->getBreite() - 2, ram->getHeight() - 2 ) )
- {
- zRObj.releaseDrawOptions();
- return;
- }
- spielTF->render( zRObj );
- karteTF->render( zRObj );
- datumTF->render( zRObj );
- statusTF->render( zRObj );
- detailsK->render( zRObj );
- dauerTF->render( zRObj );
- spielStatusTF->render( zRObj );
- gewinnerTF->render( zRObj );
- sAnzahlTF->render( zRObj );
- statistikK->render( zRObj );
- videoK->render( zRObj );
- liste->render( zRObj );
- zRObj.releaseDrawOptions();
- zRObj.releaseDrawOptions();
- }
- int AHSpielListeEintrag::getAktion()
- {
- int ret = aktion;
- aktion = 0;
- return ret;
- }
- // constant
- int AHSpielListeEintrag::getKarteId() const
- {
- return karteId;
- }
- int AHSpielListeEintrag::getHeight() const
- {
- return ram->getHeight();
- }
- int AHSpielListeEintrag::getId() const
- {
- return id;
- }
- int AHSpielListeEintrag::getListeBreite() const
- {
- return liste->getBreite();
- }
- Text *AHSpielListeEintrag::zSpiel() const
- {
- return spiel;
- }
- Text *AHSpielListeEintrag::zKarte() const
- {
- return karte;
- }
- Text *AHSpielListeEintrag::zDatum() const
- {
- return datum;
- }
- Text *AHSpielListeEintrag::zStatus() const
- {
- return status;
- }
- // Reference Counting
- AHSpielListeEintrag *AHSpielListeEintrag::getThis()
- {
- ref++;
- return this;
- }
- AHSpielListeEintrag *AHSpielListeEintrag::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
- // Inhalt der AHSpielListe Klasse aus AccountHistorie.h
- // Konstruktor
- AHSpielListe::AHSpielListe()
- : Zeichnung(),
- ram( new LRahmen() ),
- scroll( new VScrollBar() ),
- members( new RCArray< AHSpielListeEintrag >() ),
- sortSpalte( new Text( "Spiel" ) ),
- sortAbsteigend( 0 )
- {
- pos = Punkt( 10, 40 );
- ram->setFarbe( 0xFFFFFFFF );
- ram->setRamenBreite( 1 );
- ram->setSize( 760, 380 );
- scroll->update( 0, 380 );
- }
- // Destruktor
- AHSpielListe::~AHSpielListe()
- {
- ram->release();
- scroll->release();
- members->release();
- sortSpalte->release();
- }
- // privat
- int AHSpielListe::getReihenfolge( int *arr )
- {
- lockZeichnung();
- int anz = members->getEintragAnzahl();
- if( !anz )
- {
- unlockZeichnung();
- return 0;
- }
- int ret = 0;
- bool *fertig = new bool[ anz ];
- ZeroMemory( fertig, anz );
- for( int i = 0; i < anz; i++ )
- {
- int index = -1;
- Text minMaxT;
- Zeit minMaxZ;
- for( int j = 0; j < anz; j++ )
- {
- AHSpielListeEintrag *tmp = members->z( j );
- if( sortSpalte->istGleich( "Spiel" ) && !fertig[ j ] && ( index < 0 ||
- ( sortAbsteigend && *tmp->zSpiel() > minMaxT ) || ( !sortAbsteigend && *tmp->zSpiel() < minMaxT ) ) )
- {
- minMaxT = tmp->zSpiel()->getText();
- index = j;
- }
- else if( sortSpalte->istGleich( "Karte" ) && !fertig[ j ] && ( index < 0 ||
- ( sortAbsteigend && *tmp->zKarte() > minMaxT ) || ( !sortAbsteigend && *tmp->zKarte() < minMaxT ) ) )
- {
- minMaxT = tmp->zKarte()->getText();
- index = j;
- }
- else if( sortSpalte->istGleich( "Datum" ) && !fertig[ j ] && ( index < 0 ||
- ( sortAbsteigend && minMaxZ.istKleiner( "y-m-d h:i", tmp->zDatum()->getText() ) ) ||
- ( !sortAbsteigend && minMaxZ.istLater( "y-m-d h:i", tmp->zDatum()->getText() ) ) ) )
- {
- minMaxZ.setZeit( "y-m-d h:i", tmp->zDatum()->getText() );
- index = j;
- }
- else if( sortSpalte->istGleich( "Status" ) && !fertig[ j ] && ( index < 0 ||
- ( sortAbsteigend && *tmp->zStatus() > minMaxT ) || ( !sortAbsteigend && *tmp->zStatus() < minMaxT ) ) )
- {
- minMaxT = tmp->zStatus()->getText();
- index = j;
- }
- }
- if( index < 0 )
- break;
- fertig[ index ] = 1;
- arr[ ret ] = index;
- ret++;
- }
- delete[] fertig;
- unlockZeichnung();
- return ret;
- }
- // nicht constant
- void AHSpielListe::setSortSpalte( char *sp )
- {
- lockZeichnung();
- sortSpalte->setText( sp );
- unlockZeichnung();
- }
- void AHSpielListe::setSortRichtung( bool absteigend )
- {
- sortAbsteigend = absteigend;
- }
- void AHSpielListe::reset()
- {
- lockZeichnung();
- members->leeren();
- unlockZeichnung();
- }
- void AHSpielListe::addSpiel( AHSpielListeEintrag *s )
- {
- lockZeichnung();
- members->add( s );
- unlockZeichnung();
- }
- bool AHSpielListe::tick( double tickVal )
- {
- bool ret = scroll->getRend();
- lockZeichnung();
- int anz = members->getEintragAnzahl();
- for( int i = 0; i < anz; i++ )
- ret |= members->z( i )->tick( tickVal );
- unlockZeichnung();
- return ret;
- }
- void AHSpielListe::doMausEreignis( MausEreignis &me )
- {
- bool vera = 0;
- if( me.mx - pos.x <= 0 || me.mx - pos.x >= ram->getBreite() || me.my - pos.y <= 0 || me.my - pos.y >= ram->getHeight() )
- {
- vera = 1;
- me.verarbeitet = 1;
- }
- int mx = me.mx, my = me.my;
- me.mx -= pos.x;
- me.my -= pos.y;
- scroll->doMausMessage( ram->getBreite() - 16, 1, 15, ram->getHeight() - 2, me );
- me.mx -= 5;
- me.my -= 5 - scroll->getScroll();
- lockZeichnung();
- int anz = members->getEintragAnzahl();
- int *rf = new int[ anz ];
- int rfAnz = getReihenfolge( rf );
- for( int i = 0; i < rfAnz; i++ )
- {
- members->z( rf[ i ] )->doMausEreignis( me );
- me.my -= members->z( rf[ i ] )->getHeight() + 5;
- }
- delete[] rf;
- unlockZeichnung();
- me.mx = mx, me.my = my;
- if( vera )
- me.verarbeitet = 0;
- }
- void AHSpielListe::render( Bild &zRObj )
- {
- if( !zRObj.setDrawOptions( pos, ram->getSize() ) )
- return;
- ram->render( zRObj );
- scroll->render( ram->getBreite() - 16, 1, 15, ram->getHeight() - 2, zRObj );
- if( !zRObj.setDrawOptions( 1, 1, ram->getBreite() - 15, ram->getHeight() - 2 ) )
- {
- zRObj.releaseDrawOptions();
- return;
- }
- int anzHö = 5;
- lockZeichnung();
- int anz = members->getEintragAnzahl();
- int *rf = new int[ anz ];
- int rfAnz = getReihenfolge( rf );
- for( int i = 0; i < rfAnz; i++ )
- {
- members->z( rf[ i ] )->render( anzHö - scroll->getScroll(), zRObj );
- anzHö += members->z( rf[ i ] )->getHeight() + 5;
- }
- delete[] rf;
- unlockZeichnung();
- scroll->update( anzHö, ram->getHeight() - 2 );
- zRObj.releaseDrawOptions();
- zRObj.releaseDrawOptions();
- }
- // constant
- int AHSpielListe::getAktion( int *spielId, int *karteId ) const
- {
- int anz = members->getEintragAnzahl();
- for( int i = 0; i < anz; i++ )
- {
- int ak = members->z( i )->getAktion();
- if( ak )
- {
- *spielId = members->z( i )->getId();
- *karteId = members->z( i )->getKarteId();
- return ak;
- }
- }
- return 0;
- }
- // Inhalt der AccountHistorie Klasse aus AccountHistorie.h
- // Konstruktor
- AccountHistorie::AccountHistorie( Schrift *zSchrift )
- : Thread(),
- schrift( zSchrift->getThis() ),
- historieF( initFenster( 810, 40, 780, 450, zSchrift, Fenster::Style::Sichtbar | Fenster::Style::Titel | Fenster::Style::TitelBuffered | Fenster::Style::Rahmen | Fenster::Style::Erlaubt, "Historie von " ) ),
- sortSpalte( initAuswahlBox( 10, 10, 150, 20, zSchrift, ABSTYLE, { "Spiel", "Karte", "Datum", "Status" } ) ),
- sortRichtung( initAuswahlBox( 170, 10, 150, 20, zSchrift, ABSTYLE, { "Aufwärts", "Abwärts" } ) ),
- liste( new AHSpielListe() ),
- statistik( new AHSpielStatistik( zSchrift->getThis() ) ),
- video( new AHSpielVideo( zSchrift->getThis() ) ),
- status( 0 ),
- accId( 0 ),
- animation( 0 ),
- alpha( 255 ),
- alpha2( 255 ),
- alpha3( 255 ),
- tickVal( 0 ),
- rend( 0 )
- {
- initToolTip( sortSpalte, "Wähle aus, nach welcher Spalte die\nTabelle sortiert werden soll.", zSchrift, hauptScreen );
- initToolTip( sortRichtung, "Wähle aus, ob Aufwärts oder Abwärts\nsortiert werden soll.", zSchrift, hauptScreen );
- historieF->addMember( liste->getThis() );
- historieF->addMember( sortSpalte->getThis() );
- historieF->addMember( sortRichtung->getThis() );
- historieF->setMausEreignis( _ret1ME );
- }
- // Destruktor
- AccountHistorie::~AccountHistorie()
- {
- schrift->release();
- historieF->release();
- sortSpalte->release();
- sortRichtung->release();
- statistik->release();
- liste->release();
- video->release();
- }
- // nicht constant
- void AccountHistorie::reset()
- {
- liste->reset();
- statistik->reset();
- video->reset();
- }
- void AccountHistorie::ladeStatistik( int accId )
- {
- if( this->accId == accId )
- return;
- this->status = 0;
- if( run )
- {
- warteAufThread( 1000 );
- ende();
- }
- if( ( animation | 0x1 ) == animation )
- {
- animation |= 0x4;
- this->accId = accId;
- this->status = 1;
- return;
- }
- if( this->accId )
- reset();
- this->accId = accId;
- start();
- this->status = 1;
- }
- void AccountHistorie::thread()
- {
- Text *name = infoClient->getSpielerName( accId );
- if( name )
- {
- name->insert( 0, "Historie von " );
- historieF->setTitel( *name );
- name->release();
- }
- Array< KSGClient::SpielHistorieDaten > *daten = infoClient->getSpielHistorieDaten( accId );
- int anz = daten->getEintragAnzahl();
- for( int i = 0; i < anz; i++ )
- {
- KSGClient::SpielHistorieDaten spiel = daten->get( i );
- AHSpielListeEintrag *spielE = new AHSpielListeEintrag( spiel.id, spiel.karteId, schrift, spiel.spiel, spiel.karte,
- spiel.datum, spiel.status, spiel.dauer,
- spiel.spielStatus, spiel.gewinner, spiel.sAnzahl );
- int tAnz = spiel.teams.getEintragAnzahl();
- for( int j = 0; j < tAnz; j++ )
- {
- KSGClient::SpielHistorieTeamDaten team = spiel.teams.get( j );
- AHSLETeamListeTeam *teamE = new AHSLETeamListeTeam( schrift, team.name, team.sAnzahl, team.status,
- team.farbe, spielE->getListeBreite() );
- int sAnz = team.spieler.getEintragAnzahl();
- for( int k = 0; k < sAnz; k++ )
- {
- KSGClient::SpielHistorieSpielerDaten spieler = team.spieler.get( k );
- AHSLETeamListeSpieler *spielerE = new AHSLETeamListeSpieler( schrift, spieler.name, spieler.punkte, spieler.status,
- spieler.farbe, spielE->getListeBreite() - 4 );
- teamE->addSpieler( spielerE );
- }
- spielE->addTeam( teamE );
- }
- liste->addSpiel( spielE );
- }
- daten->release();
- animation &= ~0x4;
- status = 2;
- run = 0;
- }
- void AccountHistorie::setSichtbar( bool sichtbar, bool nachRechts )
- {
- if( sichtbar )
- {
- if( ( animation | 0x1 ) != animation || ( ( nachRechts && ( animation | 0x2 ) != animation ) || !nachRechts && ( animation | 0x2 ) == animation ) )
- {
- if( nachRechts )
- historieF->setPosition( -810, 40 );
- else
- historieF->setPosition( 810, 40 );
- }
- animation |= 0x1;
- }
- else
- animation &= ~0x1;
- if( nachRechts )
- animation |= 0x2;
- else
- animation &= ~0x2;
- }
- bool AccountHistorie::tick( double zeit )
- {
- if( !statistik->istNochSichtbar() && !video->istNochSichtbar() )
- rend |= historieF->tick( zeit );
- rend |= statistik->tick( zeit );
- rend |= video->tick( zeit );
- tickVal += zeit;
- int valA = (int)( tickVal * 150 );
- int valB = (int)( tickVal * 500 );
- tickVal -= valA / 150.0;
- if( valA )
- {
- if( ( animation | 0x8 ) == animation && alpha2 )
- {
- if( alpha2 - valA <= 0 )
- {
- alpha2 = 0;
- statistik->setSichtbar( 1 );
- }
- else
- alpha2 -= valA;
- rend = 1;
- }
- if( ( animation | 0x8 ) != animation && alpha2 != 255 )
- {
- if( alpha2 + valA >= 255 )
- alpha2 = 255;
- else
- alpha2 += valA;
- rend = 1;
- }
- if( ( animation | 0x10 ) == animation && alpha3 )
- {
- if( alpha3 - valA <= 0 )
- {
- alpha3 = 0;
- video->setSichtbar( 1 );
- }
- else
- alpha3 -= valA;
- rend = 1;
- }
- if( ( animation | 0x10 ) != animation && alpha3 != 255 )
- {
- if( alpha3 + valA >= 255 )
- alpha3 = 255;
- else
- alpha3 += valA;
- rend = 1;
- }
- if( ( animation | 0x4 ) == animation && alpha )
- {
- if( alpha - valA <= 0 )
- alpha = 0;
- else
- alpha -= valA;
- rend = 1;
- if( !alpha )
- {
- reset();
- start();
- }
- }
- if( ( animation | 0x4 ) != animation && alpha != 255 )
- {
- if( alpha + valA >= 255 )
- alpha = 255;
- else
- alpha += valA;
- rend = 1;
- }
- }
- if( valB )
- {
- if( ( animation | 0x1 ) == animation )
- { // Sichtbar
- if( ( animation | 0x2 ) == animation )
- { // Nach Rechts
- if( historieF->getX() != 10 )
- {
- if( historieF->getX() + valB > 10 )
- historieF->setPosition( 10, historieF->getY() );
- else
- historieF->setPosition( historieF->getX() + valB, historieF->getY() );
- statistik->setPosition( historieF->getX(), historieF->getY() );
- rend = 1;
- }
- }
- else
- { // Nach Links
- if( historieF->getX() != 10 )
- {
- if( historieF->getX() - valB < 10 )
- historieF->setPosition( 10, historieF->getY() );
- else
- historieF->setPosition( historieF->getX() - valB, historieF->getY() );
- statistik->setPosition( historieF->getX(), historieF->getY() );
- rend = 1;
- }
- }
- }
- else
- { // Unsichtbar
- if( ( animation | 0x2 ) == animation )
- { // Nach Rechts
- if( historieF->getX() != 810 )
- {
- if( historieF->getX() + valB > 810 )
- historieF->setPosition( 810, historieF->getY() );
- else
- historieF->setPosition( historieF->getX() + valB, historieF->getY() );
- statistik->setPosition( historieF->getX(), historieF->getY() );
- rend = 1;
- }
- }
- else
- { // Nach Links
- if( historieF->getX() != -810 )
- {
- if( historieF->getX() - valB < -810 )
- historieF->setPosition( -810, historieF->getY() );
- else
- historieF->setPosition( historieF->getX() - valB, historieF->getY() );
- statistik->setPosition( historieF->getX(), historieF->getY() );
- rend = 1;
- }
- }
- }
- }
- if( !alpha2 && !statistik->istNochSichtbar() )
- {
- animation &= ~0x8;
- statistik->reset();
- }
- if( !alpha3 && !video->istNochSichtbar() )
- {
- animation &= ~0x10;
- video->reset();
- }
- bool ret = rend;
- rend = 0;
- return ret;
- }
- void AccountHistorie::doMausEreignis( MausEreignis &me )
- {
- if( !statistik->istNochSichtbar() && !video->istNochSichtbar() && alpha == 255 && alpha2 == 255 && alpha3 == 255 )
- {
- int sortSpalteS = sortSpalte->getAuswahl();
- int sortRichtungS = sortRichtung->getAuswahl();
- historieF->doMausEreignis( me );
- if( sortSpalte->getAuswahl() != sortSpalteS )
- {
- liste->setSortSpalte( sortSpalte->zEintrag( sortSpalte->getAuswahl() )->zText()->getText() );
- sortSpalte->einklappen();
- }
- if( sortRichtung->getAuswahl() != sortRichtungS )
- {
- liste->setSortRichtung( sortRichtung->getAuswahl() != 0 );
- sortRichtung->einklappen();
- }
- int spielId = 0;
- int karteId = 0;
- int ak = liste->getAktion( &spielId, &karteId );
- if( ak == 1 )
- { // Statistik anzeigen
- if( statistik->ladeDaten( spielId, karteId ) )
- animation |= 0x8;
- }
- if( ak == 2 )
- { // Aufzeichnung abspielen
- if( video->ladeDaten( spielId, karteId ) )
- animation |= 0x10;
- }
- }
- if( statistik->istNochSichtbar() )
- statistik->doMausEreignis( me );
- }
- void AccountHistorie::doTastaturEreignis( TastaturEreignis &te )
- {
- if( statistik->istNochSichtbar() )
- statistik->doTastaturEreignis( te );
- }
- void AccountHistorie::render( Bild &zRObj )
- {
- zRObj.setAlpha( alpha );
- if( alpha2 && alpha3 )
- {
- zRObj.setAlpha( alpha2 );
- zRObj.setAlpha( alpha3 );
- historieF->render( zRObj );
- zRObj.releaseAlpha();
- zRObj.releaseAlpha();
- }
- if( statistik->istNochSichtbar() )
- statistik->render( zRObj );
- if( video->istNochSichtbar() )
- video->render( zRObj );
- zRObj.releaseAlpha();
- }
- // constant
- int AccountHistorie::getStatus() const
- {
- return status;
- }
|