Files
lifeRestart/public/assets/trajectory-CU66EQoL.js
T

2 lines
2.6 KiB
JavaScript

var e=class e extends ui.view.DefaultTheme.TrajectoryUI{constructor(){super();let e=[0,0];this.panelTrajectory.on(Laya.Event.MOUSE_DOWN,this,t=>e=[t.stageX,t.stageY]),this.panelTrajectory.on(Laya.Event.MOUSE_UP,this,t=>{let n=t.stageX-e[0],r=t.stageY-e[1];Math.sqrt(Math.abs(n)+Math.abs(r))>10||this.onNext()}),this.btnSummary.on(Laya.Event.CLICK,this,this.onSummary),this.panelTrajectory.vScrollBar.elasticDistance=150,this.scbSpeed.on(Laya.Event.CHANGE,this,()=>this.speed=this.scbSpeed.value),this.scbSpeed.on(Laya.Event.MOUSE_UP,this,()=>this.onNext())}#e;#t;static load(){return[`images/atlas/images/progress.atlas`,`images/atlas/images/slider.atlas`]}static#n=Laya.plugin.extractComponents(e.uiView,[`boxTrajectoryItem`]);#r(){let t=e.#n(`boxTrajectoryItem`);t.labContent=t.getChildByName(`labContent`),t.labAge=t.getChildByName(`hboxAge`).getChildByName(`labAge`);let n=$ui.common.trajectoryItem;return $_.deepMapSet(t,n.box),t.grade=e=>{$_.deepMapSet(t,n.grade[e||0])},t.getChildByName(`hboxAge`)._childs.forEach(e=>e.color=n.ageColor),t.labContent.color=n.contentColor,t}#i;#a;#o;#s;init({propertyAllocate:e,talents:t,enableExtend:n}){this.#s=n,this.boxParticle.visible=!1,this.boxSpeed.visible=!0,this.btnSummary.visible=!1,this.#a=[],this.#i=!1,this.#o=t,core.start(e),this.updateProperty(),this.onNext()}close(){this.scbSpeed.value=0,this.speed=0,this.#a.forEach(e=>{e.removeSelf(),e.destroy()}),this.#a=null}updateProperty(){let e=core.PropertyTypes,t=core.propertys;this.labCharm.text=t[e.CHR],this.labIntelligence.text=t[e.INT],this.labStrength.text=t[e.STR],this.labMoney.text=t[e.MNY],this.labSpirit.text=t[e.SPR]}onNext(){if(this.#i)return;let{age:e,content:t,isEnd:n}=core.next();this.#i=n,n&&(this.boxSpeed.visible=!1,this.btnSummary.visible=!0,Laya.timer.frameOnce(1,this,()=>{this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight)})),this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight),this.renderTrajectory(e,t),e>=100&&(this.boxParticle.visible=!0),this.updateProperty()}renderTrajectory(e,t){let n=this.#r();n.labAge.text=``+e,n.labContent.text=t.map(({type:e,description:t,grade:n,name:r,postEvent:i})=>{switch(e){case`TLT`:return`天赋【${r}】发动:${t}`;case`EVT`:return t+(i?`\n${i}`:``)}}).join(`
`),n.grade(t[t.length-1].grade),this.vboxTrajectory.addChild(n),this.#a.push(n),n.y=this.vboxTrajectory.height}onSummary(){let e=this.#o;$ui.switchView(UI.pages.SUMMARY,{talents:e,enableExtend:this.#s})}get speed(){return this.#e}set speed(e){this.#e=e,this.prgSpeed.value=e/this.scbSpeed.max,clearInterval(this.#t),this.#t=null,e&&(this.#t=setInterval(()=>this.onNext(),3e3*(1-this.prgSpeed.value)+300))}};export{e as default};