示例#1
0
        private void CheckForPlayerAddRemove()
        {
            for (int i = 0; i < DualityApp.Gamepads.Count; i++)
            {
                var item = DualityApp.Gamepads[i];
                if (item.IsAvailable)
                {
                    if (item.ButtonHit(GamepadButton.Start))
                    {
                        if (AllocatedGamepads.ContainsKey(i))
                        {
                            RemovePlayer(i);
                        }
                        else
                        {
                            GeneratePlayer(i);
                        }
                    }
                }
            }

            if (DualityApp.Keyboard.KeyHit(Duality.Input.Key.F2))
            {
                GeneratePlayer(AllocatedGamepads.Count);
            }
        }
示例#2
0
 private void RemovePlayer(int i)
 {
     if (AllocatedGamepads.ContainsKey(i))
     {
         Editors.Remove(AllocatedGamepads[i].Editor);
         AllocatedGamepads[i].Editor.DisposeLater();
         AllocatedGamepads.Remove(i);
     }
 }