コード例 #1
0
 /// <summary>
 /// Invokes all listeners of action
 /// </summary>
 protected virtual void OnActionSelcted()
 {
     if (ActionSelected != null)
     {
         ActionSelected.Invoke();
     }
 }
コード例 #2
0
        /// <summary>
        /// Generates a <see cref="HistoricalInput"/> for when there is a generic action selected by the player.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private HistoricalInput GenericAction(InputEventArgs e, ActionSelected action)
        {
            Point2D mapSpot = Util.GetMapLocation(e.MouseEventArgs.Position.X, e.MouseEventArgs.Position.Y, RenderInfo.Dimension, out bool success);

            if (success)
            {
                Tile tile = World.GetTile(RenderInfo.Dimension, mapSpot.X, mapSpot.Y);

                if (tile != null)
                {
                    List <HasComponents> selected = new List <HasComponents>
                    {
                        tile
                    };

                    if (e.ShiftDown)
                    {
                        if (this.IsSelectableSelected(tile))
                        {
                            return(new HistoricalInput(false, selected, action));
                        }
                        else
                        {
                            return(new HistoricalInput(selected, action));
                        }
                    }
                    else
                    {
                        return(new HistoricalInput(selected, true, action));
                    }
                }
            }

            return(new HistoricalInput(true, InputHistory.Selected, action));
        }
コード例 #3
0
        private void WaitBtn_Click(object sender, RoutedEventArgs _)
        {
            ActionSelected?.Invoke(this, UpdateAction.Wait);

            Dispatcher.Invoke(() => {
                ReadyPanel.Visibility    = Visibility.Collapsed;
                DownloadPanel.Visibility = Visibility.Visible;
            });
        }
コード例 #4
0
        public HistoricalInput(bool deselectAll, List <HasComponents> deselectSome, ActionSelected selected) : this(selected)
        {
            this.OrderedToTile = false;

            if (deselectAll)
            {
                this.DeselectingAll = true;
            }
            else
            {
                this.DeselectingAll = false;
                this.DeselectSome   = deselectSome;
            }
        }
コード例 #5
0
        private HistoricalInput Order(InputEventArgs e, ActionSelected action)
        {
            Point2D screenLocation = e.MouseEventArgs.Position;

            Point2D mapLocation = Util.GetMapLocation(screenLocation.X, screenLocation.Y, RenderInfo.Dimension, out bool success);

            if (success)
            {
                return(new HistoricalInput(mapLocation, action));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
    public void SetActions(List <ActionData> actions)
    {
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        for (int i = 0; i < actions.Count; i++)
        {
            Vector3        pos  = new Vector3(0, (i * _itemHeight) + _offset, 0);
            ActionListItem item = GameObject.Instantiate <ActionListItem>(_itemPrefab, Vector3.zero, Quaternion.identity, transform);
            item.transform.localPosition = pos;

            ActionData act = actions[i];
            item.SetData(act.Text, act.Time, act.Fuel, act.Resources);
            item.Selected += () => ActionSelected?.Invoke(act);
        }
    }
コード例 #7
0
 public HistoricalInput(List <HasComponents> selected, ActionSelected selectedAction) : this(selectedAction)
 {
     this.Selected       = selected;
     this.OrderedToTile  = false;
     this.DeselectingAll = false;
 }
コード例 #8
0
 public HistoricalInput(Point2D Point2D, ActionSelected selected) : this(selected)
 {
     this.OrderedToTile  = true;
     this.OrderPoint2D   = Point2D;
     this.DeselectingAll = false;
 }
コード例 #9
0
 public HistoricalInput(ActionSelected selected)
 {
     this.ActionSelected = selected;
 }
コード例 #10
0
 public HistoricalInput(ActionSelected selected)
 {
     this.ActionSelected = InGameGUI.Selected;
 }
コード例 #11
0
 private void SkipBtn_Click(object sender, RoutedEventArgs _)
 {
     ActionSelected?.Invoke(this, UpdateAction.Skip);
 }
コード例 #12
0
        private void OnGUI()
        {
            EditorGUILayout.BeginVertical(Styles.panel);

            HandleInitialSizing();
            Rect rect;

            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Label(Contents.warningIcon, Styles.warningIcon);
                EditorGUILayout.BeginVertical(Styles.commandsArea);
                {
                    GUILayout.Label(m_Header, EditorStyles.boldLabel);
                    GUILayout.Label(Contents.description, EditorStyles.wordWrappedLabel);
                    GUILayout.Label(Contents.SelectCommandHeading, EditorStyles.boldLabel);
                    rect = GUILayoutUtility.GetRect(100, 4000, 50, 10000);
                    GUI.Box(rect, GUIContent.none);

                    GUI.SetNextControlName(rebindToggleCommandName);
                    m_Rebind = GUILayout.Toggle(m_Rebind, Contents.rebindToSelectedCommand);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();

            m_ConflictListView.OnGUI(rect);

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button(Contents.OpenShortcutManager))
                {
                    Close();
                    m_ConflictResolver.GoToShortcutManagerConflictCategory();
                }

                GUILayout.FlexibleSpace();


                bool hasSelection = m_ConflictListView.HasSelection();
                using (new EditorGUI.DisabledScope(!hasSelection))
                {
                    ShortcutEntry entry = null;
                    if (hasSelection)
                    {
                        entry = m_Entries[m_ConflictListView.GetSelection().First()];
                    }

                    using (new EditorGUI.DisabledScope(entry == null || (entry.type == ShortcutType.Clutch && !m_Rebind)))
                    {
                        var buttonLabel = hasSelection && entry.type == ShortcutType.Clutch ? Contents.rebind : Contents.perform;
                        GUI.SetNextControlName(performButtonControlName);
                        if (GUILayout.Button(buttonLabel))
                        {
                            m_SelectedEntry = entry;
                            if (m_Rebind)
                            {
                                m_CloseBehaviour = ActionSelected.ExecuteAlways;
                            }
                            else
                            {
                                m_CloseBehaviour = ActionSelected.ExecuteOnce;
                            }
                            Close();
                            GUIUtility.ExitGUI();
                        }
                    }
                }

                GUI.SetNextControlName(cancelButtonControlName);
                if (GUILayout.Button(Contents.cancel))
                {
                    Close();
                    GUIUtility.ExitGUI();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
コード例 #13
0
 internal static void Initialize()
 {
     InGame = new InGameGUIContainer(true);
     MenuHandler.DisplayMenu(InGame);
     Selected = ActionSelected.None;
 }
コード例 #14
0
 private void ScanByRangeTree_Click(object sender, EventArgs e)
 {
     Selection = ActionSelected.RangeScan;
 }
コード例 #15
0
 private void BlockEdgesButton_Click(object sender, EventArgs e)
 {
     Selection = ActionSelected.BlockEdges;
 }
コード例 #16
0
 public HistoricalInput(List <HasComponents> selectSome, bool deselectAll, ActionSelected selected) : this(selected)
 {
     this.OrderedToTile  = false;
     this.DeselectingAll = deselectAll;
     this.Selected       = selectSome;
 }
コード例 #17
0
 public void OnActionSelected(ActionData action)
 {
     ActionSelected?.Invoke(action);
 }
コード例 #18
0
 private void Show(ActionSelected a)
 {
     _actionLabel.Text = a.Name;
     Show(false);
 }