Пример #1
0
        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();
        }
Пример #2
0
 private static void SetSelected(CommandView view, bool isSelected) => view.Cursor.enabled = isSelected;
Пример #3
0
 public void SetChildCommand(CommandView command)
 {
     command.transform.SetParent(RootTransform, false);
     _commands.Add(command);
 }