Exemplo n.º 1
0
 public void Press()
 {
     if (state != ActionState.WaitingForReleased) {
         state = ActionState.Pressed;
         amount++;
     }
 }
Exemplo n.º 2
0
 public Character(WorldMap worldMap, Vector2 coordinates)
 {
     mCoordinates = coordinates;
     mState = ActionState.Idle;
     mDirection = FacingDirection.Down;
     mWorldMap = worldMap;
 }
Exemplo n.º 3
0
 protected Drawer()
 {
     CellCoors = new PointF[Consts.MAP_WIDTH, Consts.MAP_HEIGHT];
     _state = ActionState.None;
     LightenedCell = Consts.MAP_START_POS;
     ShipsInfo = new Dictionary<int, ShipAttributes>();
 }
Exemplo n.º 4
0
 public ActionStateX(ActionState action, int timeDelay, bool isOnceOnly, int specifer = -1)
 {
     this.TimeDelay = timeDelay;
     IsOnceOnly = isOnceOnly;
     Action = action;
     Specifer = specifer;
 }
 private StateWrapper BuildCharge()
 {
     StateWrapper stateWrapper = new StateWrapper();
       FSMState state = new ActionState(this.chargeStateName);
       state.WithDefaultBehaviours(this.gameObject);
       if (this.animationBehaviour != null) {
     state.AddStartBehaviour(this.animationBehaviour);
       }
       state.AddStartBehaviour(new SetAnimationSpeedBehaviour(this.gameObject, 0f));
       state.AddStartBehaviour(new SetVariableBehaviour(this.gameObject, this.chargeVariable, this.initialChargeMultiplier));
       foreach (FSMBehaviour behaviour in this.customStartBehaviours) {
     state.AddStartBehaviour(behaviour);
       }
       state.AddUpdateBehaviour(new ChargeBehaviour(this.gameObject, this.chargeVariable, this.maxChargeMultiplier, this.maxChargeSeconds));
       state.AddExitBehaviour(new SetAnimationSpeedBehaviour(this.gameObject, 1f));
       stateWrapper.state = state;
       FSMTransition transition = null;
       foreach (string startingState in this.startingStates) {
     transition = new FSMTransition(startingState, this.chargeStateName);
     transition.AddConditions(
       new VarConditionsBuilder()
       .IgnoringInputs().IgnoringAttributes().IgnoringDirections().IgnoringPositions().IgnoringFlags().IgnoringCombat()
       .WithVar(CharVars.FromInputMode(this.input), new InputCondition(CharVars.FromInputMode(this.input).ToS(), Operators.EQUAL, InputModes.PRESS, InputModes.DOUBLE_TAP))
       .Build()
     );
     stateWrapper.transitions.Add(transition);
       }
       return stateWrapper;
 }
Exemplo n.º 6
0
 public ActionStateRuleAttribute(string id, string actionId, Nesting targetViewNesting, string normalCriteria,
                                 string emptyCriteria, ViewType viewType, string module, ActionState actionState,
                                 string viewId)
     : base(id, targetViewNesting, normalCriteria, emptyCriteria, viewType, module, viewId) {
     this.actionId = actionId;
     ActionState = actionState;
 }
        public void update()
        {
            if (actionState == ActionState.Idle)
            {
                if (Constants.bRandom.Next() % 12 == 0)
                    actionState = ActionState.Playing;
                else
                    return;
            }
            else
            {
                // Random idle
                if (Constants.bRandom.Next() % 50 == 0)
                {
                    curA = curB = curUp = curDown = curLeft = curRight = false;
                    actionState = ActionState.Idle;
                    return;
                }
            }

            bool prevA = curA;
            bool prevB = curB;
            bool prevUp = curUp;
            bool prevDown = curDown;
            bool prevLeft = curLeft;
            bool prevRight = curRight;

            curA = Constants.bRandom.Next() % 12 == 0 ? true : false;
            curB = Constants.bRandom.Next() % 12 == 0 ? true : false;
            curUp = Constants.bRandom.Next() % 15 == 0 ? !prevUp : prevUp;
            curDown = Constants.bRandom.Next() % 15 == 0 ? !prevDown : prevDown;
            curLeft = Constants.bRandom.Next() % 15 == 0 ? !prevLeft : prevLeft;
            curRight = Constants.bRandom.Next() % 15 == 0 ? !prevRight : prevRight;
        }
Exemplo n.º 8
0
	public void Update() {
		inventory.AddToInventory(harvestable.Harvest(), harvestable.amountPerCollection);
		if (harvestable.remainingAmount <= 0) {
			Object.Destroy(harvestable);
		}
		state = ActionState.Done;
	}
