Esempio n. 1
0
 static public void removeInputListener(InputListener listener)
 {
     if (listener != null)
     {
         gListeners.Remove(listener);
     }
 }
Esempio n. 2
0
    private void OnPlayerInputChanged(InputListener inputListener)
    {
        PlayerControlInfo playerControlInfos = inputListener.m_Player == EPlayer.Player1 ? m_Player1ControlsMapping : m_Player2ControlsMapping;
        List <EInputKey>  unassignedInputs   = new List <EInputKey>(PlayerGamePad.K_ASSIGNABLE_INPUTS);

        for (int i = 0; i < playerControlInfos.m_InputListeners.Length; i++)
        {
            if (playerControlInfos.m_InputListeners[i] != inputListener && playerControlInfos.m_InputListeners[i].m_CurrentInputKey == inputListener.m_CurrentInputKey)
            {
                EGamePadType playerGamepadType = GamePadManager.GetPlayerGamepadType((int)inputListener.m_Player);

                playerControlInfos.m_InputListeners[i].m_CurrentInputKey = inputListener.m_OldInputKey;
                playerControlInfos.m_InputListeners[i].UpdateInputForGamepadType(playerGamepadType);

                GamePadManager.SetPlayerGamepadInputMapping((int)inputListener.m_Player, inputListener.m_OldInputKey, playerControlInfos.m_InputListeners[i].m_DefaultInputKey);
            }

            unassignedInputs.Remove(playerControlInfos.m_InputListeners[i].m_CurrentInputKey);
        }

#if UNITY_EDITOR || DEBUG_DISPLAY
        if (unassignedInputs.Count > 1)
        {
            KakutoDebug.LogError("There should be only one unassigned remaining input after OnPlayerInputChanged");
        }
#endif

        for (int i = 0; i < unassignedInputs.Count; i++)
        {
            GamePadManager.SetPlayerGamepadInputMapping((int)inputListener.m_Player, unassignedInputs[i], PlayerGamePad.K_DEFAULT_UNASSIGNED_INPUT);
        }
    }
Esempio n. 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            CameraPos         = _gameInfo.Spinner.Center;
            _gameInfo.Manager = ControlManager.Manager;

            // Set up our konami code callback to give the current player 0xBEEF
            _konami = new InputListener {
                Keys = new List <int> {
                    38, 38, 40, 40, 37, 39, 37, 39, 66, 65
                }.Cast <Keys>().ToArray(),
                Callback = () => {
                    _fsm.Push(new ModifyCash(0xBEEF));
                    ControlManager.Add(new Alert(ControlManager.Manager, "Konami code detected! Acquire 0xBEEF", "Konami Code Activated"));
                }
            };

            _teleport = new InputListener {
                Keys     = new[] { Keys.T, Keys.E, Keys.L, Keys.E, Keys.P, Keys.O, Keys.R, Keys.T },
                Callback = () => {
                    _gameInfo.Fsm.Push(new Teleport());
                    ControlManager.Add(new Alert(ControlManager.Manager, "Click the place you want to teleport to!", "Teleport Activated"));
                }
            };

            CreateWelcomeMessage();
        }
Esempio n. 4
0
 private void CleanupLogicAndInputListener()
 {
     Logic?.Dispose();
     _inputListener?.Dispose();
     Logic          = null;
     _inputListener = null;
 }
Esempio n. 5
0
        protected override void Initialize()
        {
            const float secondsInMinutes = 60f;
            const float rateOfFire       = 200f;

            _inputListner = new InputListener();

            /*
             * if (_currentKeyboardState.IsKeyDown(Keys.Space) || _currentGamePadState.Buttons.X == ButtonState.Pressed)
             *  FireLaser(gameTime);
             *
             */
            _inputListner.OnKeyDown        += InputListenerOnOnKeyDown;
            _inputListner.OnGamePadPressed += InputListenerOnOnGamePadPressed;

            _inputListner.SupportKey(Keys.Space);
            _inputListner.SupportButton(Buttons.X);

            _score                  = 0;
            _player                 = new Player();
            _playerMoveSpeed        = 8.0f;
            _bgLayer1               = new ParallaxingBackground();
            _bgLayer2               = new ParallaxingBackground();
            _enemies                = new List <Enemy>();
            _previousSpawnTime      = TimeSpan.Zero;
            _enemySpawnTime         = TimeSpan.FromSeconds(1.0f);
            _random                 = new Random();
            _laserBeams             = new List <Laser>();
            _laserSpawnTime         = TimeSpan.FromSeconds(secondsInMinutes / rateOfFire);
            _previousLaserSpawnTime = TimeSpan.Zero;
            _explosions             = new List <Explosion>();

            base.Initialize();
        }
