forked from iopietro/Travianz-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,094 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 73 additions & 12 deletions
85
App/GameModule/Controls/BuildingDetail/Template/Barracks.latte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,73 @@ | ||
<table cellpadding="1" cellspacing="1" class="build_details"> | ||
<thead> | ||
<tr> | ||
<td>Troops</td> | ||
<td>No.</td> | ||
<td>Max.</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
</tbody> | ||
</table> | ||
{form trainBarracks} | ||
<table cellpadding="1" cellspacing="1" class="build_details"> | ||
<thead> | ||
<tr> | ||
<td>Troops</td> | ||
<td>No.</td> | ||
<td>Max.</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{foreach $units as $unit} | ||
<tr> | ||
<td class="desc"> | ||
<div class="tit"> | ||
<img class="unit u{$unit->getId()}" src="{$baseUrl}/img/x.gif" alt="{$unit->getName()}" title="{$unit->getName()}" /> | ||
<a href="#">{$unit->getName()}</a> <span class="info">(Available: {$current['u' . $unit->getId()]})</span> | ||
</div> | ||
<div class="details"> | ||
<img class="r1" src="{$baseUrl}/img/x.gif" alt="Wood" title="Wood" />{$unit->getWood()}|{* | ||
*}<img class="r2" src="{$baseUrl}/img/x.gif" alt="Clay" title="Clay" />{$unit->getClay()}|{* | ||
*}<img class="r3" src="{$baseUrl}/img/x.gif" alt="Iron" title="Iron" />{$unit->getIron()}|{* | ||
*}<img class="r4" src="{$baseUrl}/img/x.gif" alt="Crop" title="Crop" />{$unit->getCrop()}|{* | ||
*}<img class="r5" src="{$baseUrl}/img/x.gif" alt="Crop consumption" title="Upkeep" />{$unit->getUpkeep()}|{* | ||
*}<img class="clock" src="{$baseUrl}/img/x.gif" alt="Duration" title="Duration" />{$unit->getTime()|date:'G:i:s'}|{* | ||
*}<a href="{plink ':Game:Build:Redistribute'}" title="NPC trade"> | ||
<img class="npc" src="{$baseUrl}/img/x.gif" alt="NPC trade" title="NPC trade" /> | ||
</a> | ||
</div> | ||
</td> | ||
<td class="val"> | ||
{input $unit->getId().'number'} | ||
</td> | ||
<td class="max"> | ||
<a href="#">({$available[$unit->getId()]})</a> | ||
</td> | ||
</tr> | ||
{/foreach} | ||
</tbody> | ||
</table> | ||
<p> | ||
<input n:name="submit" type="image" id="btn_train" class="dynamic_img" value="ok" src="{$baseUrl}/img/x.gif" alt="train"/> | ||
</p> | ||
<table cellpadding="1" cellspacing="1" class="under_progress"> | ||
<thead> | ||
<tr> | ||
<td>Troops in training</td> | ||
<td>Duration</td> | ||
<td>Finished</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{foreach $queue as $single} | ||
<tr> | ||
<td class="desc"> | ||
<img class="unit u{$single->unit->getId()}" src="{$baseUrl}/img/x.gif" alt="{$single->unit->getName()}" title="{$single->unit->getName()}" /> | ||
{$single->amt} {$single->unit->getName()} | ||
</td> | ||
<td class="dur"> | ||
<span id="timer1">{($single->amt * $single->eachtime)|date:'G:i:s'}</span> | ||
</td> | ||
<td class="fin"> | ||
{($single->amt * $single->eachtime + $single->timestamp)|date:'G:i:s'} | ||
</td> | ||
</tr> | ||
{/foreach} | ||
<tr class="next"> | ||
<td colspan="3"> | ||
The next unit will be finished in <span id="timer2">{($queue[0]->timestamp - time() + $queue[0]->eachtime)|date:'G:i:s'}</span> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
{/form} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Train; | ||
|
||
|
||
interface ITrainControl | ||
{ | ||
/** | ||
* @param array $units | ||
* @return TrainControl | ||
*/ | ||
public function create($units = []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Train; | ||
|
||
use Nette; | ||
use App; | ||
|
||
class TrainControl extends Nette\Application\UI\Form | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private $units; | ||
/** | ||
* @var App\FrontModule\Model\VData\VillageService | ||
*/ | ||
private $villageService; | ||
|
||
|
||
public function __construct( | ||
$units | ||
, App\FrontModule\Model\VData\VillageService $villageService | ||
) { | ||
$this->units = $units; | ||
$this->villageService = $villageService; | ||
} | ||
|
||
|
||
public function attached($presenter) | ||
{ | ||
parent::attached($presenter); | ||
|
||
/** @var App\GameModule\DTO\Unit $unit */ | ||
foreach ($this->units as $unit) { | ||
$this->addText($unit->getId() . 'number', $unit->getName()) | ||
->setAttribute('class', 'text') | ||
->addCondition(Nette\Forms\Form::NUMERIC); | ||
} | ||
|
||
$this->addSubmit('submit', 'Train') | ||
->setAttribute('type', 'image') | ||
->setAttribute('class', 'dynamic_img') | ||
->setAttribute('id', 'btn_train'); | ||
|
||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getUnits() | ||
{ | ||
return $this->units; | ||
} | ||
|
||
|
||
/** | ||
* @param array $units | ||
*/ | ||
public function setUnits($units) | ||
{ | ||
$this->units = $units; | ||
} | ||
} |
Oops, something went wrong.