[mod]
This commit is contained in:
132
preview-templates/catan/boot.js
Normal file
132
preview-templates/catan/boot.js
Normal file
@@ -0,0 +1,132 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
var splash = document.getElementById('splash');
|
||||
var progressBar = splash.querySelector('.progress-bar span');
|
||||
splash.style.display = 'block';
|
||||
progressBar.style.width = '0%';
|
||||
|
||||
function expoOut(t, b, c, d) {
|
||||
return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
||||
}
|
||||
var canvas = document.getElementById('GameCanvas');
|
||||
window.onload = function () {
|
||||
if (window.__quick_compile_engine__) {
|
||||
window.__quick_compile_engine__.load(onload);
|
||||
} else {
|
||||
onload();
|
||||
}
|
||||
};
|
||||
|
||||
function onload() {
|
||||
|
||||
// socket
|
||||
// =======================
|
||||
|
||||
// Receives a refresh event from the editor, which triggers the reload of the page
|
||||
var socket = window.io();
|
||||
socket.on('browser:reload', function () {
|
||||
window.location.reload();
|
||||
});
|
||||
socket.on('browser:confirm-reload', function () {
|
||||
var r = confirm('Reload?');
|
||||
if (r) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
// init engine
|
||||
// =======================
|
||||
|
||||
var engineInited = false;
|
||||
|
||||
|
||||
var onStart = function () {
|
||||
cc.view.enableRetina(true);
|
||||
cc.view.resizeWithBrowserSize(true);
|
||||
cc.director.once("EVENT_AFTER_SCENE_READY", function () {
|
||||
splash.style.display = 'none';
|
||||
});
|
||||
cc.game.pause();
|
||||
|
||||
// init assets
|
||||
engineInited = true;
|
||||
|
||||
cc.assetManager.loadAny({
|
||||
url: 'preview-scene.json',
|
||||
__isNative__: false
|
||||
}, null, function (finish, totalCount) {
|
||||
var percent = expoOut(finish, 0, 100, totalCount) / 2;
|
||||
if (progressBar) {
|
||||
progressBar.style.width = percent.toFixed(2) + '%';
|
||||
}
|
||||
}, function (err, sceneAsset) {
|
||||
if (err) {
|
||||
console.error(err.message, err.stack);
|
||||
return;
|
||||
}
|
||||
var scene = sceneAsset.scene;
|
||||
scene._name = sceneAsset._name;
|
||||
cc.assetManager.dependUtil._depends.add(scene._id, cc.assetManager.dependUtil._depends.get('preview-scene.json'));
|
||||
cc.director.runSceneImmediate(scene, function () {
|
||||
// play game
|
||||
cc.game.resume();
|
||||
console.log(scene._name.substring(0,4))
|
||||
if(scene._name!="Demo" && scene._name.substring(0,4)!="Slot"){
|
||||
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
|
||||
cc.director.emit('EVENT_AFTER_SCENE_READY');
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// purge
|
||||
//noinspection JSUnresolvedVariable
|
||||
_CCSettings = undefined;
|
||||
};
|
||||
|
||||
var option = {
|
||||
id: canvas,
|
||||
debugMode: _CCSettings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
|
||||
showFPS: _CCSettings.debug,
|
||||
frameRate: 60,
|
||||
groupList: _CCSettings.groupList,
|
||||
collisionMatrix: _CCSettings.collisionMatrix,
|
||||
};
|
||||
|
||||
cc.assetManager.init({
|
||||
importBase: 'assets/others/import',
|
||||
nativeBase: 'assets/others/native'
|
||||
});
|
||||
|
||||
let {
|
||||
RESOURCES,
|
||||
INTERNAL,
|
||||
MAIN
|
||||
} = cc.AssetManager.BuiltinBundleName;
|
||||
var bundleRoot = [INTERNAL];
|
||||
_CCSettings.hasResourcesBundle && bundleRoot.push(RESOURCES);
|
||||
|
||||
var count = 0;
|
||||
|
||||
function cb(err) {
|
||||
if (err) return console.error(err);
|
||||
count++;
|
||||
if (count === bundleRoot.length + 1) {
|
||||
cc.assetManager.loadBundle(MAIN, function (err) {
|
||||
if (!err) cc.game.run(option, onStart);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// load plugins
|
||||
cc.assetManager.loadScript(_CCSettings.jsList.map(function (x) {
|
||||
return '/plugins/' + x;
|
||||
}), cb);
|
||||
|
||||
// load bundles
|
||||
for (let i = 0; i < bundleRoot.length; i++) {
|
||||
cc.assetManager.loadBundle('assets/' + bundleRoot[i], cb);
|
||||
}
|
||||
}
|
||||
})();
|
124
preview-templates/catan/style-mobile.css
Normal file
124
preview-templates/catan/style-mobile.css
Normal file
@@ -0,0 +1,124 @@
|
||||
html {
|
||||
-ms-touch-action: none;
|
||||
}
|
||||
|
||||
body, canvas, div {
|
||||
display: block;
|
||||
outline: none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* Remove spin of input type number */
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
/* display: none; <- Crashes Chrome on hover */
|
||||
-webkit-appearance: none;
|
||||
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
|
||||
}
|
||||
|
||||
body {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
|
||||
cursor: default;
|
||||
color: #888;
|
||||
background-color: #000;
|
||||
|
||||
text-align: center;
|
||||
font-family: Helvetica, Verdana, Arial, sans-serif;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
|
||||
/* overflow cannot be applied in Cocos2dGameContainer,
|
||||
otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#Cocos2dGameContainer {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-align: center;
|
||||
-webkit-box-pack: center;
|
||||
}
|
||||
|
||||
canvas {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
p.header {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
p.footer {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
#splash {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
background-size: 45%;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
position: absolute;
|
||||
left: 27.5%;
|
||||
top: 80%;
|
||||
height: 3px;
|
||||
padding: 2px;
|
||||
width: 45%;
|
||||
border-radius: 7px;
|
||||
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
|
||||
}
|
||||
|
||||
.progress-bar span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: 3px;
|
||||
transition: width .4s ease-in-out;
|
||||
background-color: #3dc5de;
|
||||
}
|
||||
|
||||
.stripes span {
|
||||
background-size: 30px 30px;
|
||||
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
|
||||
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
|
||||
transparent 75%, transparent);
|
||||
|
||||
animation: animate-stripes 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes animate-stripes {
|
||||
0% {background-position: 0 0;} 100% {background-position: 60px 0;}
|
||||
}
|
215
preview-templates/catan/style.css
Normal file
215
preview-templates/catan/style.css
Normal file
@@ -0,0 +1,215 @@
|
||||
html,
|
||||
body,
|
||||
form {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
#background-img {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
top: 0;
|
||||
bottom: -10%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#Cocos2dGameContainer {
|
||||
margin: 0 auto;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
z-index: 990;
|
||||
}
|
||||
|
||||
.closeBtn {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/historyBtn.png);
|
||||
z-index: 1100;
|
||||
top: 80%;
|
||||
left: 90%;
|
||||
position: fixed;
|
||||
overflow: unset;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
-webkit-appearance: none;
|
||||
background-position: center;
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
visibility: visible;
|
||||
border-width: 0;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
background-color: #1a1a1a;
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
top: 68%;
|
||||
height: 15px;
|
||||
padding: 5px;
|
||||
width: 50%;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
|
||||
}
|
||||
|
||||
/**LOGO*/
|
||||
#splash.L.default_1 {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_1.png);
|
||||
}
|
||||
#splash.L.default {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_en.jpg);
|
||||
}
|
||||
|
||||
#splash.L.zh-ch {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-ch.jpg);
|
||||
}
|
||||
|
||||
#splash.L.zh-tw {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-tw.jpg);
|
||||
}
|
||||
|
||||
/**新增語系圖請加在POS前*/
|
||||
#splash.L.pos {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 50%;
|
||||
background-position-y: 30%;
|
||||
z-index: 998;
|
||||
}
|
||||
|
||||
/**手機選轉螢幕動畫*/
|
||||
#ScreenRotation {
|
||||
margin: 0 auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**直轉橫*/
|
||||
#ScreenRotation.PtoL.default {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_en.gif);
|
||||
}
|
||||
|
||||
#ScreenRotation.PtoL.zh-ch {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-ch.gif);
|
||||
}
|
||||
|
||||
#ScreenRotation.PtoL.zh-tw {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-tw.gif);
|
||||
}
|
||||
|
||||
/**新增語系圖請加在POS前*/
|
||||
#ScreenRotation.PtoL.pos {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 80%;
|
||||
}
|
||||
|
||||
/**橫轉直*/
|
||||
#ScreenRotation.LtoP.default {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_en.gif);
|
||||
}
|
||||
|
||||
#ScreenRotation.LtoP.zh-ch {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-ch.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 25%;
|
||||
}
|
||||
|
||||
#ScreenRotation.LtoP.zh-tw {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-tw.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 25%;
|
||||
}
|
||||
|
||||
/**新增語系圖請加在POS前*/
|
||||
#ScreenRotation.LtoP.pos {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 25%;
|
||||
}
|
||||
|
||||
/**手機點擊螢幕動畫*/
|
||||
#FullScreenClick {
|
||||
margin: 0 auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#FullScreenClick.default {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_en.gif);
|
||||
}
|
||||
|
||||
#FullScreenClick.zh-ch {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-ch.gif);
|
||||
}
|
||||
|
||||
#FullScreenClick.zh-tw {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-tw.gif);
|
||||
}
|
||||
|
||||
/**新增語系圖請加在POS前*/
|
||||
#FullScreenClick.pos {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 20%;
|
||||
}
|
||||
|
||||
/**手機上滑全螢幕動畫*/
|
||||
#FullScreenSwipe.default {
|
||||
margin: 0 auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_en.gif);
|
||||
}
|
||||
|
||||
#FullScreenSwipe.zh-ch {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-ch.gif);
|
||||
}
|
||||
|
||||
#FullScreenSwipe.zh-tw {
|
||||
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-tw.gif);
|
||||
}
|
||||
|
||||
/**新增語系圖請加在POS前*/
|
||||
#FullScreenSwipe.pos {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: #000;
|
||||
background-size: 20%;
|
||||
}
|
Reference in New Issue
Block a user