Принцип работы
Игрок прописывает STEAM ID у себя в профиле, после чего GameCMS API, по указанному STEAM ID видит профиль игрока, и вписывает отыгранное время в таблицу users, данному аккаунту. Время записывается в секундах, в столбец game_time.
Скрипт разбирает секунды в месяца, недели, дни, часы, минуты, секунды. И выводит их, в один из слайдеров. С отсевом нулевых значений.
Так же он понимает: гостя, STEAM ID не указан, игрок еще не играл (после указания steam id).
Если игрок сменит STEAM ID, данные о времени, останутся, и будут считаться дальше.
Меняем его содержимое, на ...
Проверяем!
Добавляем стиль CSS
Заходим в Админ центр сайта, переходим в Редактор шаблонов в окне Стили шаблона standart, открываем файл mystyles.css.
Добавляем туда скрипт.
Сохраняем.
Игрок прописывает STEAM ID у себя в профиле, после чего GameCMS API, по указанному STEAM ID видит профиль игрока, и вписывает отыгранное время в таблицу users, данному аккаунту. Время записывается в секундах, в столбец game_time.
Скрипт разбирает секунды в месяца, недели, дни, часы, минуты, секунды. И выводит их, в один из слайдеров. С отсевом нулевых значений.
Так же он понимает: гостя, STEAM ID не указан, игрок еще не играл (после указания steam id).
Если игрок сменит STEAM ID, данные о времени, останутся, и будут считаться дальше.
Инструкция
Разрешить вписывать STEAM ID в формате VALVE..
Заходим в через FTP клиент к своим файлам, по пути /www/igra-hp.com/inc/classes. Находим файл class.steamidoperations.phpРазрешить вписывать STEAM ID в формате VALVE..
Меняем его содержимое, на ...
PHP:
<?php
class SteamIDOperations {
private function SteamID32to3($steamid32) {
if (preg_match('/^STEAM_1\:*\:(.*)$/', $steamid32, $res)) {
$st = '[U:1:';
$st .= $res[1] * 2 + 1;
$st .= ']';
return $st;
}
return false;
}
private function SteamID3to32($steamid3) {
if (preg_match("/\[U:1:(\d+)\]/", $steam3)) {
$steam3 = preg_replace("/\[U:1:(\d+)\]/", "$1", $steamid3);
$A = $steam3 % 2;
$B = intval($steam3 / 2);
return "STEAM_1:" . $A . ":" . $B;
}
return false;
}
private function SteamID32to64($steamid32) {
if (preg_match('/^STEAM_1\:*\:(.*)$/', $steamid32, $res)) {
list(, $m1, $m2) = explode(':', $steamid32, 3);
list($steam_cid,) = explode('.', bcadd((((int)$m2 * 2) + $m1), '76561197960265728'), 2);
return $steam_cid;
}
return false;
}
private function SteamID64to32($steamid64) {
$pattern = "/^(7656119)([0-9]{10})$/";
if (preg_match($pattern, $steamid64, $match)) {
$const1 = 7960265728;
$const2 = "STEAM_1:";
$steam32 = '';
if ($const1 <= $match[2]) {
$a = ($match[2] - $const1) % 2;
$b = ($match[2] - $const1 - $a) / 2;
$steam32 = $const2 . $a . ':' . $b;
}
return $steam32;
}
return false;
}
public function is3($steamid) {
if (preg_match("/^(\[U:1:[0-9]+\])$/", $steamid)) {
return true;
} else {
return false;
}
}
public function is32($steamid) {
if (preg_match("/^(STEAM_[0-5]:[01]:\d+|VALVE_[0-9]:[0-1]:\d+)$/", $steamid)) {
return true;
} else {
return false;
}
}
public function is64($steamid) {
if (preg_match("/^([0-9]{17})$/", $steamid)) {
return true;
} else {
return false;
}
}
public function ValidateSteamID($steamid) {
if (preg_match("/^(STEAM_[0-5]:[01]:\d+|VALVE_[0-9]:[0-1]:\d+|\[U:1:[0-9]+\]|[0-9]{17})$/", $steamid)) {
return true;
} else {
return false;
}
}
public function GetSteamID32($steamid) {
if(!$this->ValidateSteamID($steamid)) {
return false;
}
if($this->is3($steamid)) {
return $this->SteamID3to32($steamid);
}
if($this->is64($steamid)) {
return $this->SteamID64to32($steamid);
}
if($this->is32($steamid)) {
return $steamid;
}
return false;
}
}
Добавляем стиль CSS
Добавляем туда скрипт.
CSS:
html {
height: 100%;
font: 62.5%/1 "Lucida Sans Unicode","Lucida Grande",Verdana,Arial,Helvetica,sans-serif;
}
.time_slaid {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#wrapper_zvez {
text-align: center;
color: #000;
font-weight: bold;
font-size: 2em;
}
span_3d {
text-shadow: -0.06em 0 red, 0.06em 0 cyan;
letter-spacing: 0.08em;
}
p {
margin: 0;
}
#stars span_3d {
display: inline-block;
transform: scale(1);
transition: transform 2s cubic-bezier(0, 1, 0, 1);
}
#stars span_3d:hover {
cursor: crosshair;
transform: scale(1.3);
transition: transform .2s cubic-bezier(0, 0.75, 0, 1);
}
#stars span_3d:active {
text-shadow: none;
}
#stars span_3d:nth-child(1), #stars span_3d:nth-child(5) { font-size: 0.9em; animation-delay: 0.2s; }
#stars span_3d:nth-child(2), #stars span_3d:nth-child(4) { font-size: 1.5em; animation-delay: 0.1s; }
#stars span_3d:nth-child(3) { font-size: 2.4em; animation-delay: 0s; }
#stars span_3d { animation: stars-animation 3s 50 ease-in-out; }
@-webkit-keyframes stars-animation {
0% { transform: scale(1); }
90% { transform: scale(1); }
95% { transform: scale(1.3); }
100% { transform: scale(1); }
}
#stars:hover span_3d {
animation: none;
}
#title {
font-family: Helvetica, Geneva, sans-serif;
}
#title:focus {
outline: none;
}
#title span_3d {
vertical-align: middle;
line-height: 3.5em;
transition: font-size 2s cubic-bezier(0, 1, 0, 1);
}
#title span_3d:hover {
font-size: 1.2em;
line-height: 1em;
transition: font-size .2s cubic-bezier(0, 0.75, 0, 1);
}
#title span_3d:active {
font-size: 2em;
text-shadow: none;
}
#title span_3d::selection {
background-color: red;
}
#slogan { font-size: 1.25em; }
#slogan span_3d:active { text-shadow: none; }
#meta {
color: #777;
font-size: 0.7em;
line-height: 1.6em;
text-align: center;
text-shadow: rgba(255,255,255,0.5) 0 1px 0;
margin: 30px;
}
#meta strong { font-weight: bold; color: #000; }
#meta p:first-child { margin-bottom: 20px; }
#meta a { text-decoration: none; color: #7276ff; }
#meta a:hover { color: rgba(114,118,255,0.5); }
Продолжение в нижнем сообщении