private void ProcessCancelTransaction(object state)
        {
            string status = EgateAPI.egGetOpStatus(_current.ID, true).GetString();

            _cancel = (status[0] == EgateAPI.StatusResult) ? CancelState.Completed : CancelState.None;
            OnMessage(String.Format("Транзакция отменена : {0}", _cancel), false);

            if (_cancel == CancelState.Completed)
            {
                Gazprom.TransactionCancelled++;
            }
        }
        public BankingDevice(byte cashBoxUID)
        {
            _cashBoxUID            = cashBoxUID;
            _keyAcqiured           = false;
            _state                 = EquipmentState.Idle;
            _lastTransactionResult = TransactionResult.Unknown;
            _cancel                = CancelState.None;
            _reconcilation         = ReconcilationState.Idle;

            _timer          = new System.Timers.Timer(100);
            _timer.Elapsed += ProcessTransaction;

            _current = null;
        }
        public BankingDevice(byte cashBoxUID)
        {
            cashBoxUid            = cashBoxUID;
            keyAcqiured           = false;
            state                 = EquipmentState.Idle;
            lastTransactionResult = TransactionResult.Unknown;
            cancel                = CancelState.None;
            reconcilation         = ReconcilationState.Idle;

            timer          = new Timer(100);
            timer.Elapsed += ProcessTransaction;

            current = null;
        }
Exemplo n.º 4
0
        public PlayerMovement(float speed)
        {
            cancelState = CancelState.none;
            this.speed  = speed;

            isAttacking = false;
            isJumping   = false;

            groundBound = 0;

            groundIconRect  = new Rectangle(2, 2, 4, 4);
            attackDirection = new Vector2(1, 1);

            playerMovementBox = new Rectangle(20, 10, 40, 10);;
        }
        public bool BeginTransaction(int receiptID, int amount)
        {
            AcquireKey();
            if (!Ready)
            {
                OnMessage("Оборудование не готово", true);
                return(false);
            }

            if (_state != EquipmentState.Idle)
            {
                OnMessage("Транзакция уже выполняется", true);
                return(false);
            }

            string request = CreateRequest(OperationType.Payment)
                             .Append(EgateAPI.ParameterSeparator)
                             .Append(amount)
                             .Append(EgateAPI.ParameterSeparator)
                             .Append(receiptID)
                             .ToString();

            OnMessage(String.Format("Транзакция начинается : {0}", request), false);

            _current = CreateInstance();
            string result = EgateAPI.egAuthRequestAsync(_current.ID, EgateAPI.ProtocolID, request).GetString();

            if (!result.StartsWith(EgateAPI.AsyncRequestStartedString))
            {
                //EgateAPI.egGetOpStatus(_instanceID, true);
                OnError(_current);
                return(false);
            }

            OnMessage(String.Format("Запрос отправлен : {0}", result), false);

            _cancel = CancelState.None;
            _state  = EquipmentState.Started;
            OnStateChanged(_state, String.Empty);
            _timer.Start();

            return(true);
        }
Exemplo n.º 6
0
 public Hitbox(int damage, int chipDamage, int hitstun, int blockstun, Vector2 pushback,
               Rectangle hitboxBounds, Vector2 positionOffset, CancelState cancelStrength, HitSpark attackStrength, AttackProperty attackProperty = AttackProperty.Hit, int pushbackDuration = 5, int hitStop = -1, bool ignorePushback = false, ThrowType throwType = ThrowType.none)
 {
     this.damage           = damage;
     this.chipDamage       = chipDamage;
     this.hitstun          = hitstun;
     this.blockstun        = blockstun;
     this.pushbackDuration = pushbackDuration;
     this.pushback         = pushback;
     this.hitboxBounds     = hitboxBounds;
     this.positionOffset   = positionOffset;
     this.attackProperty   = attackProperty;
     this.cancelStrength   = cancelStrength;
     this.attackStrength   = attackStrength;
     this.ignorePushback   = ignorePushback;
     this.throwType        = throwType;
     moveMasterID          = MasterObjectContainer.GetMoveMasterID();
     moveCurrentUseID      = 0;
     if (hitStop == -1)
     {
         if (attackStrength == HitSpark.light)
         {
             this.hitStop = 5;
         }
         else if (attackStrength == HitSpark.medium)
         {
             this.hitStop = 7;
         }
         else if (attackStrength == HitSpark.heavy)
         {
             this.hitStop = 9;
         }
         else
         {
             this.hitStop = 11;
         }
     }
     else
     {
         this.hitStop = hitStop;
     }
 }
        public bool CancelTransaction()
        {
            if (_state == EquipmentState.Idle)
            {
                return(false);
            }
            if (_cancel != CancelState.None)
            {
                return(false);
            }

            if (!ThreadPool.QueueUserWorkItem(ProcessCancelTransaction))
            {
                return(false);
            }

            _cancel = CancelState.Pending;
            OnMessage("Отмена транзакции начинается", false);

            return(true);
        }
