Conquest objectives panel (Feature #949).
This commit is contained in:
@@ -90,6 +90,7 @@
|
|||||||
<Compile Include="CncMenuPaletteEffect.cs" />
|
<Compile Include="CncMenuPaletteEffect.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncIngameMenuLogic.cs" />
|
<Compile Include="Widgets\Logic\CncIngameMenuLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncDiplomacyLogic.cs" />
|
<Compile Include="Widgets\Logic\CncDiplomacyLogic.cs" />
|
||||||
|
<Compile Include="Widgets\Logic\CncConquestObjectivesLogic.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
74
OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs
Normal file
74
OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||||
|
{
|
||||||
|
public class CncConquestObjectivesLogic
|
||||||
|
{
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public CncConquestObjectivesLogic([ObjectCreator.Param] Widget widget,
|
||||||
|
[ObjectCreator.Param] World world)
|
||||||
|
{
|
||||||
|
var panel = widget.GetWidget("CONQUEST_OBJECTIVES");
|
||||||
|
panel.GetWidget<LabelWidget>("TITLE").GetText = () => "Conquest: " + world.Map.Title;
|
||||||
|
|
||||||
|
var objectiveCheckbox = panel.GetWidget<CheckboxWidget>("OBJECTIVE_CHECKBOX");
|
||||||
|
objectiveCheckbox.IsDisabled = () => true;
|
||||||
|
|
||||||
|
var statusLabel = panel.GetWidget<LabelWidget>("STATUS_LABEL");
|
||||||
|
statusLabel.IsVisible = () => world.LocalPlayer != null;
|
||||||
|
|
||||||
|
if (world.LocalPlayer != null)
|
||||||
|
{
|
||||||
|
var lp = world.LocalPlayer;
|
||||||
|
objectiveCheckbox.IsChecked = () => lp.WinState != WinState.Undefined;
|
||||||
|
objectiveCheckbox.GetCheckType = () => lp.WinState == WinState.Won ?
|
||||||
|
"checked" : "crossed";
|
||||||
|
|
||||||
|
statusLabel.GetText = () => lp.WinState == WinState.Won ? "Complete" :
|
||||||
|
lp.WinState == WinState.Lost ? "Failed" : "Incomplete";
|
||||||
|
statusLabel.GetColor = () => lp.WinState == WinState.Won ? Color.Green :
|
||||||
|
lp.WinState == WinState.Lost ? Color.Red : Color.White;
|
||||||
|
}
|
||||||
|
|
||||||
|
var scrollpanel = panel.GetWidget<ScrollPanelWidget>("PLAYER_LIST");
|
||||||
|
var itemTemplate = scrollpanel.GetWidget("PLAYER_TEMPLATE");
|
||||||
|
scrollpanel.RemoveChildren();
|
||||||
|
|
||||||
|
foreach (var p in world.Players.Where(a => !a.NonCombatant))
|
||||||
|
{
|
||||||
|
Player pp = p;
|
||||||
|
var c = world.LobbyInfo.ClientWithIndex(pp.ClientIndex);
|
||||||
|
var item = itemTemplate.Clone();
|
||||||
|
var nameLabel = item.GetWidget<LabelWidget>("NAME");
|
||||||
|
nameLabel.GetText = () => pp.PlayerName;
|
||||||
|
nameLabel.Color = pp.ColorRamp.GetColor(0);
|
||||||
|
|
||||||
|
var flag = item.GetWidget<ImageWidget>("FACTIONFLAG");
|
||||||
|
flag.GetImageName = () => pp.Country.Race;
|
||||||
|
flag.GetImageCollection = () => "flags";
|
||||||
|
item.GetWidget<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
|
||||||
|
|
||||||
|
var team = item.GetWidget<LabelWidget>("TEAM");
|
||||||
|
team.GetText = () => c.Team.ToString();
|
||||||
|
scrollpanel.AddChild(item);
|
||||||
|
|
||||||
|
item.GetWidget<LabelWidget>("KILLS").GetText = () => pp.Kills.ToString();
|
||||||
|
item.GetWidget<LabelWidget>("DEATHS").GetText = () => pp.Deaths.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,8 +88,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
onExit();
|
onExit();
|
||||||
};
|
};
|
||||||
|
|
||||||
menu.GetWidget<ImageWidget>("RECBLOCK").IsVisible = () => world.FrameNumber / 25 % 2 == 0;
|
|
||||||
|
|
||||||
// Mission objectives panel
|
// Mission objectives panel
|
||||||
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
|
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
|
||||||
if (iop != null && iop.ObjectivesPanel != null)
|
if (iop != null && iop.ObjectivesPanel != null)
|
||||||
|
|||||||
@@ -4,27 +4,6 @@ Container@INGAME_MENU:
|
|||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
Logic:CncIngameMenuLogic
|
Logic:CncIngameMenuLogic
|
||||||
Children:
|
Children:
|
||||||
Image@RETICLE:
|
|
||||||
X:(WINDOW_RIGHT-WIDTH)/2
|
|
||||||
Y:(WINDOW_BOTTOM-HEIGHT)/2
|
|
||||||
Width:512
|
|
||||||
Height:512
|
|
||||||
ImageCollection:shellmap
|
|
||||||
ImageName:reticle
|
|
||||||
Label@REC:
|
|
||||||
X:(WINDOW_RIGHT-512)/2+10
|
|
||||||
Y:(WINDOW_BOTTOM+512)/2-28
|
|
||||||
Height:18
|
|
||||||
Font:Bold
|
|
||||||
Text:REC
|
|
||||||
Image@RECBLOCK:
|
|
||||||
Id:RECBLOCK
|
|
||||||
X:(WINDOW_RIGHT-512)/2+40
|
|
||||||
Y:(WINDOW_BOTTOM+512)/2-25
|
|
||||||
Width:16
|
|
||||||
Height:16
|
|
||||||
ImageCollection:shellmapbits
|
|
||||||
ImageName:record
|
|
||||||
Image@EVA:
|
Image@EVA:
|
||||||
X:WINDOW_RIGHT-128-43
|
X:WINDOW_RIGHT-128-43
|
||||||
Y:43
|
Y:43
|
||||||
|
|||||||
132
mods/cnc/chrome/objectives.yaml
Normal file
132
mods/cnc/chrome/objectives.yaml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
Container@CONQUEST_OBJECTIVES:
|
||||||
|
Id:CONQUEST_OBJECTIVES
|
||||||
|
Logic:CncConquestObjectivesLogic
|
||||||
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
|
Width:512
|
||||||
|
Height:320
|
||||||
|
Children:
|
||||||
|
Label@TITLE:
|
||||||
|
Width:PARENT_RIGHT
|
||||||
|
Id:TITLE
|
||||||
|
Y:0-25
|
||||||
|
Font:BigBold
|
||||||
|
Contrast:true
|
||||||
|
Align:Center
|
||||||
|
Background@bg:
|
||||||
|
Width:512
|
||||||
|
Height:320
|
||||||
|
Background:panel-black
|
||||||
|
Children:
|
||||||
|
Label@PRIMARY:
|
||||||
|
X:15
|
||||||
|
Y:10
|
||||||
|
Width:482
|
||||||
|
Height:25
|
||||||
|
Font:MediumBold
|
||||||
|
Text:Primary Objectives:
|
||||||
|
Label@STATUS:
|
||||||
|
Id:STATUS_LABEL
|
||||||
|
X:190
|
||||||
|
Y:10
|
||||||
|
Width:482
|
||||||
|
Height:25
|
||||||
|
Font:MediumBold
|
||||||
|
Text:Incomplete
|
||||||
|
Checkbox@1:
|
||||||
|
Id:OBJECTIVE_CHECKBOX
|
||||||
|
X:25
|
||||||
|
Y:45
|
||||||
|
Width:482
|
||||||
|
Height:20
|
||||||
|
Font:Bold
|
||||||
|
Text:Crush all opposition!
|
||||||
|
Container@LABEL_CONTAINER:
|
||||||
|
X:17
|
||||||
|
Y:80
|
||||||
|
Width:393
|
||||||
|
Children:
|
||||||
|
Label@NAME:
|
||||||
|
X:10
|
||||||
|
Width:150
|
||||||
|
Height:25
|
||||||
|
Text:Player
|
||||||
|
Align:Center
|
||||||
|
Font:Bold
|
||||||
|
Label@RACE:
|
||||||
|
X:150
|
||||||
|
Width:80
|
||||||
|
Height:25
|
||||||
|
Text:Faction
|
||||||
|
Font:Bold
|
||||||
|
Align:Center
|
||||||
|
Label@STANCE:
|
||||||
|
X:240
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Text:Team
|
||||||
|
Font:Bold
|
||||||
|
Align:Center
|
||||||
|
Label@KILLS:
|
||||||
|
X:310
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Text:Kills
|
||||||
|
Font:Bold
|
||||||
|
Align:Center
|
||||||
|
Label@DEATHS:
|
||||||
|
X:380
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Text:Deaths
|
||||||
|
Font:Bold
|
||||||
|
Align:Center
|
||||||
|
ScrollPanel@PLAYER_LIST:
|
||||||
|
Id:PLAYER_LIST
|
||||||
|
X:15
|
||||||
|
Y:105
|
||||||
|
Width:482
|
||||||
|
Height:200
|
||||||
|
ItemSpacing:5
|
||||||
|
Children:
|
||||||
|
Container@PLAYER_TEMPLATE:
|
||||||
|
Id:PLAYER_TEMPLATE
|
||||||
|
Width:PARENT_RIGHT-27
|
||||||
|
Height:25
|
||||||
|
X:2
|
||||||
|
Y:0
|
||||||
|
Children:
|
||||||
|
Label@NAME:
|
||||||
|
Id:NAME
|
||||||
|
X:10
|
||||||
|
Width:150
|
||||||
|
Height:25
|
||||||
|
Image@FACTIONFLAG:
|
||||||
|
Id:FACTIONFLAG
|
||||||
|
X:160
|
||||||
|
Y:5
|
||||||
|
Width:30
|
||||||
|
Height:15
|
||||||
|
Label@FACTION:
|
||||||
|
Id:FACTION
|
||||||
|
X:195
|
||||||
|
Width:40
|
||||||
|
Height:25
|
||||||
|
Label@TEAM:
|
||||||
|
Id:TEAM
|
||||||
|
X:240
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Align:Center
|
||||||
|
Label@KILLS:
|
||||||
|
Id:KILLS
|
||||||
|
X:310
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Align:Center
|
||||||
|
Label@DEATHS:
|
||||||
|
Id:DEATHS
|
||||||
|
X:380
|
||||||
|
Width:70
|
||||||
|
Height:25
|
||||||
|
Align:Center
|
||||||
@@ -81,6 +81,7 @@ ChromeLayout:
|
|||||||
mods/cnc/chrome/cheats.yaml
|
mods/cnc/chrome/cheats.yaml
|
||||||
mods/cnc/chrome/diplomacy.yaml
|
mods/cnc/chrome/diplomacy.yaml
|
||||||
mods/cnc/chrome/dropdowns.yaml
|
mods/cnc/chrome/dropdowns.yaml
|
||||||
|
mods/cnc/chrome/objectives.yaml
|
||||||
|
|
||||||
Weapons:
|
Weapons:
|
||||||
mods/cnc/weapons.yaml
|
mods/cnc/weapons.yaml
|
||||||
@@ -124,6 +125,9 @@ Fonts:
|
|||||||
Title:
|
Title:
|
||||||
Font:titles.ttf
|
Font:titles.ttf
|
||||||
Size:48
|
Size:48
|
||||||
|
MediumBold:
|
||||||
|
Font:FreeSansBold.ttf
|
||||||
|
Size:18
|
||||||
BigBold:
|
BigBold:
|
||||||
Font:FreeSansBold.ttf
|
Font:FreeSansBold.ttf
|
||||||
Size:24
|
Size:24
|
||||||
|
|||||||
Reference in New Issue
Block a user