Esempio n. 6
0
 // TODO: maybe use endless interfaces so we can request something that is actually a ui thing, eh?
 public void AddKeyFocus(Trigger key, ZComponent focus, Action onSwitchAction, bool pressAgainToRevert)
 {
     RegisterListener(new InputListener(key, x =>
     {
         onSwitchAction();
         currentFocus = focus;
         focus.Focus();
         var escapeListeners = new List <InputListener>();
         var escapeTriggers  = new List <Trigger>()
         {
             Trigger.Escape, Trigger.LeftMouseClick
         };
         if (pressAgainToRevert)
         {
             escapeTriggers.Add(key);
         }
         foreach (var trigger in escapeTriggers)
         {
             var listener = new InputListener(trigger, y =>
             {
                 defaultFocus.Focus();
                 currentFocus = defaultFocus;
                 foreach (var l in escapeListeners)
                 {
                     focus.UnregisterListener(l);
                 }
             });
             focus.RegisterListener(listener);
             escapeListeners.Add(listener);
         }
     }));
 }
Esempio n. 7
0
    IEnumerator Behave(Animator animator)
    {
        if (InputListener.GetKeyUp(KeyCode.K) || time >= maxTime)
        {
            yield return(null);

            animator.SetBool("RuneBoob", false);
            hero.audioCtrler.PlaySound(clip, 0.7f);
            runeBoomInstance.StartSkill();

            if (spellTime == maxSpellTime)
            {
                spellTime = 0;
                StartCdColding();
                hero.statusBox.cdBar.StartCooling(skillIcon, cd);
            }
            //StopAllCoroutines();
        }
        else
        {
            yield return(null);

            time += Time.deltaTime;
            runeBoomInstance.transform.position += speed;
            StartCoroutine(Behave(animator));
        }
    }
Esempio n. 8
0
 public void EnableListener(InputListener listener)
 {
     if (disabledListeners.Contains(listener))
     {
         disabledListeners.Remove(listener);
     }
 }
Esempio n. 9
0
 public void Pop(InputListener l)
 {
     if (stack.Peek() == l)
     {
         stack.Pop();
         InputListener stackTop = GetStackTop();
         if (stackTop != null)
         {
             stackTop.OnFocus(true, l);
         }
     }
     else if (!stack.IsEmpty())
     {
         // Remove element in the middle of the stack
         log.Warn("Stack Top: {0}, request:{1}", stack.Peek(), l);
         Stack <InputListener> backup = new Stack <InputListener> ();
         while (!stack.IsEmpty() && stack.Peek() != l)
         {
             backup.Push(stack.Pop());
         }
         stack.Pop();
         while (!backup.Empty())
         {
             stack.Push(backup.Pop());
         }
     }
     else
     {
         log.Warn("no stack pop for {0}", l);
     }
 }
Esempio n. 10
0
 static public void addInputListener(InputListener listener)
 {
     if (listener != null)
     {
         gListeners.Add(listener);
     }
 }
Esempio n. 11
0
 public void Run()
 {
     GameThread      = new Thread(Start);
     GameThread.Name = "Game Main Loop thread";
     inputListener   = new InputListener();
     Program.threads.Add(GameThread);
     GameThread.Start();
 }
Esempio n. 12
0
    private void OnDisable()
    {
        InputListener handle     = InputListener.Instance;
        Timer         TimeHandle = Timer.Instance;

        TimeHandle.HitZero.AddListener(YouLoose);
        handle.InteractWith.RemoveListener(TelekinShot);
    }
Esempio n. 13
0
        /*
         * Registers a listener for control events.
         */
        public void registerForInputEvents(InputListener listener, ControlType type)
        {
            Control control = Controls[type];
            if (!ListenerMap.ContainsKey(type))
                ListenerMap[type] = new List<InputListener>();

            ListenerMap[type].Add(listener);
        }
