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; }