Totem38 Messages : 13
|
Alors, j'ai essayé sa ne fait rien de plus si ce n'est me marquer en haut de la page {if count == 0} {/if} {if count == 0} {/if}{if count == 0} {/if} {if count == 0} {/if}{if count == 0} {/if} {if count == 0} {/if}{if count == 0} {/if} {if count == 0} {/if}{if co... ... sur 2 lignes Sinon je te met le fichier buildings_builds.tpl et il n'y a que sa <br /> <div id="content"> {BuildListScript} <table width=530> {BuildList} <tr> <th colspan="3"></th> </tr> {BuildingsList} </table> </div> C'est dingue, en cherchant je suis tombé sur un code pour xnova ou il paraitrait que sa marche sur une des versions et il utilise {tropen} et {trclose} je ne connais pas et je n'arrive pas à trouver de l'info sur le net Le code du fichier buildings_builds_row.tpl est celui-ci {tropen} <a href="infos.php?gid={i}"> <img border="0" src="skins/xnova/gebaeude/{i}.gif" align="top" width="145" height="145"> </a> <div style="padding:5px"> {price}<br> {time} </div>
</th> <td class="2"> <a href="infos.php?gid={tech_id}">{tech_name}</a> {tech_level}<br>{tech_descr}<br> {tech_price} {search_time} {tech_restp} </td> <th class="2"> {tech_link} </th> {trclose}
Par contre sur xnova il mette sa dans le fichier BatimentBuildingPage.php, mais n'existe pas dans XG proyect, donc j'ai essayé de le mettre dans le fichier class.ShowBuildingsPage.php mais en vain. if ($zaehler == 0 || $zaehler % 3 == 0) { $parse['tropen'] = '<tr>'; } else { $parse['tropen'] = ''; } Au cas ou sa pourrait te donner une idée, pourtant sa marche sur xnova revolution , j'essaye d'en décortiquer un pour voir si je trouve un indice |
Homer Messages : 1925
|
Ah, forcément, je me base encore sur xnova révolution, dont la version smarty est plus récente, donc forcément, ça marche pas. Alors, en reprenant ce que tu me donne, ça donne ça. fichier tpl : {tropen} <td class="l"> <a href="game.php?page=infos&gid={i}"> <img border="0" src="{dpath}gebaeude/{i}.gif" align="top" width="120" height="120"> </a> </td> <td class="l"> <a href="game.php?page=infos&gid={i}">{n}</a>{nivel}<br> {descriptions}<br> {price} {time} {rest_price} </td> <td class="k">{click}</td> {trclose} fichier php, remplace la fonction construct par celle-ci : public function __construct (&$CurrentPlanet, $CurrentUser) { global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
include_once($xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx); include_once($xgp_root . 'includes/functions/GetElementPrice.' . $phpEx);
CheckPlanetUsedFields ( $CurrentPlanet );
$parse = $lang; $Allowed['1'] = array( 1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 35, 44, 45); $Allowed['3'] = array( 12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
if (isset($_GET['cmd'])) { $bDoItNow = false; $TheCommand = $_GET['cmd']; $Element = $_GET['building']; $ListID = $_GET['listid'];
if (!in_array( trim($Element), $Allowed[$CurrentPlanet['planet_type']])) { unset($Element); }
if( isset ( $Element )) { if ( !strchr ( $Element, ",") && !strchr ( $Element, " ") && !strchr ( $Element, "+") && !strchr ( $Element, "*") && !strchr ( $Element, "~") && !strchr ( $Element, "=") && !strchr ( $Element, ";") && !strchr ( $Element, "'") && !strchr ( $Element, "#") && !strchr ( $Element, "-") && !strchr ( $Element, "_") && !strchr ( $Element, "[") && !strchr ( $Element, "]") && !strchr ( $Element, ".") && !strchr ( $Element, ":")) { if (in_array( trim($Element), $Allowed[$CurrentPlanet['planet_type']])) { $bDoItNow = true; } } else { header("location:game.php?page=buildings"); } } elseif ( isset ( $ListID )) { $bDoItNow = true; }
if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) { $bDoItNow = false; }
if ( ( $Element == 21 or $Element == 14 or $Element == 15 ) && $CurrentPlanet["b_hangar"] != 0) { $bDoItNow = false; }
if ($bDoItNow == true) { switch($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue ($CurrentPlanet, $CurrentUser); break; case 'remove': $this->RemoveBuildingFromQueue ($CurrentPlanet, $CurrentUser, $ListID); break; case 'insert': $this->AddBuildingToQueue ($CurrentPlanet, $CurrentUser, $Element, true); break; case 'destroy': $this->AddBuildingToQueue ($CurrentPlanet, $CurrentUser, $Element, false); break; } }
if ( $_GET['r'] == 'overview' ) { header('location:game.php?page=overview'); } else { header ("Location: game.php?page=buildings&mode=buildings"); } }
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser); $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser); $this->BuildingSavePlanetRecord($CurrentPlanet);
if ($Queue['lenght'] < (MAX_BUILDING_QUEUE_SIZE)) { $CanBuildElement = true; } else { $CanBuildElement = false; }
$BuildingPage = ""; $Count = 1; $EnCours = 1; $MaxBat = count($lang['tech']); foreach($lang['tech'] as $Element => $ElementName) { if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) { $CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet); if ($CurrentPlanet["field_current"] < ($CurrentMaxFields - $Queue['lenght'])) { $RoomIsOk = true; } else { $RoomIsOk = false; }
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) { $HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, false); $parse = array(); $parse = $lang; $parse['dpath'] = $dpath; $parse['i'] = $Element; $BuildingLevel = $CurrentPlanet[$resource[$Element]]; $parse['nivel'] = ($BuildingLevel == 0) ? "" : " (". $lang['bd_lvl'] . " " . $BuildingLevel .")"; $parse['n'] = $ElementName; $parse['descriptions'] = $lang['res']['descriptions'][$Element]; $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element); $parse['time'] = ShowBuildTime($ElementBuildTime); $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element); $parse['click'] = ''; $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
if ($RoomIsOk && $CanBuildElement) { if ($Queue['lenght'] == 0) { if ($NextBuildLevel == 1) { if ( $HaveRessources == true ) $parse['click'] = "<a href="game.php?page=buildings&cmd=insert&building=". $Element .""><font color=#00FF00>".$lang['bd_build']."</font></a>"; else $parse['click'] = "<font color=#FF0000>".$lang['bd_build']."</font>"; } else { if ( $HaveRessources == true ) $parse['click'] = "<a href="game.php?page=buildings&cmd=insert&building=". $Element .""><font color=#00FF00>". $lang['bd_build_next_level'] . $NextBuildLevel ."</font></a>"; else $parse['click'] = "<font color=#FF0000>". $lang['bd_build_next_level'] . $NextBuildLevel ."</font>"; } } else { $parse['click'] = "<a href="game.php?page=buildings&cmd=insert&building=". $Element .""><font color=#00FF00>".$lang['bd_add_to_list']."</font></a>"; } } elseif ($RoomIsOk && !$CanBuildElement) { if ($NextBuildLevel == 1) $parse['click'] = "<font color=#FF0000>".$lang['bd_build']."</font>"; else $parse['click'] = "<font color=#FF0000>". $lang['bd_build_next_level'] . $NextBuildLevel ."</font>"; } else $parse['click'] = "<font color=#FF0000>".$lang['bd_no_more_fields']."</font>";
if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) { $parse['click'] = "<font color=#FF0000>".$lang['bd_working']."</font>"; }
if ( ( $Element == 21 or $Element == 14 or $Element == 15 ) && $CurrentPlanet["b_hangar"] != 0) { $parse['click'] = "<font color=#FF0000>".$lang['bd_working']."</font>"; } if($Count == 1) $parse['tropen'] = '<tr>'; else $parse['tropen'] = ''; if($Count == 3 || $EnCours == $MaxBat) { $parse['trclose'] = '</tr>'; $Count = 0; } else $parse['trclose'] = ''; $Count++; $EnCours++; $BuildingPage .= parsetemplate(gettemplate('buildings/buildings_builds_row'), $parse);
} } }
if ($Queue['lenght'] > 0) { include($xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx);
$parse['BuildListScript'] = InsertBuildListScript ("buildings"); $parse['BuildList'] = $Queue['buildlist']; } else { $parse['BuildListScript'] = ""; $parse['BuildList'] = ""; }
$parse['BuildingsList'] = $BuildingPage;
display(parsetemplate(gettemplate('buildings/buildings_builds'), $parse)); } |
Totem38 Messages : 13
|
Voilà ce qu'il reste de ton code qui va avec le screen Edit: bien déjà je te remercie grandement pour cet avancé Homer Mais là je vais au dodo, demain matin boulot de bonheur Encore merci Edit du 01/01/2015 heu... je ne voulais pas refaire encore un double post Bonne Année & bonne santé à tous pour 2015 @Homer je te remercie pour avoir pris du temps pour m'aider à résoudre ce problème Du coup, j'ai essayé de trouver pourquoi et comment faire pour que toute la liste de bâtiments puissent tenir par bloc de 3 sur chaque lignes, mais je n'est pas réussit. Je sais que ton code détient la clé pour le faire, je ne sais pas si tu ira jusqu'au bout. Par contre, tu ma fait énormément réfléchir et j'ai réussi, là, ce matin même, du coup je vous laisse le petit tuto, si quelqu'un qui utilise XG Proyect veut mettre ses bâtiments sur 3 colonnes et en plus adaptable suivant la largeur. Exemple, vous pourrez mettre par lignes 3 blocs, 4 blocs... ou comme dans le screen 5 blocs par lignes (testé sur firefox et IE tout est ok). styles/templates/buildings/buildings_builds_row.TPL comme on la vue avant on place dedans le tropen et le trclose {tropen} <tr> <td class="l"> <a href="game.php?page=infos&gid={i}"> <img border="0" src="{dpath}gebaeude/{i}.gif" align="top" width="120" height="120"> </a> </td> <td class="l"> <a href="game.php?page=infos&gid={i}">{n}</a>{nivel}<br> {descriptions}<br> {price} {time} {rest_price} </td> <td class="k">{click}</td> </tr> {trclose} Ensuite, includes/pages/class.ShowBuildingsPage.PHP je l'est mis en entier en début de post, mais préférer travailler sur le votre Chercher $BuildingPage = ""; Rajouter juste en dessous $zaehler = 1; Chercher if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)){ et mettre juste en-dessous if ($zaehler == 0 || $zaehler % 6 == 0) { $parse['tropen'] = '<tr>'; } else { $parse['tropen'] = ''; }
chercher elseif ($RoomIsOk && !$CanBuildElement) et juste après sa elseif ($RoomIsOk && !$CanBuildElement) { if ($NextBuildLevel == 1) $parse['click'] = "<font color=#FF0000>".$lang['bd_build']."</font>"; else $parse['click'] = "<font color=#FF0000>". $lang['bd_build_next_level'] . $NextBuildLevel ."</font>"; } else $parse['click'] = "<font color=#FF0000>".$lang['bd_no_more_fields']."</font>"; mettre sa (remarque, ici le % de if $zaehler est inférieur de 1 par rapport a celui du haut if ($zaehler % 5 == 0) { $parse['trclose'] = '</tr>'; $zaehler++; } else { $parse['trclose'] = ''; $zaehler++; } Donc pour finir, comme dans mon screen le 1er if $zaehler % est 6 et le 2e est 5 = 5 blocs par lignes Si vous mettez 5 dans le 1er if $zaehler % et 4 dans le 2e vous aurez 4 blocs par lignes, etc... vous pourrez suivant la taille de vos blocs et la largeur du jeu adapter le nombre de bloc par ligne. En fait facile non |