Example #1
0
 function onDraw()
 {
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink(array('yes' => 'yes', 'no' => 'no')));
     $this->yesButton->setAction($this->yesAction);
     $this->noButton->setAction($this->noAction);
     $this->questionLabel->setText($this->questionText);
 }
Example #2
0
 /**
  * @param $login
  */
 private function updateKarma($login)
 {
     $player = $this->storage->getPlayerObject($login);
     $playerInfo = Services\PlayerInfo::Get($login);
     if ($player && $playerInfo) {
         $penalty = $this->matchMakingService->getPlayerPenalty($login, $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
         if ($penalty > 0) {
             if (array_key_exists($login, $this->blockedPlayers)) {
                 if (time() - $this->blockedPlayers[$login] >= $penalty) {
                     $this->matchMakingService->decreasePlayerPenalty($login, time() - $this->blockedPlayers[$login], $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
                 }
             } else {
                 $this->blockedPlayers[$login] = time();
                 $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'playerSuspended', 'params' => array(self::PREFIX, $player->nickName)))));
             }
             $this->setPlayerNotReady($login);
             $this->resetShortKey($login);
             $this->updatePlayerList = true;
             $this->gui->updateWaitingScreenLabel($this->gui->getBadKarmaText($penalty), $login);
             $this->gui->disableReadyButton($login);
         } else {
             unset($this->blockedPlayers[$login]);
             $this->setPlayerNotReady($login);
             $this->gui->updateWaitingScreenLabel(null, $login);
             $this->gui->disableReadyButton($login, false);
         }
     } else {
         if (array_key_exists($login, $this->blockedPlayers)) {
             unset($this->blockedPlayers[$login]);
         }
         \ManiaLive\Utilities\Logger::debug(sprintf('UpdateKarma for not connected player %s', $login));
     }
 }
    protected function onDraw()
    {
        $this->posZ = 5;
        $countdown = (int) $this->time;
        \ManiaLive\Gui\Manialinks::appendScript(<<<MANIASCRIPT
#RequireContext CMlScript
#Include "MathLib" as MathLib
#Include "TextLib" as TextLib
main()
{
\tdeclare Integer countdownTime = CurrentTime;
\tdeclare Integer countdownTimeLeft = {$countdown};
\tdeclare Boolean waiting = False;
\tdeclare CMlLabel label <=> (Page.MainFrame.GetFirstChild("info-label") as CMlLabel);
\tdeclare CMlLabel label2 <=> (Page.MainFrame.GetFirstChild("transfer-label") as CMlLabel);
\tdeclare CMlLabel label3 <=> (Page.MainFrame.GetFirstChild("cancel-label") as CMlLabel);
\tdeclare Text labelText = label.Value;
\tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft)));
\tlabel2.Hide();
\tlabel3.Hide();

\twhile(True)
\t{
\t\tif(countdownTimeLeft > 0 && CurrentTime - countdownTime > 1000)
\t\t{
\t\t\tcountdownTime = CurrentTime;
\t\t\tcountdownTimeLeft = countdownTimeLeft - 1;
\t\t\tlabel.SetText(TextLib::Compose(labelText, TextLib::ToText(countdownTimeLeft)));
\t\t}
\t\telse if(countdownTimeLeft <= 0)
\t\t{
\t\t\tlabel2.Show();
\t\t\tlabel.Hide();
\t\t\twaiting = True;
\t\t}
\t\tyield;
\t}
}
MANIASCRIPT
);
        \ManiaLive\Gui\Manialinks::appendXML(\ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance()->getManialink(array('text' => 'launchMatch', 'transferText' => 'transfer', 'cancel' => 'cancel')));
    }