Esempio n. 14
0
 public new void addInputListener(InputListener lis)
 {
     BitesPINVOKE.ApplicationContext_addInputListener__SWIG_1_0(swigCPtr, InputListener.getCPtr(lis));
     if (BitesPINVOKE.SWIGPendingException.Pending)
     {
         throw BitesPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 15
0
    protected override void UnsubscribeFromEvents()
    {
        InputListener.GetInstance().OnMouse0_Down -= OnLeftMouseDown;
        InputListener.GetInstance().OnMouse0_Up   -= OnLeftMouseUp;
        InputListener.GetInstance().OnMouse1_Down -= SwitchToDefaultState;

        SelectionTracker.GetInstance().OnAreaChange -= OnAreaChange;
    }
Esempio n. 16
0
    /*========================================Components=========================================*/


    /*==========================================Event============================================*/


    /*=====================================Public Function=======================================*/
    //加入偵聽者  params: 偵聽者本身, 優先度
    public void AddListener(InputListener listener, float priority)
    {
        //加入偵聽者
        listenerList.Add(listener);

        //排序
        this.SortListener();
    }
Esempio n. 17
0
 private void onKeyUp(InputListener listener, EventArgs e)
 {
     Debug.Log("Stopped pressing " + inputListener.key);
     if (inputListener.key == KeyCode.A || inputListener.key == KeyCode.D)
     {
         StopMoving();
     }
 }
Esempio n. 18
0
 public void removeInputListener(InputListener lis)
 {
     BitesPINVOKE.ApplicationContextBase_removeInputListener__SWIG_1(swigCPtr, InputListener.getCPtr(lis));
     if (BitesPINVOKE.SWIGPendingException.Pending)
     {
         throw BitesPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 19
0
 public AIPlayer(UserController controller, PlayerType playerType, BlockBoardStorage boardStorage,
                 BoardManager boardManager, InputListener inputListener)
 {
     this.playerType    = playerType;
     this.controller    = controller;
     this.boardManager  = boardManager;
     this.inputListener = inputListener;
     this.boardStorage  = boardStorage;
 }
Esempio n. 20
0
	/*========================================Components=========================================*/


	/*==========================================Event============================================*/


	/*=====================================Public Function=======================================*/
	//加入偵聽者  params: 偵聽者本身, 優先度
	public void AddListener(InputListener listener, float priority){
		
		//加入偵聽者
		listenerList.Add(listener);

		//排序
		this.SortListener();

	}
Esempio n. 21
0
    private void UnsubscribeFromInput()
    {
        InputListener input = InputListener.GetInstance();

        input.OnW_Pressed -= MoveUp;
        input.OnA_Pressed -= MoveLeft;
        input.OnS_Pressed -= MoveDown;
        input.OnD_Pressed -= MoveRight;
    }
Esempio n. 22
0
 void Start()
 {
     // Load All Mangers;
     GameManager.Instance.curStatus = GameManager.Status.LOAD_RESOURCE;
     InputListener.Init();
     DataManager.Init();
     f_LastInterval = Time.realtimeSinceStartup;
     i_Frames       = 0;
 }
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        return;
    }
    protected override void SubscribeToEvents()
    {
        InputListener.GetInstance().OnMouse0_Down += OnLeftClickDown;
        InputListener.GetInstance().OnMouse0_Up   += OnLeftClickUp;
        InputListener.GetInstance().OnMouse1_Down += SwitchToDefaultState;
        InputListener.GetInstance().OnEscape_Down += SwitchToDefaultState;

        SelectionTracker.GetInstance().OnAreaChange += OnAreaChange;
    }
Esempio n. 25
0
 /// <summary>
 ///     Creates a new start user interface.
 /// </summary>
 /// <param name="window">The game window.</param>
 /// <param name="inputListener">The input listener.</param>
 /// <param name="worldProvider">The world provider.</param>
 /// <param name="settingsProviders">The settings provider.</param>
 /// <param name="drawBackground">Whether to draw the ui background.</param>
 public StartUserInterface(GameWindow window, InputListener inputListener, IWorldProvider worldProvider,
                           List <ISettingsProvider> settingsProviders, bool drawBackground) : base(
         window,
         inputListener,
         drawBackground)
 {
     this.worldProvider     = worldProvider;
     this.settingsProviders = settingsProviders;
 }
Esempio n. 26
0
File: Bomb.cs Progetto: Raful/CSBomb
 private void HandleFuseDone()
 {
     if (m_buttonPressedTimer >= m_fuseTimer)
     {
         SoundHandler.PlayPlantedSound();
         GameData.gameState = GameData.GameState.Planted;
         InputListener.InterruptMainButton();
     }
 }
Esempio n. 27
0
    void Start()
    {
        //load all managers
        GameManager.Instance.CurStatus = GameManager.Status.LOAD_RESOURCE;
        InputListener.Init();
        DataManager.Init();

        f_LastInterval = Time.realtimeSinceStartup;//从游戏开始到现在,游戏经过的时间
        i_Frames       = 0;
    }
Esempio n. 28
0
        private static void AddListener()
        {
            if (_listener != null)
            {
                RemoveListener();
            }

            _listener = new InputListener();
            _listener.OnInputReceived += OnInput;
        }
Esempio n. 29
0
 void Start()
 {
     input              = GetComponent <InputListener>();
     jetpack            = GetComponent <Jetpack>();
     jetpackDustInitPos = jetpackDust.transform.localPosition;
     anim         = sprite.GetComponent <Animator>();
     playerScript = GetComponent <ActorPlayer>();
     CC           = GetComponent <CharacterController2D>();
     myHealth     = GetComponent <PlayerHealth>();
 }
Esempio n. 30
0
        private static void LoadListener()
        {
            if (_listener != null)
            {
                UnloadListener();
            }

            _listener = new InputListener();
            _listener.OnInputReceived += OnInput;
        }
Esempio n. 31
0
        protected override void OnShow()
        {
            base.OnShow();

            var inputManager = base.Alex.InputManager.GetOrAddPlayerManager(PlayerIndex.One);

            if (inputManager.TryGetListener(out KeyboardInputListener inputListener))
            {
                InputListener = inputListener;
                var inputs = InputListener.ToDictionary(x => x.Key, x => x.Value);

                foreach (InputCommand ic in Enum.GetValues(typeof(InputCommand)))
                {
                    InputCommand inputCommand = ic;

                    Keys value = KeybindElement.Unbound;
                    if (inputs.TryGetValue(ic, out Keys key))
                    {
                        value = key;
                    }

                    KeybindElement textInput = new KeybindElement(value);

                    var row = AddGuiRow(new GuiTextElement()
                    {
                        Text = ic.ToString().SplitPascalCase()
                    }, textInput);
                    row.Margin = new Thickness(5, 5);

                    textInput.ValueChanged += (sender, newValue) =>
                    {
                        if (newValue == KeybindElement.Unbound)
                        {
                            inputListener.RemoveMap(inputCommand);
                        }
                        else
                        {
                            foreach (var input in Inputs.Where(x => x.Key != inputCommand && x.Value.Value == newValue))
                            {
                                input.Value.Value = KeybindElement.Unbound;
                            }

                            InputListener.RegisterMap(inputCommand, newValue);
                        }

                        base.Alex.GuiManager.FocusManager.FocusedElement = null;

                        textInput.ClearFocus();
                        value = newValue;
                    };

                    Inputs.TryAdd(ic, textInput);
                }
            }
        }
Esempio n. 32
0
	public void registerListener(InputListener pListener)
	{
		if (mListeners.Find(x => x.Equals(pListener)) == null)
		{
			mListeners.Add(pListener);
		}
		else
		{
			Debug.Log("InputManager - registerListener() : listener already registered");
		}
	}
Esempio n. 33
0
	public void unregisterListener(InputListener pListener)
	{
		if (mListeners.Find(x => x.Equals(pListener)) != null)
		{
			mListeners.Remove(pListener);
		}
		else
		{
			Debug.Log("InputManager - unregisterListener() : listener is not registered");
		}
	}
Esempio n. 34
0
    // simulates the user pushing a command
    // called by input listeners usually when interpreting clicks as answers to AwaitAdvance
    public void SimulateCommand(Command simulatedCommand)
    {
        simulatedAdvance = true;
        InputListener listener = listeners[listeners.Count - 1];

        if (!disabledListeners.Contains(listener))
        {
            listener.OnCommand(simulatedCommand, Event.Down);
            listener.OnCommand(simulatedCommand, Event.Up);
        }
    }
Esempio n. 35
0
        public Form1(string ipaddress)
        {
            InitializeComponent();
            FormClosing += Form1_FormClosing;
            _Viewer_Loop = new DesktopSharing_Viewer.Code.Viewer_Loop();
            _Viewer_Loop.UpdateImageEvent += Update_Image;
            _Viewer_Loop.NewImageEvent += New_Image;
            _Viewer_Loop.MouseImageChangedEvent += _Viewer_Loop_MouseUpdateEvent;
            _Viewer_Loop.MousePositionChangedEvent += _Viewer_Loop_MousePositionChangedEvent;
            var t = new InputListener(pictureBox1.Handle);
            t.InputMouseEvent += _Viewer_Loop.OnMouseEvent;
            t.InputKeyEvent += _Viewer_Loop.OnKeyEvent;

            Application.AddMessageFilter(t);
            this.DragDrop += new DragEventHandler(this.Form1_DragDrop);
            this.DragEnter += new DragEventHandler(this.Form1_DragEnter);

            _Viewer_Loop.IPtoConnect = ipaddress;
            _Viewer_Loop.Start();
        }
Esempio n. 36
0
 // Use this for initialization
 void Start()
 {
     inputListener=GetComponent<InputListener>();
 }
Esempio n. 37
0
        private void TellGamePad(InputListener listener)
        {
            foreach (var button in MappedGamePadButtons)
            {
                if (GamePadButtonsPressedOnce[button])
                    listener.DoGamePadButtonPressedOnce(Player, button);

                if (GamePadButtonsReleased[button])
                    listener.DoGamePadButtonReleased(Player, button);
            }


            if (GamePadJoystickMoved[Buttons.LeftStick] != Vector3.Zero)
                listener.DoGamePadJoystickMoved(Player, Buttons.LeftStick, GamePadJoystickMoved[Buttons.LeftStick]);


            if (GamePadJoystickMoved[Buttons.RightStick] != Vector3.Zero)
                listener.DoGamePadJoystickMoved(Player, Buttons.RightStick, GamePadJoystickMoved[Buttons.RightStick]);
        }
Esempio n. 38
0
        private void TellMouse(InputListener listener)
        {
            foreach (var button in MappedMouseButtons)
            {
                if (MouseButtonsPressed[button])
                    listener.DoMouseButtonPressed(Player, button);

                if (MouseButtonsPressedOnce[button])
                    listener.DoMouseButtonPressedOnce(Player, button);

                if (MouseButtonsReleased[button])
                    listener.DoMouseButtonReleased(Player, button);
            }


            if (MouseScrolled != 0)
                listener.DoMouseScrolled(Player, MouseScrolled);


            if (MouseMoved != Vector3.Zero)
                listener.DoMouseMoved(Player, MouseMoved);


            foreach (var keyboardkey in MappedKeys)
            {
                if (KeysPressed[keyboardkey])
                    listener.DoKeyPressed(Player, keyboardkey);

                if (KeysPressedOnce[keyboardkey])
                    listener.DoKeyPressedOnce(Player, keyboardkey);

                if (KeysReleased[keyboardkey])
                    listener.DoKeyReleased(Player, keyboardkey);
            }
        }
Esempio n. 39
0
        public MainViewer()
        {
            InitializeComponent();
            FormClosing += MainViewer_FormClosing;
            FormClosed += MainViewer_FormClosed;
            _InputListener = new InputListener(viewPort1.Handle);
            _InputListener.InputKeyEvent = KeyEvent;
            _InputListener.InputMouseEvent = MouseEvent;
            DragDrop += new DragEventHandler(Form1_DragDrop);
            DragEnter += new DragEventHandler(Form1_DragEnter);

            Application.AddMessageFilter(_InputListener);
            viewPort1.OnDraw_CB = Draw;

            //Must keep references 
            OnConnect_CallBack = OnConnect;
            OnDisconnect_CallBack = OnDisconnect;
            OnCursorChanged_CallBack = OnCursorChanged;
            OnDisplayChanged_CallBack = OnDisplayChanged;
            OnConnectingAttempt_CallBack = OnConnectingAttempt;

            OnElevateFailed_CallBack = OnElevateFailed;
            OnElevateSuccess_CallBack = OnElevateSuccess;

            _Client = Create_Client(viewPort1.Handle, OnConnect_CallBack, OnDisconnect_CallBack, OnCursorChanged_CallBack, OnDisplayChanged_CallBack, OnConnectingAttempt_CallBack);
            SetOnElevateFailed(_Client, OnElevateFailed_CallBack);
            SetOnElevateSuccess(_Client, OnElevateSuccess_CallBack);

            button3.MouseEnter += button_MouseEnter;
            button3.MouseLeave += button_MouseLeave;

            button2.MouseEnter += button_MouseEnter;
            button2.MouseLeave += button_MouseLeave;

            button4.MouseEnter += button_MouseEnter;
            button4.MouseLeave += button_MouseLeave;

            for(var i = 0; i < _Displays.Length; i++)
                _Displays[i] = new Rectangle(0, 0, 0, 0);
        }
Esempio n. 40
0
        private void TellIfWantsToConnect(InputListener listener)
        {
            foreach (var button in MappedGamePadButtons)
            {
                if (GamePadButtonsPressedOnce[button])
                {
                    Player.InputType = InputType.Gamepad;
                    listener.PlayerGamePadConnectionRequested(Player, button);
                    return;
                }
            }


            if (Inputs.PlayersController.MouseInUse)
                return;

            foreach (var button in MappedMouseButtons)
            {
                if (MouseButtonsPressedOnce[button])
                {
                    Player.InputType = InputType.Mouse;
                    listener.PlayerMouseConnectionRequested(Player, button);
                    return;
                }
            }


            foreach (var key in MappedKeys)
            {
                if (KeysPressedOnce[key])
                {
                    Player.InputType = InputType.Mouse;
                    listener.PlayerKeyboardConnectionRequested(Player, key);
                    return;
                }
            }
        }
Esempio n. 41
0
 void OnDestroy()
 {
     instance = null;
 }
Esempio n. 42
0
 //public Renderer _renderer;
 // Use this for initialization
 void Start()
 {
     inputListener=GetComponent<InputListener>();
     //if(GameObject.Find ("SceneLogic").GetComponent<ClienTest>().isServer){
     #if UNITY_EDITOR
     wiimote_start();
     #endif
     //}
 }
Esempio n. 43
0
 public void RemoveListener(InputListener listener)
 {
     Listeners.Remove(listener);
 }
Esempio n. 44
0
 public void AddListener(InputListener listener)
 {
     Listeners.Add(listener);
 }
Esempio n. 45
0
        public void addListener(InputListener listener)
        {
            if (listener != null)
            {
                // ANY
                this.onAnyButtonPressed += new gameInputHandler(listener.onAnyButtonPressed);
                this.onAnyButtonReleased += new gameInputHandler(listener.onAnyButtonReleased);

                this.onNoneDirectionPressed += new gameInputHandler(listener.onNoneDirectionPressed);
                this.onNoneDirectionReleased += new gameInputHandler(listener.onNoneDirectionReleased);
                this.onNoneDirectionIsDown += new gameInputHandler(listener.onNoneDirectionIsDown);

                // A
                this.onButtonAPressed += new gameInputHandler(listener.onButtonAPressed);
                this.onButtonAReleased += new gameInputHandler(listener.onButtonAReleased);
                this.onButtonAIsDown += new gameInputHandler(listener.onButtonAIsDown);

                // X
                this.onButtonXPressed += new gameInputHandler(listener.onButtonXPressed);
                this.onButtonXReleased += new gameInputHandler(listener.onButtonXReleased);
                this.onButtonXIsDown += new gameInputHandler(listener.onButtonXIsDown);

                // Y
                this.onButtonYPressed += new gameInputHandler(listener.onButtonYPressed);
                this.onButtonYReleased += new gameInputHandler(listener.onButtonYReleased);
                this.onButtonYIsDown += new gameInputHandler(listener.onButtonYIsDown);
                // B
                this.onButtonBPressed += new gameInputHandler(listener.onButtonBPressed);
                this.onButtonBReleased += new gameInputHandler(listener.onButtonBReleased);
                this.onButtonBIsDown += new gameInputHandler(listener.onButtonBIsDown);

                // Down
                this.onButtonDownPressed += new gameInputHandler(listener.onButtonDownPressed);
                this.onButtonDownReleased += new gameInputHandler(listener.onButtonDownReleased);
                this.onButtonDownIsDown += new gameInputHandler(listener.onButtonDownIsDown);

                // L1
                this.onButtonL1Pressed += new gameInputHandler(listener.onButtonL1Pressed);
                this.onButtonL1Released += new gameInputHandler(listener.onButtonL1Released);
                this.onButtonL1IsDown += new gameInputHandler(listener.onButtonL1IsDown);

                // L2
                this.onButtonL2Pressed += new gameInputHandler(listener.onButtonL2Pressed);
                this.onButtonL2Released += new gameInputHandler(listener.onButtonL2Released);
                this.onButtonL2IsDown += new gameInputHandler(listener.onButtonL2IsDown);

                // LEFT
                this.onButtonLeftPressed += new gameInputHandler(listener.onButtonLeftPressed);
                this.onButtonLeftReleased += new gameInputHandler(listener.onButtonLeftReleased);
                this.onButtonLeftIsDown += new gameInputHandler(listener.onButtonLeftIsDown);

                // R1
                this.onButtonR1Pressed += new gameInputHandler(listener.onButtonR1Pressed);
                this.onButtonR1Released += new gameInputHandler(listener.onButtonR1Released);
                this.onButtonR1IsDown += new gameInputHandler(listener.onButtonR1IsDown);

                // R2
                this.onButtonR2Pressed += new gameInputHandler(listener.onButtonR2Pressed);
                this.onButtonR2Released += new gameInputHandler(listener.onButtonR2Released);
                this.onButtonR2IsDown += new gameInputHandler(listener.onButtonR2IsDown);

                // Right
                this.onButtonRightPressed += new gameInputHandler(listener.onButtonRightPressed);
                this.onButtonRightReleased += new gameInputHandler(listener.onButtonRightReleased);
                this.onButtonRightIsDown += new gameInputHandler(listener.onButtonRightIsDown);

                // Start
                this.onButtonStartPressed += new gameInputHandler(listener.onButtonStartPressed);
                this.onButtonStartReleased += new gameInputHandler(listener.onButtonStartReleased);
                this.onButtonStartIsDown += new gameInputHandler(listener.onButtonStartIsDown);

                // Back
                this.onButtonBackPressed += new gameInputHandler(listener.onButtonBackPressed);
                this.onButtonBackReleased += new gameInputHandler(listener.onButtonBackReleased);
                this.onButtonBackIsDown += new gameInputHandler(listener.onButtonBackIsDown);

                // Up
                this.onButtonUpPressed += new gameInputHandler(listener.onButtonUpPressed);
                this.onButtonUpReleased += new gameInputHandler(listener.onButtonUpReleased);
                this.onButtonUpIsDown += new gameInputHandler(listener.onButtonUpIsDown);

                // UpLeft
                this.onButtonUpLeftPressed += new gameInputHandler(listener.onButtonUpLeftPressed);
                this.onButtonUpLeftReleased += new gameInputHandler(listener.onButtonUpLeftReleased);
                this.onButtonUpLeftIsDown += new gameInputHandler(listener.onButtonUpLeftIsDown);

                // UpRight
                this.onButtonUpRightPressed += new gameInputHandler(listener.onButtonUpRightPressed);
                this.onButtonUpRightReleased += new gameInputHandler(listener.onButtonUpRightReleased);
                this.onButtonUpRightIsDown += new gameInputHandler(listener.onButtonUpRightIsDown);

                // DownLeft
                this.onButtonDownLeftPressed += new gameInputHandler(listener.onButtonDownLeftPressed);
                this.onButtonDownLeftReleased += new gameInputHandler(listener.onButtonDownLeftReleased);
                this.onButtonDownLeftIsDown += new gameInputHandler(listener.onButtonDownLeftIsDown);

                // DownLeft
                this.onButtonDownRightPressed += new gameInputHandler(listener.onButtonDownRightPressed);
                this.onButtonDownRightReleased += new gameInputHandler(listener.onButtonDownRightReleased);
                this.onButtonDownRightIsDown += new gameInputHandler(listener.onButtonDownRightIsDown);

            }
        }
Esempio n. 46
0
 void Awake()
 {
     Instance = this;
 }
Esempio n. 47
0
	//移除偵聽者  params: 偵聽者本身
	public void RemoveListener(InputListener listener){
		//加入偵聽者
		listenerList.Remove(listener);
	}
Esempio n. 48
0
        public void TellListener(InputListener listener)
        {
            if (Player.State == PlayerState.Disconnected)
            {
                TellIfWantsToConnect(listener);
                return;
            }


            if (Player.InputType == InputType.Gamepad)
            {
                TellGamePad(listener);
                return;
            }

            TellMouse(listener);
        }
Esempio n. 49
0
 // Use this for initialization
 void Awake()
 {
     motor = GetComponent("CharacterMotor") as CharacterMotor;
     inputListener=GetComponent<InputListener>();
 }