vue Voire la flotte en mouvement avec une barre de progression - Page 1
Kommunauty
Connexion
Inscription

Voire la flotte en mouvement avec une barre de progression


Homer Messages : 1925

C'est normal, il faut creer les différente div avec des nom différents

<div id="pwidget_x">  
<div id="progressbar_x">
    <div id="indicator_x"></div>
    <div id="indicatorretour_x"></div>
</div>
<div id="progressnum"></div>
</div>
<input hidden type="text" value="5" id="Ttraj_x" /><br>
<input hidden type="text" value="1000" id="tempo_x" /><br>
<input hidden type="text" value="3" id="Testatio_x" /><br>

et modifier le code JS pour qu'il prennent en compte les différentes flottes

vendredi 3 mars 2017

Sc0rpio Messages : 110

Mon problème est justement pour le code JS, je ne voit pas du tous comment le modifier pour que ça prennent les flottes en compte individuellement...

Tu pourrait me le faire juste pour la function aller() et après je modifierais les autres?

vendredi 3 mars 2017

Homer Messages : 1925

On essai de se caler demain, fin de mâtiné ?

vendredi 3 mars 2017

Sc0rpio Messages : 110

ok vers 10 h ou 11h comme tu veut.

samedi 4 mars 2017

Sc0rpio Messages : 110

Bonjour je reviens vers vous:

Je voudrais lancer la function retour() des-que la function aller() se termine mais je n'arrive pas a la lancer comme je le voudrait alors que si je lance soit la function aller() ou la function retour() individuellement tous ce passe comme je le veut et je n'arrive pas a trouver d’où vient le problème une aide serait la bienvenue.

Edit: Et je pense aussi que le foreach est pas bon pour les mouvements de flottes

{block name="title" prepend}{$LNG.lm_fleet}{/block}
{block name="content"}
<div id="page">
<div id="content">
<div id="ally_content" class="conteiner">

    <div class="gray_stripe">
            <a href="game.php?page=reduceresources" class="fleet_reduce ico_reduceresources tooltip" data-tooltip-content="Récupérer Ressources{*{$LNG.HarRes}*}"></a>
   <a href="game.php?page=reducefleet" class="fleet_reduce ico_reducefleet tooltip" data-tooltip-content="Récupérer Flotte"></a>
        <span style="float:right;color:#6ccdce;"><span class="totalFleetPoints">0</span> Points Flottes Séléctionner</span>
    </div>
    {if !empty($acsData)}
{include file="shared.fleetTable.acsTable.tpl"}
{/if}
    <form action="?page=fleetStep1" method="post">
<input type="hidden" name="galaxy" value="{$targetGalaxy}">
<input type="hidden" name="system" value="{$targetSystem}">
<input type="hidden" name="planet" value="{$targetPlanet}">
<input type="hidden" name="type" value="{$targetType}">
<input type="hidden" name="target_mission" value="{$targetMission}">
        <table class="tablesorter ally_ranks">
             <tr>
         <th colspan="3" class="gray_stripe">Vaisseaux de Combats</th>     
            <th style="padding:0;" class="gray_stripe">            
              <a href="javascript:noShipsBatle();" class="fl_min_ships">Min</a>
                <a href="javascript:maxShipsBatle();" class="fl_max_ships">Max</a>
            </th>
        </tr>

