local UIHorseSoulGachaUnlockAndReset = UIViewClass() function UIHorseSoulGachaUnlockAndReset:OnOpened(context) self.isReSet = context.isReSet if self.isReSet then self:ReSetLevel() else self:SetLevelUp(context.lastPoolID, context.curPoolID) CTL.Sound.PlayGameSound("UI_breakout_03") end end function UIHorseSoulGachaUnlockAndReset:OnBackButtonPressed() self:OnButtonClicked(self.event_Bottom) end function UIHorseSoulGachaUnlockAndReset:OnButtonClicked(comp) if comp == self.event_Bottom then self:CloseView() end end function UIHorseSoulGachaUnlockAndReset:SetLevelUp(lastPoolID, curPoolID) UIUtils.SetActive(self.group_LevelUp, true) UIUtils.SetActive(self.group_ReSet, false) local gachaPoolData = DataSheetManager.HorseSoulDrawData:GetDataByID(curPoolID) local lastPoolData = DataSheetManager.HorseSoulDrawData:GetDataByID(lastPoolID) self:SetLevelIconAndName(self.group_Left, lastPoolData) self:SetLevelIconAndName(self.group_Right, gachaPoolData) local colorName = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.QualityColor:GetDataByID(gachaPoolData.Quality).ColorText]), gachaPoolData.Quality) UIUtils.SetLabel(self.lab01, string.FormatByIdsId(Const_IDS.IDS_HorseSoul_DrawHint13, colorName)) end function UIHorseSoulGachaUnlockAndReset:ReSetLevel() UIUtils.SetActive(self.group_LevelUp, false) UIUtils.SetActive(self.group_ReSet, true) self:SetLevelIconAndName(self.group_Reset, DataSheetManager.HorseSoulDrawData:GetDataByID(1)) end function UIHorseSoulGachaUnlockAndReset:SetLevelIconAndName(cell_Table, levelInfo) UIUtils.SetImageByAssetBundle(cell_Table.img_sys, levelInfo.DrawIcon) local colorName = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.QualityColor:GetDataByID(levelInfo.Quality).ColorText]), levelInfo.Quality) UIUtils.SetLabel(cell_Table.txt_Name, string.FormatByIdsId(Const_IDS.IDS_HorseSoul_DrawHint17, colorName)) end return UIHorseSoulGachaUnlockAndReset