local EventSystem = require'Event/EventSystem' local Base = require("Battle/Expression/ExpLevel/ExpLevelFunction/ExpSyncGuildWarBaseLevelFunction") local ExpSyncGuildWarMapResourcesLevelFunction = class("ExpSyncGuildWarMapResourcesLevelFunction",Base) local HandInTipsAmount = DataSheetManager.ConstData:GetDataByID("GuildWarMaterialCriticality").IntValue --弹提示上交物资tips的最小资源数量 local EStatisticType = LuaConst.EStatisticType function ExpSyncGuildWarMapResourcesLevelFunction:OnInitLevel() Base.OnInitLevel(self) end function ExpSyncGuildWarMapResourcesLevelFunction:RefreshResourceScoreUI(entity) local resAmount = self.levelFunction:GetResourceAmountOfPlayer(entity:GetPlayerID()) entity.ExpEntity:SetModelUIResScore(resAmount, self.levelFunction:IsResAmountReachLimit(resAmount)) end function ExpSyncGuildWarMapResourcesLevelFunction:OnHeroBorn(entity) self:RefreshResourceScoreUI(entity) end function ExpSyncGuildWarMapResourcesLevelFunction:OnSwitchHero(fromEntity, toEntity) Base.OnSwitchHero(self, fromEntity, toEntity) self:RefreshResourceScoreUI(toEntity) end local EPlayerResAmountChangeEventEntityType = { interactDoer = "interactDoer", touch = "touch", } local GUILDWAR_TIPS_TYPE_SCORE = 3 function ExpSyncGuildWarMapResourcesLevelFunction:OnPlayerResourceAmountChange(entity, delta, eventEntityType) self:RefreshResourceScoreUI(entity) if entity:IsPlayerSelf() then if LevelManager.CurLevelFunc:IsEntityResAmountReachLimit(entity) then EventSystem.Dispatch(EventID.UI_GuildWarTips_Help,"IDS_GuildWar_BattleHelpText9") else if delta > 0 then if eventEntityType == EPlayerResAmountChangeEventEntityType.interactDoer then EventSystem.Dispatch(EventID.UI_GuildWarTips_InteractGetRes, delta) elseif eventEntityType == EPlayerResAmountChangeEventEntityType.touch then EventSystem.Dispatch(EventID.UI_GuildWarTips_TouchGetRes, delta) end local resAmount = self.levelFunction:GetResourceAmountOfPlayer(entity:GetPlayerID()) if resAmount >= HandInTipsAmount then EventSystem.Dispatch(EventID.UI_ShowGuildWarTips, Const_IDS["IDS_GuildWar_SupportAllyInfoCode"], GUILDWAR_TIPS_TYPE_SCORE) else EventSystem.Dispatch(EventID.UI_CloseGuildWarTips, GUILDWAR_TIPS_TYPE_SCORE) end EventSystem.Dispatch(EventID.UI_GuildWarResourceScoreChange) else EventSystem.Dispatch(EventID.UI_CloseGuildWarTips, GUILDWAR_TIPS_TYPE_SCORE) end end end end function ExpSyncGuildWarMapResourcesLevelFunction:OnHandInResource(entity, amount) if entity:IsPlayerSelf() then EventSystem.Dispatch(EventID.UI_GuildWarTips_HandInRes, amount) end end function ExpSyncGuildWarMapResourcesLevelFunction:OnDropResourceAmountOfPlayer(entity, playerID, delta) if entity:IsPlayerSelf() then EventSystem.Dispatch(EventID.UI_GuildWarTips_DropRes, delta ~= 0 and -delta or 0) end end return ExpSyncGuildWarMapResourcesLevelFunction