{foreach $FleetsOnPlanet as $FleetRow}
                        <tr class="fl_fllets_rows">
            <td class="fl_fllets_rows_img_td"><a href="#" onclick="return Dialog.info({$FleetRow.id})"><img src="./styles/theme/gow/gebaeude/{$FleetRow.id}.gif" alt="{$LNG.tech.{$FleetRow.id}}" /></a></td>
            <td> <span class="tooltip" {if $FleetRow.speed != 0}data-tooltip-content="Vitesse:  {pretty_number($FleetRow.speed)}"{/if} style="cursor:help;">{$LNG.tech.{$FleetRow.id}}</span></td>
            <td id="ship{$FleetRow.id}_value">{$FleetRow.count|number}</td>
            <td class="fl_fllets_rows_input_td">
             <div class="fl_fllets_rows_input_div">
                 <div onclick="minShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_min">Min</div>
                    <div onclick="maxShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_max">Max</div>
                 <input class="countdots fl_fllets_rows_input_countdots" name="ship{$FleetRow.id}" id="ship{$FleetRow.id}_input"  value="0">
                </div>
            </td>
        </tr>
{/foreach}


    <tr>
         <th colspan="3" class="gray_stripe">Transporteurs</th>     
            <th style="padding:0;" class="gray_stripe">            
              <a href="javascript:noShipsTransports();" class="fl_min_ships">Min</a>
                <a href="javascript:maxShipsTransports();" class="fl_max_ships">Max</a>
            </th>
        </tr>

{foreach $FleetsOnPlanetTransport as $FleetRow}
                        <tr class="fl_fllets_rows">
            <td class="fl_fllets_rows_img_td"><a href="#" onclick="return Dialog.info({$FleetRow.id})"><img src="./styles/theme/gow/gebaeude/{$FleetRow.id}.gif" alt="{$LNG.tech.{$FleetRow.id}}" /></a></td>
            <td> <span class="tooltip" {if $FleetRow.speed != 0}data-tooltip-content="Vitesse:  {pretty_number($FleetRow.speed)}"{/if}  style="cursor:help;">{$LNG.tech.{$FleetRow.id}}</span></td>
            <td id="ship{$FleetRow.id}_value">{$FleetRow.count|number}</td>
            <td class="fl_fllets_rows_input_td">
             <div class="fl_fllets_rows_input_div">
                 <div onclick="minShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_min">Min</div>
                    <div onclick="maxShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_max">Max</div>
                 <input class="countdots fl_fllets_rows_input_countdots" name="ship{$FleetRow.id}" id="ship{$FleetRow.id}_input"  value="0">
                </div>
            </td>
        </tr>
{/foreach}

                                                        <tr>
         <th colspan="3" class="gray_stripe">Recycleurs</th>     
            <th style="padding:0;" class="gray_stripe">            
              <a href="javascript:noShipsProcessors();" class="fl_min_ships">Min</a>
                <a href="javascript:maxShipsProcessors();" class="fl_max_ships">Max</a>
            </th>
        </tr>

{foreach $FleetsOnPlanetProccesors as $FleetRow}
                        <tr class="fl_fllets_rows">
            <td class="fl_fllets_rows_img_td"><a href="#" onclick="return Dialog.info({$FleetRow.id})"><img src="./styles/theme/gow/gebaeude/{$FleetRow.id}.gif" alt="{$LNG.tech.{$FleetRow.id}}" /></a></td>
            <td> <span class="tooltip" {if $FleetRow.speed != 0}data-tooltip-content="Vitesse:  {pretty_number($FleetRow.speed)}"{/if}  style="cursor:help;">{$LNG.tech.{$FleetRow.id}}</span></td>
            <td id="ship{$FleetRow.id}_value">{$FleetRow.count|number}</td>
            <td class="fl_fllets_rows_input_td">
             <div class="fl_fllets_rows_input_div">
                 <div onclick="minShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_min">Min</div>
                    <div onclick="maxShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_max">Max</div>
                 <input class="countdots fl_fllets_rows_input_countdots" name="ship{$FleetRow.id}" id="ship{$FleetRow.id}_input"  value="0">
                </div>
            </td>
        </tr>
{/foreach}


                                                        <tr>
         <th colspan="3" class="gray_stripe">Spécial</th>     
            <th style="padding:0;" class="gray_stripe">            
              <a href="javascript:noShipsSpecial();" class="fl_min_ships">Min</a>
                <a href="javascript:maxShipsSpecial();" class="fl_max_ships">Max</a>
            </th>
        </tr>