Example #4
0
 function onDraw()
 {
     \ManiaLib\Gui\Manialink::appendXML(Dictionary::getInstance()->getManiaLink($this->message));
     $this->bg->setVisibility($this->showBackground);
     $this->setScript($this->countdown, $this->animated, $this->hideOnF6);
 }
 function onDraw()
 {
     $this->playerListFrame->destroyComponents();
     $playerKeys = array_keys($this->playerList);
     for ($i = 0; $i < static::$partySize; $i++) {
         if (array_key_exists($i, $playerKeys)) {
             $player = $this->playerList[$playerKeys[$i]];
             $ui = new PlayerDetailed();
             $ui->nickname = $player['nickname'];
             $ui->zone = $player['zone'];
             $ui->avatarUrl = $player['avatarUrl'];
             $ui->rank = $player['rank'];
             $ui->echelon = $player['echelon'];
             $ui->countryFlagUrl = $player['countryFlagUrl'];
             $ui->disable($player['disable']);
             $ui->setHalign('center');
             $this->playerListFrame->addComponent($ui);
         } else {
             $this->playerListFrame->addComponent(clone $this->emptySlot);
         }
     }
     if ($this->disableReadyButton) {
         $this->readyButtonFrame->setVisibility(false);
     } else {
         $this->readyButtonFrame->setVisibility(true);
         $this->readyButton->setAction(static::$readyAction);
     }
     $this->posZ = 3.9;
     if (static::$logoURL) {
         $this->logo->setImage(static::$logoURL, true);
         $this->logo->setUrl(static::$logoLink);
         $this->addComponent($this->logo);
     } else {
         $this->removeComponent($this->logo);
     }
     $textId = $this->textId ?: array('textId' => 'waitingHelp', 'params' => array(static::$scriptName));
     $this->dico['text'] = $textId;
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico));
 }
