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