{foreach $FleetsOnPlanetSpecial as $FleetRow}
                        <tr class="fl_fllets_rows">
            <td class="fl_fllets_rows_img_td"><a href="#" onclick="return Dialog.info({$FleetRow.id})"><img src="./styles/theme/gow/gebaeude/{$FleetRow.id}.gif" alt="{$LNG.tech.{$FleetRow.id}}" /></a></td>
            <td> <span class="tooltip" {if $FleetRow.speed != 0}data-tooltip-content="Vitesse:  {pretty_number($FleetRow.speed)}"{/if} style="cursor:help;">{$LNG.tech.{$FleetRow.id}}</span></td>
            <td id="ship{$FleetRow.id}_value">{$FleetRow.count|number}</td>
            <td class="fl_fllets_rows_input_td">
             <div class="fl_fllets_rows_input_div">
                 <div onclick="minShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_min">Min</div>
                    <div onclick="maxShip('ship{$FleetRow.id}');" class="fl_fllets_rows_input_max">Max</div>
                 <input class="countdots fl_fllets_rows_input_countdots" name="ship{$FleetRow.id}" id="ship{$FleetRow.id}_input"  value="0">
                </div>
            </td>
        </tr>
{/foreach}



                        <tr>     
         <th colspan="2" style="text-align:center;" class="gray_stripe"><a href="javascript:onSave();" style="color:#666;"></a></td>                   
         <th colspan="1" style="text-align:center;" class="gray_stripe"><a href="javascript:maxShips();" style="color:#666;">Tous les Vaisseaux</a></td>           
            <th colspan="1" style="text-align:center;" class="gray_stripe"><a href="javascript:noShips();" style="color:#666;">Remise a Zero</a></td>           
        </tr>
        <tr style="display:none;" id="save">
         <td colspan="3" style="text-align:right; color:#CCC;">Indiquez le nom du Groupe</td>
            <td colspan="1"><input name="save_groop" size="15" maxlength="13" style="width:96%;"></td>
        </tr>    
{if $maxFleetSlots != $activeFleetSlots}
        <tr>
            <td colspan="4" style="padding:0;">
                <input class="fl_bigbtn_go" type="submit"  value="{$LNG.fl_continue}">
            </td>
        </tr>
               {/if}  
    </table>
    </form>
    
        
      <div class="gray_stripe" style="margin-top:1px;">
{*<div class="transparent" style="text-align:left;float:left;">{$LNG.fl_fleets} {$activeFleetSlots} / {$maxFleetSlots}<font color=blue>|||||</font>{$activeFortSlots} / {$maxFortSlots} Capture<font color=blue>|||||</font>{$activeColoSlots} / {$maxColoSlots} Colonie<font color=blue>|||||</font>{$activeDMSlots} / {$maxDMSlots} Recherche MN<font color=blue>|||||</font>{$activeASSlots} / {$maxASSlots} Astéroide<font color=blue>|||||</font>{$activeExpedition} / {$maxExpedition} {$LNG.fl_expeditions}</div>*}
<div class="transparent" style="text-align:center;float:center;">{$activeFleetSlots} / {$maxFleetSlots} {$LNG.fl_fleets}<font color=blue>|||</font>{$activeFortSlots} / {$maxFortSlots} Fort<font color=blue>|||</font>{$activeColoSlots} / {$maxColoSlots} Colo<font color=blue>|||</font>{$activeDMSlots} / {$maxDMSlots} Rech MN<font color=blue>|||</font>{$activeASSlots} / {$maxASSlots} Astéro<font color=blue>|||</font>{$activeExtraSlots} / {$maxExtraSlots} Extraction<font color=blue>|||</font>{$activeExpedition} / {$maxExpedition} {$LNG.fl_expeditions}</div>
        </div>       
{*    <div class="gray_stripe" style="margin-top:1px;">
        <div class="left_part">
            <div class="transparent" style="text-align:left;float:left;">{$LNG.fl_fleets} {$activeFleetSlots} / {$maxFleetSlots}<font color=blue>|||||||</font>{$activeFortSlots} / {$maxFortSlots} Capture<font color=blue>|||||||</font>{$activeColoSlots} / {$maxColoSlots} Colonie</div>
        </div>
        <div class="right_part">
            <div class="transparent" style="text-align:right;float:right;">{$activeExpedition} / {$maxExpedition} {$LNG.fl_expeditions}</div>
<th colspan="2" style="text-align:left;" class="gray_stripe">{$activeDMSlots} / {$maxDMSlots} Rech. MN<font color=blue>||</font>{$activeASSlots} / {$maxASSlots} Astéroide<font color=blue>|</font></td>    
        </div>
    </div>*}    