Exemplo n.º 8
0
        public IActionResult Attack(Guid gameId, Guid playerId, Guid cardId, int state)
        {
            try
            {
                switch (state)
                {
                case 1:
                {
                    IState logic = new AttackState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }

                case 2:
                {
                    IState logic = new TargetState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }

                case 3:
                {
                    IState logic = new CancelState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }
                }


                return(Ok());
            }
            catch
            {
                return(BadRequest());
            }
        }
Exemplo n.º 9
0
 public void CancelActions()
 {
     isAttacking = false;
     isJumping   = false;
     cancelState = CancelState.none;
 }
Exemplo n.º 10
0
    }                                              // 0x00898B10-0x00898B20

    public void SetCancelState(CancelState state, bool bMessage)
    {
    }                                                                   // 0x00898B20-0x00898B30
Exemplo n.º 11
0
        public MainViewModel(KeyHooker hookerKey, MouseHooker hookerMouse, KeySenderInput keySenderInput, MouseSenderInput mouseSenderInput)
        {
            mHookerKey = hookerKey;
            mHookerKey.SetHook();
            mHookerMouse = hookerMouse;
            mHookerMouse.SetHook();

            mKeySenderInput = keySenderInput;
            mMouseSenderInput = mouseSenderInput;

            mStopMacroBranch = new Branch<IInput>(mInputEqualityComparer);
            mMacrosModeBranch = new Branch<IInput>(mInputEqualityComparer);

            Settings.Default.Setting = Settings.Default.Setting ?? new AppSettings(mInputEqualityComparer);
            AppSettings settings = Settings.Default.Setting;
            mTreeRoot = settings.TreeRoot;
            mTreeSequence = settings.TreeSequence;
            MacrosCollection = settings.MacrosCollection;
            StopMacroCollection = settings.SequenceStopMacro;
            MacrosModeCollection = settings.SequenceMacrosMode;
            SequenceCollection = settings.Sequence;
            MacroCollection = settings.Macro;

            mSequenceReader = new HookNotRepeatReader(mHookerKey, SequenceCollection);
            ObservableCollection<IInput> tempCollection = new ObservableCollection<IInput>(MacroCollection.Cast<IInput>());
            tempCollection.CollectionChanged += ReadMacro_CollectionChanged;
            mMacroReader = new MultiHookNotRepeatReader(new List<IHooker> { mHookerKey, mHookerMouse }, tempCollection);
            mStopMacroReader = new HookNotRepeatReader(mHookerKey, StopMacroCollection);
            mMacrosModeReader = new HookNotRepeatReader(mHookerKey, MacrosModeCollection);

            RecordSequenceCommand = new RelayCommand(RecordSequence);
            RecordMacroCommand = new RelayCommand(RecordMacro);
            CreateMacrosCommand = new RelayCommand(CreateMacros);
            CleanRowsSequenceCommand = new RelayCommand(CleanSequence);
            CleanRowsMacroCommand = new RelayCommand(CleanMacro);
            CleanRowsMacrosCommand = new RelayCommand(CleanMacros);
            DeleteRowSequenceCommand = new RelayCommand<IInput>(RemoveSequence);
            DeleteRowMacroCommand = new RelayCommand<InputDelay>(RemoveMacro);
            DeleteRowMacrosCommand = new RelayCommand<Macros>(RemoveMacros);
            StopRecordStopMacroCommand = new RelayCommand(StopRecordStopMacro);
            StartRecordStopMacroCommand = new RelayCommand(StartRecordStopMacro);
            StartRecordMacrosModeCommand = new RelayCommand(StartRecordMacrosMode);
            StopRecordMacrosModeCommand = new RelayCommand(StopRecordMacrosMode);
            SetDefaultDelayCommand = new RelayCommand(SetDefaultDelay);
            StopAllRecordCommand = new RelayCommand(StopAllRecord);

            mCancellationState = new CancelState<IInput>(mInputEqualityComparer);

            StateWalker<IInput> machineWalker = new StateWalker<IInput>(mTreeRoot);
            mHookerKey.Hooked += arg =>
            {
                State<IInput> currentState = machineWalker.WalkStates(arg);
                return currentState is FunctionState<IInput>
                    ? (bool)((FunctionState<IInput>)currentState).ExecuteFunction()
                    : currentState is CancellationFunctionState<IInput>
                    ? (bool)((CancellationFunctionState<IInput>)currentState).ExecuteFunction(mCancellationState.CancelToken)
                    : true;
            };
        }