Exemplo n.º 9
0
    public bool Collect()
    {
        GetComponent<NPCFidget>().StopWalking();

        foundObject = false;
        leftHand = findLeftHandRecursive(transform);
        rightHand = findRightHandRecursive(transform);
        if(leftHand != null && rightHand != null)
        {
            armsUp = true;
            if(objToCollect == null)
                currentState = ActionState.Find;
            objToCollect.transform.rotation = transform.rotation;
            objToCollect.transform.position = transform.position + transform.forward*2;
            objToCollect.transform.position = new Vector3(objToCollect.transform.position.x, objToCollect.transform.position.y+1, objToCollect.transform.position.z);
            objToCollect.transform.parent = transform;
            if(objToCollect.GetComponent("Evolvable") != null)
            {
                (objToCollect.GetComponent("Evolvable") as Evolvable).enabled = false;
            }

            if(objToCollect.GetComponent<PickUpableItem>() != null)
            {
                objToCollect.GetComponent<PickUpableItem>().enabled = false;
            }
            return true;
        }
        return false;
    }
Exemplo n.º 10
0
        public ActionChangeDialog(ActionState currentState)
        {
            InitializeComponent();

            ExistingState = currentState;
            NewState = currentState;
            ExtraInfo = "";
        }
 protected override void UpdateActionState(ActionState state)
 {
     base.UpdateActionState(state);
     if (this.FComponentCheckedProperty != null)
     {
         this.FComponentCheckedProperty.SetValue(base.Component, (state & ActionState.Checked) > ActionState.None, null);
     }
 }
Exemplo n.º 12
0
        public void Begin()
        {
            if (state != ActionState.None)
                throw new InvalidOperationException("Begin should only be called once.");

            state = ActionState.InProgress;
            ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProcess));
        }
Exemplo n.º 13
0
        public RuntimeLumberjack(ActionState state, Lumberjack prototype)
            : base(state)
        {
            Prototype = prototype;

            var size = new Vector2(8, 8);
            Hitbox = new Bounds(-size, size);

            Occupy(state.Building<RuntimeAdminBuilding>());
        }
 private void SetActionState(ActionState state, bool value)
 {
     if (value)
     {
         this.FState |= state;
     }
     else
     {
         this.FState &= ~state;
     }
 }
Exemplo n.º 15
0
    public static ActionState NextAction(List<int> pinFalls)
    {
        ActionMaster actionMaster = new ActionMaster();
        ActionState currentAction = new ActionState();

        foreach (int pinFall in pinFalls) {
            currentAction = actionMaster.Bowl (pinFall);
        }

        return currentAction;
    }
    public ActionState RunAction()
    {
        if (this.CachedFunc != null) {
            this.CurrentState = this.CachedFunc();
        }
        else {
            Debug.LogWarning("Action has no OnAction set");
            this.CurrentState = ActionState.ACTION_CANCELLED;
        }

        return this.CurrentState;
    }
Exemplo n.º 17
0
        protected override JobStatus ActionDoneOverride(ActionState actionStatus)
        {
            switch (actionStatus)
            {
                case ActionState.Done:
                case ActionState.Fail:
                case ActionState.Abort:
                    return JobStatus.Ok;

                default:
                    throw new Exception();
            }
        }
Exemplo n.º 18
0
    protected virtual void Attack(int attackWeight = 1)
    {

        ACC = level - PlayerState._instance.level > 0 ? 0.7f :
                   (0.7 - (PlayerState._instance.level - level) * 0.15f <= 0 ? 0.05f :
                           ((0.7f - (PlayerState._instance.level - level) * 0.15f + 0.05f)));
        PlayerController._instance.TakeDamage(ATK, ACC);
        if (!PlayerState._instance.PlayerAliveNow)
        {
            nowState = ActionState.notFoundPlayer;
        }

    }
Exemplo n.º 19
0
        public SecretAnnouncement(string name, Dictionary<string, Agent> allAgents, Dictionary<string, Agent> audience, Formula announcement)
            : base(name , allAgents , audience , announcement)
        {
            ActionState trueState = new ActionState("TrueState");
            SecretState = new ActionState("Secret");
            SecretState.Precondition = announcement;
            ActionStates.Add(trueState);
            ActionStates.Add(SecretState);

            Relation = new ActionIndecisionPair(SecretState, trueState);
            Relation.TagedAgents = GetSubtractionOfAgentDics(allAgents, audience);
            TransitionRelation.Add(Relation);
        }
Exemplo n.º 20
0
        // высота объекта над землей

        public Entity(string url, string id) : base(url) {
            Id = id;
            IsAntialiased = false;
            Direction = 0;
            Speed = 0;
            Tag = Tags.Unknown;
            Hp = new Stat(0);
            AttackDamage = 0;
            ActionState = ActionState.Idle;
            Scale = Settings.Scale;
            MaskW = (int) (Texture.PixelsWide*ScaleX) - MaskLesser;
            MaskH = (int) (Texture.PixelsHigh*ScaleY) - MaskLesser;
        }
        public AIPlayer()
        {
            // Init controls to idle state
            curA = curB = curUp = curDown = curLeft = curRight = false;
            controls = new Ringo.Controls();
            controls.A = delegate { return curA; };
            controls.B = delegate { return curB; };
            controls.up = delegate { return curUp; };
            controls.down = delegate { return curDown; };
            controls.left = delegate { return curLeft; };
            controls.right = delegate { return curRight; };

            actionState = ActionState.Idle;
        }
