Пример #1
0
    private Keypad keypad; // reference to Keypad

    #endregion Fields

    #region Constructors

    // five-parameter constructor
    public Withdrawal( int userAccountNumber, Screen atmScreen, 
        BankDatabase atmBankDatabase, Keypad atmKeypad,
        CashDispenser atmCashDispenser)
        : base(userAccountNumber, atmScreen, atmBankDatabase)
    {
        // initialize references to keypad and cash dispenser
          keypad = atmKeypad;
          cashDispenser = atmCashDispenser;
    }
Пример #2
0
    private bool userAuthenticated; // true if user is authenticated

    #endregion Fields

    #region Constructors

    // parameterless constructor initializes instance variables
    public ATM()
    {
        userAuthenticated = false; // user is not authenticated to start
          currentAccountNumber = 0; // no current account number to start
          screen = new Screen(); // create screen
          keypad = new Keypad(); // create keypad
          cashDispenser = new CashDispenser(); // create cash dispenser
          depositSlot = new DepositSlot(); // create deposit slot
          bankDatabase = new BankDatabase(); // create account info database
    }
Пример #3
0
	void Start ()
	{
		keypad = GetComponentInParent <Keypad> ();
		squareRend = GetComponent <SpriteRenderer> ();
		col = GetComponent <BoxCollider2D> ();

		squareText = GetComponentInChildren<Text> ();
		squareText.text = Letter;

		Activate ();
	}
Пример #4
0
 private void SetPressMode(Keypad keypad)
 {
     SetMode = true;
     _keypadToBeSet = keypad;
     Refresh();
 }
 /// <summary>
 /// This method is intended to be used when a button is pressed or released in the user interface.
 /// Updates the internal state of the buttons in the interrupt controller and determines if an interrupt is necessary.
 /// </summary>
 /// <param name="buttons">The new state of the buttons</param>
 public void UpdateKeypadState(Keypad buttons)
 {
     _state.PressedButtons = (byte)buttons; // This only works because the magic values we chose for the Keypad enum
       this.UpdateKeypadState();
 }
Пример #6
0
 /// <summary>
 /// Call this method when a button is released in the user interface.
 /// </summary>
 /// <param name="button">The button that was released. It can be a combination of buttons too.</param>
 public void ReleaseButton(Keypad button)
 {
     if (button != Keypad.Speed)
     {
         if (ReleaseButtons)
         {
             _buttons &= ~button;
             _interruptController.UpdateKeypadState(_buttons);
         }
     }
     else
     {
         FastEmulation = false;
         _apu.DepleteSoundEventQueues();
     }
 }
Пример #7
0
 /// <summary>
 /// Call this method when a button is pressed in the user interface.
 /// </summary>
 /// <param name="button">The button that was pressed. It can be a combination of buttons too.</param>
 public void PressButton(Keypad button)
 {
     if (button != Keypad.Speed)
     {
         _buttons |= button;
         _interruptController.UpdateKeypadState(_buttons);
         if (_cpu.Stopped) { _cpu.Stopped = false; }
     }
     else
     {
         FastEmulation = true;
     }
 }
Пример #8
0
        public void InternalReset(bool resetComponents)
        {
            // NOTE(Cristian): It's responsability of the view (or the calling audio code) to
            //                 handling and re-hooking correctly the audio on reset
            if (_state.Run) { this.Stop(); }

            if (resetComponents)
            {
                _memory.Reset();
                _cpu.Reset();
                _interruptController.Reset();
                _display.Reset();
                _apu.Reset();
                _disassembler.Reset();
                //this.serial = new SerialSpace.SerialController(this.interruptController, this.memory);
            }

            // We re-hook information
            if (this._cartridge != null)
            {
                _apu.CartridgeFilename = this.CartridgeFilename;
                _memory.SetMemoryHandler(GBSharp.MemorySpace.MemoryHandlers.
                                         MemoryHandlerFactory.CreateMemoryHandler(this));
            }

            _buttons = Keypad.None;
            _pauseEvent = new ManualResetEvent(true);
            _manualResetEvent = new ManualResetEventSlim(false);

            _state.InBreakpoint = false;
            ReleaseButtons = true;

            var disDef = _display.GetDisplayDefinition();

            #if TIMING
              _timingSamples = new long[_sampleAmount * _maxSamples];
              _swCPU = new Stopwatch();
              _swDisplay = new Stopwatch();
              _swBlit = new Stopwatch();
              _swClockMem = new Stopwatch();
            #endif
        }