mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Show tooltip for representative Shardok command
This commit is contained in:
+8
-6
@@ -114,16 +114,18 @@ namespace eagle0 {
|
||||
return commands.Where(command => CommandGroupForType(command.Type) == group).ToList();
|
||||
}
|
||||
|
||||
public CommandDescriptor RepresentativeCommandForGroup(
|
||||
List<CommandDescriptor> commands,
|
||||
int group) {
|
||||
return commands.Last(command => CommandGroupForType(command.Type) == group);
|
||||
}
|
||||
|
||||
public bool WarnOnCommandType(List<CommandDescriptor> commands, int group) {
|
||||
return infoForType[commands.First(command => CommandGroupForType(command.Type) == group)
|
||||
.Type]
|
||||
.warnOnCommit;
|
||||
return infoForType[RepresentativeCommandForGroup(commands, group).Type].warnOnCommit;
|
||||
}
|
||||
|
||||
public string WarningForCommandType(List<CommandDescriptor> commands, int group) {
|
||||
return infoForType[commands.First(command => CommandGroupForType(command.Type) == group)
|
||||
.Type]
|
||||
.commitWarning;
|
||||
return infoForType[RepresentativeCommandForGroup(commands, group).Type].commitWarning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -426,11 +426,11 @@ namespace Shardok {
|
||||
|
||||
public void WarningPanelCommitClicked() {
|
||||
var commands = CommandsForSelectedCoords;
|
||||
var commandsForPosition =
|
||||
commandTypeUIManager.ApplicableCommandsForGroup(commands, _clickedPosition);
|
||||
|
||||
var sourceGridIndex = _selectedGridIndex ?? -1;
|
||||
var commandType = commandsForPosition[0].Type;
|
||||
var commandType =
|
||||
commandTypeUIManager.RepresentativeCommandForGroup(commands, _clickedPosition)
|
||||
.Type;
|
||||
Model.PerformUntargetedCommand(SelectedCoords, commandType);
|
||||
PlayUntargetedCommandAnimation(commandType, sourceGridIndex);
|
||||
_selectedGridIndex = null;
|
||||
@@ -461,7 +461,9 @@ namespace Shardok {
|
||||
var commands = CommandsForSelectedCoords;
|
||||
var commandsForPosition =
|
||||
commandTypeUIManager.ApplicableCommandsForGroup(commands, position);
|
||||
if (commandsForPosition[0].Target != null) {
|
||||
var representativeCommand =
|
||||
commandTypeUIManager.RepresentativeCommandForGroup(commands, position);
|
||||
if (representativeCommand.Target != null) {
|
||||
SetDisplayedCommandGroup(_displayedCommandGroup == position ? 0 : position);
|
||||
} else {
|
||||
if (commandsForPosition.Count > 1) {
|
||||
@@ -476,7 +478,7 @@ namespace Shardok {
|
||||
commandWarningPanel.SetActive(true);
|
||||
} else {
|
||||
var sourceGridIndex = _selectedGridIndex ?? -1;
|
||||
var command = commandsForPosition[0];
|
||||
var command = representativeCommand;
|
||||
Model.PerformUntargetedCommand(SelectedCoords, command.Type);
|
||||
PlayUntargetedCommandAnimation(
|
||||
command.Type,
|
||||
@@ -1815,7 +1817,10 @@ namespace Shardok {
|
||||
buttonIndex);
|
||||
if (!applicableCommands.Any()) break;
|
||||
|
||||
var firstApplicableCommand = applicableCommands.First();
|
||||
var firstApplicableCommand =
|
||||
commandTypeUIManager.RepresentativeCommandForGroup(
|
||||
commands,
|
||||
buttonIndex);
|
||||
string commandName =
|
||||
commandTypeUIManager.NameForType(firstApplicableCommand.Type);
|
||||
buttonTooltipText.text = commandName;
|
||||
|
||||
Reference in New Issue
Block a user