Exemplo n.º 22
0
 public int GetAmount()
 {
     int temp = amount;
     if (temp != 0) {
         if (state == ActionState.Released) {
             amount = 0;
         } else
         if (behavior == ActionKind.OnlyInitialPress) {
             state = ActionState.WaitingForReleased;
             amount = 0;
         }
     }
     return temp;
 }
Exemplo n.º 23
0
 void ThreadProcess(object state)
 {
     lock (stateLock) {
         try {
             PerformBackgroundAction();
             this.state = cancel ? ActionState.Cancelled : ActionState.Success;
             ReportFinished();
         }
         catch (Exception e) {
             this.state = ActionState.Error;
             if (Finished != null)
                 Finished(this, new ActionFinishedEventArgs() { State = State, Exception = e });
         }
     }
 }
Exemplo n.º 24
0
// MonoBehaviour
//
	void Update () {
		if (actionState != ActionState.eIdle) {
			const float travelTime = 3.0f;

			t += Time.deltaTime;
			if (t >= travelTime) {
				t = travelTime;
				actionState = ActionState.eIdle;
			}
			transform.position = Vector3.Lerp (startPt, endPt, t / travelTime);
		}

		if (bSelected) {
			transform.Rotate (Vector3.up, 360.0f * Time.deltaTime, Space.World);
		}
	}
Exemplo n.º 25
0
 void Update() {
     bool wait = Input.GetKeyUp(KeyCode.W);
     if (wait) {
         if (!canWait_ || actionState_ == ActionState.ATTACK) {
             Debug.Log(String.Format("Cannot wait! {0}, {1}", canWait_, actionState_));
             return;
         }
         actionState_ = ActionState.MOVE;
         characterQueue_.CharacterIsWaiting();
         ActivateFrom(GetCurrentCharacter());
     }
     bool defend = Input.GetKeyUp(KeyCode.D);
     if (defend) {
         actionState_ = ActionState.MOVE;
         characterQueue_.CharacterDidAction();
         ActivateFrom(GetCurrentCharacter());
     }
 }
Exemplo n.º 26
0
        protected override JobStatus ActionDoneOverride(ActionState actionStatus)
        {
            if (CheckProgress() == JobStatus.Done)
                return JobStatus.Done;

            switch (actionStatus)
            {
                case ActionState.Done:
                    return JobStatus.Ok;

                case ActionState.Fail:
                    var res = PreparePath(this.Worker);
                    return res;

                case ActionState.Abort:
                    return JobStatus.Abort;

                default:
                    throw new Exception();
            }
        }
        public MegamanActionState GetActionState(ActionState state)
        {
            switch (state)
            {
                case ActionState.Crouching:
                    if (!states.ContainsKey(state))
                    {
                        states.Add(state, new MegamanCrouchingState(megaman));
                    }
                    break;
                case ActionState.Falling:
                    if (!states.ContainsKey(state))
                    {
                        states.Add(state, new MegamanFallingState(megaman));
                    }
                    break;
                case ActionState.Idle:
                    if (!states.ContainsKey(state))
                    {
                        states.Add(state, new MegamanIdleState(megaman));
                    }
                    break;
                case ActionState.Jumping:
                    if (!states.ContainsKey(state))
                    {
                        states.Add(state, new MegamanJumpingState(megaman));
                    }
                    break;
                case ActionState.Running:
                    if (!states.ContainsKey(state))
                    {
                        states.Add(state, new MegamanRunningState(megaman));
                    }
                    break;
                default:
                    return new MegamanActionState(megaman);
            }

            return states[state];
        }
Exemplo n.º 28
0
        public virtual void Cancel() {
            // if it's already done, this is a no-op
            lock (_lock) {
                if (_actionState >= ActionState.Cancelling) {
                    return;
                }
                _actionState = ActionState.Cancelling;
            }

            // activate the cancellation token for those who are watching for that.
            _cancellationTokenSource.Cancel();

            // actively tell anyone who is listening that we're trying to cancel this.
            if (OnCancel != null) {
                OnCancel();
            }
            lock (_lock) {
                if (_actionState < ActionState.Canceled) {
                    _actionState = ActionState.Canceled;
                }
            }
        }
Exemplo n.º 29
0
    void OnAiActionChanged(ActionState _state)
    {
        if (mActionState == _state || mAnim == null)
            return;

        mActionState = _state;

        switch(_state)
        {
        case ActionState.Idle:
            mAnim.SetInteger("ActionType", 0);
            break;

        case ActionState.Walk:
            mAnim.SetInteger("ActionType", 1);
            break;

        case ActionState.Run:
            mAnim.SetInteger("ActionType", 2);
            break;
        }
    }
