This commit is contained in:
parent
df98eb1deb
commit
d20826251e
|
@ -1,91 +0,0 @@
|
|||
'use strict';
|
||||
(function(){
|
||||
var temp;
|
||||
try{
|
||||
temp=JSON.parse(localStorage.getItem('noname_0.9_config'));
|
||||
if(!temp){
|
||||
throw('err');
|
||||
}
|
||||
}
|
||||
catch(err){
|
||||
return;
|
||||
}
|
||||
var bg=document.querySelector('.background');
|
||||
if(bg){
|
||||
bg.style.backgroundSize="cover";
|
||||
}
|
||||
if(temp.image_background&&temp.image_background!='default'&&temp.image_background!='custom'){
|
||||
bg.setBackgroundImage('image/background/'+temp.image_background+'.jpg');
|
||||
|
||||
switch (temp.image_background_filter){
|
||||
case 'blur':
|
||||
bg.style.filter='blur(8px)';
|
||||
bg.style.webkitFilter='blur(8px)';
|
||||
bg.style.transform='scale(1.05)';
|
||||
break;
|
||||
case 'gray':
|
||||
bg.style.filter='grayscale(1)';
|
||||
bg.style.webkitFilter='grayscale(1)';
|
||||
break;
|
||||
case 'sepia':
|
||||
bg.style.filter='sepia(0.5)';
|
||||
bg.style.webkitFilter='sepia(0.5)';
|
||||
break;
|
||||
case 'invert':
|
||||
bg.style.filter='invert(1)';
|
||||
bg.style.webkitFilter='invert(1)';
|
||||
break;
|
||||
case 'saturate':
|
||||
bg.style.filter='saturate(5)';
|
||||
bg.style.webkitFilter='saturate(5)';
|
||||
break;
|
||||
case 'contrast':
|
||||
bg.style.filter='contrast(1.4)';
|
||||
bg.style.webkitFilter='contrast(1.4)';
|
||||
break;
|
||||
case 'hue':
|
||||
bg.style.filter='hue-rotate(180deg)';
|
||||
bg.style.webkitFilter='hue-rotate(180deg)';
|
||||
break;
|
||||
case 'brightness':
|
||||
bg.style.filter='brightness(5)';
|
||||
bg.style.webkitFilter='brightness(5)';
|
||||
break;
|
||||
default:
|
||||
bg.style.webkitFilter='';
|
||||
}
|
||||
}
|
||||
window.resetGameTimeout=setTimeout(function(){
|
||||
if(window.inSplash) return;
|
||||
if(window.resetExtension){
|
||||
if(confirm('游戏似乎未正常载入,是否禁用扩展并重新打开?')){
|
||||
window.resetExtension();
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
|
||||
localStorage.clear();
|
||||
if(indexedDB) indexedDB.deleteDatabase('noname_0.9_data');
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
},5000);
|
||||
var scripts=document.head.querySelectorAll('script');
|
||||
for(var i=0;i<scripts.length;i++){
|
||||
if(scripts[i].src&&scripts[i].src.indexOf('game/game.js')!=-1){
|
||||
if(scripts[i].src.indexOf('ios')!=-1||scripts[i].src.indexOf('android')!=-1){
|
||||
var script=document.createElement('script');
|
||||
script.src='cordova.js';
|
||||
document.body.appendChild(script);
|
||||
document.addEventListener('deviceready',function(){
|
||||
if(window._onDeviceReady){
|
||||
window._onDeviceReady();
|
||||
delete window._onDeviceReady;
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}())
|
145
game/game.js
145
game/game.js
|
@ -1,4 +1,23 @@
|
|||
"use strict";
|
||||
(function(){
|
||||
window.resetGameTimeout=setTimeout(function(){
|
||||
if(window.inSplash) return;
|
||||
if(window.resetExtension){
|
||||
if(confirm('游戏似乎未正常载入,是否禁用扩展并重新打开?')){
|
||||
window.resetExtension();
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
|
||||
localStorage.clear();
|
||||
if(indexedDB) indexedDB.deleteDatabase('noname_0.9_data');
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
},5000);
|
||||
}());
|
||||
|
||||
(function(){
|
||||
var _status={
|
||||
paused:false,
|
||||
|
@ -420,7 +439,7 @@
|
|||
ui.arena.hide();
|
||||
setTimeout(function(){
|
||||
var theme=ui.css.theme;
|
||||
ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style');
|
||||
ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style');
|
||||
theme.remove();
|
||||
setTimeout(function(){ui.arena.show();},100);
|
||||
},500);
|
||||
|
@ -620,7 +639,7 @@
|
|||
onclick:function(layout){
|
||||
game.saveConfig('card_style',layout);
|
||||
var style=ui.css.card_style;
|
||||
ui.css.card_style=lib.init.css('theme/style/card',lib.config.card_style);
|
||||
ui.css.card_style=lib.init.css(lib.assetURL+'theme/style/card',lib.config.card_style);
|
||||
style.remove();
|
||||
},
|
||||
unfrequent:true,
|
||||
|
@ -637,7 +656,7 @@
|
|||
onclick:function(layout){
|
||||
game.saveConfig('cardback_style',layout);
|
||||
var style=ui.css.cardback_style;
|
||||
ui.css.cardback_style=lib.init.css('theme/style/cardback',lib.config.cardback_style);
|
||||
ui.css.cardback_style=lib.init.css(lib.assetURL+'theme/style/cardback',lib.config.cardback_style);
|
||||
style.remove();
|
||||
},
|
||||
unfrequent:true,
|
||||
|
@ -652,7 +671,7 @@
|
|||
onclick:function(layout){
|
||||
game.saveConfig('hp_style',layout);
|
||||
var style=ui.css.hp_style;
|
||||
ui.css.hp_style=lib.init.css('theme/style/hp',lib.config.hp_style);
|
||||
ui.css.hp_style=lib.init.css(lib.assetURL+'theme/style/hp',lib.config.hp_style);
|
||||
style.remove();
|
||||
if(lib.config.layout=='default'&&lib.config.hp_style=='official'){
|
||||
ui.arena.classList.add('hpimage');
|
||||
|
@ -953,7 +972,7 @@
|
|||
onclick:function(bool){
|
||||
game.saveConfig('blur_ui',bool);
|
||||
if(bool){
|
||||
ui.css.blur_ui=lib.init.css('layout/default','blur');
|
||||
ui.css.blur_ui=lib.init.css(lib.assetURL+'layout/default','blur');
|
||||
}
|
||||
else if(ui.css.blur_ui){
|
||||
ui.css.blur_ui.remove();
|
||||
|
@ -2794,6 +2813,12 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
var noname_inited=localStorage.getItem('noname_inited');
|
||||
if(noname_inited){
|
||||
lib.device='android';
|
||||
lib.assetURL=noname_inited;
|
||||
delete lib.assetLoading;
|
||||
}
|
||||
|
||||
lib.config={};
|
||||
var config2;
|
||||
|
@ -2955,30 +2980,30 @@
|
|||
}
|
||||
|
||||
if(localStorage.getItem(lib.configprefix+'playback')){
|
||||
lib.init.js('mode',lib.config.mode);
|
||||
lib.init.js(lib.assetURL+'mode',lib.config.mode);
|
||||
}
|
||||
else if((localStorage.getItem(lib.configprefix+'directstart')||!lib.config.show_splash)&&
|
||||
lib.config.all.mode.indexOf(lib.config.mode)!=-1){
|
||||
lib.init.js('mode',lib.config.mode);
|
||||
lib.init.js(lib.assetURL+'mode',lib.config.mode);
|
||||
}
|
||||
lib.init.js('card',lib.config.all.cards);
|
||||
lib.init.js('character',lib.config.all.characters);
|
||||
lib.init.js('play',lib.config.plays);
|
||||
lib.init.js('character','rank');
|
||||
lib.init.js(lib.assetURL+'card',lib.config.all.cards);
|
||||
lib.init.js(lib.assetURL+'character',lib.config.all.characters);
|
||||
lib.init.js(lib.assetURL+'play',lib.config.plays);
|
||||
lib.init.js(lib.assetURL+'character','rank');
|
||||
ui.css={};
|
||||
lib.init.css('layout/default','menu');
|
||||
lib.init.css(lib.assetURL+'layout/default','menu');
|
||||
var layout=lib.config.layout;
|
||||
if(lib.config.layoutfixed.indexOf(lib.config.mode)!==-1){
|
||||
if(layout=='default'){
|
||||
layout='mobile';
|
||||
}
|
||||
}
|
||||
ui.css.layout=lib.init.css('layout/'+layout,'layout');
|
||||
if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css('layout/default','blur');
|
||||
ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style');
|
||||
ui.css.card_style=lib.init.css('theme/style/card',lib.config.card_style);
|
||||
ui.css.cardback_style=lib.init.css('theme/style/cardback',lib.config.cardback_style);
|
||||
ui.css.hp_style=lib.init.css('theme/style/hp',lib.config.hp_style);
|
||||
ui.css.layout=lib.init.css(lib.assetURL+'layout/'+layout,'layout');
|
||||
if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css(lib.assetURL+'layout/default','blur');
|
||||
ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style');
|
||||
ui.css.card_style=lib.init.css(lib.assetURL+'theme/style/card',lib.config.card_style);
|
||||
ui.css.cardback_style=lib.init.css(lib.assetURL+'theme/style/cardback',lib.config.cardback_style);
|
||||
ui.css.hp_style=lib.init.css(lib.assetURL+'theme/style/hp',lib.config.hp_style);
|
||||
|
||||
lib.config.duration=500;
|
||||
|
||||
|
@ -3111,7 +3136,7 @@
|
|||
});
|
||||
|
||||
if(lib.device){
|
||||
window._onDeviceReady=function(){
|
||||
lib.init.cordovaReady=function(){
|
||||
if(lib.device=='android'){
|
||||
document.addEventListener("pause", function(){
|
||||
if(!_status.paused2&&!_status.event.isMine()){
|
||||
|
@ -3222,7 +3247,7 @@
|
|||
ui.arena.hide();
|
||||
setTimeout(function(){
|
||||
var layout=ui.css.layout;
|
||||
ui.css.layout=lib.init.css('layout/'+lib.config.layout,'layout',layout);
|
||||
ui.css.layout=lib.init.css(lib.assetURL+'layout/'+lib.config.layout,'layout',layout);
|
||||
if(lib.config.layout=='mobile'||lib.config.layout=='phone'){
|
||||
ui.arena.classList.add('mobile');
|
||||
if(game.me&&game.me.node.handcards2.childNodes.length){
|
||||
|
@ -9999,7 +10024,7 @@
|
|||
zip.file('pack.js','game.import("character",'+lib.init.stringify(character)+')');
|
||||
}
|
||||
if(!window.JSZip){
|
||||
lib.init.js('game','jszip',zipReady);
|
||||
lib.init.js(lib.assetURL+'game','jszip',zipReady);
|
||||
}
|
||||
else{
|
||||
zipReady();
|
||||
|
@ -10125,7 +10150,7 @@
|
|||
else{
|
||||
event.playtoload++;
|
||||
}
|
||||
var script=lib.init.js('play',content.name);
|
||||
var script=lib.init.js(lib.assetURL+'play',content.name);
|
||||
script.addEventListener('load',function(){
|
||||
var play=window.play[content.name]
|
||||
if(play&&play.video){
|
||||
|
@ -12864,7 +12889,7 @@
|
|||
next.content=function(){
|
||||
'step 0'
|
||||
window.mode={};
|
||||
lib.init.js('mode',event.mode,game.resume);
|
||||
lib.init.js(lib.assetURL+'mode',event.mode,game.resume);
|
||||
game.pause();
|
||||
'step 1'
|
||||
event.result=window.mode[event.mode];
|
||||
|
@ -12885,7 +12910,7 @@
|
|||
window.character={};
|
||||
window.card={};
|
||||
var pack=event.packages.shift().split('/');
|
||||
lib.init.js(pack[0],pack[1],game.resume);
|
||||
lib.init.js(lib.assetURL+pack[0],pack[1],game.resume);
|
||||
game.pause();
|
||||
}
|
||||
else{
|
||||
|
@ -15172,7 +15197,7 @@
|
|||
fileReader.readAsArrayBuffer(fileToLoad, "UTF-8");
|
||||
}
|
||||
if(!window.JSZip){
|
||||
lib.init.js('game','jszip',zipReady);
|
||||
lib.init.js(lib.assetURL+'game','jszip',zipReady);
|
||||
}
|
||||
else{
|
||||
zipReady();
|
||||
|
@ -15909,7 +15934,7 @@
|
|||
fileReader.readAsArrayBuffer(fileToLoad, "UTF-8");
|
||||
}
|
||||
if(!window.JSZip){
|
||||
lib.init.js('game','jszip',zipReady);
|
||||
lib.init.js(lib.assetURL+'game','jszip',zipReady);
|
||||
}
|
||||
else{
|
||||
zipReady();
|
||||
|
@ -17502,7 +17527,6 @@
|
|||
game.checkForUpdate(false);
|
||||
},3000);
|
||||
}
|
||||
|
||||
clearTimeout(window.resetGameTimeout);
|
||||
delete window.resetGameTimeout;
|
||||
delete window.resetExtension;
|
||||
|
@ -19947,7 +19971,7 @@
|
|||
ui.arena.hide();
|
||||
setTimeout(function(){
|
||||
var theme=ui.css.theme;
|
||||
ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style');
|
||||
ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style');
|
||||
theme.remove();
|
||||
setTimeout(function(){ui.arena.show();},100);
|
||||
},500);
|
||||
|
@ -19958,7 +19982,7 @@
|
|||
ui.arena.hide();
|
||||
setTimeout(function(){
|
||||
var layout=ui.css.layout;
|
||||
ui.css.layout=lib.init.css('layout/'+lib.config.layout,'layout',layout);
|
||||
ui.css.layout=lib.init.css(lib.assetURL+'layout/'+lib.config.layout,'layout',layout);
|
||||
|
||||
setTimeout(function(){layout.remove();ui.arena.show();},100);
|
||||
},500);
|
||||
|
@ -20121,7 +20145,7 @@
|
|||
game.saveConfig('show_scrollbar',bool);
|
||||
if(lib.config.touchscreen) return;
|
||||
if(bool){
|
||||
ui.css.scrollbar=lib.init.css('layout/default','scrollbar');
|
||||
ui.css.scrollbar=lib.init.css(lib.assetURL+'layout/default','scrollbar');
|
||||
}
|
||||
else{
|
||||
ui.css.scrollbar.remove();
|
||||
|
@ -20141,7 +20165,7 @@
|
|||
blur_ui:function(bool){
|
||||
game.saveConfig('blur_ui',bool);
|
||||
if(bool){
|
||||
ui.css.blur_ui=lib.init.css('layout/default','blur');
|
||||
ui.css.blur_ui=lib.init.css(lib.assetURL+'layout/default','blur');
|
||||
}
|
||||
else if(ui.css.blur_ui){
|
||||
ui.css.blur_ui.remove();
|
||||
|
@ -22926,6 +22950,61 @@
|
|||
}
|
||||
};
|
||||
window.onload=function(){
|
||||
if(lib.device){
|
||||
var script=document.createElement('script');
|
||||
script.src='cordova.js';
|
||||
document.body.appendChild(script);
|
||||
document.addEventListener('deviceready',function(){
|
||||
if(lib.init.cordovaReady){
|
||||
lib.init.cordovaReady();
|
||||
delete lib.init.cordovaReady;
|
||||
}
|
||||
});
|
||||
}
|
||||
ui.background=ui.create.div('.background');
|
||||
ui.background.style.backgroundSize="cover";
|
||||
if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background!='custom'){
|
||||
ui.background.setBackgroundImage('image/background/'+lib.config.image_background+'.jpg');
|
||||
switch (lib.config.image_background_filter){
|
||||
case 'blur':
|
||||
ui.background.style.filter='blur(8px)';
|
||||
ui.background.style.webkitFilter='blur(8px)';
|
||||
ui.background.style.transform='scale(1.05)';
|
||||
break;
|
||||
case 'gray':
|
||||
ui.background.style.filter='grayscale(1)';
|
||||
ui.background.style.webkitFilter='grayscale(1)';
|
||||
break;
|
||||
case 'sepia':
|
||||
ui.background.style.filter='sepia(0.5)';
|
||||
ui.background.style.webkitFilter='sepia(0.5)';
|
||||
break;
|
||||
case 'invert':
|
||||
ui.background.style.filter='invert(1)';
|
||||
ui.background.style.webkitFilter='invert(1)';
|
||||
break;
|
||||
case 'saturate':
|
||||
ui.background.style.filter='saturate(5)';
|
||||
ui.background.style.webkitFilter='saturate(5)';
|
||||
break;
|
||||
case 'contrast':
|
||||
ui.background.style.filter='contrast(1.4)';
|
||||
ui.background.style.webkitFilter='contrast(1.4)';
|
||||
break;
|
||||
case 'hue':
|
||||
ui.background.style.filter='hue-rotate(180deg)';
|
||||
ui.background.style.webkitFilter='hue-rotate(180deg)';
|
||||
break;
|
||||
case 'brightness':
|
||||
ui.background.style.filter='brightness(5)';
|
||||
ui.background.style.webkitFilter='brightness(5)';
|
||||
break;
|
||||
default:
|
||||
ui.background.style.webkitFilter='';
|
||||
}
|
||||
}
|
||||
document.body.insertBefore(ui.background,document.body.firstChild);
|
||||
|
||||
document.body.onresize=ui.updatex;
|
||||
if(lib.config.touchscreen){
|
||||
document.body.addEventListener('touchstart',function(e){
|
||||
|
@ -22941,8 +23020,6 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
ui.background=document.querySelector('.background.static');
|
||||
ui.background.classList.remove('static');
|
||||
|
||||
lib.onDB(function(){
|
||||
if(lib.config.image_background=='custom'){
|
||||
|
@ -23282,7 +23359,7 @@
|
|||
game.saveConfig('mode',this.link);
|
||||
splash.delete();
|
||||
delete window.inSplash;
|
||||
var scriptnode=lib.init.js('mode',lib.config.mode);
|
||||
var scriptnode=lib.init.js(lib.assetURL+'mode',lib.config.mode);
|
||||
if(scriptnode){
|
||||
scriptnode.onload=proceed;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ window.noname_source_list=[
|
|||
'character/yxs.js',
|
||||
'character/zhuogui.js',
|
||||
'game/asset.js',
|
||||
'game/background.js',
|
||||
'game/config.js',
|
||||
'game/game.js',
|
||||
'game/jszip.js',
|
||||
|
@ -93,5 +92,4 @@ window.noname_source_list=[
|
|||
'theme/style/hp/image/hp2.png',
|
||||
'theme/style/hp/image/hp3.png',
|
||||
'theme/style/hp/image/hp4.png',
|
||||
'index.html'
|
||||
];
|
||||
|
|
|
@ -7,5 +7,3 @@
|
|||
<script src="game/config.js"></script>
|
||||
<script src="game/package.js"></script>
|
||||
<script src="game/game.js"></script>
|
||||
<div class='background static'></div>
|
||||
<script src="game/background.js"></script>
|
||||
|
|
|
@ -5,6 +5,7 @@ html{width: 100%;height: 100%;font-size: 16px;cursor: default;overflow: hidden;
|
|||
-webkit-user-select:none;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
-webkit-tap-highlight-color:rgba(0,0,0,0);
|
||||
background-color: rgb(60,60,60);
|
||||
}
|
||||
body{
|
||||
width: 100%;height: 100%;padding: 0; margin: 0;
|
||||
|
|
|
@ -34,7 +34,7 @@ mode.boss={
|
|||
}
|
||||
}
|
||||
}
|
||||
lib.init.css('layout/mode','boss');
|
||||
lib.init.css(lib.assetURL+'layout/mode','boss');
|
||||
game.delay(0.1);
|
||||
"step 2"
|
||||
var bosslist=ui.create.div('#bosslist.hidden');
|
||||
|
|
|
@ -17,7 +17,7 @@ mode.chess={
|
|||
}
|
||||
}
|
||||
}
|
||||
lib.init.css('layout/mode','chess');
|
||||
lib.init.css(lib.assetURL+'layout/mode','chess');
|
||||
ui.chesssheet=document.createElement('style');
|
||||
document.head.appendChild(ui.chesssheet);
|
||||
var playback=localStorage.getItem(lib.configprefix+'playback');
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
mode.stone={
|
||||
start:function(){
|
||||
"step 0"
|
||||
lib.init.css('layout/mode/','stone');
|
||||
lib.init.css(lib.assetURL+'layout/mode/','stone');
|
||||
_status.mode=get.config('stone_mode');
|
||||
game.initStone();
|
||||
var playback=localStorage.getItem(lib.configprefix+'playback');
|
||||
|
|
Loading…
Reference in New Issue