<table class="tablesorter ally_ranks">
        <tr>
            <td>№</td>
            <td>{$LNG.j}</td>
            <td>{$LNG.st}</td>
            <td>{$LNG.wh}</td>
            <td>{$LNG.ar}</td>
            <td>{$LNG.whe}</td>
            <td>{$LNG.re}</td>
            <td>{$LNG.Re}</td>
            <td>{$LNG.Or}</td>
        </tr>
             {foreach name=FlyingFleets item=FlyingFleetRow from=$FlyingFleetList}
<tr>
<td>{$smarty.foreach.FlyingFleets.iteration}</td>
<td>{$LNG.type_mission.{$FlyingFleetRow.mission}}
{if $FlyingFleetRow.state == 1}
<br><a title="{$LNG.fl_returning}">{$LNG.fl_r}</a>
{else}
<br><a title="{$LNG.fl_onway}">{$LNG.fl_a}</a>
{/if}
</td>
<td><a class="tooltip_sticky" data-tooltip-content="<table width='100%'><tr><th colspan='2' style='text-align:center;'>{$LNG.fl_info_detail}</th></tr>{foreach $FlyingFleetRow.FleetList as $shipID => $shipCount}<tr><td class='transparent'>{$LNG.tech.{$shipID}}:</td><td class='transparent'>{$shipCount}</td></tr>{/foreach}</table>">{$FlyingFleetRow.amount}</a></td>
<td><a href="game.php?page=galaxy&galaxy={$FlyingFleetRow.startGalaxy}&system={$FlyingFleetRow.startSystem}">[{$FlyingFleetRow.startGalaxy}:{$FlyingFleetRow.startSystem}:{$FlyingFleetRow.startPlanet}]</a></td>
<td{if $FlyingFleetRow.state == 0} style="color:lime"{/if}>{$FlyingFleetRow.startTime}</td>
<td><a href="game.php?page=galaxy&galaxy={$FlyingFleetRow.endGalaxy}&system={$FlyingFleetRow.endSystem}">[{$FlyingFleetRow.endGalaxy}:{$FlyingFleetRow.endSystem}:{$FlyingFleetRow.endPlanet}]</a></td>
{if $FlyingFleetRow.mission == 4 && $FlyingFleetRow.state == 0}
<td>-</td>
{else}
<td{if $FlyingFleetRow.state != 0} style="color:lime"{/if}>{$FlyingFleetRow.endTime}</td>
{/if}
<td id="fleettime_{$smarty.foreach.FlyingFleets.iteration}" class="fleets" data-fleet-end-time="{$FlyingFleetRow.returntime}" data-fleet-time="{$FlyingFleetRow.resttime}">{pretty_fly_time({$FlyingFleetRow.resttime})}</td>
<td>
{if !$isVacation && $FlyingFleetRow.state != 1}
<form action="game.php?page=fleetTable&action=sendfleetback" method="post">
<input name="fleetID" value="{$FlyingFleetRow.id}" type="hidden">
<input class="fl_btn_table_fleets_order" value="{$LNG.fl_send_back}" type="submit">
</form>
{if $FlyingFleetRow.mission == 1}
<form action="game.php?page=fleetTable&action=acs" method="post">
<input name="fleetID" value="{$FlyingFleetRow.id}" type="hidden">
<input class="fl_btn_table_fleets_order" value="{$LNG.fl_acs}" type="submit">
</form>
{/if}
{else}
 - 
{/if}
</td>
</tr>
{foreachelse}
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
{/foreach}
                    </table>


        <div class="gray_stripe" style="border-bottom:0;">
        {*<div class="gray_stripe" style="border-style: solid;">*}
        <span style="cursor:help; color:#6ccdce" class="tooltip" data-tooltip-content="
         <table>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.fl_bonus_attack}</th>
                {*<th style='border-style: solid;border-color: #6ccdce;text-align:right; padding-right:12px;'>{$LNG.fl_bonus_attack}</th>*}
              <td>+{$bonusAttack} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.fl_bonus_shield}</th>
                <td>+{$bonusShield} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.fl_bonus_defensive}</th>
                <td>+{$bonusDefensive} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.tech.115}</th>
                <td>+{$bonusCombustion} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.tech.117}</th>
                <td>+{$bonusImpulse} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>{$LNG.tech.118}</th>
                <td>+{$bonusHyperspace} %</td>
            </tr>
            <tr>
                <th style='text-align:right; padding-right:12px;'>Vitesse de Flotte</th>
                <td>+{$bonusFleetSpeed} %</td>
            </tr>
        </table>
        ">{$LNG.ReTe}</span>
        <span style="float:right;color:#6ccdce;"><span class="totalFleetPoints">0</span> Points Flotte Séléctionner</span>
    </div>