Exemplo n.º 30
0
        protected override JobStatus ActionDoneOverride(ActionState actionStatus)
        {
            switch (actionStatus)
            {
                case ActionState.Done:
                    return CheckProgress(this.Worker);

                case ActionState.Fail:
                    m_numFails++;
                    if (m_numFails > 10)
                        return JobStatus.Abort;

                    var res = PreparePath(this.Worker);
                    return res;

                case ActionState.Abort:
                    return JobStatus.Abort;

                default:
                    throw new Exception();
            }
        }
        public virtual BaseAction Handle(string inputString)
        {
            State = ActionState.NotFound;

            // First check if normal action
            var words       = Children.Join("|");
            var actionFound = Regex.Match(inputString, $@"\b(?:{words})\b", RegexOptions.IgnoreCase);

            if (actionFound.Success)
            {
                var actionObject = GetActionObjectFrom(actionFound.Value);

                // If is action?
                if (actionObject.IsAskingForHelp(inputString))
                {
                    ConsoleUtils.WriteLine(actionObject.Description, ConsoleColor.Yellow);
                    return(this);
                }

                actionObject.Handle(inputString);
                return(actionObject);
            }

            // Then check if help action
            words       = HelpKeywords.Select(Regex.Escape).Join("|");
            actionFound = Regex.Match(inputString, $@"(?:{words})", RegexOptions.IgnoreCase);

            if (actionFound.Success)
            {
                foreach (var actionName in Children)
                {
                    var actionObject = GetActionObjectFrom(actionName);
                    ConsoleUtils.WriteLine($"{actionName}: {actionObject.Description}", ConsoleColor.Yellow);
                }
            }

            return(this);
        }
Exemplo n.º 32
0
        public void TestSmallTransitionLoop()
        {
            var runs = 0;

            var machine = new StateMachine();

            var state1 = new ActionState
            {
                Enter = () => runs++
            };

            var state2 = new ActionState
            {
                Enter = () => runs++
            };

            machine.AddTransition(DefaultState.Enter, state1);
            machine.AddTransition(state1, state2);
            machine.AddTransition(state2, state1);

            machine.Update(0);
            Assert.AreEqual(2, runs, double.Epsilon);
        }
        private void btnDeleteI_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;

            string tempcolorTextBox = colorTextBox.Text.ToString();
            string tempmakeTextBox  = makeTextBox.Text.ToString();

            btnNewI.IsEnabled    = false;
            btnEditI.IsEnabled   = false;
            btnDeleteI.IsEnabled = false;

            btnSaveI.IsEnabled   = true;
            btnCancelI.IsEnabled = true;

            btnPrevI.IsEnabled = false;
            btnNextI.IsEnabled = false;

            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);

            colorTextBox.Text = tempcolorTextBox;
            makeTextBox.Text  = tempmakeTextBox;
        }
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Nothing;
            btnNew.IsEnabled = true;
            btnEdit.IsEnabled = true;
            btnEdit.IsEnabled = true;
            btnSave.IsEnabled = false;
            btnCancel.IsEnabled = false;
            lstPhones.IsEnabled = true;
            btnPrevious.IsEnabled = true;
            btnNext.IsEnabled = true;
            txtPhoneNumber.IsEnabled = false;
            txtSubscriber.IsEnabled = false;

            txtContactValue.IsEnabled = false;
            txtContactDate.IsEnabled = false;
            txtPhoneNumber.SetBinding(TextBox.TextProperty, txtPhoneNumberBinding);
            txtSubscriber.SetBinding(TextBox.TextProperty, txtSubscriberBinding);

            txtContactValue.SetBinding(TextBox.TextProperty, txtContactValueBinding);
            txtContactDate.SetBinding(TextBox.TextProperty, txtContactDateBinding);

        }
Exemplo n.º 35
0
        private void ordDelete_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;

            string tempCustomer = cmbCustomers.Text.ToString();
            string tempProducts = cmbProducts.Text.ToString();

            ordNew.IsEnabled    = false;
            ordEdit.IsEnabled   = false;
            ordDelete.IsEnabled = false;

            ordSave.IsEnabled        = true;
            ordCancel.IsEnabled      = true;
            ordersDataGrid.IsEnabled = false;
            ordPrev.IsEnabled        = false;
            ordNext.IsEnabled        = false;


            BindingOperations.ClearBinding(cmbCustomers, ComboBox.TextProperty);
            BindingOperations.ClearBinding(cmbProducts, ComboBox.TextProperty);
            cmbCustomers.Text = tempCustomer;
            cmbProducts.Text  = tempProducts;
        }
Exemplo n.º 36
0
        private void btnDeleteCust_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;
            string tempFirstName = firstNameTextBox.Text.ToString();
            string tempLastName  = lastNameTextBox.Text.ToString();

            btnNewCust.IsEnabled    = false;
            btnEditCust.IsEnabled   = false;
            btnDeleteCust.IsEnabled = false;

            btnSaveCust.IsEnabled   = true;
            btnCancelCust.IsEnabled = true;

            customerDataGrid.IsEnabled = false;

            btnPrevCust.IsEnabled = false;
            btnNextCust.IsEnabled = false;

            BindingOperations.ClearBinding(firstNameTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(lastNameTextBox, TextBox.TextProperty);
            firstNameTextBox.Text = tempFirstName;
            lastNameTextBox.Text  = tempLastName;
        }
