Merge pull request #2801 from Mailaender/hotkey-cleanup
Remove inconsistencies that crash C&C mod
This commit is contained in:
@@ -46,7 +46,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
foreach (var p in world.Players.Where(a => !a.NonCombatant))
|
foreach (var p in world.Players.Where(a => !a.NonCombatant))
|
||||||
{
|
{
|
||||||
Player pp = p;
|
Player pp = p;
|
||||||
var c = world.LobbyInfo.ClientWithIndex(pp.ClientIndex);
|
|
||||||
var item = itemTemplate.Clone();
|
var item = itemTemplate.Clone();
|
||||||
var nameLabel = item.Get<LabelWidget>("NAME");
|
var nameLabel = item.Get<LabelWidget>("NAME");
|
||||||
nameLabel.GetText = () => pp.WinState == WinState.Lost ? pp.PlayerName + " (Dead)" : pp.PlayerName;
|
nameLabel.GetText = () => pp.WinState == WinState.Lost ? pp.PlayerName + " (Dead)" : pp.PlayerName;
|
||||||
@@ -58,7 +57,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
|
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
|
||||||
|
|
||||||
var team = item.Get<LabelWidget>("TEAM");
|
var team = item.Get<LabelWidget>("TEAM");
|
||||||
team.GetText = () => (c.Team == 0) ? "-" : c.Team.ToString();
|
team.GetText = () => (pp.PlayerReference.Team == 0) ? "-" : pp.PlayerReference.Team.ToString();
|
||||||
scrollpanel.AddChild(item);
|
scrollpanel.AddChild(item);
|
||||||
|
|
||||||
item.Get<LabelWidget>("KILLS").GetText = () => pp.Kills.ToString();
|
item.Get<LabelWidget>("KILLS").GetText = () => pp.Kills.ToString();
|
||||||
|
|||||||
@@ -123,6 +123,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
BindOrderButton<SellOrderGenerator>(world, sidebarRoot, "SELL_BUTTON", "sell");
|
BindOrderButton<SellOrderGenerator>(world, sidebarRoot, "SELL_BUTTON", "sell");
|
||||||
BindOrderButton<RepairOrderGenerator>(world, sidebarRoot, "REPAIR_BUTTON", "repair");
|
BindOrderButton<RepairOrderGenerator>(world, sidebarRoot, "REPAIR_BUTTON", "repair");
|
||||||
|
|
||||||
|
sidebarRoot.Get<ToggleButtonWidget>("SELL_BUTTON").Key = Game.Settings.Keys.SellKey;
|
||||||
|
sidebarRoot.Get<ToggleButtonWidget>("REPAIR_BUTTON").Key = Game.Settings.Keys.RepairKey;
|
||||||
|
|
||||||
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
||||||
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
||||||
sidebarRoot.Get<LabelWidget>("CASH").GetText = () =>
|
sidebarRoot.Get<LabelWidget>("CASH").GetText = () =>
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
objectivesButton.IsVisible = () => world.LocalPlayer != null;
|
objectivesButton.IsVisible = () => world.LocalPlayer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var moneybin = gameRoot.Get("INGAME_MONEY_BIN");
|
||||||
|
moneybin.Get<OrderButtonWidget>("SELL").Key = Game.Settings.Keys.SellKey;
|
||||||
|
moneybin.Get<OrderButtonWidget>("POWER_DOWN").Key = Game.Settings.Keys.PowerDownKey;
|
||||||
|
moneybin.Get<OrderButtonWidget>("REPAIR").Key = Game.Settings.Keys.RepairKey;
|
||||||
|
|
||||||
optionsBG.Get<ButtonWidget>("DISCONNECT").OnClick = () => LeaveGame(optionsBG, world);
|
optionsBG.Get<ButtonWidget>("DISCONNECT").OnClick = () => LeaveGame(optionsBG, world);
|
||||||
|
|
||||||
optionsBG.Get<ButtonWidget>("SETTINGS").OnClick = () => Ui.OpenWindow("SETTINGS_MENU");
|
optionsBG.Get<ButtonWidget>("SETTINGS").OnClick = () => Ui.OpenWindow("SETTINGS_MENU");
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
{
|
{
|
||||||
w.Pressed = () => world.OrderGenerator is T;
|
w.Pressed = () => world.OrderGenerator is T;
|
||||||
w.OnMouseDown = mi => world.ToggleInputMode<T>();
|
w.OnMouseDown = mi => world.ToggleInputMode<T>();
|
||||||
|
w.OnKeyPress = ki => world.ToggleInputMode<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
SetupKeyBinding(repairKey, "Switch to Repair-Cursor:", () => keyConfig.RepairKey, k => keyConfig.RepairKey = k);
|
SetupKeyBinding(repairKey, "Switch to Repair-Cursor:", () => keyConfig.RepairKey, k => keyConfig.RepairKey = k);
|
||||||
specialHotkeyList.AddChild(repairKey);
|
specialHotkeyList.AddChild(repairKey);
|
||||||
|
|
||||||
|
var tabCycleKey = ScrollItemWidget.Setup(specialHotkeyTemplate, () => false, () => {});
|
||||||
|
SetupKeyBinding(tabCycleKey, "Cycle Tabs (+Shift to Reverse):", () => keyConfig.CycleTabsKey, k => keyConfig.CycleTabsKey = k);
|
||||||
|
specialHotkeyList.AddChild(tabCycleKey);
|
||||||
|
|
||||||
var unitCommandHotkeyList = keys.Get<ScrollPanelWidget>("UNITCOMMANDHOTKEY_LIST");
|
var unitCommandHotkeyList = keys.Get<ScrollPanelWidget>("UNITCOMMANDHOTKEY_LIST");
|
||||||
var unitCommandHotkeyTemplate = unitCommandHotkeyList.Get<ScrollItemWidget>("UNITCOMMANDHOTKEY_TEMPLATE");
|
var unitCommandHotkeyTemplate = unitCommandHotkeyList.Get<ScrollItemWidget>("UNITCOMMANDHOTKEY_TEMPLATE");
|
||||||
|
|
||||||
|
|||||||
@@ -53,15 +53,6 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (e.KeyName == Game.Settings.Keys.ToSelectionKey)
|
if (e.KeyName == Game.Settings.Keys.ToSelectionKey)
|
||||||
return ToSelection();
|
return ToSelection();
|
||||||
|
|
||||||
if (e.KeyName == Game.Settings.Keys.SellKey)
|
|
||||||
return PerformSwitchToSellMode();
|
|
||||||
|
|
||||||
if (e.KeyName == Game.Settings.Keys.PowerDownKey)
|
|
||||||
return PerformSwitchToPowerDownMode();
|
|
||||||
|
|
||||||
if (e.KeyName == Game.Settings.Keys.RepairKey)
|
|
||||||
return PerformSwitchToRepairMode();
|
|
||||||
|
|
||||||
if (!World.Selection.Actors.Any()) // Put all functions, that are no unit-functions, before this line!
|
if (!World.Selection.Actors.Any()) // Put all functions, that are no unit-functions, before this line!
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -196,23 +187,5 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
Game.viewport.Center(World.Selection.Actors);
|
Game.viewport.Center(World.Selection.Actors);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerformSwitchToSellMode()
|
|
||||||
{
|
|
||||||
World.ToggleInputMode<SellOrderGenerator>();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PerformSwitchToPowerDownMode()
|
|
||||||
{
|
|
||||||
World.ToggleInputMode<PowerDownOrderGenerator>();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PerformSwitchToRepairMode()
|
|
||||||
{
|
|
||||||
World.ToggleInputMode<RepairOrderGenerator>();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
mods/cnc/bits/nopower.shp
Normal file
BIN
mods/cnc/bits/nopower.shp
Normal file
Binary file not shown.
BIN
mods/cnc/bits/poweroff.shp
Normal file
BIN
mods/cnc/bits/poweroff.shp
Normal file
Binary file not shown.
@@ -112,7 +112,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
ImageCollection:order-icons
|
ImageCollection:order-icons
|
||||||
ImageName:options
|
ImageName:options
|
||||||
ToggleButton@SELL_BUTTON:
|
ToggleButton@SELL_BUTTON:
|
||||||
Key: [
|
|
||||||
X:82
|
X:82
|
||||||
Y:0-24
|
Y:0-24
|
||||||
Width:30
|
Width:30
|
||||||
@@ -126,7 +125,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Y:5
|
Y:5
|
||||||
ImageCollection:order-icons
|
ImageCollection:order-icons
|
||||||
ToggleButton@REPAIR_BUTTON:
|
ToggleButton@REPAIR_BUTTON:
|
||||||
Key: ]
|
|
||||||
X:122
|
X:122
|
||||||
Y:0-24
|
Y:0-24
|
||||||
Width:30
|
Width:30
|
||||||
|
|||||||
@@ -272,4 +272,16 @@ Cursors:
|
|||||||
start:213
|
start:213
|
||||||
length:1
|
length:1
|
||||||
x:12
|
x:12
|
||||||
y:12
|
y:12
|
||||||
|
|
||||||
|
nopower: cursor
|
||||||
|
powerdown-blocked:
|
||||||
|
start:0
|
||||||
|
length: 1
|
||||||
|
x: 12
|
||||||
|
y: 12
|
||||||
|
powerdown:
|
||||||
|
start:1
|
||||||
|
length: 3
|
||||||
|
x: 12
|
||||||
|
y: 12
|
||||||
@@ -29,6 +29,8 @@ Sounds:
|
|||||||
CashTickUp:
|
CashTickUp:
|
||||||
CashTickDown:
|
CashTickDown:
|
||||||
LevelUp: text2
|
LevelUp: text2
|
||||||
|
DisablePower: bleep11
|
||||||
|
EnablePower: bleep12
|
||||||
ChatLine: scold1
|
ChatLine: scold1
|
||||||
TabClick: button
|
TabClick: button
|
||||||
ClickSound: button
|
ClickSound: button
|
||||||
|
|||||||
@@ -269,3 +269,13 @@ overlay:
|
|||||||
Start: 0
|
Start: 0
|
||||||
target-invalid:
|
target-invalid:
|
||||||
Start: 1
|
Start: 1
|
||||||
|
|
||||||
|
powerdown:
|
||||||
|
disabled: speed
|
||||||
|
Start: 3
|
||||||
|
|
||||||
|
poweroff:
|
||||||
|
offline:
|
||||||
|
Start: 0
|
||||||
|
Length: *
|
||||||
|
Tick: 160
|
||||||
Reference in New Issue
Block a user