This commit is contained in:
libccy 2017-02-26 16:34:27 +08:00
parent 9f620a6bd5
commit 8193253aeb
1 changed files with 66 additions and 45 deletions

View File

@ -25541,10 +25541,10 @@
if(del!=0) return del; if(del!=0) return del;
var aa=a,bb=b; var aa=a,bb=b;
if(a.indexOf('_')!=-1){ if(a.indexOf('_')!=-1){
a=a.slice(a.indexOf('_')+1); a=a.slice(a.lastIndexOf('_')+1);
} }
if(b.indexOf('_')!=-1){ if(b.indexOf('_')!=-1){
b=b.slice(b.indexOf('_')+1); b=b.slice(b.lastIndexOf('_')+1);
} }
if(a!=b){ if(a!=b){
return a>b?1:-1; return a>b?1:-1;
@ -30177,7 +30177,7 @@
capt=str[0]; capt=str[0];
} }
else{ else{
capt=str[str.indexOf('_')+1]; capt=str[str.lastIndexOf('_')+1];
} }
capt=capt.toLowerCase(); capt=capt.toLowerCase();
if(!/[a-z]/i.test(capt)){ if(!/[a-z]/i.test(capt)){
@ -30605,10 +30605,10 @@
if(del!=0) return del; if(del!=0) return del;
var aa=a,bb=b; var aa=a,bb=b;
if(a.indexOf('_')!=-1){ if(a.indexOf('_')!=-1){
a=a.slice(a.indexOf('_')+1); a=a.slice(a.lastIndexOf('_')+1);
} }
if(b.indexOf('_')!=-1){ if(b.indexOf('_')!=-1){
b=b.slice(b.indexOf('_')+1); b=b.slice(b.lastIndexOf('_')+1);
} }
if(a!=b){ if(a!=b){
return a>b?1:-1; return a>b?1:-1;
@ -31978,6 +31978,9 @@
}, },
skin:function(avatar,name,callback){ skin:function(avatar,name,callback){
var num=1; var num=1;
if(name.indexOf('gz_')==0){
name=name.slice(3);
}
if(lib.config.skin[name]){ if(lib.config.skin[name]){
num=lib.config.skin[name]+1; num=lib.config.skin[name]+1;
} }
@ -34151,6 +34154,10 @@
} }
}).setBackground(name,'character'); }).setBackground(name,'character');
var changeskinfunc=null; var changeskinfunc=null;
var nameskin=name;
if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
}
var changeskin=function(){ var changeskin=function(){
var node=ui.create.div('.changeskin','可换肤',playerbg); var node=ui.create.div('.changeskin','可换肤',playerbg);
var avatars=ui.create.div('.avatars',playerbg); var avatars=ui.create.div('.avatars',playerbg);
@ -34169,24 +34176,24 @@
var button=ui.create.div(avatars,function(){ var button=ui.create.div(avatars,function(){
playerbg.classList.remove('scroll'); playerbg.classList.remove('scroll');
if(this._link){ if(this._link){
lib.config.skin[name]=this._link; lib.config.skin[nameskin]=this._link;
bg.style.backgroundImage=this.style.backgroundImage; bg.style.backgroundImage=this.style.backgroundImage;
sourcenode.style.backgroundImage=this.style.backgroundImage; sourcenode.style.backgroundImage=this.style.backgroundImage;
game.saveConfig('skin',lib.config.skin); game.saveConfig('skin',lib.config.skin);
} }
else{ else{
delete lib.config.skin[name]; delete lib.config.skin[nameskin];
bg.setBackground(name,'character'); bg.setBackground(nameskin,'character');
sourcenode.setBackground(name,'character'); sourcenode.setBackground(nameskin,'character');
game.saveConfig('skin',lib.config.skin); game.saveConfig('skin',lib.config.skin);
} }
}); });
button._link=i; button._link=i;
if(i){ if(i){
button.setBackgroundImage('image/skin/'+name+'/'+i+'.jpg'); button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
} }
else{ else{
button.setBackground(name,'character','noskin'); button.setBackground(nameskin,'character','noskin');
} }
} }
}; };
@ -34201,22 +34208,22 @@
num--; num--;
createButtons(num); createButtons(num);
} }
img.src=lib.assetURL+'image/skin/'+name+'/'+num+'.jpg'; img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
} }
if(lib.config.change_skin){ if(lib.config.change_skin){
loadImage(); loadImage();
} }
else{ else{
createButtons(lib.skin[name]); createButtons(lib.skin[nameskin]);
} }
}; };
}; };
if(lib.config.change_skin){ if(lib.config.change_skin){
var img=new Image(); var img=new Image();
img.onload=changeskin; img.onload=changeskin;
img.src=lib.assetURL+'image/skin/'+name+'/1.jpg'; img.src=lib.assetURL+'image/skin/'+nameskin+'/1.jpg';
} }
else if(lib.config.debug&&lib.skin[name]){ else if(lib.config.debug&&lib.skin[nameskin]){
changeskin(); changeskin();
} }
var ban=ui.create.div('.menubutton.large.ban.character',uiintro,'禁用',function(e){ var ban=ui.create.div('.menubutton.large.ban.character',uiintro,'禁用',function(e){
@ -36934,37 +36941,40 @@
uiintro.add('<div class="text center">更改皮肤</div>'); uiintro.add('<div class="text center">更改皮肤</div>');
} }
var buttons=ui.create.div('.buttons.smallzoom'); var buttons=ui.create.div('.buttons.smallzoom');
var nameskin=(avatar2?node.name2:node.name);
if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
}
for(var i=0;i<=num;i++){ for(var i=0;i<=num;i++){
var button=ui.create.div('.button.character',buttons,function(){ var button=ui.create.div('.button.character.pointerdiv',buttons,function(){
if(this._link){ if(this._link){
if(avatar2){ if(avatar2){
lib.config.skin[node.name2]=this._link; lib.config.skin[nameskin]=this._link;
node.node.avatar2.style.backgroundImage=this.style.backgroundImage; node.node.avatar2.style.backgroundImage=this.style.backgroundImage;
} }
else{ else{
lib.config.skin[node.name]=this._link; lib.config.skin[nameskin]=this._link;
node.node.avatar.style.backgroundImage=this.style.backgroundImage; node.node.avatar.style.backgroundImage=this.style.backgroundImage;
} }
game.saveConfig('skin',lib.config.skin);
} }
else{ else{
if(avatar2){ if(avatar2){
delete lib.config.skin[node.name2]; delete lib.config.skin[nameskin];
node.node.avatar2.setBackground(node.name2,'character'); node.node.avatar2.setBackground(nameskin,'character');
} }
else{ else{
delete lib.config.skin[node.name]; delete lib.config.skin[nameskin];
node.node.avatar.setBackground(node.name,'character'); node.node.avatar.setBackground(nameskin,'character');
} }
game.saveConfig('skin',lib.config.skin);
} }
game.saveConfig('skin',lib.config.skin);
}); });
button._link=i; button._link=i;
if(i){ if(i){
button.setBackgroundImage('image/skin/'+(avatar2?node.name2:node.name)+'/'+i+'.jpg'); button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
} }
else{ else{
button.setBackground((avatar2?node.name2:node.name),'character','noskin'); button.setBackground(nameskin,'character','noskin');
} }
} }
uiintro.add(buttons); uiintro.add(buttons);
@ -36987,7 +36997,11 @@
} }
} }
} }
img.src=lib.assetURL+'image/skin/'+(avatar2?node.name2:node.name)+'/'+num+'.jpg'; var nameskin=(avatar2?node.name2:node.name);
if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
}
img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
} }
if(lib.config.change_skin){ if(lib.config.change_skin){
if(!node.isUnseen(0)){ if(!node.isUnseen(0)){
@ -36999,11 +37013,19 @@
} }
else{ else{
setTimeout(function(){ setTimeout(function(){
if(!node.isUnseen(0)&&lib.skin[node.name]){ var nameskin1=node.name;
createButtons(lib.skin[node.name]); var nameskin2=node.name2;
if(nameskin1.indexOf('gz_')==0){
nameskin1=nameskin1.slice(3);
} }
if(!node.isUnseen(1)&&lib.skin[node.name2]){ if(nameskin2.indexOf('gz_')==0){
createButtons(lib.skin[node.name2],true); nameskin2=nameskin2.slice(3);
}
if(!node.isUnseen(0)&&lib.skin[nameskin1]){
createButtons(lib.skin[nameskin1]);
}
if(!node.isUnseen(1)&&lib.skin[nameskin2]){
createButtons(lib.skin[nameskin2],true);
} }
}); });
} }
@ -37308,6 +37330,10 @@
if(addskin&&(!simple||get.is.phoneLayout())){ if(addskin&&(!simple||get.is.phoneLayout())){
var num=1; var num=1;
var introadded=false; var introadded=false;
var nameskin=node.link;
if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
}
var createButtons=function(num){ var createButtons=function(num){
if(!num) return; if(!num) return;
if(!introadded){ if(!introadded){
@ -37316,24 +37342,24 @@
} }
var buttons=ui.create.div('.buttons.smallzoom'); var buttons=ui.create.div('.buttons.smallzoom');
for(var i=0;i<=num;i++){ for(var i=0;i<=num;i++){
var button=ui.create.div('.button.character',buttons,function(){ var button=ui.create.div('.button.character.pointerdiv',buttons,function(){
if(this._link){ if(this._link){
lib.config.skin[node.link]=this._link; lib.config.skin[nameskin]=this._link;
node.style.backgroundImage=this.style.backgroundImage; node.style.backgroundImage=this.style.backgroundImage;
game.saveConfig('skin',lib.config.skin); game.saveConfig('skin',lib.config.skin);
} }
else{ else{
delete lib.config.skin[node.link]; delete lib.config.skin[nameskin];
node.setBackground(node.link,'character'); node.setBackground(nameskin,'character');
game.saveConfig('skin',lib.config.skin); game.saveConfig('skin',lib.config.skin);
} }
}); });
button._link=i; button._link=i;
if(i){ if(i){
button.setBackgroundImage('image/skin/'+node.link+'/'+i+'.jpg'); button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
} }
else{ else{
button.setBackground(node.link,'character','noskin'); button.setBackground(nameskin,'character','noskin');
} }
} }
uiintro.add(buttons); uiintro.add(buttons);
@ -37348,19 +37374,14 @@
num--; num--;
createButtons(num); createButtons(num);
} }
img.src=lib.assetURL+'image/skin/'+node.link+'/'+num+'.jpg'; img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
} }
if(lib.config.change_skin){ if(lib.config.change_skin){
if(!node.isUnseen(0)){ loadImage();
loadImage();
}
else{
loadImage(true);
}
} }
else{ else{
setTimeout(function(){ setTimeout(function(){
createButtons(lib.skin[node.link]); createButtons(lib.skin[nameskin]);
}); });
} }
} }