Exemplo n.º 37
0
        // inner update sequnce
        ActionState UpdateSequence()
        {
            ActionState result = ActionState.Success;

            while (m_index < childNodes.Length)
            {
                // exception infinite loop
                Debug.Assert(childNodes[m_index] != this, "child node is ownself!! " + this.name);
                if (childNodes[m_index] == this)
                {
                    return(ActionState.Error);
                }

                result = childNodes[m_index].OnUpdate();
                if (ActionState.Success != result)
                {
                    return(result);
                }
                ++m_index;
            }

            return(result);
        }
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     action                   = ActionState.New;
     btnNew.IsEnabled         = false;
     btnEdit.IsEnabled        = false;
     btnDelete.IsEnabled      = false;
     btnSave.IsEnabled        = true;
     btnCancel.IsEnabled      = true;
     lstPhones.IsEnabled      = false;
     btnPrevious.IsEnabled    = false;
     btnNext.IsEnabled        = false;
     txtPhoneNumber.IsEnabled = true;
     txtSubscriber.IsEnabled  = true;
     BindingOperations.ClearBinding(txtPhoneNumber, TextBox.TextProperty);
     BindingOperations.ClearBinding(txtSubscriber, TextBox.TextProperty);
     BindingOperations.ClearBinding(txtContractValue, TextBox.TextProperty);
     BindingOperations.ClearBinding(txtContractDate, TextBox.TextProperty);
     txtPhoneNumber.Text   = "";
     txtSubscriber.Text    = "";
     txtContractValue.Text = "";
     txtContractDate.Text  = "";
     Keyboard.Focus(txtPhoneNumber);
 }
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.New;

            btnNew.IsEnabled    = false;
            btnEdit.IsEnabled   = false;
            btnDelete.IsEnabled = false;

            btnSave.IsEnabled   = true;
            btnCancel.IsEnabled = true;
            btnPrev.IsEnabled   = false;
            btnNext.IsEnabled   = false;

            customerDataGrid.IsEnabled = false;
            firstNameTextBox.IsEnabled = true;
            lastNameTextBox.IsEnabled  = true;
            BindingOperations.ClearBinding(firstNameTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(lastNameTextBox, TextBox.TextProperty);

            firstNameTextBox.Text = "";
            lastNameTextBox.Text  = "";
            Keyboard.Focus(firstNameTextBox);
        }
        private void btnDelete_Ord_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;
            string tempCustId = txtCustId.Text.ToString();
            string tempCarId  = txtCarId.Text.ToString();

            btnNew_Ord.IsEnabled     = false;
            btnEdit_Ord.IsEnabled    = false;
            btnDelete_Ord.IsEnabled  = false;
            btnSave_Ord.IsEnabled    = true;
            btnCancel_Ord.IsEnabled  = true;
            btnNext_Ord.IsEnabled    = false;
            btnPrev_Ord.IsEnabled    = false;
            ordersDataGrid.IsEnabled = false;
            txtCarId.IsEnabled       = true;
            txtCustId.IsEnabled      = true;
            txtOrderId.IsEnabled     = false;

            BindingOperations.ClearBinding(txtCarId, TextBox.TextProperty);
            BindingOperations.ClearBinding(txtCustId, TextBox.TextProperty);
            txtCarId.Text  = tempCarId;
            txtCustId.Text = tempCustId;
        }
Exemplo n.º 41
0
        private void btnDelete2_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;

            string tempCustomer  = cmbCustomers.Text.ToString();
            string tempInventory = cmbInventory.Text.ToString();

            btnNew2.IsEnabled    = false;
            btnEdit2.IsEnabled   = false;
            btnDelete2.IsEnabled = false;

            btnSave2.IsEnabled      = true;
            btnCancel2.IsEnabled    = true;
            orderDataGrid.IsEnabled = false;
            btnPrevious2.IsEnabled  = false;
            btnNext2.IsEnabled      = false;


            BindingOperations.ClearBinding(cmbCustomers, ComboBox.TextProperty);
            BindingOperations.ClearBinding(cmbInventory, ComboBox.TextProperty);
            cmbCustomers.Text = tempCustomer;
            cmbInventory.Text = tempInventory;
        }
        private void btnDelete_Inv_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;
            string tempColor = colorTextBox.Text.ToString();
            string tempMake  = makeTextBox.Text.ToString();

            btnNew_Inv.IsEnabled        = false;
            btnEdit_Inv.IsEnabled       = false;
            btnDelete_Inv.IsEnabled     = false;
            btnSave_Inv.IsEnabled       = true;
            btnCancel_Inv.IsEnabled     = true;
            btnNext_Inv.IsEnabled       = false;
            btnPrev_Inv.IsEnabled       = false;
            inventoryDataGrid.IsEnabled = false;
            carIdTextBox.IsEnabled      = true;
            colorTextBox.IsEnabled      = true;
            makeTextBox.IsEnabled       = true;

            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);
            colorTextBox.Text = tempColor;
            makeTextBox.Text  = tempMake;
        }