</div>
{* MOUVEMENT DES FLOTTES*}
             {foreach name=FlyingFleets item=FlyingFleetRow from=$FlyingFleetList}

<div id="pwidget">  
<div id="progressbar">
    <div id="indicator"></div>
    <div id="indicatorretour"></div>
</div>
<div id="progressnum">{$FlyingFleetRow.volTimeA} Temps reel {$FlyingFleetRow.TimeReel} Tr {$FlyingFleetRow.volstartTime}</div>
</div>
<input hidden type="text" value="5" id="Ttraj" />
<input hidden type="text" value="1000" id="tempo" />
<input hidden type="text" value="3" id="Testatio" />

<script type="text/javascript">
//caractéristiques
var maxprogress = 250;
var imgwidth = 20;
var distparcourue = maxprogress - imgwidth; //taille du fond - taille img en mouvement


//variables fonctionnelles
// variable du temps total du trajet aller
var Ttraj = {$FlyingFleetRow.volstartTime};
var TtrajR = {$FlyingFleetRow.volTimeR};
// variable du temps de stationnement
var Testatio = {$FlyingFleetRow.volstatioTime};
var progressnum = document.getElementById("progressnum");
var indicator = document.getElementById("indicator");
var indicatorretour = document.getElementById("indicatorretour");
var temporisation = 1000;
var volTimeA = {$FlyingFleetRow.volTimeA};
var TimeReel = {$FlyingFleetRow.TimeReel};

//initialisations

var HandleA = 0;
var HandleR = 0;
var HandleS = 0;
var tstatio = 0;
// variable du temps(heure temps réels)
var actualprogress = {$FlyingFleetRow.volTime};
var actualprogressR = {$FlyingFleetRow.volTimeR};
indicatorretour.style.visibility="hidden";
indicator.style.visibility="hidden";

if (volTimeA < TimeReel) {
window.onload= function() {

   retour();    

   HandleR = setInterval( retour, temporisation);
};
} else {
window.onload= function() {

   aller();    

   HandleA = setInterval( aller, temporisation);
};
}

function statio()
{
tempsfinal = document.getElementById('Ttraj').value = Ttraj;
tempsstatio = document.getElementById('Testatio').value = Testatio;
indicator.style.visibility="visible";
if(actualprogress > tempsfinal)
{
tstatio = 1;
actualprogress = 0;
}
if(tstatio){
if (tstatio > tempsstatio){
indicator.style.visibility="hidden";
clearInterval(HandleS);
HandleR = setInterval(retour, temporisation);
return;
}
tstatio += 1;
}else{
        indicator_left = actualprogress * distparcourue / tempsfinal;
indicator.style.left = indicator_left + "px"
actualprogress += 1;
}


}

