From e8e21c3e395cfddd28302f35edf7a0f72fc70daa Mon Sep 17 00:00:00 2001 From: libccy Date: Sun, 19 Mar 2017 02:37:26 +0800 Subject: [PATCH] 6 --- game/game.js | 130 +++++++++++++++++++++++++++++++++--- theme/style/hp/custom.css | 4 ++ theme/style/hp/default.css | 1 + theme/style/hp/emotion.css | 4 ++ theme/style/hp/glass.css | 4 ++ theme/style/hp/official.css | 4 ++ 6 files changed, 136 insertions(+), 11 deletions(-) diff --git a/game/game.js b/game/game.js index dafe590fc..b56c72be9 100644 --- a/game/game.js +++ b/game/game.js @@ -1347,6 +1347,68 @@ var style=ui.css.hp_style; ui.css.hp_style=lib.init.css(lib.assetURL+'theme/style/hp',lib.config.hp_style); style.remove(); + if(ui.css.hp_stylesheet1){ + ui.css.hp_stylesheet1.remove(); + delete ui.css.hp_stylesheet1; + } + if(ui.css.hp_stylesheet2){ + ui.css.hp_stylesheet2.remove(); + delete ui.css.hp_stylesheet2; + } + if(ui.css.hp_stylesheet3){ + ui.css.hp_stylesheet3.remove(); + delete ui.css.hp_stylesheet3; + } + if(ui.css.hp_stylesheet4){ + ui.css.hp_stylesheet4.remove(); + delete ui.css.hp_stylesheet4; + } + if(layout=='custom'){ + game.getDB('image','hp_style1',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet1){ + ui.css.hp_stylesheet1.remove(); + } + ui.css.hp_stylesheet1=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style2',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet2){ + ui.css.hp_stylesheet2.remove(); + } + ui.css.hp_stylesheet2=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style3',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet3){ + ui.css.hp_stylesheet3.remove(); + } + ui.css.hp_stylesheet3=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style4',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet4){ + ui.css.hp_stylesheet4.remove(); + } + ui.css.hp_stylesheet4=lib.init.sheet('.hp:not(.text):not(.actcount)>.lost{background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + } }, unfrequent:true, }, @@ -5766,17 +5828,63 @@ ui.css.cardback_stylesheet.remove(); } ui.css.cardback_stylesheet=lib.init.sheet('.card:empty,.card.infohidden{background-image:url('+fileLoadedEvent.target.result+')}'); - game.getDB('image','cardback_style2',function(fileToLoad){ - if(!fileToLoad) return; - var fileReader = new FileReader(); - fileReader.onload = function(fileLoadedEvent){ - if(ui.css.cardback_stylesheet2){ - ui.css.cardback_stylesheet2.remove(); - } - ui.css.cardback_stylesheet2=lib.init.sheet('.card.infohidden:not(.infoflip){background-image:url('+fileLoadedEvent.target.result+')}'); - }; - fileReader.readAsDataURL(fileToLoad, "UTF-8"); - }); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','cardback_style2',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.cardback_stylesheet2){ + ui.css.cardback_stylesheet2.remove(); + } + ui.css.cardback_stylesheet2=lib.init.sheet('.card.infohidden:not(.infoflip){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + } + if(lib.config.hp_style=='custom'){ + game.getDB('image','hp_style1',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet1){ + ui.css.hp_stylesheet1.remove(); + } + ui.css.hp_stylesheet1=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style2',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet2){ + ui.css.hp_stylesheet2.remove(); + } + ui.css.hp_stylesheet2=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style3',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet3){ + ui.css.hp_stylesheet3.remove(); + } + ui.css.hp_stylesheet3=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); + }; + fileReader.readAsDataURL(fileToLoad, "UTF-8"); + }); + game.getDB('image','hp_style4',function(fileToLoad){ + if(!fileToLoad) return; + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent){ + if(ui.css.hp_stylesheet4){ + ui.css.hp_stylesheet4.remove(); + } + ui.css.hp_stylesheet4=lib.init.sheet('.hp:not(.text):not(.actcount)>.lost{background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); diff --git a/theme/style/hp/custom.css b/theme/style/hp/custom.css index aa717d93e..1acdfcb67 100644 --- a/theme/style/hp/custom.css +++ b/theme/style/hp/custom.css @@ -4,6 +4,7 @@ background-size: 100% 100%; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){ box-shadow: none; @@ -11,6 +12,7 @@ background-size: 100% 100%; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){ box-shadow: none; @@ -18,12 +20,14 @@ background-size: 100% 100%; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)>.lost{ box-shadow: none; border: none; background-size: 100% 100%; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } #arena.oldlayout .player .hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){ diff --git a/theme/style/hp/default.css b/theme/style/hp/default.css index e69de29bb..34cf876a0 100644 --- a/theme/style/hp/default.css +++ b/theme/style/hp/default.css @@ -0,0 +1 @@ +/*default*/ diff --git a/theme/style/hp/emotion.css b/theme/style/hp/emotion.css index 8dd71c96e..b350140f9 100644 --- a/theme/style/hp/emotion.css +++ b/theme/style/hp/emotion.css @@ -5,6 +5,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:brightness(0.8) contrast(1.5); + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){ background: url('image/emotion2.png'); @@ -13,6 +14,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:brightness(0.8) contrast(1.5); + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){ background: url('image/emotion3.png'); @@ -21,6 +23,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:brightness(0.8) contrast(1.5); + border-radius: 0px; } .hp:not(.text):not(.actcount)>.lost{ background: url('image/emotion4.png'); @@ -28,6 +31,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } #arena.oldlayout .player .hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){ diff --git a/theme/style/hp/glass.css b/theme/style/hp/glass.css index 6d4cead71..9e2146248 100644 --- a/theme/style/hp/glass.css +++ b/theme/style/hp/glass.css @@ -5,6 +5,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){ background: url('image/glass2.png'); @@ -13,6 +14,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){ background: url('image/glass3.png'); @@ -21,6 +23,7 @@ background-size: cover; transform: scale(1.4) rotate(180deg); -webkit-filter:none; + border-radius: 0px; } .hp:not(.text):not(.actcount)>.lost{ background: url('image/glass4.png'); @@ -28,6 +31,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } #arena.oldlayout .player .hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){ diff --git a/theme/style/hp/official.css b/theme/style/hp/official.css index 51c883b83..94a7f5eec 100644 --- a/theme/style/hp/official.css +++ b/theme/style/hp/official.css @@ -4,6 +4,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){ background: url('image/official2.png'); @@ -11,6 +12,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } .hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){ background: url('image/official3.png'); @@ -18,6 +20,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } .hp:not(.text):not(.actcount)>.lost{ background: url('image/official4.png'); @@ -25,6 +28,7 @@ border: none; background-size: cover; transform: scale(1.4) rotate(180deg); + border-radius: 0px; } #arena.oldlayout .player .hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){