mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2025-07-14 00:02:45 +08:00
2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
var d=a=>{throw TypeError(a)};var T=(a,s,e)=>s.has(a)||d("Cannot "+e);var l=(a,s,e)=>(T(a,s,"read from private field"),e?e.call(a):s.get(a)),u=(a,s,e)=>s.has(a)?d("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,e);var t;class p extends ui.view.DefaultTheme.TalentUI{constructor(){super();u(this,t,new Set);this.btnDrawCard.on(Laya.Event.CLICK,this,this.onClickDrawCard),this.btnNext.on(Laya.Event.CLICK,this,this.onClickNext),this.listTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1),this.listTalents.scrollBar.elasticDistance=150}init(){this.pageDrawCard.visible=!0,this.pageResult.visible=!1,this.btnNext.label="UI_Talent_Select_Uncomplete",l(this,t).clear()}close(){}onClickDrawCard(){this.pageDrawCard.visible=!1,this.pageResult.visible=!0,this.listTalents.array=core.talentRandom()}onClickNext(){if(l(this,t).size<core.talentSelectLimit)return $$event("message",["F_TalentSelectNotComplect",core.talentSelectLimit]);const e=[...l(this,t)].map(i=>this.listTalents.array[i]);$ui.switchView(UI.pages.PROPERTY,{talents:e,enableExtend:!0})}renderTalent(e,i){const c=e.dataSource,m=e.getChildByName("blank");e.label=$_.format($lang.F_TalentSelection,c);const h=$ui.common.card[c.grade],o=()=>{const n=l(this,t).has(i);m.pause=!n,$_.deepMapSet(e,n?h.selected:h.normal)};o(),e.offAll(Laya.Event.CLICK),e.on(Laya.Event.CLICK,this,()=>{if(l(this,t).has(i))l(this,t).delete(i);else{if(l(this,t).size>=core.talentSelectLimit)return $$event("message",["F_TalentSelectLimit",core.talentSelectLimit]);const n=core.exclude([...l(this,t)].map(r=>this.listTalents.array[r].id),this.listTalents.array[i].id);if(n!=null){for(const{name:r,id:C}of this.listTalents.array)if(n==C)return $$event("message",["F_TalentConflict",r]);return}l(this,t).add(i)}this.btnNext.label=l(this,t).size===core.talentSelectLimit?"UI_Next":"UI_Talent_Select_Uncomplete",o()})}}t=new WeakMap;export{p as default};
|