Skip to content

Commit

Permalink
Merge pull request #473 from hemberger/turns-color
Browse files Browse the repository at this point in the history
SmrPlayer: add method getTurnsColor
  • Loading branch information
hemberger authored Apr 30, 2018
2 parents 170a6f7 + bf75f7d commit a4e970f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
17 changes: 17 additions & 0 deletions lib/Default/SmrPlayer.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,23 @@ class SmrPlayer extends AbstractSmrPlayer {
return 'HIGH';
}

/**
* Returns the CSS class color to use when displaying the player's turns
*/
public function getTurnsColor() {
switch($this->getTurnsLevel()) {
case 'NONE':
case 'LOW':
return 'red';
break;
case 'MEDIUM':
return 'yellow';
break;
default:
return 'green';
}
}

public function update() {
$this->save();
}
Expand Down
14 changes: 1 addition & 13 deletions templates/Default/engine/Default/includes/RightPanelPlayer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@ if(isset($GameID)) { ?>
<br />
Race : <a href="<?php echo Globals::getCouncilHREF($ThisPlayer->getRaceID()); ?>"><?php echo $ThisPlayer->getColouredRaceName($ThisPlayer->getRaceID()); ?></a><br />
Turns : <span id="turns">
<span class="<?php
switch($ThisPlayer->getTurnsLevel()) {
case 'NONE':
case 'LOW':
echo 'red';
break;
case 'MEDIUM':
echo 'yellow';
break;
default:
echo 'green';
}
?>"><?php
<span class="<?php echo $ThisPlayer->getTurnsColor(); ?>"><?php
echo $ThisPlayer->getTurns() .'/'.$ThisPlayer->getMaxTurns();
?></span>
</span><br />
Expand Down
14 changes: 1 addition & 13 deletions templates/Freon22/engine/Default/skeleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,7 @@
Race: <a href="<?php echo Globals::getCouncilHREF($ThisPlayer->getRaceID()); ?>"><?php echo $ThisPlayer->getColouredRaceName($ThisPlayer->getRaceID()); ?></a><br />

Turns : <span id="turns">
<span class="<?php
switch($ThisPlayer->getTurnsLevel()) {
case 'NONE':
case 'LOW':
echo 'red';
break;
case 'MEDIUM':
echo 'yellow';
break;
default:
echo 'green';
}
?>"><?php
<span class="<?php echo $ThisPlayer->getTurnsColor(); ?>"><?php
echo $ThisPlayer->getTurns() .'/'.$ThisPlayer->getMaxTurns();
?></span>
</span><br />
Expand Down

0 comments on commit a4e970f

Please sign in to comment.