示例#1
0
    private void EditWaypointMarkerControl()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (_editedWaypointMarkerWrapper != null)
            {
                WaypointMarker.UpdateWaypointMarker(_editedWaypointMarkerWrapper, false, pointerInfo.pointedPositionScreen);
                _editedWaypointMarkerWrapper = null;
            }
            else if (_editedWaypointMarkerWrapper == null)
            {
                var ewp = GetUICloseToScreenPosition <WaypointMarker>(GetMyCamera(), pointerInfo.pointedPositionScreen, 7f);
                if (ewp != null)
                {
                    _editedWaypointMarkerWrapper = ewp.GetRefWrapper();
                }
                else if (NoUIAtScreenPositionExceptCanvas(pointerInfo.pointedPositionScreen, 0))
                {
                }
            }
        }

        if (_editedWaypointMarkerWrapper != null &&
            _editedWaypointMarkerWrapper.GetWrappedReference() != null)
        {
            WaypointMarker.UpdateWaypointMarker(_editedWaypointMarkerWrapper, true, pointerInfo.pointedPositionScreen);
        }
    }
示例#2
0
        private void UITaskMarkerCreationAndTaskBuilding<T>(List<ISelectable> selected) where T : TaskMarker
        {
            if (selected.Count > 0)
            {

                //if (_taskSubject == null)
                //    _taskSubject = PrepareAndGetSubjectFromSelected(selected);

                T taskMarker = TaskMarker.CreateInstanceAtScreenPosition<T>(UIHandler.GetPointedScreenPosition());
                taskMarker.InitBinderForTask(associatedTaskEditMenu);
                taskMarker.EnterPlacementUIMode();

                taskMarker.OnExitPlacementUIMode.SubscribeEventHandlerMethod("spawnerbuttondeactivate",// += SpawnerButtonDeactivate;
                    () =>
                    {
                        on = false;
                        taskMarker.OnExitPlacementUIMode.UnsubscribeEventHandlerMethod("spawnerbuttondeactivate");
                    });

                taskMarker.OnPlacementConfirmation.SubscribeEventHandlerMethod("onplacementconfirmationcallback",
                    (b) =>
                    {
                        if (b)
                        {
                            if (_actorGroup == null)
                                _actorGroup = UnitGroup.PrepareAndCreateGroupFromSelected(selected);

                            TaskPlan2 taskPlan = taskMarker.InsertAssociatedTaskIntoPlan(_actorGroup, _lastPlacedTaskMarkerWrapper?.Value);

                            if (!taskPlan.IsPlanBeingExecuted())
                                taskPlan.StartPlanExecution();

                            if (Input.GetKey(KeyCode.LeftShift))
                            {
                                /*if (_lastPlacedTaskMarkerWrapper == null)
                                {
                                    var tm = ITaskSubject.GetPlans().FirstOrDefault()?.GetCurrentTaskInPlan()?.GetTaskMarker();
                                    if (tm != null)
                                        _lastPlacedTaskMarkerWrapper = new MapMarkerWrapper<TaskMarker>(tm);
                                }
                                else
                                {
                                    _lastPlacedTaskMarkerWrapper = new MapMarkerWrapper<TaskMarker>(taskMarker);
                                }*/
                                _lastPlacedTaskMarkerWrapper = new MapMarkerWrapper<TaskMarker>(taskMarker);
                                OnButtonActivationOrNot(true);
                            }
                            else
                            {
                                _actorGroup = null;
                                _lastPlacedTaskMarkerWrapper = null;
                            }
                        }
                        else
                        {
                            _actorGroup = null;
                            _lastPlacedTaskMarkerWrapper = null;
                            taskMarker.OnPlacementConfirmation.UnsubscribeEventHandlerMethod("onplacementconfirmationcallback");
                            //editedTaskPlan = null;
                        }
                    });

                SelectionHandler.GetUsedSelector().SelectEntity(taskMarker);
            }
        }
示例#3
0
 protected override void InstanceSetTaskMarker(TaskMarker taskMarker)
 {
     _targetTaskMarkerWrapper = new MapMarkerWrapper <TargetTaskMarker>(taskMarker as TargetTaskMarker);
 }
示例#4
0
 protected override void InstanceSetTaskMarker(TaskMarker taskMarker)
 {
     _moveTaskMarkerWrapper = new MapMarkerWrapper <MoveTaskMarker>(taskMarker as MoveTaskMarker);
 }