function aller()
{
tempsfinal = document.getElementById('Ttraj').value = Ttraj;
indicator.style.visibility="visible";
if(actualprogress > tempsfinal)
{
actualprogress = 0;
indicator.style.visibility="hidden";
clearInterval(HandleA);
return;
}
indicator_left = actualprogress * distparcourue / tempsfinal;
indicator.style.left = indicator_left + "px";
actualprogress += 1;
}

function aller_retour()
{
tempsfinal = document.getElementById('Ttraj').value = Ttraj;
if(actualprogress > tempsfinal)
{
actualprogress = 0;
clearInterval(HandleA);
HandleR = setInterval(retour, temporisation);
return;
}
indicator.style.visibility="visible";
indicator_left = actualprogress * distparcourue / tempsfinal;
indicator.style.left = indicator_left + "px"; //met à l'échelle le temps à parcourir par rapport à la distance parcourue sur le fond
actualprogress += 1;
}

function retour()
{
tempsfinal = document.getElementById('Ttraj').value = Ttraj;
indicator.style.visibility="hidden";
indicatorretour.style.visibility="visible";
if(actualprogress > tempsfinal){
actualprogress = 0;
indicatorretour.style.visibility="hidden";
clearInterval(HandleR);
return;
}
indicatorretour_left = distparcourue-(actualprogress*distparcourue/tempsfinal);
indicatorretour.style.left= indicatorretour_left  + "px";
actualprogress += 1;
}
</script>
{/foreach}
{* FIN MOUVEMENT DES FLOTTES*}
<script type="text/javascript">
fleetGroopShip = [];
var pointsPrice = { "ship202":0.4,"ship203":1.2,"ship204":0.4,"ship205":1,"ship206":2.6,"ship207":6.5,"ship208":3,"ship209":1.8,"ship210":0.1,"ship211":10,"ship212":0.25,"ship213":12.1,"ship214":920,"ship215":8,"ship216":220,"ship217":6,"ship218":24000,"ship219":102,"ship220":1600,"ship221":92000,"ship222":45800,"ship223":562.5,"ship224":15,"ship225":60.5,"ship226":540,"ship227":5300,"ship228":10700,"ship229":1.05,"ship230":2775,"ship231":3000 };
</script>
</div>
</div>
            <div class="clear"></div>            
        </div>

{/block}
{block name="script" append}<script src="scripts/game/fleetTable.js"></script>{/block}
mardi 7 mars 2017 (Dernière édition mardi 7 mars 2017)

Homer Messages : 1925

Regarde ce qu'il se passe pour la fonction aller-retour

tu as ça : HandleR = setInterval(retour, temporisation);

A la fin de l'aller, tu enclenche le retour.

Si tu met ça à l'aller, alors tu n'a que des aller retour... des fois tu envoie ta flotte uniquement en statio, donc aller simple.

mardi 7 mars 2017

Sc0rpio Messages : 110

Le problème la c'est que tel quel la function aller_retour quand la flotte est en aller quand j'actualise la page c'est ok la flotte repart a l'endroit qu'elle a parcourue mais quand elle est sur le chemin du retour et que j'actualise la page et bien le retour redémarre sans prendre en compte la distance parcourue

mardi 7 mars 2017

Homer Messages : 1925

Après c'est un soucis de variable transmise ça.

J'ai pas vraiment le temps de t'aider plus que ça, mais tu dois faire une erreur quelque part.

mercredi 8 mars 2017

Sc0rpio Messages : 110

Merci Homer tu avait raison c’était un soucis de variable il me manque plus que le foreach pour les flottes et la par contre j'aurais vraiment besoin de toi car je vois pas du tous comment procéder...

mercredi 8 mars 2017

Homer Messages : 1925

Pour avoir cette fonctionnalité sur tout les mouvements de flotte ?

jeudi 9 mars 2017

Page suivante »