Exemplo n.º 43
0
        void Meteo(Vector3 pos)
        {
            switch (actionState)
            {
            case ActionState.MeteoLv3:
                Instantiate(meteoLv3, pos, Quaternion.identity);
                break;

            case ActionState.MeteoLv2:
                Instantiate(meteoLv2, pos, Quaternion.identity);
                break;

            case ActionState.MeteoLv1:
                Instantiate(meteoLv1, pos, Quaternion.identity);
                break;

            case ActionState.MeteoLv0:
                Instantiate(meteoLv0, pos, Quaternion.identity);
                break;
            }
            meteoCoolDown = 0;
            actionState   = ActionState.None;
        }
Exemplo n.º 44
0
        void Poison(Vector3 pos)
        {
            switch (actionState)
            {
            case ActionState.PoisonLv0:
                Instantiate(poisonLv0, pos, Quaternion.identity);
                break;

            case ActionState.PoisonLv1:
                Instantiate(poisonLv1, pos, Quaternion.identity);
                break;

            case ActionState.PoisonLv2:
                Instantiate(poisonLv2, pos, Quaternion.identity);
                break;

            case ActionState.PoisonLv3:
                Instantiate(poisonLv3, pos, Quaternion.identity);
                break;
            }
            poisonCoolDown = 0;
            actionState    = ActionState.None;
        }
Exemplo n.º 45
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;
            string tempPhonenum       = txtPhoneNumber.Text.ToString();
            string tempSubscriber     = txtSubscriber.Text.ToString();
            string tempContract_Value = txtValoareContract.Text.ToString();
            string tempContract_Date  = txtDataContract.Text.ToString();

            btnNew.IsEnabled      = false;
            btnEdit.IsEnabled     = false;
            btnDelete.IsEnabled   = false;
            btnSave.IsEnabled     = true;
            btnCancel.IsEnabled   = true;
            lstPhones.IsEnabled   = false;
            btnPrevious.IsEnabled = false;
            btnNext.IsEnabled     = false;
            BindingOperations.ClearBinding(txtPhoneNumber, TextBox.TextProperty);
            BindingOperations.ClearBinding(txtSubscriber, TextBox.TextProperty);
            txtPhoneNumber.Text     = tempPhonenum;
            txtSubscriber.Text      = tempSubscriber;
            txtValoareContract.Text = tempContract_Value;
            txtDataContract.Text    = tempContract_Date;
        }
        private void btnDelete1_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;
            string tempColor = firstNameTextBox.Text.ToString();
            string tempMake  = lastNameTextBox.Text.ToString();

            btnNew.IsEnabled    = false;
            btnEdit.IsEnabled   = false;
            btnDelete.IsEnabled = false;
            btnSave.IsEnabled   = true;
            btnCancel.IsEnabled = true;

            inventoryDataGrid.IsEnabled = false;

            btnPrevious.IsEnabled = false;
            btnNext.IsEnabled     = false;

            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);

            colorTextBox.Text = tempColor;
            makeTextBox.Text  = tempMake;
        }
        private void btnInNew_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.New;

            btnInNew.IsEnabled    = false;
            btnInEdit.IsEnabled   = false;
            btnInDelete.IsEnabled = false;

            btnInSave.IsEnabled   = true;
            btnInCancel.IsEnabled = true;
            btnInPrev.IsEnabled   = false;
            btnInNext.IsEnabled   = false;

            inventoryDataGrid.IsEnabled = false;
            colorTextBox.IsEnabled      = true;
            makeTextBox.IsEnabled       = true;
            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);

            colorTextBox.Text = "";
            makeTextBox.Text  = "";
            Keyboard.Focus(colorTextBox);
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Edit;
            string tempFirstName = firstNameTextBox.Text.ToString();
            string tempLastName  = lastNameTextBox.Text.ToString();

            btnNew.IsEnabled    = false;
            btnEdit.IsEnabled   = false;
            btnDelete.IsEnabled = false;

            btnSave.IsEnabled          = true;
            btnCancel.IsEnabled        = true;
            customerDataGrid.IsEnabled = false;
            btnPrevious.IsEnabled      = false;
            btnNext.IsEnabled          = false;
            firstNameTextBox.IsEnabled = true;
            lastNameTextBox.IsEnabled  = true;
            BindingOperations.ClearBinding(firstNameTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(lastNameTextBox, TextBox.TextProperty);
            firstNameTextBox.Text = tempFirstName;
            lastNameTextBox.Text  = tempLastName;
            Keyboard.Focus(firstNameTextBox);
        }