Example #6
0
    function onDraw()
    {
        $this->posZ = 3;
        $bullet = ' $<$ff0$o>$> ';
        $displayHelpManiaScript = $this->displayHelp ? 'True' : 'False';
        $this->dico = array('switch' => 'helpSwitch', 'help' => array('textId' => 'helpText', 'params' => array($bullet, $this->modeName)), 'tip' => 'helpTip', 'note' => 'helpNote');
        \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico));
        \ManiaLive\Gui\Manialinks::appendScript(<<<MANIASCRIPT
#RequireContext CMlScript
#Include "MathLib" as MathLib
#Include "TextLib" as TextLib

main()
{
\tdeclare Boolean helpDisplayed = {$displayHelpManiaScript};
\tdeclare CMlLabel helpLabel <=> (Page.MainFrame.GetFirstChild("help-label") as CMlLabel);
\tdeclare CMlFrame helpFrame <=> (Page.MainFrame.GetFirstChild("help-frame") as CMlFrame);
\tif(helpDisplayed)
\t{
\t\thelpLabel.Hide();
\t}
\telse
\t{
\t\thelpFrame.Hide();
\t}

\twhile(True)
\t{
\t\tforeach(Event in PendingEvents)
\t\t{
\t\t\tif(Event.Type == CMlEvent::Type::KeyPress)
\t\t\t{
\t\t\t\tif(Event.KeyName == "F7")
\t\t\t\t{
\t\t\t\t\tif(helpDisplayed)
\t\t\t\t\t{
\t\t\t\t\t\thelpFrame.Hide();
\t\t\t\t\t\thelpLabel.Show();
\t\t\t\t\t}
\t\t\t\t\telse
\t\t\t\t\t{
\t\t\t\t\t\thelpFrame.Show();
\t\t\t\t\t\thelpLabel.Hide();
\t\t\t\t\t}
\t\t\t\t\thelpDisplayed = !helpDisplayed;
\t\t\t\t}
\t\t\t\telse if(Event.KeyName == "F6")
\t\t\t\t{
\t\t\t\t\tif (helpDisplayed)
\t\t\t\t\t{
\t\t\t\t\t\thelpFrame.Hide();
\t\t\t\t\t\thelpLabel.Show();
\t\t\t\t\t}
\t\t\t\t}
\t\t\t}
\t\t}
\t\tyield;
\t}
}
MANIASCRIPT
);
    }
    function onDraw()
    {
        $this->setPosZ(3);
        if (static::$displayAlliesHelp) {
            $this->title->setPosY(-4.5);
            $this->alliesHelp->setVisibility(true);
        } else {
            $this->title->setPosY(-6);
            $this->alliesHelp->setVisibility(false);
        }
        \ManiaLive\Gui\Manialinks::appendXML(\ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance()->getManiaLink($this->dictionnary));
        \ManiaLive\Gui\Manialinks::appendScript(<<<EOSCRIPT
#RequireContext CMlScript
#Include "MathLib" as MathLib
#Include "TextLib" as TextLib

main()
{
\tdeclare Text ClickedIndex;
\tdeclare Text ButtonIdPrefix;
\tdeclare Text DataIdPrefix;
\tdeclare Text DataEntryId;
\tdeclare Integer ButtonIdPrefixLength;
\tdeclare CMlLabel DataLabel;
\tdeclare CMlEntry DataEntry;
\t\t
\tButtonIdPrefix = "player_button-";
\tDataIdPrefix = "player_label-";
\tDataEntryId = "allyLogin_entry";
\t
\tButtonIdPrefixLength = TextLib::Length(ButtonIdPrefix);
\tDataEntry <=> (Page.GetFirstChild(DataEntryId) as CMlEntry);

\twhile(True)
\t{
\t\tforeach(Event in PendingEvents)
\t\t{
\t\t\tif(Event.Type == CMlEvent::Type::MouseOver)
\t\t\t{
\t\t\t\tif(TextLib::SubString(Event.ControlId, 0, ButtonIdPrefixLength) == ButtonIdPrefix)
\t\t\t\t{
\t\t\t\t\tClickedIndex = TextLib::SubString(Event.ControlId, ButtonIdPrefixLength, 2);
\t\t\t\t\tDataLabel <=> (Page.GetFirstChild(DataIdPrefix^ClickedIndex) as CMlLabel);
\t\t\t\t\tif(DataLabel != Null)\t
\t\t\t\t\t{
\t\t\t\t\t\tDataEntry.Value = DataLabel.Value;
\t\t\t\t\t}
\t\t\t\t}
\t\t\t}
\t\t}
\t\tyield;
\t}
}
EOSCRIPT
);
        $this->updateItemList();
    }
    public function display()
    {
        Manialink::load();
        Manialink::appendXML(Dictionary::getInstance()->getManiaLink($this->displayedText));
        Manialink::appendScript(<<<MANIASCRIPT
#RequireContext CMlScript
#Include "MathLib" as MathLib
#Include "TextLib" as TextLib
main()
{
\tdeclare Boolean countdown = True;
\tdeclare Integer countdownTime = CurrentTime;
\tdeclare Integer countdownTimeLeft = 10;
\tdeclare CMlFrame frame  <=> (Page.MainFrame.GetFirstChild("block-quit") as CMlFrame);
\tdeclare CMlLabel label <=> (Page.MainFrame.GetFirstChild("countdown-label") as CMlLabel);
\tlabel.SetText(TextLib::ToText(countdownTimeLeft));

\twhile(True)
\t{
\t\tif(countdown && countdownTimeLeft >= 0 && CurrentTime - countdownTime > 1000)
\t\t{
\t\t\tcountdownTime = CurrentTime;
\t\t\tcountdownTimeLeft = countdownTimeLeft - 1;
\t\t\tlabel.SetText(TextLib::ToText(countdownTimeLeft));
\t\t}
\t\telse if(countdown && countdownTimeLeft <= 0)
\t\t{
\t\t\tframe.Hide();
\t\t}
\t\tyield;
\t}
}
MANIASCRIPT
);
        $frame = new \ManiaLib\Gui\Elements\Frame();
        $frame->setPosition(0, 5, 0);
        $label = new Label(170);
        $label->setAlign('center', 'center2');
        $label->setStyle(Label::TextRaceMessageBig);
        $label->setTextSize(5);
        $label->setTextColor('f00');
        $label->setTextId('text');
        $frame->add($label);
        $iconBlink = new Icons128x128_Blink(15);
        $iconBlink->setAlign('right', 'center');
        $iconBlink->setPosition(-87, 0);
        $iconBlink->setSubStyle(Icons128x128_Blink::Hard);
        $frame->add($iconBlink);
        $iconBlink = new Icons128x128_Blink(15);
        $iconBlink->setAlign('left', 'center');
        $iconBlink->setPosition(87, 0);
        $iconBlink->setSubStyle(Icons128x128_Blink::Hard);
        $frame->add($iconBlink);
        $frame->save();
        $frame = new \ManiaLib\Gui\Elements\Frame();
        $frame->setPosition(0, -6.5, 10);
        $frame->setScriptEvents();
        $frame->setId('block-quit');
        $bg = new Bgs1(180, 45);
        $bg->setSubStyle(Bgs1::BgDialogBlur);
        $bg->setAlign('center');
        $bg->setScriptEvents();
        $bg->setId('background');
        $bg->setManialink('');
        $frame->add($bg);
        $bg = new Quad(180, 45);
        $bg->setBgcolor('0008');
        $bg->setAlign('center');
        $bg->setScriptEvents();
        $frame->add($bg);
        $ui = new Label(120);
        $ui->setAlign('center');
        $ui->setPosition(0, -6, 0.1);
        $ui->setStyle(Label::TextRaceMessageBig);
        $ui->setTextSize(4);
        $ui->setTextid('available');
        $frame->add($ui);
        $ui = new Label(20);
        $ui->setId('countdown-label');
        $ui->setAlign('center');
        $ui->setPosition(0, -15, 0.1);
        $ui->setStyle(Label::TextRaceMessageBig);
        $ui->setTextSize(5);
        $ui->setText('10');
        $frame->add($ui);
        $frame->save();
        return Manialink::render(true);
    }
 function onDraw()
 {
     $this->dico = array('playing' => 'playing', 'ready' => 'ready', 'avgWaitingHelper' => 'avgWaitingHelper', 'avgWaiting' => array('textId' => 'avgWaitingTime', 'params' => array(static::$avgWaitingTime == -1 ? "-" : static::$avgWaitingTime)), 'nPlayers' => array('textId' => 'nPlayersPlaying', 'params' => array(static::$playingPlayerCount)), 'nPlayersHelper' => array('textId' => 'nPlayersReady', 'params' => array(static::$readyPlayerCount)));
     $this->serverNameLabel->setText(static::$serverName);
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico));
 }
 function onDraw()
 {
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink(array('noPlanet' => 'noPlanet', 'noPlanetBuy' => 'noPlanetBuy', 'noPlanetBye' => 'noPlanetBye', 'noPlanetThanks' => 'noPlanetThanks', 'noPlanetTips' => 'noPlanetTips')));
     //$this->yesButton->bg->setAction($this->yesAction);
     //$this->noButton->bg->setAction($this->noAction);
 }
