Files
lifeRestart/public/assets/trajectory-BQAemv1w.js

4 lines
3.8 KiB
JavaScript

var U=s=>{throw TypeError(s)};var g=(s,i,t)=>i.has(s)||U("Cannot "+t);var h=(s,i,t)=>(g(s,i,"read from private field"),t?t.call(s):i.get(s)),l=(s,i,t)=>i.has(s)?U("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,t),o=(s,i,t,e)=>(g(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t),f=(s,i,t)=>(g(s,i,"access private method"),t);var m,p,T,E,L,b,c,S,x;const v=class v extends ui.view.CyberTheme.CyberTrajectoryUI{constructor(){super();l(this,E);l(this,m);l(this,p);l(this,b);l(this,c);l(this,S);l(this,x);let t=[0,0];this.panelTrajectory.on(Laya.Event.MOUSE_DOWN,this,n=>t=[n.stageX,n.stageY]),this.panelTrajectory.on(Laya.Event.MOUSE_UP,this,n=>{const r=n.stageX-t[0],j=n.stageY-t[1];Math.sqrt(Math.abs(r)+Math.abs(j))>10||this.onNext()}),this.btnSummary.on(Laya.Event.CLICK,this,this.onSummary),this.panelTrajectory.vScrollBar.elasticDistance=150;let e=null,a=null;const y=n=>{let r=this.panelTrajectory.vScrollBar.value+n;r<0&&(r=0),r>this.panelTrajectory.vScrollBar.max&&(r=this.panelTrajectory.vScrollBar.max),this.panelTrajectory.scrollTo(0,r)},u=(n,r)=>{n.off(Laya.Event.CLICK,this,y),n.on(Laya.Event.CLICK,this,y,[100*r]),a=setTimeout(()=>{n.off(Laya.Event.CLICK,this,y),e=setInterval(()=>y(10*r),10)},100)},d=()=>{e&&(clearInterval(e),e=null),a&&(clearTimeout(a),a=null)};this.btnUp.on(Laya.Event.MOUSE_DOWN,this,u,[this.btnUp,-1]),this.btnDown.on(Laya.Event.MOUSE_DOWN,this,u,[this.btnDown,1]),this.btnUp.on(Laya.Event.MOUSE_UP,this,d),this.btnUp.on(Laya.Event.MOUSE_OUT,this,d),this.btnDown.on(Laya.Event.MOUSE_UP,this,d),this.btnDown.on(Laya.Event.MOUSE_OUT,this,d),this.scbSpeed.on(Laya.Event.CHANGE,this,()=>this.speed=this.scbSpeed.value),this.scbSpeed.on(Laya.Event.MOUSE_UP,this,()=>this.onNext())}init({propertyAllocate:t,talents:e,enableExtend:a}){o(this,x,a),this.boxParticle.visible=!1,this.boxSpeed.visible=!0,this.btnSummary.visible=!1,o(this,c,[]),o(this,b,!1),o(this,S,e),core.start(t),this.updateProperty(),this.onNext()}close(){this.scbSpeed.value=0,this.speed=0,h(this,c).forEach(t=>{t.removeSelf(),t.destroy()}),o(this,c,null)}updateProperty(){const t=core.PropertyTypes,e=core.propertys;this.labCharm.text=e[t.CHR],this.labIntelligence.text=e[t.INT],this.labStrength.text=e[t.STR],this.labMoney.text=e[t.MNY],this.labSpirit.text=e[t.SPR]}onNext(){if(h(this,b))return;const{age:t,content:e,isEnd:a}=core.next();o(this,b,a),a&&(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(t,e),t>=100&&(this.boxParticle.visible=!0),this.updateProperty()}renderTrajectory(t,e){const a=f(this,E,L).call(this);a.labAge.text=""+t,a.labContent.text=e.map(({type:y,description:u,grade:d,name:n,postEvent:r})=>{switch(y){case"TLT":return`天赋【${n}】发动:${u}`;case"EVT":return u+(r?`
${r}`:"")}}).join(`
`),$_.deepMapSet(a.boxGrade,$ui.common.gradeBlk[e[e.length-1].grade||0]),this.vboxTrajectory.addChild(a),h(this,c).push(a),a.y=this.vboxTrajectory.height}onSummary(){const t=h(this,S);$ui.switchView(UI.pages.SUMMARY,{talents:t,enableExtend:h(this,x)})}get speed(){return h(this,m)}set speed(t){o(this,m,t),this.prgSpeed.value=t/this.scbSpeed.max,clearInterval(h(this,p)),o(this,p,null),t&&o(this,p,setInterval(()=>this.onNext(),3e3*(1-this.prgSpeed.value)+300))}};m=new WeakMap,p=new WeakMap,T=new WeakMap,E=new WeakSet,L=function(){var e;const t=h(e=v,T).call(e,"boxTrajectoryItem");return t.labContent=t.getChildByName("labContent"),t.labAge=t.getChildByName("hboxAge").getChildByName("labAge"),t.boxGrade=t.getChildByName("boxGrade"),t},b=new WeakMap,c=new WeakMap,S=new WeakMap,x=new WeakMap,l(v,T,Laya.plugin.extractComponents(v.uiView,["boxTrajectoryItem"]));let C=v;export{C as default};