/// <summary> /// Invokes all listeners of action /// </summary> protected virtual void OnActionSelcted() { if (ActionSelected != null) { ActionSelected.Invoke(); } }
/// <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)); }
private void WaitBtn_Click(object sender, RoutedEventArgs _) { ActionSelected?.Invoke(this, UpdateAction.Wait); Dispatcher.Invoke(() => { ReadyPanel.Visibility = Visibility.Collapsed; DownloadPanel.Visibility = Visibility.Visible; }); }
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; } }
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); } }
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); } }
public HistoricalInput(List <HasComponents> selected, ActionSelected selectedAction) : this(selectedAction) { this.Selected = selected; this.OrderedToTile = false; this.DeselectingAll = false; }
public HistoricalInput(Point2D Point2D, ActionSelected selected) : this(selected) { this.OrderedToTile = true; this.OrderPoint2D = Point2D; this.DeselectingAll = false; }
public HistoricalInput(ActionSelected selected) { this.ActionSelected = selected; }
public HistoricalInput(ActionSelected selected) { this.ActionSelected = InGameGUI.Selected; }
private void SkipBtn_Click(object sender, RoutedEventArgs _) { ActionSelected?.Invoke(this, UpdateAction.Skip); }
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(); }
internal static void Initialize() { InGame = new InGameGUIContainer(true); MenuHandler.DisplayMenu(InGame); Selected = ActionSelected.None; }
private void ScanByRangeTree_Click(object sender, EventArgs e) { Selection = ActionSelected.RangeScan; }
private void BlockEdgesButton_Click(object sender, EventArgs e) { Selection = ActionSelected.BlockEdges; }
public HistoricalInput(List <HasComponents> selectSome, bool deselectAll, ActionSelected selected) : this(selected) { this.OrderedToTile = false; this.DeselectingAll = deselectAll; this.Selected = selectSome; }
public void OnActionSelected(ActionData action) { ActionSelected?.Invoke(action); }
private void Show(ActionSelected a) { _actionLabel.Text = a.Name; Show(false); }