public void Initialize() { //if (_characterManager.ActiveCharacter == null) return; foreach (ICharacter character in _characterManager.SelectableCharacters) { CommandPanelView commandPanelView = CreatePanel(); character.CommandPanelView = commandPanelView; //Register root actions foreach (IAction action in character.Actions) { CommandView commandView = _commandFactory.Create(); commandView.Name.text = action.Name; commandView.Cursor.enabled = false; commandView.Action = action; commandPanelView.SetChildCommand(commandView); //Register sub actions (eg magic, items, etc) if (action.SubActions == null || action.SubActions.Count == 0) { continue; } CommandPanelView subCommandPanel = CreatePanel(commandPanelView); commandView.ChildPanel = subCommandPanel; foreach (IAction subAction in action.SubActions) { CommandView subCommandView = _commandFactory.Create(); subCommandView.Name.text = subAction.Name; subCommandView.Cursor.enabled = false; subCommandView.Action = subAction; subCommandPanel.SetChildCommand(subCommandView); } } } Activate(); }
private static void SetSelected(CommandView view, bool isSelected) => view.Cursor.enabled = isSelected;
public void SetChildCommand(CommandView command) { command.transform.SetParent(RootTransform, false); _commands.Add(command); }