mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-04-04 04:12:55 +08:00
fix: bug
save load
This commit is contained in:
@@ -15,6 +15,8 @@ export default ({
|
||||
UI_Loading: '加载中...',
|
||||
UI_Error: '错误',
|
||||
|
||||
UI_BackupBtn: '上面没有效果就试试这个吧',
|
||||
|
||||
UI_Colon: ':',
|
||||
UI_Times: '次',
|
||||
UI_Count: '个',
|
||||
|
||||
@@ -648,6 +648,7 @@ var SaveLoadUI=(function(_super){
|
||||
this.btnRead=null;
|
||||
this.btnWrite=null;
|
||||
this.btnClose=null;
|
||||
this.btnBackup=null;
|
||||
|
||||
SaveLoadUI.__super.call(this);
|
||||
}
|
||||
@@ -662,7 +663,7 @@ var SaveLoadUI=(function(_super){
|
||||
|
||||
}
|
||||
|
||||
SaveLoadUI.uiView={"type":"Dialog","props":{"width":645,"height":250},"child":[{"type":"Box","props":{"top":0,"right":0,"left":0,"bottom":150},"child":[{"type":"Box","props":{"y":0,"x":0,"width":645,"height":2},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":2,"fillColor":"#97ffe6"}}]},{"type":"Box","props":{"width":645,"height":2,"centerX":0,"bottom":0},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":2,"fillColor":"#97ffe6"}}]},{"type":"Box","props":{"width":645,"height":100,"centerY":0,"centerX":0,"alpha":0.2},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":100,"fillColor":"#000000"}}]}]},{"type":"TextInput","props":{"wordWrap":false,"var":"input","valign":"middle","top":0,"text":"content","right":0,"overflow":"scroll","left":0,"fontSize":35,"font":"SimHei","color":"#ffffff","bottom":150}},{"type":"Box","props":{"width":120,"var":"btnSave","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":5,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Save","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"width":120,"var":"btnLoad","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":130,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Load","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"y":335,"width":120,"var":"btnRead","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":260,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Read","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"y":335,"width":120,"var":"btnWrite","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":390,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Write","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"y":10,"x":10,"width":120,"var":"btnClose","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnSmall","height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"×","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]}]};
|
||||
SaveLoadUI.uiView={"type":"Dialog","props":{"width":645,"height":400},"child":[{"type":"Box","props":{"top":0,"right":0,"left":0,"bottom":300},"child":[{"type":"Box","props":{"y":0,"x":0,"width":645,"height":2},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":2,"fillColor":"#97ffe6"}}]},{"type":"Box","props":{"width":645,"height":2,"centerX":0,"bottom":0},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":2,"fillColor":"#97ffe6"}}]},{"type":"Box","props":{"width":645,"height":100,"centerY":0,"centerX":0,"alpha":0.2},"child":[{"type":"Rect","props":{"width":645,"lineWidth":1,"height":100,"fillColor":"#000000"}}]}]},{"type":"TextInput","props":{"wordWrap":false,"var":"input","valign":"middle","top":0,"text":"content","right":0,"overflow":"scroll","left":0,"fontSize":35,"font":"SimHei","color":"#ffffff","bottom":300}},{"type":"Box","props":{"width":120,"var":"btnSave","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":5,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Save","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"width":120,"var":"btnLoad","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":130,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Load","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"width":120,"var":"btnRead","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":260,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Read","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"width":120,"var":"btnWrite","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":390,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_Write","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"x":10,"width":120,"var":"btnClose","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnSmall","height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"×","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]},{"type":"Box","props":{"y":20,"var":"btnBackup","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnBackup","left":5,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},"child":[{"type":"Label","props":{"text":"UI_BackupBtn","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5}}]}]};
|
||||
return SaveLoadUI;
|
||||
})(Dialog);
|
||||
var ThemesUI=(function(_super){
|
||||
|
||||
@@ -15,7 +15,13 @@ export default class CyberCelebrity extends ui.view.CyberTheme.CelebrityUI {
|
||||
const vboxStates = item.getChildByName('vboxStates');
|
||||
const boxName = item.getChildByName('boxName');
|
||||
boxName.getChildByName('label').text = name;
|
||||
vboxStates.getChildByName('label').text = $_.format($lang.F_PropertyStr, property);
|
||||
|
||||
const p = $_.clone(property);
|
||||
for(const k in p)
|
||||
if(Math.abs(p[k] - Math.PI) < 0.0000001)
|
||||
p[k] = 'π';
|
||||
|
||||
vboxStates.getChildByName('label').text = $_.format($lang.F_PropertyStr, p);
|
||||
for(const t of talent) {
|
||||
const i = CyberCelebrity.#createComponent('boxTalent');
|
||||
i.getChildByName('label').text = $_.format($lang.F_TalentSelection, t);
|
||||
|
||||
@@ -66,8 +66,10 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
|
||||
#isEnd;
|
||||
#trajectoryItems;
|
||||
#talents;
|
||||
#enableExtend;
|
||||
|
||||
init({propertyAllocate, talents}) {
|
||||
init({propertyAllocate, talents, enableExtend}) {
|
||||
this.#enableExtend = enableExtend;
|
||||
this.boxParticle.visible = false;
|
||||
this.boxSpeed.visible = true;
|
||||
this.btnSummary.visible = false;
|
||||
@@ -147,7 +149,7 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
|
||||
|
||||
onSummary() {
|
||||
const talents = this.#talents;
|
||||
$ui.switchView(UI.pages.SUMMARY, {talents});
|
||||
$ui.switchView(UI.pages.SUMMARY, { talents, enableExtend: this.#enableExtend });
|
||||
}
|
||||
|
||||
get speed() {
|
||||
|
||||
@@ -16,7 +16,13 @@ export default class Celebrity extends ui.view.DefaultTheme.CelebrityUI {
|
||||
const vboxStates = item.getChildByName('vboxStates');
|
||||
const boxName = item.getChildByName('boxName');
|
||||
boxName.label = name;
|
||||
vboxStates.label = $_.format($lang.F_PropertyStr, property);
|
||||
|
||||
const p = $_.clone(property);
|
||||
for(const k in p)
|
||||
if(Math.abs(p[k] - Math.PI) < 0.0000001)
|
||||
p[k] = 'π';
|
||||
|
||||
vboxStates.label = $_.format($lang.F_PropertyStr, p);
|
||||
$_.deepMapSet(boxName, style.name);
|
||||
$_.deepMapSet(vboxStates, style.state);
|
||||
for(const t of talent) {
|
||||
|
||||
@@ -45,8 +45,10 @@ export default class Trajectory extends ui.view.DefaultTheme.TrajectoryUI {
|
||||
#isEnd;
|
||||
#trajectoryItems;
|
||||
#talents;
|
||||
#enableExtend;
|
||||
|
||||
init({propertyAllocate, talents}) {
|
||||
init({propertyAllocate, talents, enableExtend}) {
|
||||
this.#enableExtend = enableExtend;
|
||||
this.boxParticle.visible = false;
|
||||
this.boxSpeed.visible = true;
|
||||
this.btnSummary.visible = false;
|
||||
@@ -123,7 +125,7 @@ export default class Trajectory extends ui.view.DefaultTheme.TrajectoryUI {
|
||||
|
||||
onSummary() {
|
||||
const talents = this.#talents;
|
||||
$ui.switchView(UI.pages.SUMMARY, {talents});
|
||||
$ui.switchView(UI.pages.SUMMARY, {talents, enableExtend: this.#enableExtend});
|
||||
}
|
||||
|
||||
get speed() {
|
||||
|
||||
@@ -60,6 +60,71 @@ export default class SaveLoad extends ui.view.SaveLoadUI {
|
||||
this.input.on(Laya.Event.MOUSE_DOWN, this, ()=>{
|
||||
this.input.setSelection(0, this.input.text.length);
|
||||
})
|
||||
|
||||
this.btnBackup.on(Laya.Event.CLICK, this, ()=>{
|
||||
const board = document.createElement("div");
|
||||
document.body.appendChild(board);
|
||||
board.style = `
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
opacity: 0.95`;
|
||||
|
||||
const bg = document.createElement("div");
|
||||
bg.style = `
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
opacity: 0.95`;
|
||||
document.body.appendChild(board);
|
||||
board.appendChild(bg);
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.style = `position: absolute; width: ${window.innerWidth}px; height: ${window.innerHeight}px;`
|
||||
textarea.value = JSON.stringify(
|
||||
JSON.parse(this.data),
|
||||
null,
|
||||
4
|
||||
);
|
||||
board.appendChild(textarea);
|
||||
const close = document.createElement("div");
|
||||
close.style = `
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: red;
|
||||
font-size:100px;
|
||||
padding: 0;
|
||||
line-height: 100px;
|
||||
color: white;
|
||||
opacity: 0.7`;
|
||||
close.innerHTML = '×';
|
||||
board.appendChild(close);
|
||||
close.onclick = ()=>board.remove();
|
||||
|
||||
const load = document.createElement("div");
|
||||
load.style = `
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: limegreen;
|
||||
font-size: 35px;
|
||||
padding: 0;
|
||||
line-height: 50px;
|
||||
color: white;
|
||||
opacity: 0.7`;
|
||||
load.innerHTML = 'LOAD<br>读取';
|
||||
board.appendChild(load);
|
||||
load.onclick = ()=>this.data = [textarea.value, '成功/success', '失败/failed', true];
|
||||
});
|
||||
}
|
||||
|
||||
static load() {
|
||||
@@ -79,17 +144,19 @@ export default class SaveLoad extends ui.view.SaveLoadUI {
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
|
||||
set data([v, success = 'UI_LoadSuccess', Failed = 'UI_LoadFailed']) {
|
||||
set data([v, success = 'UI_LoadSuccess', failed = 'UI_LoadFailed', altMsg]) {
|
||||
try {
|
||||
const data = JSON.parse(v);
|
||||
for(const key in data)
|
||||
localStorage.setItem(key, data[key]);
|
||||
$$event('message', [success]);
|
||||
if(altMsg) alert(success);
|
||||
else $$event('message', [success]);
|
||||
$ui.theme = $ui.theme;
|
||||
this.btnClose.event(Laya.Event.CLICK);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
$$event('message', [Failed]);
|
||||
if(altMsg) alert(`${failed}\n${e}`);
|
||||
else $$event('message', [failed]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,13 @@ const cyber = {
|
||||
defaultColor: '#fc5531',
|
||||
hoverColor: '#f28b54',
|
||||
},
|
||||
btnBackup: {
|
||||
defaultColor: '#9c30cd',
|
||||
hoverColor: '#bf50fd',
|
||||
radius: 8,
|
||||
defaultLabel: '#ffffff',
|
||||
hoverLabel: '#ffffff',
|
||||
},
|
||||
},
|
||||
names: {
|
||||
btnSmall: {
|
||||
@@ -216,20 +223,20 @@ const dark = {
|
||||
},
|
||||
grade: [
|
||||
{
|
||||
defaultColor: '#4a5361',
|
||||
defaultColor: '#464646',
|
||||
hoverColor: '#4a5361',
|
||||
},
|
||||
{
|
||||
defaultColor: '#1160b0',
|
||||
hoverColor: '#1160b0',
|
||||
defaultColor: '#6495ed',
|
||||
hoverColor: '#87cefa',
|
||||
},
|
||||
{
|
||||
defaultColor: '#9379ca',
|
||||
hoverColor: '#9379ca',
|
||||
defaultColor: '#e2a7ff',
|
||||
hoverColor: '#e7beff',
|
||||
},
|
||||
{
|
||||
defaultColor: '#ab6157',
|
||||
hoverColor: '#ab6157',
|
||||
defaultColor: '#ffa07a',
|
||||
hoverColor: '#f7a989',
|
||||
},
|
||||
],
|
||||
ageColor: '#ffffee',
|
||||
@@ -639,6 +646,13 @@ const dark = {
|
||||
defaultColor: '#fc5531',
|
||||
hoverColor: '#f28b54',
|
||||
},
|
||||
btnBackup: {
|
||||
defaultColor: '#9c30cd',
|
||||
hoverColor: '#bf50fd',
|
||||
radius: 8,
|
||||
defaultLabel: '#ffffff',
|
||||
hoverLabel: '#ffffff',
|
||||
},
|
||||
},
|
||||
names: {
|
||||
btnSmall: {
|
||||
@@ -707,18 +721,21 @@ const light = {
|
||||
lineWidth: 2,
|
||||
},
|
||||
grade: [
|
||||
{},
|
||||
{
|
||||
defaultColor: '#55fffe',
|
||||
hoverColor: '#55fffe',
|
||||
defaultColor: '#ffffff',
|
||||
hoverColor: '#ededed',
|
||||
},
|
||||
{
|
||||
defaultColor: '#b17cff',
|
||||
hoverColor: '#b17cff',
|
||||
defaultColor: '#87cefa',
|
||||
hoverColor: '#6495ed',
|
||||
},
|
||||
{
|
||||
defaultColor: '#ffce45',
|
||||
hoverColor: '#ffce45',
|
||||
defaultColor: '#e7beff',
|
||||
hoverColor: '#e2a7ff',
|
||||
},
|
||||
{
|
||||
defaultColor: '#f7a989',
|
||||
hoverColor: '#ffa07a',
|
||||
},
|
||||
],
|
||||
ageColor: '#000000',
|
||||
@@ -1126,6 +1143,13 @@ const light = {
|
||||
defaultColor: '#fc5531',
|
||||
hoverColor: '#f28b54',
|
||||
},
|
||||
btnBackup: {
|
||||
defaultColor: '#9c30cd',
|
||||
hoverColor: '#bf50fd',
|
||||
radius: 8,
|
||||
defaultLabel: '#ffffff',
|
||||
hoverLabel: '#ffffff',
|
||||
},
|
||||
},
|
||||
names: {
|
||||
btnSmall: {
|
||||
|
||||
Reference in New Issue
Block a user