Example #11
0
 protected function play()
 {
     \ManiaLive\Utilities\Logger::debug('play()');
     $this->matchMakingService->updateMatchState($this->matchId, Services\Match::PLAYING);
     Label::EraseAll();
     switch ($this->state) {
         case self::DECIDING:
             $ratios = array();
             $ratios[] = new Structures\VoteRatio('NextMap', -1.0);
             $ratios[] = new Structures\VoteRatio('JumpToMapIndex', -1.0);
             $this->connection->setCallVoteRatiosEx(false, $ratios);
             $this->connection->chatSendServerMessageToLanguage($this->dictionary->getChat(array(array('textId' => 'matchStarting', 'params' => array(static::PREFIX)))));
             break;
         case static::PLAYER_LEFT:
             $this->connection->chatSendServerMessageToLanguage(array(array('Lang' => 'fr', 'Text' => static::PREFIX . 'Le joueur est de retour.'), array('Lang' => 'en', 'Text' => static::PREFIX . 'Player is back.')));
             break;
         case static::WAITING_BACKUPS:
             $this->connection->chatSendServerMessageToLanguage(array(array('Lang' => 'fr', 'Text' => static::PREFIX . 'Les remplaçants sont connectés.'), array('Lang' => 'en', 'Text' => static::PREFIX . 'Substitutes are connected.')));
             break;
     }
     $this->changeState(self::PLAYING);
 }
 function onDraw()
 {
     $this->setPosZ(3);
     \ManiaLive\Gui\Manialinks::appendXML(\ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance()->getManiaLink($this->dictionnary));
     $this->updateItemList();
 }
 protected function onDraw()
 {
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink($this->dico));
 }
 function onDraw()
 {
     \ManiaLive\Gui\Manialinks::appendXML(Dictionary::getInstance()->getManiaLink(array('demoReady' => 'demoReady', 'demoReady2' => 'demoReady2', 'demoReadyTips' => 'demoReadyTips', 'ok' => 'yes', 'cancel' => 'no')));
     $this->yesButton->bg->setAction($this->yesAction);
     $this->noButton->bg->setAction($this->noAction);
 }