Exemplo n.º 49
0
        protected override JobStatus ActionDoneOverride(ActionState actionStatus)
        {
            if (CheckProgress() == JobStatus.Done)
            {
                return(JobStatus.Done);
            }

            switch (actionStatus)
            {
            case ActionState.Done:
                return(JobStatus.Ok);

            case ActionState.Fail:
                var res = PreparePath(this.Worker);
                return(res);

            case ActionState.Abort:
                return(JobStatus.Abort);

            default:
                throw new Exception();
            }
        }
Exemplo n.º 50
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Edit;
            string tempPhonenum   = txtPhoneNumber.Text.ToString();
            string tempSubscriber = txtSubscriber.Text.ToString();

            btnCancel.IsEnabled      = true;
            btnSave.IsEnabled        = true;
            btnNew.IsEnabled         = false;
            btnEdit.IsEnabled        = false;
            lstPhones.IsEnabled      = false;
            btnPrevious.IsEnabled    = false;
            btnNext.IsEnabled        = false;
            txtPhoneNumber.IsEnabled = true;
            txtSubscriber.IsEnabled  = true;

            BindingOperations.ClearBinding(txtPhoneNumber, TextBox.TextProperty);
            BindingOperations.ClearBinding(txtSubscriber, TextBox.TextProperty);

            txtPhoneNumber.Text = tempPhonenum;
            txtSubscriber.Text  = tempSubscriber;
            Keyboard.Focus(txtPhoneNumber);
        }
Exemplo n.º 51
0
        private void btnNew_Click2(object sender, RoutedEventArgs e)
        {
            action               = ActionState.New;
            btnNew2.IsEnabled    = false;
            btnEdit2.IsEnabled   = false;
            btnDelete2.IsEnabled = false;
            btnSave2.IsEnabled   = true;
            btnCancel2.IsEnabled = true;



            btnPrev.IsEnabled = false;
            btnNext.IsEnabled = false;

            cmbCustomers.IsEnabled = true;
            cmbInventory.IsEnabled = true;

            BindingOperations.ClearBinding(cmbInventory, TextBox.TextProperty);
            BindingOperations.ClearBinding(cmbCustomers, TextBox.TextProperty);

            cmbInventory.Text = "";
            cmbCustomers.Text = "";
        }
Exemplo n.º 52
0
        private void ActionForm_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.S:
                ActionStateValue = ActionState.Stop;
                break;

            case Keys.C:
                ActionStateValue = ActionState.Continue;
                break;

            case Keys.M:
                ActionStateValue = ActionState.Minimize;
                break;

            case Keys.I:
                ActionStateValue = ActionState.Interruption;
                break;
            }

            Close();
        }
Exemplo n.º 53
0
        private void btnNew1_Click(object sender, RoutedEventArgs e)
        {
            action               = ActionState.New;
            btnNew1.IsEnabled    = false;
            btnEdit1.IsEnabled   = false;
            btnDelete1.IsEnabled = false;

            btnSave1.IsEnabled   = true;
            btnCancel1.IsEnabled = true;

            btnPrev1.IsEnabled     = false;
            btnNext1.IsEnabled     = false;
            colorTextBox.IsEnabled = true;
            makeTextBox.IsEnabled  = true;

            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);

            colorTextBox.Text = "";
            makeTextBox.Text  = "";

            Keyboard.Focus(colorTextBox);
        }
Exemplo n.º 54
0
        /// <summary>
        /// Runs a sequence of Actions so that it can be awaited.
        /// </summary>
        /// <param name="actions">An array of FiniteTimeAction objects.</param>
        public Task <ActionState> RunActionsAsync(params FiniteTimeAction[] actions)
        {
            if (actions.Length == 0)
            {
                return(Task.FromResult <ActionState>(null));
            }

            var tcs = new TaskCompletionSource <ActionState>();

            var numActions   = actions.Length;
            var asyncActions = new FiniteTimeAction[actions.Length + 1];

            Array.Copy(actions, asyncActions, numActions);

            ActionState state = null;

            asyncActions[numActions] = new CallFunc(() => tcs.TrySetResult(state));

            var asyncAction = asyncActions.Length > 1 ? new Sequence(asyncActions) : asyncActions[0];

            state = Application.Current.ActionManager.AddAction(asyncAction, this);
            return(tcs.Task);
        }
Exemplo n.º 55
0
    // 漂浮
    private void Float()
    {
        _curState = ActionState.Float;
        turnSpeed = Random.Range(2f, 5f);
        tarTime   = Random.Range(1, 5f);
        float dis = Random.Range(1, 2);

        tarDir.y = 0;
        Vector3 tarPos = _tr.position + tarDir * dis;

        if (Tank.instance.InTank(tarPos))
        {
            tarDistance = dis;
        }
        else
        {
            tarPos      = Tank.instance.InTankPos(tarPos);
            tarDistance = Vector3.Distance(_tr.position, tarPos);
        }
        speed.StartToTarSpeed(Random.Range(-1f, 1f), Random.Range(0.5f, 2f));
        rota.SetRotate(turnSpeed, turnSpeed, tarDir);
        move.MoveByTime(Random.Range(2f, 5f), tarDir, SpeedOver);
    }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Delete;

            string tempfirstNameTextBox = firstNameTextBox.Text.ToString();
            string templastNameTextBox  = lastNameTextBox.Text.ToString();

            btnNew.IsEnabled    = false;
            btnEdit.IsEnabled   = false;
            btnDelete.IsEnabled = false;

            btnSave.IsEnabled   = true;
            btnCancel.IsEnabled = true;

            btnPrev.IsEnabled = false;
            btnNext.IsEnabled = false;

            BindingOperations.ClearBinding(firstNameTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(lastNameTextBox, TextBox.TextProperty);

            firstNameTextBox.Text = tempfirstNameTextBox;
            lastNameTextBox.Text  = templastNameTextBox;
        }
