Skip to content

Commit e55053d

Browse files
committed
观战席的UI
1 parent ef47244 commit e55053d

2 files changed

Lines changed: 47 additions & 28 deletions

File tree

mods/copilot/maps/copilot-fin/copilot-fin.lua

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ local SPECIAL_BUFFS = {
6464
-- === 内部状态 ===
6565
local Players = {}
6666
local Multi0, Multi1 -- 玩家引用
67-
local Self, Enemy -- 自己和敌人引用
6867
local ControlPoints = {} -- 控制点列表
6968
local ControlPointTimes = {} -- 控制点创建时间记录
7069
local ControlPointCounter = 0 -- 控制点计数器
@@ -404,30 +403,30 @@ local function checkVictoryConditions()
404403
end
405404

406405
-- 检查Multi1(敌方)是否还有建筑
407-
local enemyBuildings = Utils.Where(Map.ActorsInWorld, function(actor)
406+
local Multi1Buildings = Utils.Where(Map.ActorsInWorld, function(actor)
408407
return actor.Owner == Multi1 and actor.HasProperty("StartBuildingRepairs") and not actor.IsDead
409408
end)
410409

411-
if #enemyBuildings == 0 then
410+
if #Multi1Buildings == 0 then
412411
gameCompleted = true
413-
Multi0.MarkCompletedObjective(SovietObjective1)
414-
if AlliedObjective1 then Multi1.MarkFailedObjective(AlliedObjective1) end
415-
debugMsg("Multi0 wins! All enemy buildings destroyed.")
416-
Media.DisplayMessage("Victory! All enemy buildings destroyed.", "Menacing")
412+
Multi0.MarkCompletedObjective(SovietObjective)
413+
if AlliedObjective then Multi1.MarkFailedObjective(AlliedObjective) end
414+
debugMsg("Multi0 wins! All Multi1 buildings destroyed.")
415+
Media.DisplayMessage("Victory! All Multi1 buildings destroyed.", "Menacing")
417416
return
418417
end
419418

420419
-- 检查Multi0(玩家)是否还有建筑
421-
local playerBuildings = Utils.Where(Map.ActorsInWorld, function(actor)
420+
local Multi0Buildings = Utils.Where(Map.ActorsInWorld, function(actor)
422421
return actor.Owner == Multi0 and actor.HasProperty("StartBuildingRepairs") and not actor.IsDead
423422
end)
424423

425-
if #playerBuildings == 0 then
424+
if #Multi0Buildings == 0 then
426425
gameCompleted = true
427-
if AlliedObjective1 then Multi1.MarkCompletedObjective(AlliedObjective1) end
428-
Multi0.MarkFailedObjective(SovietObjective1)
429-
debugMsg("Multi1 wins! All player buildings destroyed.")
430-
Media.DisplayMessage("Defeat! All your buildings are destroyed.", "Menacing")
426+
if AlliedObjective then Multi1.MarkCompletedObjective(AlliedObjective) end
427+
Multi0.MarkFailedObjective(SovietObjective)
428+
debugMsg("Multi1 wins! All Multi0 buildings destroyed.")
429+
Media.DisplayMessage("Defeat! All Multi0 buildings are destroyed.", "Menacing")
431430
end
432431
end
433432

@@ -501,33 +500,19 @@ WorldLoaded = function()
501500
if not p.IsNonCombatant then
502501
table.insert(Players, p)
503502
end
504-
if p.IsLocalPlayer then
505-
Self = p
506-
end
507503
end
508504
-- debugMsg(string.format("PlayersNum:%d", #Players))
509505
Multi0 = Players[1]
510506
Multi1 = Players[2]
511507

512-
if not Self then
513-
debugMsg("Warning: Self not found")
514-
end
515508
if not Multi0 then
516509
debugMsg("Warning: Multi0 not found")
517510
end
518511
if not Multi1 then
519512
debugMsg("Warning: Multi1 not found")
520513
end
521514

522-
-- 设置敌人引用
523-
if Self.Name == Multi0.Name then
524-
Enemy = Multi1
525-
elseif Self.Name == Multi1.Name then
526-
Enemy = Multi0
527-
else
528-
debugMsg("Warning: Could not determine enemy player")
529-
end
530-
515+
531516
InitObjectives(Multi0)
532517
InitObjectives(Multi1)
533518

mods/ra/chrome/ingame-observer.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
Container@OBSERVER_WIDGETS:
22
Logic: LoadIngameChatLogic
33
Children:
4+
Container@CopilotScoreHUD:
5+
LogicTicker@COPILOT_SCORE_TICKER:
6+
Logic: CopilotScoreChrome
7+
X: 230
8+
Y: 18
9+
Width: 250
10+
Height: 100
11+
Children:
12+
Container@CopilotScorePanel:
13+
Width: PARENT_RIGHT
14+
Height: PARENT_BOTTOM
15+
Children:
16+
Label@ScoreLabelFront:
17+
X: 0
18+
Text: Score:
19+
Align: Left
20+
Font: Bold
21+
Label@ScoreLabel:
22+
X: 60
23+
Id: CopilotScoreLabel
24+
Text: "0 - 0"
25+
Align: Left
26+
Font: Bold
27+
Label@TimerLabelFront:
28+
X: PARENT_RIGHT - 60
29+
Text: Time:
30+
Align: Right
31+
Font: Bold
32+
Label@TimerLabel:
33+
X: PARENT_RIGHT
34+
Id: CopilotTimerLabel
35+
Text: "15:00"
36+
Align: Right
37+
Font: Bold
438
Container@CHAT_ROOT:
539
Container@MUTE_INDICATOR:
640
Logic: MuteIndicatorLogic

0 commit comments

Comments
 (0)