This commit is contained in:
libccy 2017-03-18 23:16:44 +08:00
parent 0b428b4f93
commit ca580fe7b8
4 changed files with 239 additions and 5 deletions

View File

@ -964,10 +964,94 @@
intro:'设置正面朝上的卡牌的样式',
item:{
default:'默认',
custom:'自定',
wood:'木纹',
music:'音乐',
simple:'原版',
new:'新版',
// new:'新版',
},
visualBar:function(node,item,create){
if(node.created){
node.lastChild.classList.remove('active');
return;
}
var button;
for(var i=0;i<node.parentNode.childElementCount;i++){
if(node.parentNode.childNodes[i]._link=='custom'){
button=node.parentNode.childNodes[i];
}
}
if(!button){
return;
}
node.created=true;
var deletepic;
ui.create.filediv('.menubutton','添加图片',node,function(file){
if(file){
game.putDB('image','card_style',file,function(){
game.getDB('image','card_style',function(fileToLoad){
if(!fileToLoad) return;
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var data = fileLoadedEvent.target.result;
button.style.backgroundImage='url('+data+')';
button.className='button card fullskin';
node.classList.add('showdelete');
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
});
}
else{
game.deleteDB('image','card_style');
button.style.backgroundImage='none';
button.className='button character dashedmenubutton';
}
});
deletepic=ui.create.div('.menubutton.deletebutton','删除图片',node,function(){
if(confirm('确定删除自定义图片?(此操作不可撤销)')){
game.deleteDB('image','card_style');
button.style.backgroundImage='none';
button.className='button character dashedmenubutton';
node.classList.remove('showdelete');
}
});
},
visualMenu:function(node,link,name,config){
node.className='button card fullskin';
node.style.backgroundSize='100% 100%';
switch(link){
case 'default':case 'custom':{
if(lib.config.theme=='simple'){
node.style.backgroundImage='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4))';
node.className='button character';
}
else{
node.style.backgroundImage='none';
node.className='button character dashedmenubutton';
}
break;
}
case 'new':node.setBackgroundImage('theme/style/card/image/new.png');break;
case 'wood':node.setBackgroundImage('theme/woodden/wood.jpg');node.style.backgroundSize='initial';break;
case 'music':node.setBackgroundImage('theme/music/wood3.png');break;
case 'simple':node.setBackgroundImage('theme/simple/card.png');break;
}
if(link=='custom'){
game.getDB('image','card_style',function(fileToLoad){
if(!fileToLoad) return;
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var data = fileLoadedEvent.target.result;
node.style.backgroundImage='url('+data+')';
node.className='button card fullskin';
node.parentNode.lastChild.classList.add('showdelete');
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
}
},
onclick:function(layout){
game.saveConfig('card_style',layout);
@ -983,13 +1067,112 @@
init:'default',
item:{
default:'默认',
wood:'木纹',
music:'音乐',
custom:'自定',
// wood:'木纹',
// music:'音乐',
official:'原版',
new:'新版',
feicheng:'废城',
// new:'新版',
// feicheng:'废城',
liusha:'流沙',
},
visualBar:function(node,item,create){
if(node.created){
node.lastChild.classList.remove('active');
return;
}
var button;
for(var i=0;i<node.parentNode.childElementCount;i++){
if(node.parentNode.childNodes[i]._link=='custom'){
button=node.parentNode.childNodes[i];
}
}
if(!button){
return;
}
node.created=true;
var deletepic;
ui.create.filediv('.menubutton','添加图片',node,function(file){
if(file){
game.putDB('image','cardback_style',file,function(){
game.getDB('image','cardback_style',function(fileToLoad){
if(!fileToLoad) return;
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var data = fileLoadedEvent.target.result;
button.style.backgroundImage='url('+data+')';
button.className='button character';
node.classList.add('showdelete');
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
});
}
else{
game.deleteDB('image','cardback_style');
button.style.backgroundImage='none';
button.className='button character dashedmenubutton';
}
});
ui.create.filediv('.menubutton.deletebutton.addbutton','添加翻转图片',node,function(file){
if(file){
game.putDB('image','cardback_style2',file,function(){
node.classList.add('hideadd');
});
}
});
deletepic=ui.create.div('.menubutton.deletebutton','删除图片',node,function(){
if(confirm('确定删除自定义图片?(此操作不可撤销)')){
game.deleteDB('image','cardback_style');
game.deleteDB('image','cardback_style2');
button.style.backgroundImage='none';
button.className='button character dashedmenubutton';
node.classList.remove('showdelete');
node.classList.remove('hideadd');
}
});
},
visualMenu:function(node,link,name,config){
node.style.backgroundSize='100% 100%';
switch(link){
case 'default':case 'custom':{
if(lib.config.theme=='simple'){
node.style.backgroundImage='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4))';
node.className='button character';
}
else{
node.style.backgroundImage='none';
node.className='button character dashedmenubutton';
}
break;
}
case 'new':node.className='button character';node.setBackgroundImage('theme/style/cardback/image/new.png');break;
case 'feicheng':node.className='button character';node.setBackgroundImage('theme/style/cardback/image/feicheng.png');break;
case 'official':node.className='button character';node.setBackgroundImage('theme/style/cardback/image/official.png');break;
case 'liusha':node.className='button character';node.setBackgroundImage('theme/style/cardback/image/liusha.png');break;
case 'wood':node.className='button card fullskin';node.setBackgroundImage('theme/woodden/wood.jpg');node.style.backgroundSize='initial';break;
case 'music':node.className='button card fullskin';node.setBackgroundImage('theme/music/wood3.png');break;
}
if(link=='custom'){
game.getDB('image','cardback_style',function(fileToLoad){
if(!fileToLoad) return;
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var data = fileLoadedEvent.target.result;
node.style.backgroundImage='url('+data+')';
node.className='button character';
node.parentNode.lastChild.classList.add('showdelete');
game.getDB('image','cardback_style2',function(file){
if(file){
node.parentNode.lastChild.classList.add('hideadd');
}
});
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
}
},
onclick:function(layout){
game.saveConfig('cardback_style',layout);
var style=ui.css.cardback_style;

View File

@ -608,6 +608,15 @@
margin-left: 5px;
margin-right: 5px;
}
.popup-container>.menu.visual.withbar>div:not(.showdelete)>.deletebutton{
display: none;
}
.popup-container>.menu.visual.withbar>div.hideadd>.addbutton{
display: none;
}
.popup-container>.menu.visual.withbar>div.showdelete>div:first-child{
display: none;
}
#window:not(.nopointer) .popup-container>.menu.visual.withbar>div:last-child>div{
cursor: pointer;
}
@ -622,6 +631,9 @@ input.fileinput{
top: 0 !important;
opacity: 0 !important;
}
input.fileinput::-webkit-file-upload-button {
cursor: pointer;
}
#window:not(.nopointer) input.fileinput{
cursor: pointer;
}

View File

@ -0,0 +1,31 @@
.card:not(*:empty){
color:rgb(77, 60, 51);
text-shadow:none;
background-size:100% 100%;
}
#arena.mobile:not(.chess) .player[data-position='0']>.equips>.equip5 {
border-radius: 4px;
}
#arena.mobile:not(.chess) .player[data-position='0']>.equips>.equip5>.image{
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#arena.mobile:not(.chess) .player[data-position='0']>.equips>.equip5>.name{
display: block;
transform: scale(0.43) !important;
transform-origin: left top;
left: 2px;
top: 3px;
}
#arena.mobile:not(.chess) .player[data-position='0']>.equips>.equip5>.name.long{
top: 2px;
}
#arena.mobile:not(.chess) .player[data-position='0']>.equips>.equip5>.info{
display: block;
transform: scale(0.43) !important;
transform-origin: right top;
right: 3px;
top: 3px;
}

View File

@ -0,0 +1,8 @@
.card:empty,.card.infohidden{
background: url('image/liusha.png');
background-size: cover;
}
.card.infohidden:not(.infoflip){
background: url('image/liusha2.png');
background-size: cover;
}