private void ChangeAction(InterfaceAction action) { foreach (var button in Toolbar.Children.OfType <Button>()) { button.Tag = null; } ClearCreateEdgeActionState(); switch (action) { case InterfaceAction.VertexEdit: CreateVertexButton.Tag = SelectedTag; _currentAction = InterfaceAction.VertexEdit; break; case InterfaceAction.EdgeEdit: CreateEdgeButton.Tag = SelectedTag; _currentAction = InterfaceAction.EdgeEdit; break; case InterfaceAction.PerformAlgorithm: _currentAction = InterfaceAction.PerformAlgorithm; break; default: throw new ArgumentOutOfRangeException(nameof(action), action, null); } }
public void BeginBuildingPlacement(IEnumerable <IWorkerOrders> workers, Func <IWorkerOrders, Vector2, Task <Guid> > createTemplate, Vector2 size) { if (mCurrentAction != null) { mCurrentAction.Cancel(); } mCurrentAction = new BuildingPlacementInterfaceAction(this, workers, createTemplate, size); }
public void BeginAttack(IEnumerable <IWarriorOrders> views) { if (mCurrentAction != null) { mCurrentAction.Cancel(); } mCurrentAction = new AttackInterfaceAction(views, mRaycaster); }
public void BeginGoTo(IEnumerable <IUnitOrders> views) { if (mCurrentAction != null) { mCurrentAction.Cancel(); } mCurrentAction = new GoToInterfaceAction(views); }
public MainWindow() { InitializeComponent(); _graph = new Graph(); _vertices = new Dictionary <Ellipse, Vertex>(); _edges = new Dictionary <Edge, Line>(); _currentAction = InterfaceAction.CreateVertex; CreateVertexButton.Tag = SelectedTag; _currentCreateEdgeActionState = CreateEdgeActionState.SelectFirstVertex; }
private void readCondition(Interface i, UnitConditionType condition) { InterfaceAction action_row = new InterfaceAction(); action_row.Id_abstract = i.Id_abstract; action_row.Id_interface = i.Id_interface; // action_row.PartitionIndex = i.Unit_replica; action_row.Id_action = condition.id; action_row.IsCondition = true; action_row.Protocol = ""; br.ufc.pargo.hpe.backend.DGAC.BackEnd.iadao.insert(action_row); }
private void readProtocol(Interface i, string action_id, ProtocolChoiceType protocol) { InterfaceAction action_row = new InterfaceAction(); action_row.Id_abstract = i.Id_abstract; action_row.Id_interface = i.Id_interface; // action_row.PartitionIndex = i.Unit_replica; action_row.Id_action = action_id; action_row.IsCondition = false; action_row.Protocol = ""; br.ufc.pargo.hpe.backend.DGAC.BackEnd.iadao.insert(action_row); }
public MainWindow() { InitializeComponent(); MinHeight = SystemParameters.MaximizedPrimaryScreenHeight; MinWidth = SystemParameters.MaximizedPrimaryScreenWidth; _graph = new Graph(); _ellipses = new Dictionary <VertexControl, Vertex>(); _vertices = new Dictionary <Vertex, VertexControl>(); _edges = new Dictionary <Edge, Line>(); _lines = new Dictionary <Line, Edge>(); _edgeWeightMapping = new Dictionary <Edge, TextBox>(); _weightEdgeMapping = new Dictionary <TextBox, Edge>(); _currentAction = InterfaceAction.VertexEdit; CreateVertexButton.Tag = SelectedTag; _currentCreateEdgeActionState = CreateEdgeActionState.SelectFirstVertex; InitializeAlgorithmButtons(); }
/// <summary> /// Обрабатывает событие нажатия на кнопку тулбара. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolbarButtonClick(object sender, EventArgs e) { foreach (var toolbarChild in Toolbar.Children) { ((Button)toolbarChild).Tag = null; } var button = (Button)sender; button.Tag = "Selected"; if (Equals(sender, CreateVertexButton)) { _currentAction = InterfaceAction.CreateVertex; } if (Equals(sender, CreateEdgeButton)) { _currentAction = InterfaceAction.CreateEdge; } // TODO: алгоритмы }
public void ClosePlanetsMenu(InterfaceAction action) { PlanetsMenu.instance.planetsMenuGameObj.SetActive(false); CloseMonitorAnimation(action); }
public void CloseMonitorAnimation(InterfaceAction endAction) { animationEndAction = endAction; interfaceMenu.Play("closeMonitorMenu"); }
public void OpenMonitorAnimation(InterfaceAction endAction) { animationEndAction = endAction; interfaceMenu.Play("openMonitorMenu"); }
void Update() { Selected.RemoveAll(view => view == null || view.gameObject == null); if (mSelectionState == SelectionState.Boxing && Input.GetMouseButtonUp((int)MouseButton.LeftMouse)) { SelectionManager.FinishBoxSelection(Input.GetKey(KeyCode.LeftShift), Input.mousePosition); mSelectionState = SelectionState.Idle; } SelectionManager.Update(Input.mousePosition); if (EventSystem.current.IsPointerOverGameObject()) { return; } if (mCurrentAction != null && !EventSystem.current.IsPointerOverGameObject()) { var mapHit = mRaycaster.Raycast <MapView>(Input.mousePosition); if (mapHit.IsEmpty()) { return; } var mapPoint = GameUtils.GetFlatPosition(mapHit.HitPoint); mCurrentAction.Move(mapPoint); if (Input.GetMouseButtonDown((int)MouseButton.LeftMouse)) { try { mCurrentAction.Resolve(mapPoint); } finally { mCurrentAction = null; } return; } if (Input.GetMouseButtonDown((int)MouseButton.RightMouse)) { try { mCurrentAction.Cancel(); } finally { mCurrentAction = null; } return; } return; } if (mSelectionState == SelectionState.Idle && Input.GetMouseButtonDown((int)MouseButton.LeftMouse)) { mSelectionState = SelectionState.Choose; } if (mSelectionState == SelectionState.Choose) { if (Vector2.Distance(Input.mousePosition, mLastMousePosition) > 1) { SelectionManager.StartBoxSelection(Input.mousePosition); mSelectionState = SelectionState.Boxing; } else if (Input.GetMouseButtonUp((int)MouseButton.LeftMouse)) { SelectionManager.SelectSingle(Input.GetKey(KeyCode.LeftShift), Input.mousePosition); mSelectionState = SelectionState.Idle; } } if (Input.GetMouseButtonDown((int)MouseButton.RightMouse)) { var viewHit = mRaycaster.Raycast <SelectableView>(Input.mousePosition); if (!viewHit.IsEmpty()) { foreach (var view in Selected) { if (!view.IsControlable) { continue; } if (viewHit.Object.IsControlable) { view.OnRightClick(viewHit.Object); } else { view.OnEnemyRightClick(viewHit.Object); } } return; } var mapHit = mRaycaster.Raycast <MapView>(Input.mousePosition); if (!mapHit.IsEmpty()) { var mapPoint = GameUtils.GetFlatPosition(mapHit.HitPoint); ForwardRightClick(mapPoint); return; } } mLastMousePosition = Input.mousePosition; }