From 5564f9433d99dc6138cc5dce219bddf7bfa296e6 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Fri, 14 Jan 2022 20:14:10 +0100 Subject: [PATCH] test --- core/classes/Item.php | 21 ++++++++------- pages/assets/css/bloc.css | 10 +++---- pages/client/shops.php | 56 +++++++++++++++++++++++++++++++++------ 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/core/classes/Item.php b/core/classes/Item.php index 97a60894..76a6399b 100644 --- a/core/classes/Item.php +++ b/core/classes/Item.php @@ -39,22 +39,25 @@ public function getType(){ public function getId(){ return $this->id; } - public function getTexture(){ - $texture = array(); + public function getRepresentation(){ + $return["texture"] = array(); if(file_exists("data/images/textures/block/".$this->id.".png")){ - $texture[0] = "data/images/textures/block/".$this->id.".png"; + $return["type"] = "block"; + $return["texture"][0] = "data/images/textures/block/".$this->id.".png"; if(file_exists("data/images/textures/block/".$this->id."_top.png")){ - $texture[1] = "data/images/textures/block/".$this->id."_top.png"; + $return["texture"][1] = "data/images/textures/block/".$this->id."_top.png"; } }elseif(file_exists("data/images/textures/item/".$this->id.".png")){ - $texture[0] = "data/images/textures/item/".$this->id.".png"; + $return["type"] = "item"; + $return["texture"][0] = "data/images/textures/item/".$this->id.".png"; }else{ - $texture[0] = "data/images/textures/missing.png"; + $return["type"] = "unknown"; + $return["texture"][0] = "data/images/textures/missing.png"; } - if(!isset($texture[1])){ - $texture[1] = $texture[0]; + if(!isset($return["texture"][1])){ + $return["texture"][1] = $return["texture"][0]; } - return $texture; + return $return["texture"]; } } \ No newline at end of file diff --git a/pages/assets/css/bloc.css b/pages/assets/css/bloc.css index e01e1e81..37474c02 100644 --- a/pages/assets/css/bloc.css +++ b/pages/assets/css/bloc.css @@ -86,11 +86,11 @@ .object { transform-origin: bottom center; } .block > div:nth-child(5) { - -webkit-transform: rotateY(272deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); - -moz-transform: rotateY(272deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); - -ms-transform: rotateY(272deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); - -o-transform: rotateY(272deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); - transform: rotateY(272deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); + -webkit-transform: rotateY(270deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); + -moz-transform: rotateY(270deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); + -ms-transform: rotateY(270deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); + -o-transform: rotateY(270deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); + transform: rotateY(270deg) rotateZ(90deg) rotateX(0) translate3d(-30px, 30px, -1px); -webkit-transform-origin: center left; -moz-transform-origin: center left; -ms-transform-origin: center left; diff --git a/pages/client/shops.php b/pages/client/shops.php index c2561b9c..adf43ecc 100644 --- a/pages/client/shops.php +++ b/pages/client/shops.php @@ -59,19 +59,20 @@ <?php $shops = Shop::getShops(); foreach($shops as $shop){ - $texture = $shop['item']->getTexture(); - echo ('<div class="col-sm"> + $representation = $shop['item']->getRepresentation(); + if($representation["type"] == "item"){ + echo ('<div class="col-sm"> <div class="card" style="width: 18rem;"> <div class="card-body"> <div class="card-top"> <div class="object"> <div class="block grass"> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[1].'\');"><!--top --></div> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[1].'\');"><!--bottom--></div> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[0].'\');"><!--left--></div> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[0].'\');"><!--right--></div> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[0].'\');"><!--back--></div> - <div style="background: url(\''.getWebsiteSetting("websiteUrl").$texture[0].'\');"><!--front--></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][1].'\');"><!--top --></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][1].'\');"><!--bottom--></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][0].'\');"><!--left--></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][0].'\');"><!--right--></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][0].'\');"><!--back--></div> + <div style="background: url(\''.getWebsiteSetting("websiteUrl").$representation["texture"][0].'\');"><!--front--></div> </div> </div> </div> @@ -84,8 +85,27 @@ </div> </div> </div>'); + }else{ + echo ('<div class="col-sm"> + <div class="card" style="width: 18rem;"> + <div class="card-body"> + <div class="card-top"> + <img src="'.getWebsiteSetting("websiteUrl").$representation["texture"][0].'" alt="'.$shop['item']->getLabel().'"> + </div> + + <h5 class="card-title">'.$shop['item']->getLabel().'</h5> + <p class="card-text">Test content</p> + <div class="mc-button normal"> + <div class="title">Se téléporter</div> + </div> + </div> + </div> + </div>'); + } + } ?> + <!-- exemple --> <div class="col-sm"> <div class="card" style="width: 18rem;"> <div class="card-body"> @@ -110,6 +130,26 @@ </div> </div> </div> + <!-- exemple --> + + <!-- exemple --> + <div class="col-sm"> + <div class="card" style="width: 18rem;"> + <div class="card-body"> + <div class="card-top"> + <img src="<?=getWebsiteSetting("websiteUrl")?>data/images/textures/item/copper_ingot.png" alt="Item"> + </div> + + <h5 class="card-title">Card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + <div class="mc-button normal"> + <div class="title">Se téléporter</div> + </div> + </div> + </div> + </div> + <!-- exemple --> + </div> </div> </div> -- GitLab