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);
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public void BeginAttack(IEnumerable <IWarriorOrders> views)
        {
            if (mCurrentAction != null)
            {
                mCurrentAction.Cancel();
            }

            mCurrentAction = new AttackInterfaceAction(views, mRaycaster);
        }
Exemple #4
0
        public void BeginGoTo(IEnumerable <IUnitOrders> views)
        {
            if (mCurrentAction != null)
            {
                mCurrentAction.Cancel();
            }

            mCurrentAction = new GoToInterfaceAction(views);
        }
Exemple #5
0
 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();
 }
Exemple #9
0
        /// <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: алгоритмы
        }
Exemple #10
0
 public void ClosePlanetsMenu(InterfaceAction action)
 {
     PlanetsMenu.instance.planetsMenuGameObj.SetActive(false);
     CloseMonitorAnimation(action);
 }
Exemple #11
0
 public void CloseMonitorAnimation(InterfaceAction endAction)
 {
     animationEndAction = endAction;
     interfaceMenu.Play("closeMonitorMenu");
 }
Exemple #12
0
 public void OpenMonitorAnimation(InterfaceAction endAction)
 {
     animationEndAction = endAction;
     interfaceMenu.Play("openMonitorMenu");
 }
Exemple #13
0
        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;
        }