mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2025-07-13 15:52:44 +08:00
2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
var S=a=>{throw TypeError(a)};var E=(a,s,e)=>s.has(a)||S("Cannot "+e);var u=(a,s,e)=>(E(a,s,"read from private field"),e?e.call(a):s.get(a)),v=(a,s,e)=>s.has(a)?S("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,e),f=(a,s,e,t)=>(E(a,s,"write to private field"),t?t.call(a,e):s.set(a,e),e),p=(a,s,e)=>(E(a,s,"access private method"),e);var r,g,x,L,$;const m=class m extends ui.view.CyberTheme.CelebrityUI{constructor(){super();v(this,x);v(this,r);this.btnRetry.on(Laya.Event.CLICK,this,()=>this.random()),this.btnNext.on(Laya.Event.CLICK,this,this.next),this.panelCharacter.vScrollBar.elasticDistance=150}init(){this.random()}close(){f(this,r,null),this.vboxCharacter.destroyChildren(!0)}random(e){f(this,r,null),this.vboxCharacter.destroyChildren(!0);const{unique:t,normal:l}=core.characterRandom(),i=[],c=this.generateUnique(t,()=>{core.generateUnique(),this.random(l)});c&&i.push(c),(e||l).forEach(n=>i.push(p(this,x,L).call(this,n))),i.forEach((n,o)=>{n.y=o,this.vboxCharacter.addChild(n),n.click(()=>{u(this,r)&&u(this,r).switch(!1),f(this,r,n),n.switch(!0),n.event(Laya.Event.RESIZE)})}),e&&c&&(f(this,r,c),c.switch(!0),c.event(Laya.Event.RESIZE))}generateUnique(e,t){return e?e.generate?(e.name=$lang.UI_UniqueWaTaShi,p(this,x,L).call(this,e)):p(this,x,$).call(this,t):null}next(){if(!u(this,r))return $$event("message",["M_PleaseSelectOne"]);if(!u(this,r).dataSource)return $$event("message",["M_UnGenerate"]);const{property:e,talent:t}=u(this,r).dataSource,l=core.remake(t.map(i=>i.id));l.length>0&&$$event("message",[l.map(i=>["F_TalentReplace",i])]),$ui.switchView(UI.pages.TRAJECTORY,{propertyAllocate:e,talents:t,enableExtend:!1})}};r=new WeakMap,g=new WeakMap,x=new WeakSet,L=function(e,t){var I,B;const{name:l,property:i,talent:c}=e,n=u(I=m,g).call(I,"boxCharacter"),o=n.getChildByName("vboxStates"),y=n.getChildByName("boxName");y.getChildByName("label").text=l;const h=$_.clone(i);for(const C in h)Math.abs(h[C]-Math.PI)<1e-7&&(h[C]="π");o.getChildByName("label").text=$_.format($lang.F_PropertyStr,h);for(const C of c){const b=u(B=m,g).call(B,"boxTalent");b.getChildByName("label").text=$_.format($lang.F_TalentSelection,C),b.y=o.height+o.space;let N=b.getChildByName(`grade${C.grade}`);N&&(N.visible=!0),o.addChild(b)}const d=new Laya.Box;return d.height=o.space,d.y=o.height,o.addChild(d),o.scaleY=0,n.dataSource=e,n.switch=C=>o.scaleY=C?1:0,n.click=(C,b)=>{y.offAll(Laya.Event.CLICK),y.on(Laya.Event.CLICK,b||this,C)},t&&n.click(t),n},$=function(e){var y;const t=u(y=m,g).call(y,"boxUniqueUnGenerate"),l=t.getChildByName("boxName"),i=t.getChildByName("vboxStates"),c=i.getChildByName("label"),o=i.getChildByName("boxBtn").getChildByName("btn");return c.event(Laya.Event.RESIZE),i.scaleY=0,t.dataSource=!1,t.switch=h=>i.scaleY=h?1:0,t.click=(h,d)=>{l.offAll(Laya.Event.CLICK),l.on(Laya.Event.CLICK,d||this,h)},t.generate=(h,d)=>{o.offAll(Laya.Event.CLICK),o.on(Laya.Event.CLICK,d||this,h)},e&&t.generate(e),t},v(m,g,Laya.plugin.extractComponents(m.uiView,["boxCharacter","boxTalent","boxUniqueUnGenerate"]));let U=m;export{U as default};
|