local EventSystem = require('Event/EventSystem') local Tips_Controller = {} local private = {} local UICommonSkillTips = require "View/Common/UICommonSkillTips" local UITalentSkillTips = require "View/Common/UITalentSkillTips" local type = type Tips_Controller.SkillType = { ActiveSkill = 1, PassiveSkill = 2, DevelopEffect = 3, Buff = 4, ConstantBuff = 5, BuildingSkill = 6, } Tips_Controller.RelationPanelType = { TreasureRelation = 1, HorseRelation = 2, } Tips_Controller.TalentType = { HeroStarTalent = 1, AppearanceTalent = 2, HeroAwakenTalent = 3, } function Tips_Controller.OnStartup() EventSystem.Regist(EventID.UI_AddTipsMsg, Tips_Controller.AddTipsMsg) EventSystem.Regist(EventID.UIBattle_BattlePropUptoMax, Tips_Controller.OnBattlePropUptoMax) end function Tips_Controller.OnShutdown() end function Tips_Controller.OnBattlePropUptoMax(btnIndex) CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_196_WarnCode_DrawStraws_MaxItem) end --后续 function Tips_Controller.AddTipsMsgAndPlaySound(tipIds, formatParam, ...) Tips_Controller.AddTipsMsg(tipIds, formatParam, ...) CTL.Sound.PlayGameSound("UI_invalid") end function Tips_Controller.AddTipsMsg(tipIds, formatParam, ...) -- 处理有无参数情况下的信息文本 if formatParam then local tipMsg if type(tipIds) == "string" then tipMsg = string.format(tipIds, formatParam, ...) elseif tipIds > 0 then tipMsg = string.FormatByIdsId(tipIds, formatParam, ...) end if tipMsg then MDL.Tips.InsertTipsMsg(tipMsg, MDL.Tips.TipsType.FormatText) end else if type(tipIds) == "string" then MDL.Tips.InsertTipsMsg(tipIds, MDL.Tips.TipsType.Text) elseif tipIds > 0 then MDL.Tips.InsertTipsMsg(tipIds, MDL.Tips.TipsType.SingleIDS) end end Tips_Controller.OpenOrRecover() end -- 增加有图片的tips消息信息 function Tips_Controller.AddImageTip(itemId, itemCount, extraDesc) if itemCount <= 0 then return end local itemData = DataSheetManager.ItemData:GetDataByID(itemId) local colorText = UTL.Color.FormatQualityText(UTL.Item.GetItemDataSpliceByType(itemId).Name, itemData.Color) MDL.Tips.InsertTipsMsg({Name = colorText, Id = itemId, Count = itemCount, ExtraDesc = extraDesc}, MDL.Tips.TipsType.Item) Tips_Controller.OpenOrRecover() end function Tips_Controller.OpenOrRecover() if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITipsPanel) then UIManager.OpenView(Const_UI_Lua.UIEnum.UITipsPanel) else EventSystem.Dispatch(EventID.UI_Tips_RecoverUpdate) end end function Tips_Controller.ClearTipsObj() if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITipsPanel) then EventSystem.Dispatch(EventID.UI_Tips_ClearQueue) end end function Tips_Controller.AddSpecialTipsMsg(tipIds, formatParam, ...) -- 处理有无参数情况下的信息文本 if formatParam then local tipMsg if type(tipIds) == "string" then tipMsg = string.format(tipIds, formatParam, ...) elseif tipIds > 0 then tipMsg = string.FormatByIdsId(tipIds, formatParam, ...) end if tipMsg then MDL.Tips.InsertSpecialTipsMsg(tipMsg, MDL.Tips.TipsType.FormatText) end else if type(tipIds) == "string" then MDL.Tips.InsertSpecialTipsMsg(tipIds, MDL.Tips.TipsType.Text) elseif tipIds > 0 then MDL.Tips.InsertSpecialTipsMsg(tipIds, MDL.Tips.TipsType.SingleIDS) end end Tips_Controller.RecoverSpecialTips() end function Tips_Controller.RecoverSpecialTips() EventSystem.Dispatch(EventID.UI_SpecialTips_RecoverUpdate) end function Tips_Controller.OpenTalentTips(parentRoot, heroId, talentId, talentType, extraData) parentRoot:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UITalentSkillTips), {talentId = talentId, parentTf = parentRoot.transform, heroId = heroId, talentType = talentType, extraData = extraData}) end function Tips_Controller.OpenTalentTipsPreview(isMax, parentRoot, heroId, talentId, appearanceData) parentRoot:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UITalentSkillTipsPreview), {talentId = talentId, parentTf = parentRoot.transform, heroId = heroId, appearanceData = appearanceData, isMax = isMax}, "Common/UITalentSkillTips") end function Tips_Controller.OpenHeroSkillTips(parentRoot, heroId, skillId, isAwaken) parentRoot:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIHeroSkillTips), { heroId = heroId, skillId = skillId, isAwaken = isAwaken }, Const_UI_Lua.UIEnum.UITalentSkillTips, Const_UI_Lua.UIEnum.UIHeroSkillTips) end function Tips_Controller.OpenHeroSkillTipsPreview(isMax, parentRoot, heroId, skillId, isAwaken) parentRoot:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIHeroSkillTipsPreview), {heroId = heroId, skillId = skillId, isMax = isMax, isAwaken = isAwaken}, "Common/UITalentSkillTips") end function Tips_Controller.OpenSkillTips(id, parentRoot, skillType, isLock, heroId) parentRoot:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UISkillTips), {skillId = id, parentTf = parentRoot.transform, isLock = isLock, skillType = skillType, heroId = heroId}) end function Tips_Controller.CloseSkillTips(parentRoot) parentRoot:CloseView(Const_UI_Lua.UIEnum.UISkillTips) end function Tips_Controller.CloseTalentTips(parentRoot) parentRoot:CloseView(Const_UI_Lua.UIEnum.UITalentSkillTips) end function Tips_Controller.AddHelpTips(str) if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIHelpTipsPanel) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIHelpTipsPanel) end EventSystem.Dispatch(EventID.UI_AddHelpTips, str) end -- 交换武将位置 判断是否有羁绊效果 function Tips_Controller.ShowChangeHeroRelationPanel(oldHero, curHero) if oldHero == curHero then return end -- 如果两个交换英雄一致,则维持现状 CTL.Treasure.PushTreasureRelationActiveShow(oldHero) CTL.Treasure.PushTreasureRelationActiveShow(curHero) CTL.WarHorse.PushHorseRelationActiveShow(oldHero) CTL.WarHorse.PushHorseRelationActiveShow(curHero) Tips_Controller.PopRelationShowPanel() end function Tips_Controller.PopRelationShowPanel() local arr = MDL.Tips.RelationShowUpPanelQueue if #arr> 0 then local panelInfo = table.remove(arr, 1) if panelInfo.RelationPanelType == Tips_Controller.RelationPanelType.TreasureRelation then UIManager.OpenView(Const_UI_Lua.UIEnum.UITreasureRelationActivePopUp, {treasureID = panelInfo.treasureID, heroID = panelInfo.heroID}) elseif panelInfo.RelationPanelType == Tips_Controller.RelationPanelType.HorseRelation then UIManager.OpenView(Const_UI_Lua.UIEnum.UIWarHorseRelationActivePopUp, { HorseID = panelInfo.horseID, HeroID = panelInfo.heroID }) end end end return Tips_Controller