123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838 |
- #include "AccountSpieleUndKarten.h"
- #include "../../../Global/Initialisierung.h"
- #include "../../../Global/Variablen.h"
- #include <Rahmen.h>
- #include <DateiSystem.h>
- #include <Punkt.h>
- #include <ToolTip.h>
- #include <AuswahlBox.h>
- // Inhalt der AccountSUKListeKarte Klasse aus AccountSpieleUndKarten.h
- // Konstruktor
- AccountSUKListeKarte::AccountSUKListeKarte(int id, int account)
- : ReferenceCounter(),
- ram(new LRahmen()),
- name(initTextFeld(5, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Karte: ")),
- spiele(initTextFeld(165, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Spiele: ")),
- gewonnen(initTextFeld(325, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Gewonnen: ")),
- status(initTextFeld(485, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Status: ")),
- st(new Text()),
- karteId(id),
- rend(0)
- {
- na = infoClient->getKarteName(id);
- if (na)
- name->zText()->append(na->getText());
- sp = infoClient->getAccountKarteSpiele(account, id);
- spiele->zText()->append(sp);
- gw = infoClient->getAccountKarteSpieleGewonnen(account, id);
- gewonnen->zText()->append(gw);
- if (infoClient->hatAccountKarte(account, id))
- st->setText("Im Besitz");
- else
- st->setText("Nicht im Besitz");
- status->zText()->append(st->getText());
- ram->setFarbe(0xFFFFFFFF);
- ram->setSize(715, 20);
- ram->setRamenBreite(1);
- }
- // Destruktor
- AccountSUKListeKarte::~AccountSUKListeKarte()
- {
- ram->release();
- name->release();
- spiele->release();
- gewonnen->release();
- status->release();
- if (na)
- na->release();
- st->release();
- }
- // nicht constant
- void AccountSUKListeKarte::render(int yOff, Bild& zRObj)
- {
- if (!zRObj.setDrawOptions(5, yOff, ram->getBreite(), ram->getHeight()))
- return;
- name->render(zRObj);
- spiele->render(zRObj);
- gewonnen->render(zRObj);
- status->render(zRObj);
- ram->render(zRObj);
- zRObj.releaseDrawOptions();
- }
- // constant
- Text* AccountSUKListeKarte::zName() const
- {
- return na;
- }
- int AccountSUKListeKarte::getSpiele() const
- {
- return sp;
- }
- int AccountSUKListeKarte::getGewonnen() const
- {
- return gw;
- }
- Text* AccountSUKListeKarte::zStatus() const
- {
- return st;
- }
- // Inhalt der AccountSUKListeSpiel Klasse aus AccountSpieleUndKarten.h
- // Konstruktor
- AccountSUKListeSpiel::AccountSUKListeSpiel(int id, int account)
- : ReferenceCounter(),
- ram(new LRahmen()),
- nameTF(initTextFeld(5, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Name: ")),
- spieleTF(initTextFeld(165, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Spiele: ")),
- gewonnenTF(initTextFeld(325, 0, 100, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Gewonnen: ")),
- punkteTF(initTextFeld(435, 0, 100, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Punkte: ")),
- statusTF(initTextFeld(545, 0, 150, 20, TextFeld::Style::Text | TextFeld::Style::Center, "Status: ")),
- details(initKnopf(705, 0, 20, 20, 0, "")),
- karten(new RCArray< AccountSUKListeKarte >()),
- einklappen(bilder->get("data/client/bilder/account.ltdb/einklappen.png")),
- ausklappen(bilder->get("data/client/bilder/account.ltdb/ausklappen.png")),
- status(new Text()),
- statusFilter(new Text("Alle")),
- sortSpalte(new Text("Name")),
- sortAbsteigend(0),
- spielId(id),
- tickVal(0),
- rend(0)
- {
- ram->setFarbe(0xFFFFFFFF);
- ram->setRamenBreite(1);
- ram->setSize(725, 20);
- details->setStyle(Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer);
- details->setHintergrundBildZ(dynamic_cast<Bild*>(ausklappen->getThis()));
- initToolTip(details, "Karten anzeigen.");
- name = infoClient->getSpielName(id);
- if (name)
- nameTF->zText()->append(name->getText());
- Array< int >* stat = new Array< int >();
- if (infoClient->getSpielStatistik(account, id, stat))
- {
- spiele = stat->get(0);
- gewonnen = stat->get(1);
- punkte = stat->get(3);
- }
- stat->release();
- spieleTF->zText()->append(spiele);
- gewonnenTF->zText()->append(gewonnen);
- punkteTF->zText()->append(punkte);
- if (infoClient->hatAccountSpiel(account, id))
- status->setText("Im Besitz");
- else
- status->setText("Nicht im Besitz");
- statusTF->zText()->append(status->getText());
- Array< int >* maps = infoClient->getAccountKarteGespieltListe(account, id);
- if (maps)
- {
- int anz = maps->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- karten->set(new AccountSUKListeKarte(maps->get(i), account), i);
- maps->release();
- }
- }
- // Destruktor
- AccountSUKListeSpiel::~AccountSUKListeSpiel()
- {
- ram->release();
- nameTF->release();
- spieleTF->release();
- gewonnenTF->release();
- punkteTF->release();
- statusTF->release();
- details->release();
- karten->release();
- einklappen->release();
- ausklappen->release();
- if (name)
- name->release();
- status->release();
- statusFilter->release();
- sortSpalte->release();
- }
- // privat
- int AccountSUKListeSpiel::getReihenfolge(int* arr)
- {
- int anz = karten->getEintragAnzahl();
- if (!anz)
- return 0;
- int ret = 0;
- bool* fertig = new bool[anz];
- ZeroMemory(fertig, anz);
- for (int i = 0; i < anz; i++)
- {
- int index = -1;
- int minMax = 0;
- Text minMaxT;
- for (int j = 0; j < anz; j++)
- {
- AccountSUKListeKarte* tmp = karten->z(j);
- if (!statusFilter->istGleich("Alle") && !tmp->zStatus()->istGleich(statusFilter->getText()))
- continue;
- if (sortSpalte->istGleich("Name") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && *tmp->zName() > minMaxT) || (!sortAbsteigend && *tmp->zName() < minMaxT)))
- {
- minMaxT = tmp->zName()->getText();
- index = j;
- }
- else if (sortSpalte->istGleich("Spiele") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && tmp->getSpiele() > minMax) || (!sortAbsteigend && tmp->getSpiele() < minMax)))
- {
- minMax = tmp->getSpiele();
- index = j;
- }
- else if (sortSpalte->istGleich("Gewonnen") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && tmp->getGewonnen() > minMax) || (!sortAbsteigend && tmp->getGewonnen() < minMax)))
- {
- minMax = tmp->getGewonnen();
- 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;
- }
- else if (sortSpalte->istGleich("Punkte") && !fertig[j])
- {
- index = j;
- break;
- }
- }
- if (index < 0)
- break;
- fertig[index] = 1;
- arr[ret] = index;
- ret++;
- }
- delete[] fertig;
- return ret;
- }
- // nicht constant
- void AccountSUKListeSpiel::setStatusAusw(const char* status)
- {
- statusFilter->setText(status);
- rend = 1;
- }
- void AccountSUKListeSpiel::setSortSpalte(const char* spalte)
- {
- sortSpalte->setText(spalte);
- rend = 1;
- }
- void AccountSUKListeSpiel::setSortRichtung(bool absteigend)
- {
- sortAbsteigend = absteigend;
- rend = 1;
- }
- bool AccountSUKListeSpiel::tick(double tickVal)
- {
- rend |= details->tick(tickVal);
- this->tickVal += tickVal * 150;
- int val = (int)this->tickVal;
- this->tickVal -= val;
- if (val)
- {
- if (details->zHintergrundBild() == ausklappen && ram->getHeight() != 20)
- {
- if (ram->getHeight() - val < 20)
- ram->setSize(ram->getBreite(), 20);
- else
- ram->setSize(ram->getBreite(), ram->getHeight() - val);
- rend = 1;
- }
- if (details->zHintergrundBild() == einklappen)
- {
- int maxHö = 20;
- int anz = karten->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- {
- AccountSUKListeKarte* tmp = karten->z(i);
- if (!statusFilter->istGleich("Alle") && !tmp->zStatus()->istGleich(statusFilter->getText()))
- continue;
- maxHö += 25;
- }
- if (maxHö > 20)
- maxHö += 5;
- if (ram->getHeight() > maxHö)
- {
- if (ram->getHeight() - val < maxHö)
- ram->setSize(ram->getBreite(), maxHö);
- else
- ram->setSize(ram->getBreite(), ram->getHeight() - val);
- rend = 1;
- }
- if (ram->getHeight() < maxHö)
- {
- if (ram->getHeight() + val > maxHö)
- ram->setSize(ram->getBreite(), maxHö);
- else
- ram->setSize(ram->getBreite(), ram->getHeight() + val);
- rend = 1;
- }
- }
- }
- bool ret = rend;
- rend = 0;
- return ret;
- }
- void AccountSUKListeSpiel::doPublicMausEreignis(MausEreignis& me)
- {
- bool vera = me.verarbeitet;
- details->doPublicMausEreignis(me);
- if (!vera && me.verarbeitet && me.id == ME_RLinks)
- {
- if (details->zHintergrundBild() == ausklappen)
- {
- details->setHintergrundBildZ(dynamic_cast<Bild*>(einklappen->getThis()));
- // TODO: details->zToolTip()->setText( "Karten verbergen." );
- }
- else
- {
- details->setHintergrundBildZ(dynamic_cast<Bild*>(ausklappen->getThis()));
- // TODO: details->zToolTip()->setText( "Karten anzeigen." );
- }
- }
- }
- void AccountSUKListeSpiel::render(int yOff, Bild& zRObj)
- {
- if (!zRObj.setDrawOptions(10, yOff, ram->getBreite(), ram->getHeight()))
- return;
- nameTF->render(zRObj);
- spieleTF->render(zRObj);
- gewonnenTF->render(zRObj);
- punkteTF->render(zRObj);
- statusTF->render(zRObj);
- details->render(zRObj);
- ram->render(zRObj);
- if (ram->getHeight() > 20)
- {
- zRObj.drawLinieH(0, 20, ram->getBreite(), ram->getFarbe());
- if (!zRObj.setDrawOptions(1, 25, ram->getBreite() - 2, ram->getHeight() - 2))
- {
- zRObj.releaseDrawOptions();
- return;
- }
- int anz = karten->getEintragAnzahl();
- int* arr = new int[anz];
- anz = getReihenfolge(arr);
- yOff = 0;
- for (int i = 0; i < anz; i++)
- {
- karten->z(arr[i])->render(yOff, zRObj);
- yOff += 25;
- }
- delete[]arr;
- zRObj.releaseDrawOptions();
- }
- zRObj.releaseDrawOptions();
- }
- // constant
- int AccountSUKListeSpiel::getHeight() const
- {
- return ram->getHeight();
- }
- Text* AccountSUKListeSpiel::zName() const
- {
- return name;
- }
- int AccountSUKListeSpiel::getSpiele() const
- {
- return spiele;
- }
- int AccountSUKListeSpiel::getGewonnen() const
- {
- return gewonnen;
- }
- int AccountSUKListeSpiel::getPunkte() const
- {
- return punkte;
- }
- Text* AccountSUKListeSpiel::zStatus() const
- {
- return status;
- }
- // Inhalt der AccountSUKListe Klasse aus AccountSpieleUndKarten.h
- // Konstruktor
- AccountSUKListe::AccountSUKListe()
- : Zeichnung(),
- ram(new LRahmen()),
- scroll(new VScrollBar()),
- spiele(new RCArray< AccountSUKListeSpiel >()),
- status(new Text()),
- statusFilter(new Text("Alle")),
- sortSpalte(new Text("Name")),
- sortAbsteigend(0),
- rend(0)
- {
- pos = Punkt(10, 40);
- ram->setSize(760, 380);
- ram->setFarbe(0xFFFFFFFF);
- ram->setRamenBreite(1);
- }
- // Destruktor
- AccountSUKListe::~AccountSUKListe()
- {
- ram->release();
- scroll->release();
- spiele->release();
- status->release();
- statusFilter->release();
- sortSpalte->release();
- }
- // privat
- int AccountSUKListe::getReihenfolge(int* arr)
- {
- int anz = spiele->getEintragAnzahl();
- if (!anz)
- return 0;
- int ret = 0;
- bool* fertig = new bool[anz];
- ZeroMemory(fertig, anz);
- for (int i = 0; i < anz; i++)
- {
- int index = -1;
- int minMax = 0;
- Text minMaxT;
- for (int j = 0; j < anz; j++)
- {
- AccountSUKListeSpiel* tmp = spiele->z(j);
- if (!statusFilter->istGleich("Alle") && !tmp->zStatus()->istGleich(statusFilter->getText()))
- continue;
- if (sortSpalte->istGleich("Name") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && *tmp->zName() > minMaxT) || (!sortAbsteigend && *tmp->zName() < minMaxT)))
- {
- minMaxT = tmp->zName()->getText();
- index = j;
- }
- else if (sortSpalte->istGleich("Spiele") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && tmp->getSpiele() > minMax) || (!sortAbsteigend && tmp->getSpiele() < minMax)))
- {
- minMax = tmp->getSpiele();
- index = j;
- }
- else if (sortSpalte->istGleich("Gewonnen") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && tmp->getGewonnen() > minMax) || (!sortAbsteigend && tmp->getGewonnen() < minMax)))
- {
- minMax = tmp->getGewonnen();
- index = j;
- }
- else if (sortSpalte->istGleich("Punkte") && !fertig[j] && (index < 0 ||
- (sortAbsteigend && tmp->getPunkte() > minMax) || (!sortAbsteigend && tmp->getPunkte() < minMax)))
- {
- minMax = tmp->getPunkte();
- 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;
- return ret;
- }
- // nicht constant
- void AccountSUKListe::reset()
- {
- lockZeichnung();
- spiele->leeren();
- unlockZeichnung();
- }
- void AccountSUKListe::addSpiel(AccountSUKListeSpiel* spiel)
- {
- lockZeichnung();
- spiel->setSortRichtung(sortAbsteigend);
- spiel->setSortSpalte(sortSpalte->getText());
- spiel->setStatusAusw(statusFilter->getText());
- spiele->add(spiel);
- unlockZeichnung();
- }
- void AccountSUKListe::setStatusAusw(const char* status)
- {
- lockZeichnung();
- this->statusFilter->setText(status);
- int anz = spiele->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- spiele->z(i)->setStatusAusw(status);
- unlockZeichnung();
- rend = 1;
- }
- void AccountSUKListe::setSortSpalte(const char* spalte)
- {
- lockZeichnung();
- this->sortSpalte->setText(spalte);
- int anz = spiele->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- spiele->z(i)->setSortSpalte(spalte);
- unlockZeichnung();
- rend = 1;
- }
- void AccountSUKListe::setSortRichtung(bool absteigend)
- {
- lockZeichnung();
- sortAbsteigend = absteigend;
- int anz = spiele->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- spiele->z(i)->setSortRichtung(absteigend);
- unlockZeichnung();
- rend = 1;
- }
- bool AccountSUKListe::tick(double tickVal)
- {
- lockZeichnung();
- int anz = spiele->getEintragAnzahl();
- if (anz > 0)
- {
- int* rf = new int[anz];
- int rfAnz = getReihenfolge(rf);
- for (int i = 0; i < rfAnz; i++)
- rend |= spiele->z(rf[i])->tick(tickVal);
- delete[] rf;
- }
- unlockZeichnung();
- rend |= scroll->getRend();
- bool ret = rend;
- rend = 0;
- return ret;
- }
- void AccountSUKListe::doPublicMausEreignis(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 -= 10;
- me.my -= 10 - scroll->getScroll();
- lockZeichnung();
- int anz = spiele->getEintragAnzahl();
- int* rf = new int[anz];
- int rfAnz = getReihenfolge(rf);
- for (int i = 0; i < rfAnz; i++)
- {
- spiele->z(rf[i])->doPublicMausEreignis(me);
- me.my -= spiele->z(rf[i])->getHeight() + 10;
- }
- delete[] rf;
- unlockZeichnung();
- me.mx = mx, me.my = my;
- if (vera)
- me.verarbeitet = 0;
- }
- void AccountSUKListe::render(Bild& zRObj)
- {
- if (!zRObj.setDrawOptions(pos.x, pos.y, ram->getBreite(), ram->getBreite()))
- 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 y = -scroll->getScroll();
- int anzHö = 10;
- lockZeichnung();
- int anz = spiele->getEintragAnzahl();
- int* rf = new int[anz];
- int rfAnz = getReihenfolge(rf);
- for (int i = 0; i < rfAnz; i++)
- {
- spiele->z(rf[i])->render(anzHö, zRObj);
- anzHö += spiele->z(rf[i])->getHeight() + 10;
- }
- delete[] rf;
- unlockZeichnung();
- scroll->update(anzHö, ram->getHeight() - 2);
- zRObj.releaseDrawOptions();
- zRObj.releaseDrawOptions();
- }
- #define ABSTYLE AuswahlBox::Style::Sichtbar | AuswahlBox::Style::Erlaubt | AuswahlBox::Style::Rahmen | AuswahlBox::Style::AuswahlBuffer | AuswahlBox::Style::MausBuffer | AuswahlBox::Style::MaxHeight | AuswahlBox::Style::Hintergrund | AuswahlBox::Style::VScroll
- // Inhalt der AccountSpieleUndKarten Klasse aus AccountSpieleUndKarten.h
- // Konstruktor
- AccountSpieleUndKarten::AccountSpieleUndKarten()
- : Thread(),
- spieleUndKartenF(initFenster(810, 40, 780, 450, Fenster::Style::Sichtbar | Fenster::Style::Titel | Fenster::Style::TitelBuffered | Fenster::Style::Rahmen | Fenster::Style::Erlaubt, "Spiele und Karten von ")),
- statusAusw(initAuswahlBox(10, 10, 150, 20, ABSTYLE, { "Alle", "Im Besitz", "Nicht im Besitz" })),
- sortSpalte(initAuswahlBox(170, 10, 150, 20, ABSTYLE, { "Name", "Spiele", "Gewonnen", "Punkte", "Status" })),
- sortRichtung(initAuswahlBox(330, 10, 150, 20, ABSTYLE, { "Aufwärts", "Abwärts" })),
- liste(new AccountSUKListe()),
- status(0),
- accId(0),
- animation(0),
- alpha(255),
- tickVal(0),
- rend(0)
- {
- initToolTip(statusAusw, "Wähle den Status der anzuzeigenden Spiele und Karten aus.");
- initToolTip(sortSpalte, "Wähle aus, nach welcher Spalte die\nTabelle sortiert werden soll.");
- initToolTip(sortRichtung, "Wähle aus, Ob Aufwärts oder Abwärts sortiert werden soll.");
- spieleUndKartenF->addMember(dynamic_cast<Zeichnung*>(liste->getThis()));
- spieleUndKartenF->addMember(dynamic_cast<Zeichnung*>(statusAusw->getThis()));
- spieleUndKartenF->addMember(dynamic_cast<Zeichnung*>(sortSpalte->getThis()));
- spieleUndKartenF->addMember(dynamic_cast<Zeichnung*>(sortRichtung->getThis()));
- spieleUndKartenF->setMausEreignis(_ret1ME);
- }
- // Destruktor
- AccountSpieleUndKarten::~AccountSpieleUndKarten()
- {
- spieleUndKartenF->release();
- statusAusw->release();
- sortSpalte->release();
- sortRichtung->release();
- liste->release();
- }
- // nicht constant
- void AccountSpieleUndKarten::reset()
- {
- liste->reset();
- }
- void AccountSpieleUndKarten::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 AccountSpieleUndKarten::thread()
- {
- Text* name = infoClient->getSpielerName(accId);
- if (name)
- {
- name->insert(0, "Spiele und Karten von ");
- spieleUndKartenF->setTitel(*name);
- name->release();
- }
- Array< int >* spiele = infoClient->getAccountSpielGespieltListe(accId);
- if (spiele)
- {
- int anz = spiele->getEintragAnzahl();
- for (int i = 0; i < anz; i++)
- {
- AccountSUKListeSpiel* s = new AccountSUKListeSpiel(spiele->get(i), accId);
- liste->addSpiel(s);
- }
- spiele->release();
- }
- else
- nachLogin->zNachrichtenListe()->addNachricht(new Text("Fehler"), new Text("Fehler beim laden der Daten."), new Text("Ok"));
- animation &= ~0x4;
- status = 2;
- run = 0;
- }
- void AccountSpieleUndKarten::setSichtbar(bool sichtbar, bool nachRechts)
- {
- if (sichtbar)
- {
- if ((animation | 0x1) != animation || ((nachRechts && (animation | 0x2) != animation) || !nachRechts && (animation | 0x2) == animation))
- {
- if (nachRechts)
- spieleUndKartenF->setPosition(-810, 40);
- else
- spieleUndKartenF->setPosition(810, 40);
- }
- animation |= 0x1;
- }
- else
- animation &= ~0x1;
- if (nachRechts)
- animation |= 0x2;
- else
- animation &= ~0x2;
- }
- bool AccountSpieleUndKarten::tick(double zeit)
- {
- rend |= spieleUndKartenF->tick(zeit);
- tickVal += zeit;
- int valA = (int)(tickVal * 150);
- int valB = (int)(tickVal * 500);
- tickVal -= valA / 150.0;
- if (valA)
- {
- 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 (spieleUndKartenF->getX() != 10)
- {
- if (spieleUndKartenF->getX() + valB > 10)
- spieleUndKartenF->setPosition(10, spieleUndKartenF->getY());
- else
- spieleUndKartenF->setPosition(spieleUndKartenF->getX() + valB, spieleUndKartenF->getY());
- rend = 1;
- }
- }
- else
- { // Nach Links
- if (spieleUndKartenF->getX() != 10)
- {
- if (spieleUndKartenF->getX() - valB < 10)
- spieleUndKartenF->setPosition(10, spieleUndKartenF->getY());
- else
- spieleUndKartenF->setPosition(spieleUndKartenF->getX() - valB, spieleUndKartenF->getY());
- rend = 1;
- }
- }
- }
- else
- { // Unsichtbar
- if ((animation | 0x2) == animation)
- { // Nach Rechts
- if (spieleUndKartenF->getX() != 810)
- {
- if (spieleUndKartenF->getX() + valB > 810)
- spieleUndKartenF->setPosition(810, spieleUndKartenF->getY());
- else
- spieleUndKartenF->setPosition(spieleUndKartenF->getX() + valB, spieleUndKartenF->getY());
- rend = 1;
- }
- }
- else
- { // Nach Links
- if (spieleUndKartenF->getX() != -810)
- {
- if (spieleUndKartenF->getX() - valB < -810)
- spieleUndKartenF->setPosition(-810, spieleUndKartenF->getY());
- else
- spieleUndKartenF->setPosition(spieleUndKartenF->getX() - valB, spieleUndKartenF->getY());
- rend = 1;
- }
- }
- }
- }
- bool ret = rend;
- rend = 0;
- return ret;
- }
- void AccountSpieleUndKarten::doPublicMausEreignis(MausEreignis& me)
- {
- int statusAuswS = statusAusw->getAuswahl();
- int sortSpalteS = sortSpalte->getAuswahl();
- int sortRichtungS = sortRichtung->getAuswahl();
- spieleUndKartenF->doPublicMausEreignis(me);
- if (statusAusw->getAuswahl() != statusAuswS)
- {
- liste->setStatusAusw(statusAusw->zEintrag(statusAusw->getAuswahl())->zText()->getText());
- statusAusw->einklappen();
- }
- 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();
- }
- }
- void AccountSpieleUndKarten::render(Bild& zRObj)
- {
- zRObj.setAlpha(alpha);
- spieleUndKartenF->render(zRObj);
- zRObj.releaseAlpha();
- }
- // constant
- int AccountSpieleUndKarten::getStatus() const
- {
- return status;
- }
|