local UIIllustratedMainPanel = UIViewClass() ---------------------------------------------- 系统函数 ---------------------------------------------------------- function UIIllustratedMainPanel:OnOpened(context) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Hero, self.RefreshLibraryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Weapon, self.RefreshLibraryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Treasure, self.RefreshLibraryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Horse, self.RefreshLibraryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_GodBeast, self.RefreshLibraryRp) -- 室内红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Stratagem, self.RefreshLibraryInRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_PlotReview, self.RefreshLibraryInRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_LightEffect, self.RefreshLibraryInRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Dye, self.RefreshLibraryInRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Library_Appearance, self.RefreshLibraryInRp) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Handbook_Enter_Title) self:RefreshLibraryRp() self:RefreshLibraryInRp() UIManager.ActiveUIModle(false, "UIIllustratedMainPanel") end function UIIllustratedMainPanel:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIIllustratedMainPanel:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.Mansion}) elseif comp == self.btn_Hero or comp == self.btn_HeroLoc then --武将图鉴 CTL.HeroLibrary.OpenMainPanel() elseif comp == self.btn_Weapon or comp == self.btn_WeaponLoc then --神兵图鉴 CTL.WeaponLibrary.OpenMainPanel() elseif comp == self.btn_Treasure or comp == self.btn_TreasureLoc then --宝物图鉴 CTL.TreasureLibrary.OpenMainPanel() elseif comp == self.btn_Horse or comp == self.btn_HorseLoc then --坐骑图鉴 CTL.HorseLibrary.OpenMainPanel() elseif comp == self.btn_MythicalAnimals or comp == self.btn_MythicalAnimalsLoc then CTL.GodBeastLibrary.OpenMainPanel() elseif comp == self.btn_ChangeIn then CTL.Sound.PlayGameSound("UI_sound_liaotian") self:CloseView(true) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIIllustratedSecondPanel) end end ------------------------------------------------------------------------------------------------------------------- function UIIllustratedMainPanel:RefreshLibraryRp() UIUtils.SetActive(self.loc_Hero,true) local isRp = CTL.RedPoint.GetRedPointActive if CTL.HeroLibrary.CheckUnlock() then self.btn_Hero:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Hero)) self.btn_HeroLoc:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Hero)) else UIUtils.SetActive(self.btn_Hero,false) UIUtils.SetActive(self.btn_HeroLoc,false) end if CTL.WeaponLibrary.CheckUnlock() then self.btn_Weapon:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Weapon)) self.btn_WeaponLoc:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Weapon)) else UIUtils.SetActive(self.btn_Weapon,false) UIUtils.SetActive(self.btn_WeaponLoc,false) end if CTL.TreasureLibrary.CheckUnlock() then self.btn_Treasure:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Treasure)) self.btn_TreasureLoc:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Treasure)) else UIUtils.SetActive(self.btn_Treasure,false) UIUtils.SetActive(self.btn_TreasureLoc,false) end if CTL.HorseLibrary.CheckUnlock() then self.btn_Horse:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Horse)) self.btn_HorseLoc:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_Horse)) else UIUtils.SetActive(self.btn_Horse,false) UIUtils.SetActive(self.btn_HorseLoc,false) end if CTL.GodBeastLibrary.CheckUnlock() then self.btn_MythicalAnimals:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_GodBeast)) self.btn_MythicalAnimalsLoc:SetRedPoint(isRp(CTL.RedPoint.RedPointKey.Library_GodBeast)) else UIUtils.SetActive(self.btn_MythicalAnimals,false) UIUtils.SetActive(self.btn_MythicalAnimalsLoc,false) end end function UIIllustratedMainPanel:RefreshLibraryInRp() local showChangeIn = CTL.StratagemLibrary.CheckUnlock() or CTL.PlotReviewLibrary.CheckUnlock() UIUtils.SetActive(self.btn_ChangeIn, showChangeIn) if not showChangeIn then return end local isRp = CTL.RedPoint.GetRedPointActive if CTL.StratagemLibrary.CheckUnlock() and isRp(CTL.RedPoint.RedPointKey.Library_Stratagem) then self.btn_ChangeIn:SetRedPoint(true) return end if CTL.PlotReviewLibrary.CheckUnlock() and isRp(CTL.RedPoint.RedPointKey.Library_PlotReview) then self.btn_ChangeIn:SetRedPoint(true) return end if CTL.EffectLibrary.CheckUnlock() and isRp(CTL.RedPoint.RedPointKey.Library_LightEffect) then self.btn_ChangeIn:SetRedPoint(true) return end if CTL.DyeLibrary.CheckUnlock() and isRp(CTL.RedPoint.RedPointKey.Library_Dye) then self.btn_ChangeIn:SetRedPoint(true) return end if CTL.AppearanceLibrary.CheckUnlock() and isRp(CTL.RedPoint.RedPointKey.Library_Appearance) then self.btn_ChangeIn:SetRedPoint(true) return end self.btn_ChangeIn:SetRedPoint(false) end function UIIllustratedMainPanel:OnClosed() UIManager.ActiveUIModle(true, "UIIllustratedMainPanel") end return UIIllustratedMainPanel