Exemplo n.º 57
0
 private void btnCancel2_Click(object sender, RoutedEventArgs e)
 {
     action                     = ActionState.Nothing;
     btnNew2.IsEnabled          = true;
     btnEdit2.IsEnabled         = true;
     btnSave2.IsEnabled         = false;
     btnCancel2.IsEnabled       = false;
     btnPrev2.IsEnabled         = true;
     btnNext2.IsEnabled         = true;
     custIdTextBox.IsEnabled    = false;
     firstNameTextBox.IsEnabled = false;
     lastNameTextBox.IsEnabled  = false;
     carIdTextBox.IsEnabled     = false;
     colorTextBox.IsEnabled     = false;
     makeTextBox.IsEnabled      = false;
     //firstNameTextBox.SetBinding(TextBox.TextProperty, firstNameTextBoxBinding);
     //txtPhoneNumber.SetBinding(TextBox.TextProperty, txtPhoneNumberBinding);
     //txtPhoneNumber.SetBinding(TextBox.TextProperty, txtPhoneNumberBinding);
     BindingOperations.ClearBinding(firstNameTextBox, TextBox.TextProperty);
     BindingOperations.ClearBinding(lastNameTextBox, TextBox.TextProperty);
     BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
     BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);
 }
        private void btnDelete2_Click(object sender, RoutedEventArgs e)
        { //nu sunt sigura ca e ok
            action = ActionState.Delete;
            string tempcustId = custIdTextBox.Text.ToString();
            string tempcarId  = carIdTextBox.Text.ToString();

            btnNew2.IsEnabled        = false;
            btnEdit2.IsEnabled       = false;
            btnDelete2.IsEnabled     = false;
            btnSave2.IsEnabled       = true;
            btnCancel2.IsEnabled     = true;
            ordersDataGrid.IsEnabled = false;
            btnPrev2.IsEnabled       = false;
            btnNext2.IsEnabled       = false;
            custIdTextBox.IsEnabled  = false;
            carIdTextBox.IsEnabled   = false;

            BindingOperations.ClearBinding(custIdTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(carIdTextBox, TextBox.TextProperty);

            custIdTextBox.Text = tempcustId;
            carIdTextBox.Text  = tempcarId;
        }
        private void btnEditI_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Edit;
            string tempColor = colorTextBox.Text.ToString();
            string tempMake  = makeTextBox.Text.ToString();

            btnNewI.IsEnabled    = false;
            btnEditI.IsEnabled   = false;
            btnDeleteI.IsEnabled = false;

            btnSaveI.IsEnabled          = true;
            btnCancelI.IsEnabled        = true;
            inventoryDataGrid.IsEnabled = false;
            btnPreviousI.IsEnabled      = false;
            btnNextI.IsEnabled          = false;
            colorTextBox.IsEnabled      = true;
            makeTextBox.IsEnabled       = true;
            BindingOperations.ClearBinding(colorTextBox, TextBox.TextProperty);
            BindingOperations.ClearBinding(makeTextBox, TextBox.TextProperty);
            colorTextBox.Text = tempColor;
            makeTextBox.Text  = tempMake;
            Keyboard.Focus(colorTextBox);
        }
Exemplo n.º 60
0
        private void btnEdit2_Click(object sender, RoutedEventArgs e)
        {
            action = ActionState.Edit;
            string tempCustomers = cmbCustomers.Text.ToString();
            string tempInventory = cmbInventory.Text.ToString();

            btnNew2.IsEnabled        = false;
            btnEdit2.IsEnabled       = false;
            btnDelete2.IsEnabled     = false;
            btnSave2.IsEnabled       = true;
            btnCancel2.IsEnabled     = true;
            ordersDataGrid.IsEnabled = false;
            btnPrev2.IsEnabled       = false;
            btnNext2.IsEnabled       = false;
            cmbCustomers.IsEnabled   = true;
            cmbInventory.IsEnabled   = true;

            BindingOperations.ClearBinding(cmbCustomers, TextBox.TextProperty);
            BindingOperations.ClearBinding(cmbInventory, TextBox.TextProperty);
            cmbCustomers.Text = tempCustomers;
            cmbInventory.Text = tempInventory;
            Keyboard.Focus(cmbCustomers);
        }