diff --git a/MY_Cataclysm/src/MY_CataclysmMain.lua b/MY_Cataclysm/src/MY_CataclysmMain.lua index 240fc4dd3..079f387d5 100644 --- a/MY_Cataclysm/src/MY_CataclysmMain.lua +++ b/MY_Cataclysm/src/MY_CataclysmMain.lua @@ -48,11 +48,15 @@ local function InsertBuffListCache(aBuffList, szVia, nViaPriority) for iid, aList in pairs(BUFF_LIST) do if iid == id or (tab.szName and type(iid) == 'number' and Table_GetBuffName(iid, 1) == tab.szName) then for i, p in X.ipairs_r(aList) do - if (not tab.nLevel or p.nLevel == tab.nLevel) - and (not tab.szStackOp or p.szStackOp == tab.szStackOp) - and (not tab.nStackNum or p.nStackNum == tab.nStackNum) - and (not tab.bOnlyMe or p.bOnlyMe == tab.bOnlyMe) - and (not tab.bOnlyMine or p.bOnlyMine == tab.bOnlyMine) then + if (not tab.nLevel or tab.nLevel == p.nLevel) + and (not tab.szStackOp or tab.szStackOp == p.szStackOp) + and (not tab.nStackNum or tab.nStackNum == p.nStackNum) + and (not tab.nPriority or tab.nPriority == p.nPriority) + and (not tab.bOnlyMe == not p.bOnlyMe) + and (not tab.bOnlyMine == not p.bOnlyMine) + and (not tab.bCaution == not p.bCaution) + and (not tab.bAttention == not p.bAttention) + and (not tab.bScreenHead == not p.bScreenHead) then table.remove(aList, i) end end @@ -111,6 +115,8 @@ local function UpdateTeamMonData() v.nLevel = data.nLevel end v.nIcon = data.nIcon + v.szDisplay = v.szDisplay or data.szDisplay + v.szDisplay = v.szDisplay and X.RenderTemplateString(v.szDisplay, nil, -1, false, false) table.insert(aBuff, v) end end diff --git a/MY_Cataclysm/src/MY_CataclysmParty.lua b/MY_Cataclysm/src/MY_CataclysmParty.lua index 1a0f473d7..93649ef45 100644 --- a/MY_Cataclysm/src/MY_CataclysmParty.lua +++ b/MY_Cataclysm/src/MY_CataclysmParty.lua @@ -1725,7 +1725,7 @@ function D.UpdateCharaterBuff(p, handle, tKeep) local szCountdownKey = 'MY_CATACLYSM_' .. tBuff.dwID .. '_' .. tRule.szKey FireUIEvent('MY_LIFEBAR_COUNTDOWN', dwCharID, 'BUFF', szCountdownKey, { dwBuffID = tBuff.dwID, - szText = tBuff.szName, + szText = tRule.szDisplay or tBuff.szName, nLogicFrame = tBuff.nEndFrame, col = tRule.colScreenHead or tRule.col, nPriority = tItem.nPriority, diff --git a/MY_LifeBar/src/MY_LifeBar.lua b/MY_LifeBar/src/MY_LifeBar.lua index c683d3495..7366b5a47 100644 --- a/MY_LifeBar/src/MY_LifeBar.lua +++ b/MY_LifeBar/src/MY_LifeBar.lua @@ -206,6 +206,7 @@ X.RegisterEvent('PARTY_UPDATE_BASE_INFO', 'MY_LifeBar', onPartySetMark) local function onLoadingEnd() OVERWRITE_TITLE_EFFECT = {} + COUNTDOWN_CACHE = {} -- 清除缓存,防止不同地图分配相同ID,造成染色污染 end X.RegisterEvent('LOADING_END', onLoadingEnd) end diff --git a/MY_LifeBar/src/MY_LifeBar_Official.lua b/MY_LifeBar/src/MY_LifeBar_Official.lua index de0496cc2..d7ef55dcf 100644 --- a/MY_LifeBar/src/MY_LifeBar_Official.lua +++ b/MY_LifeBar/src/MY_LifeBar_Official.lua @@ -289,11 +289,21 @@ local settings = { MY_LifeBar_Official = X.CreateModule(settings) end +-------------------------------------------------------------------------------- +-- 事件注册 +-------------------------------------------------------------------------------- + X.RegisterEvent({'PLAYER_ENTER_SCENE', 'NPC_ENTER_SCENE'}, 'MY_LifeBar_Official', function() local dwID = arg0 X.DelayCall(function() ApplyCaption(dwID) end) X.DelayCall(200, function() ApplyCaption(dwID) end) X.DelayCall(500, function() ApplyCaption(dwID) end) end) +X.RegisterEvent('LOADING_END', 'MY_LifeBar_Official', function() + for dwID, _ in pairs(COUNTDOWN_CACHE) do + ResetCaption(dwID) + end + COUNTDOWN_CACHE = {} +end) --[[#DEBUG BEGIN]]X.ReportModuleLoading(MODULE_PATH, 'FINISH')--[[#DEBUG END]] diff --git a/MY_LifeBar/src/MY_LifeBar_ScreenArrow.lua b/MY_LifeBar/src/MY_LifeBar_ScreenArrow.lua index 936d010da..04194ad2d 100644 --- a/MY_LifeBar/src/MY_LifeBar_ScreenArrow.lua +++ b/MY_LifeBar/src/MY_LifeBar_ScreenArrow.lua @@ -877,7 +877,11 @@ X.BreatheCall('MY_LifeBar_ScreenArrow', D.OnBreathe) X.RegisterEvent('FIGHT_HINT', 'MY_LifeBar_ScreenArrow', D.RegisterFight) X.RegisterEvent('LOGIN_GAME', 'MY_LifeBar_ScreenArrow', D.Init) X.RegisterEvent('UI_SCALED' , 'MY_LifeBar_ScreenArrow', SetUIScale) - +X.RegisterEvent('LOADING_END', 'MY_LifeBar_ScreenArrow', function() + CACHE[TARGET.NPC] = {} + CACHE[TARGET.PLAYER] = {} + CACHE[TARGET.DOODAD] = {} +end) X.RegisterUserSettingsInit('MY_LifeBar_ScreenArrow', function() D.bReady = true end) diff --git a/MY_TeamMon/src/MY_TeamMon.lua b/MY_TeamMon/src/MY_TeamMon.lua index bda48d822..ac963d139 100644 --- a/MY_TeamMon/src/MY_TeamMon.lua +++ b/MY_TeamMon/src/MY_TeamMon.lua @@ -121,6 +121,8 @@ end -- 核心优化变量 local MY_TEAM_MON_CORE_PLAYERID = 0 local MY_TEAM_MON_CORE_NAME = 0 +local MY_TEAM_MON_MEMBER_CACHE = {} +local MY_TEAM_MON_MEMBER_ID_MAP = {} local MY_TEAM_MON_MAX_INTERVAL = 300 local MY_TEAM_MON_MAX_CACHE = 3000 -- 最大的cache数量 主要是UI的问题 @@ -410,10 +412,12 @@ local function ParseCountdown(szCountdown) local nTime = tonumber(aParams[1]) local szContent = aParams[2] local szVoice + local nIcon, nFrame local szParam, bUnknownParam, bParamRecognized for i = 3, #aParams do szParam = aParams[i] bParamRecognized = false + -- 解析语音 if not szVoice and not bParamRecognized then if szParam:sub(1, 3) == 'VO:' or szParam:sub(1, 3) == 'VC:' then @@ -421,15 +425,31 @@ local function ParseCountdown(szCountdown) bParamRecognized = true end end + -- 解析图标 + if not nIcon and not bParamRecognized then + if szParam:sub(1, 6) == 'nIcon:' then + nIcon = tonumber(szParam:sub(7)) + bParamRecognized = true + end + end + -- 解析背景色 + if not nFrame and not bParamRecognized then + if szParam:sub(1, 7) == 'nFrame:' then + nFrame = tonumber(szParam:sub(8)) + bParamRecognized = true + end + end if not bParamRecognized then bUnknownParam = true end end - if nTime and szContent and nTime and szContent ~= '' and not bUnknownParam then + if nTime and szContent and szContent ~= '' and not bUnknownParam then table.insert(aCountdown, { nTime = nTime, szContent = szContent, szVoice = szVoice, + nIcon = nIcon, + nFrame = nFrame, }) bPartError = false end @@ -469,10 +489,12 @@ local function ParseHPCountdown(szString) local szContent = aParams[2] local nTime local szVoice + local nIcon, nFrame local szParam, bUnknownParam, bParamRecognized for i = 3, #aParams do szParam = aParams[i] bParamRecognized = false + -- 解析语音 if not szVoice and not bParamRecognized then if szParam:sub(1, 3) == 'VO:' or szParam:sub(1, 3) == 'VC:' then @@ -486,6 +508,20 @@ local function ParseHPCountdown(szString) bParamRecognized = true end end + -- 解析图标 + if not nIcon and not bParamRecognized then + if szParam:sub(1, 6) == 'nIcon:' then + nIcon = tonumber(szParam:sub(7)) + bParamRecognized = true + end + end + -- 解析背景色 + if not nFrame and not bParamRecognized then + if szParam:sub(1, 7) == 'nFrame:' then + nFrame = tonumber(szParam:sub(8)) + bParamRecognized = true + end + end if not bParamRecognized then bUnknownParam = true end @@ -497,6 +533,8 @@ local function ParseHPCountdown(szString) szContent = szContent, nTime = nTime, szVoice = szVoice, + nIcon = nIcon, + nFrame = nFrame, }) bPartError = false end @@ -517,6 +555,11 @@ local function ParseHPCountdown(szString) return X.Clone(CACHE.HP_CD_STR[szString][1]), CACHE.HP_CD_STR[szString][2] end +-- 判断是否为队友ID +local function IsTeamMemberID(dwID) + return dwID and MY_TEAM_MON_MEMBER_ID_MAP and MY_TEAM_MON_MEMBER_ID_MAP[dwID] +end + function D.OnFrameCreate() this:RegisterEvent('MY_TEAM_MON_LOADING_END') this:RegisterEvent('MY_TEAM_MON_CREATE_CACHE') @@ -699,7 +742,10 @@ function D.OnEvent(szEvent) elseif szEvent == 'LOADING_END' or szEvent == 'MY_TEAM_MON_CREATE_CACHE' or szEvent == 'MY_TEAM_MON_LOADING_END' then D.FireCrossMapEvent('before') D.CreateData(szEvent) + D.OnTeamEvent(szEvent) X.DelayCall('MY_TeamMon__FireCrossMapEvent__after', D.FireCrossMapEvent, 'after') + elseif szEvent == 'PARTY_ADD_MEMBER' or szEvent == 'PARTY_DELETE_MEMBER' or szEvent == 'PARTY_DISBAND' then + D.OnTeamEvent(szEvent) end end @@ -875,7 +921,7 @@ function D.CreateData(szEvent) if v.szContent then if v.szContent:find('{$me}') or v.szContent:find('{$team}') or v.bSearch or v.bReg then -- 具有通配符和搜索标记的数据不作 HIT 高速匹配策略考虑 table.insert(cache.OTHER, v) - elseif not cache.HIT[v.szContent] then -- 按照数据优先级顺序(地图>地图组>通用),同级按照下标先后顺序,只取第一个匹配结果 + elseif not (cache.HIT[v.szContent] and cache.HIT[v.szContent][v.szTarget or 'sys']) then -- 按照数据优先级顺序(地图>地图组>通用),同级按照下标先后顺序,只取第一个匹配结果 cache.HIT[v.szContent] = cache.HIT[v.szContent] or {} cache.HIT[v.szContent][v.szTarget or 'sys'] = v end @@ -1035,10 +1081,14 @@ function D.CountdownEvent(data, nClass, szSender, szReceiver, aBackreferences) nIcon = v.nIcon or data.nIcon or 340, nFrame = v.nFrame, szContent = FilterCustomText(v.szName or data.szName, szSender, szReceiver, aBackreferences), + szRawName = v.szName or data.szName, nTime = v.nTime, nRefresh = v.nRefresh, bTalk = v.bTeamChannel, bHold = v.bHold, + szVoice = v.szVoice, + nNewtime = v.nNewtime, + bHoldFrame = v.bHoldFrame, } D.FireCountdownEvent(nType, szKey, tParam, szSender, szReceiver, aBackreferences) end @@ -1071,7 +1121,7 @@ function D.OnBuff(dwOwner, bDelete, bCanCancel, dwBuffID, nCount, nBuffLevel, dw if MY_TEAM_MON_SHIELDED_TOTAL then return end - if MY_TEAM_MON_SHIELDED_OTHER_PLAYER and X.IsPlayer(dwSkillSrcID) and dwSkillSrcID ~= MY_TEAM_MON_CORE_PLAYERID then + if MY_TEAM_MON_SHIELDED_OTHER_PLAYER and X.IsPlayer(dwSkillSrcID) and dwSkillSrcID ~= MY_TEAM_MON_CORE_PLAYERID and not IsTeamMemberID(dwSkillSrcID) then return end local szType = bCanCancel and 'BUFF' or 'DEBUFF' @@ -1737,18 +1787,46 @@ function D.OnCallMessage(szEvent, szContent, dwNpcID, szNpcName) dwReceiverID, szReceiver = nil end if bInParty and content:find('{$team}', nil, true) then - local c = content - for _, vv in ipairs(team.GetTeamMemberList()) do - if string.find(szContent, c:gsub('{$team}', team.GetClientTeamMemberName(vv)), nil, true) and (v.szTarget == szNpcName or v.szTarget == '%') then -- hit - data = v - dwReceiverID = vv - szReceiver = team.GetClientTeamMemberName(vv) + if v.bReg then + -- 正则模式(带{$team}):逆向排除,先遍历成员名,替换为{$team},不替换为空防止破坏位置约束,若替换成功,说明命中,再正则匹配剩余的内容,如此只用一次正则,节约性能 + local nHitMemberID, szHitMemberName, szProcessedContent + -- 获取正则{$team}数量,决定后续成员名替换为{$team}次数 + local _, nTeamCount = content:gsub('{$team}', '{$team}') + for _, member in ipairs(MY_TEAM_MON_MEMBER_CACHE) do + local szHitContent, nHitCount = string.gsub(szContent, member.szName, '{$team}', nTeamCount) + if nHitCount > 0 then + nHitMemberID = member.dwID + szHitMemberName = member.szName + szProcessedContent = szHitContent + break + end + end + if nHitMemberID and szHitMemberName then + local res = {string.find(szProcessedContent, content)} + if res[1] then + table.remove(res, 1) + table.remove(res, 1) + data = v + aBackreferences = res + dwReceiverID = nHitMemberID + szReceiver = szHitMemberName + break + end + end + else + local c = content + for _, vv in ipairs(team.GetTeamMemberList()) do + if string.find(szContent, c:gsub('{$team}', team.GetClientTeamMemberName(vv)), nil, true) and (v.szTarget == szNpcName or v.szTarget == '%') then -- hit + data = v + dwReceiverID = vv + szReceiver = team.GetClientTeamMemberName(vv) + break + end + end + if dwReceiverID and szReceiver then break end end - if dwReceiverID and szReceiver then - break - end elseif v.szTarget == szNpcName or v.szTarget == '%' then if v.bReg then local res = {string.find(szContent, content)} @@ -2011,10 +2089,54 @@ function D.FireCrossMapEvent(szWhen) D.OnCallMessage(szEvent, szContent) end MAP_ID = dwMapID + + -- 组队模式下过图后系统没有推送BUFF刷新事件,这里手动补发一下,以后修复了再删除 + local me = X.GetClientPlayer() + if me then + if me.IsInParty() then + for _, tBuff in X.ipairs_c(X.GetBuffList(me)) do + D.OnBuff(me.dwID, false, tBuff.bCanCancel, tBuff.dwID, tBuff.nStackNum, tBuff.nLevel, tBuff.dwSkillSrcID) + end + end + end end end end +-- 团队成员事件 刷新团队成员排序缓存 +function D.OnTeamEvent(szEvent) + local me = X.GetClientPlayer() + if not me then + return + end + local tMemberID = {} + local tMemberList = {} + if me.IsInParty() then + local team = GetClientTeam() + if team then + for _, vv in ipairs(team.GetTeamMemberList()) do + local tMemberData = { + dwID = vv, + szName = team.GetClientTeamMemberName(vv) + } + tMemberID[vv] = tMemberData + table.insert(tMemberList, tMemberData) + end + table.sort(tMemberList, function(a, b) return #a.szName > #b.szName end) + end + end + if #tMemberList == 0 then + local tMemberData = { + dwID = MY_TEAM_MON_CORE_PLAYERID, + szName = MY_TEAM_MON_CORE_NAME + } + tMemberID[MY_TEAM_MON_CORE_PLAYERID] = tMemberData + table.insert(tMemberList, tMemberData) + end + MY_TEAM_MON_MEMBER_CACHE = tMemberList + MY_TEAM_MON_MEMBER_ID_MAP = tMemberID +end + -- RegisterMsgMonitor function D.RegisterMessage(bEnable) if bEnable then diff --git a/MY_TeamMon/src/MY_TeamMon_BuffList.lua b/MY_TeamMon/src/MY_TeamMon_BuffList.lua index a091771fa..036042f32 100644 --- a/MY_TeamMon/src/MY_TeamMon_BuffList.lua +++ b/MY_TeamMon/src/MY_TeamMon_BuffList.lua @@ -130,6 +130,8 @@ function D.OnEvent(szEvent) D.UpdateAnchor(this) elseif szEvent == 'ON_ENTER_CUSTOM_UI_MODE' or szEvent == 'ON_LEAVE_CUSTOM_UI_MODE' then UpdateCustomModeWindow(this, _L['Buff list']) + elseif szEvent == 'LOADING_END' then + D.handle:Clear() end end function D.OnItemMouseEnter() diff --git a/MY_TeamMon/src/MY_TeamMon_SpellTimer.lua b/MY_TeamMon/src/MY_TeamMon_SpellTimer.lua index ef30d76fe..ee777941c 100644 --- a/MY_TeamMon/src/MY_TeamMon_SpellTimer.lua +++ b/MY_TeamMon/src/MY_TeamMon_SpellTimer.lua @@ -112,6 +112,11 @@ local function CreateCountdown(nType, szKey, tParam, szSender, szReceiver, aBack tTime = { nTime = tParam.nTime, szContent = tParam.szContent, + szRawName = tParam.szRawName, + nIcon = tParam.nIcon, + nFrame = tParam.nFrame, + szVoice = tParam.szVoice, + bHoldFrame = tParam.bHoldFrame, } elseif X.IsString(tParam.nTime) then local aCountdown = ParseCountdown(tParam.nTime, szSender, szReceiver, aBackreferences) @@ -152,13 +157,70 @@ local function CreateCountdown(nType, szKey, tParam, szSender, szReceiver, aBack end elseif tTime.nTime == -2 then ST_TIME_EXPIRE[nType][szKey] = nTime + (tParam.nRefresh or 0) * 1000 - 3 + elseif tTime.nTime == -3 then + -- 修改计时条属性 + local ui = ST_CACHE[nType][szKey] + if ui and ui:IsValid() then + if tParam.nRefresh then + ST_TIME_EXPIRE[nType][szKey] = nTime + tParam.nRefresh * 1000 - 3 + end + local tRefs = ui.tBackreferences or aBackreferences or {} + if tParam.nNewTime and X.IsString(tParam.nNewTime) then + local aCountdown = ParseCountdown(tParam.nNewTime, tRefs.szSender or szSender, tRefs.szReceiver or szReceiver, tRefs.aBackreferences or aBackreferences) + if aCountdown then + ui.countdown = aCountdown + ui.nCreate = nTime + ui.nLeft = nTime + tTime = aCountdown[1] + tParam.nRefresh = tParam.nRefresh or aCountdown[#aCountdown].nTime - 3 + ST_TIME_EXPIRE[nType][szKey] = nTime + (tParam.nRefresh or 0) * 1000 + ui.obj:SetInfo(tTime, tTime.nIcon or tParam.nIcon) + end + + elseif tParam.nNewTime and X.IsNumber(tParam.nNewTime) and tParam.nNewTime > 0 then + ui.countdown = tParam.nNewTime -- 改成数字,OnFrameBreathe 走单段逻辑 + ui.nCreate = nTime + ui.nLeft = nTime + local szNewContent = (tParam.szRawName ~= '' and tParam.szRawName) + if szNewContent then + szNewContent = FilterCustomText(szNewContent, tRefs.szSender or szSender, tRefs.szReceiver or szReceiver, tRefs.aBackreferences or aBackreferences) + end + tTime.nTime = tParam.nNewTime + tTime.szContent = szNewContent + ui.obj:SetInfo(tTime, tParam.nIcon) + end + else + if MY_TeamMon.bPushVoiceAlarm and tTime.szVoice then + FireUIEvent('MY_TEAM_MON__VOICE_ALARM', tTime.szVoice) + end + end + elseif tTime.nTime == -4 then + -- 冻结计时条 + local ui = ST_CACHE[nType][szKey] + if ui and ui:IsValid() then + ui.bPaused = true + ui.nPauseTime = nTime + end + elseif tTime.nTime == -5 then + -- 恢复计时条 + local ui = ST_CACHE[nType][szKey] + if ui and ui:IsValid() and ui.bPaused then + local nPauseDuration = nTime - ui.nPauseTime + ui.nCreate = ui.nCreate + nPauseDuration -- 顺延创建时间 + ui.nLeft = ui.nLeft + nPauseDuration -- 顺延当前段起点 + if ST_TIME_EXPIRE[nType][szKey] then + ST_TIME_EXPIRE[nType][szKey] = ST_TIME_EXPIRE[nType][szKey] + nPauseDuration + end + ui.bPaused = false + end else local nExpire = ST_TIME_EXPIRE[nType][szKey] if nExpire and nExpire > nTime then return end + local tBackreferences = {szSender = szSender, szReceiver = szReceiver, aBackreferences = aBackreferences} ST_TIME_EXPIRE[nType][szKey] = nTime + (tParam.nRefresh or 0) * 1000 - ST:ctor(nType, szKey, tParam):SetInfo(tTime, tParam.nIcon or 13):Switch(false) + ST:ctor(nType, szKey, tParam, tBackreferences):SetInfo(tTime, tTime.nIcon or tParam.nIcon or 13):Switch(false) end end @@ -173,6 +235,7 @@ function D.OnFrameCreate() D.hItem = this:CreateItemData(ST_INI_FILE, 'Handle_Item') D.UpdateAnchor(this) D.handle = this:Lookup('', 'Handle_List') + D.handle:SetIgnoreInvisibleChild(true) -- 排版时跳过隐藏的子组件 end function D.OnEvent(szEvent) @@ -214,12 +277,21 @@ local function SetSTAction(ui, nLeft, nPer) local me = X.GetClientPlayer() local obj = ui.obj if nLeft < 5 then - local nTimeLeft = nLeft * 1000 % 1000 - local nAlpha = 255 * nTimeLeft / 1000 - if math.floor(nLeft / 1) % 2 == 1 then - nAlpha = 255 - nAlpha + if ui.bHoldFrame then + if ui.nAlpha < ST_UI_ALPHA then + ui.nAlpha = math.min(ST_UI_ALPHA, ui.nAlpha + 15) + obj:SetInfo({ nTime = nLeft }):SetPercentage(nPer):SetAlpha(ui.nAlpha) + else + obj:SetInfo({ nTime = nLeft }):SetPercentage(nPer) + end + else + local nTimeLeft = nLeft * 1000 % 1000 + local nAlpha = 255 * nTimeLeft / 1000 + if math.floor(nLeft / 1) % 2 == 1 then + nAlpha = 255 - nAlpha + end + obj:SetInfo({ nTime = nLeft }):SetPercentage(nPer):Switch(true):SetAlpha(100 + nAlpha) end - obj:SetInfo({ nTime = nLeft }):SetPercentage(nPer):Switch(true):SetAlpha(100 + nAlpha) if ui.bTalk and me.IsInParty() then if not ui.szTalk or ui.szTalk ~= math.floor(nLeft) then ui.szTalk = math.floor(nLeft) @@ -242,7 +314,7 @@ function D.OnFrameBreathe() local nNow = GetTime() for k, v in pairs(ST_CACHE) do for kk, vv in pairs(v) do - if vv:IsValid() then + if vv:IsValid() and not vv.bPaused then if type(vv.countdown) == 'number' then local nLeft = vv.countdown - ((nNow - vv.nLeft) / 1000) if nLeft >= 0 then @@ -282,7 +354,7 @@ function D.UpdateAnchor(frame) end -- 构造函数 -function ST:ctor(nType, szKey, tParam) +function ST:ctor(nType, szKey, tParam, tBackreferences) if not ST_CACHE[nType] then return end @@ -300,6 +372,9 @@ function ST:ctor(nType, szKey, tParam) oo.ui.nRefresh = tParam.nRefresh or 1 oo.ui.bTalk = tParam.bTalk oo.ui.nFrame = tParam.nFrame + oo.ui.bHold = tParam.bHold + oo.ui.bHoldFrame = tParam.bHoldFrame + oo.ui.tBackreferences = tBackreferences or oo.ui.tBackreferences else -- 没有ui的情况下 创建 oo = {} setmetatable(oo, self) @@ -312,6 +387,8 @@ function ST:ctor(nType, szKey, tParam) oo.ui.bTalk = tParam.bTalk oo.ui.nFrame = tParam.nFrame oo.ui.bHold = tParam.bHold + oo.ui.bHoldFrame = tParam.bHoldFrame + oo.ui.tBackreferences = tBackreferences -- 杂项 oo.ui.nAlpha = 30 -- ui @@ -349,10 +426,36 @@ function ST:SetInfo(tTime, nIcon) ) self.ui:SetUserData(math.floor(tTime.nTime)) end - if nIcon then + -- 修改倒计时条图标 + if nIcon or tTime.nIcon then local box = self.ui:Lookup('Box') box:SetObject(UI_OBJECT_NOT_NEED_KNOWN) - box:SetObjectIcon(nIcon) + box:SetObjectIcon(tTime.nIcon or nIcon) + end + -- 修改倒计时条背景色,设置背景框与显隐,-2隐藏背景、阴影、特效,-3隐藏背景、时间、阴影、特效,-4全隐藏 + local nFrame = tTime.nFrame or self.ui.nFrame + if nFrame == -2 then + self.ui:Show() + self.ui.img:Hide() + self.ui.sha:Hide() + self.ui.sfx:Hide() + elseif nFrame == -3 then + self.ui:Show() + self.ui.img:Hide() + self.ui.sha:Hide() + self.ui.sfx:Hide() + self.ui.time:Hide() + elseif nFrame == -4 then + self.ui:Hide() + else + self.ui:Show() + self.ui.img:Show() + self.ui.time:Show() + self.ui.sha:Show() + self.ui.sfx:Show() + if nFrame then + self.ui.img:SetFrame(nFrame) + end end if MY_TeamMon.bPushVoiceAlarm and tTime.szVoice then FireUIEvent('MY_TEAM_MON__VOICE_ALARM', tTime.szVoice)