public void AddDevice(DeviceType type)
        {
            InputDeviceBase[] tlist = deviceList;
            int deviceCount         = 0;

            if (tlist != null)
            {
                deviceCount = tlist.Length;
            }
            deviceCount += 1;
            deviceList   = new InputDeviceBase[deviceCount];
            //首先把旧的移进去
            if (tlist != null)
            {
                for (int i = 0; i < tlist.Length; i++)
                {
                    deviceList[i] = tlist[i];
                }
            }
            //把新加的,增加上
            InputDeviceBase device = InputPlayer.AllocDevice(type, this);

            device.Initialization();
            deviceList[deviceList.Length - 1] = device;
        }
 public void Initialization(DeviceType[] typelist, bool issupportmouse, Vector2 mousesensitivity)
 {
     deviceList = new InputDeviceBase[typelist.Length];
     for (int i = 0; i < deviceList.Length; i++)
     {
         deviceList[i] = InputPlayer.AllocDevice(typelist[i], this);
         deviceList[i].Initialization();
     }
     isSupportMouse   = issupportmouse;
     mouseSensitivity = mousesensitivity;
 }
        public static InputDeviceBase AllocDevice(DeviceType type, InputPlayer player)
        {
            switch (type)
            {
            case DeviceType.Type_KeyboardP1:
                return(new InputDevice_KeyboardP1(player));

            case DeviceType.Type_KeyBorarP2:
                return(new InputDevice_KeyboardP2(player));

            case DeviceType.Type_RemoteControl:
                return(new InputDevice_RemoteControl(player));

            case DeviceType.Type_Joystick:
                return(new InputDevice_Joystick(player));

            case DeviceType.Type_NetInput:
                return(new InputDevice_NetInput(player));
            }
            return(null);
        }
 public InputDevice_RemoteControl(InputPlayer player)
     : base(player)
 {
 }
示例#5
0
 public InputDevice_KeyboardP1(InputPlayer player)
     : base(player)
 {
 }
示例#6
0
 public InputDevice_NetInput(InputPlayer player)
     : base(player)
 {
 }
 public InputDevice_Joystick(InputPlayer player)
     : base(player)
 {
 }
示例#8
0
 public InputDeviceBase(InputPlayer player)
 {
     inputPlayer = player;
 }