void Start() { Npad.Initialize(); Npad.SetSupportedStyleSet(NpadStyle.Handheld | NpadStyle.JoyDual | NpadStyle.FullKey); NpadId[] npadIds = { NpadId.Handheld, NpadId.No1 }; Npad.SetSupportedIdType(npadIds); }
void Start() { textComponent = GameObject.Find("/Canvas/Text").GetComponent <UnityEngine.UI.Text>(); Npad.Initialize(); Npad.SetSupportedStyleSet(NpadStyle.Handheld | NpadStyle.JoyDual | NpadStyle.FullKey); NpadId[] npadIds = { NpadId.Handheld, NpadId.No1 }; Npad.SetSupportedIdType(npadIds); }
void Start() { iterator = 0; Npad.Initialize(); Npad.SetSupportedStyleSet(nn.hid.NpadStyle.Handheld | nn.hid.NpadStyle.JoyDual | nn.hid.NpadStyle.FullKey); nn.hid.NpadId[] npadIds = { nn.hid.NpadId.Handheld, nn.hid.NpadId.No1, nn.hid.NpadId.No2, nn.hid.NpadId.No3, nn.hid.NpadId.No4 }; Npad.SetSupportedIdType(npadIds); intensityOverallMultiplier = 1f; }
public override void MyStart() { //コントローラーの初期化 Npad.Initialize(); //サポートするタイプをセット Npad.SetSupportedIdType(m_NpadIds); //サポートするスタイルをセット Npad.SetSupportedStyleSet(m_NpadStyles); //配列の要素確保 m_IsConnect = new bool[m_NpadIds.Length]; //入力の初期化 SwitchInput.InputInit(m_NpadIds.Length); }
public override void MyStart() { //コントローラーの初期化 Npad.Initialize(); //サポートするタイプをセット Npad.SetSupportedIdType(npadIds); //サポートするスタイルをセット Npad.SetSupportedStyleSet(npadStyles); NpadJoy.SetHoldType(NpadJoyHoldType.Horizontal); //配列の要素確保 isConnect = new bool[npadIds.Length]; //入力の初期化 SwitchInput.InputInit(npadIds.Length); SwitchAcceleration.AccelerationInit(npadIds.Length); }
public override void MyStart() { #if UNITY_SWITCH && !(UNITY_EDITOR) //コントローラーの初期化 Npad.Initialize(); //サポートするタイプをセット Npad.SetSupportedIdType(npadIds); //サポートするスタイルをセット Npad.SetSupportedStyleSet(npadStyles); //配列の要素確保 isConnect = new bool[npadIds.Length]; //入力の初期化 SwitchInput.InputInit(npadIds.Length); #else //配列の要素確保 isConnect = new bool[1]; //入力の初期化 SwitchInput.InputInit(1); #endif }
public NintendoSwitchInputDeviceManager() { DebugPad.Initialize(); CreateDebugDevice(); Npad.Initialize(); // NpadJoy.SetHoldType only affects how controllers behave when using a system applet. // NpadJoyHoldType.Vertical is the default setting, but most games would want to use // NpadJoyHoldType.Horizontal as it can support all controller styles. // // If you do use NpadJoyHoldType.Vertical, Npad.SetSupportedStyleSet must only list // controller types supported by NpadJoyHoldType.Vertical. If you don't, the controller // applet will fail to load. // // Supported types for NpadJoyHoldType.Vertical are: // NpadStyle.FullKey, NpadStyle.JoyLeft and NpadStyle.JoyRight NpadJoy.SetHoldType(NpadJoyHoldType.Horizontal); // Handheld = Joy-Con docked with the console. // FullKey = Pro Controller. // JoyDual = Two Joy-Con used together as one controller. // JoyLeft = Left Joy-Con used by itself. // JoyRight = Left Joy-Con used by itself. Npad.SetSupportedStyleSet(NpadStyle.Handheld | NpadStyle.FullKey | NpadStyle.JoyDual | NpadStyle.JoyLeft | NpadStyle.JoyRight); // Both controllers must be docked for handheld mode. NpadJoy.SetHandheldActivationMode(NpadHandheldActivationMode.Dual); // You must call Npad.SetSupportedIdType for all supported controllers. // Not calling this may lead to crashes in some circumstances. var nPadIds = new NpadId[] { NpadId.Handheld, NpadId.No1, NpadId.No2, NpadId.No3, NpadId.No4, NpadId.No5, NpadId.No6, NpadId.No7, NpadId.No8 }; Npad.SetSupportedIdType(nPadIds); // Create InControl devices for all NpadIds regardless of how many we request from NintendoSDK. CreateDevice(NpadId.Handheld); CreateDevice(NpadId.No1); CreateDevice(NpadId.No2); CreateDevice(NpadId.No3); CreateDevice(NpadId.No4); CreateDevice(NpadId.No5); CreateDevice(NpadId.No6); CreateDevice(NpadId.No7); CreateDevice(NpadId.No8); UpdateInternal(0, 0); ShowControllerSupportForSinglePlayer(false); InputManager.OnDeviceAttached += inputDevice => { if (!Gunhouse.AppEntry.HasAppStarted()) { UnityEngine.Debug.Log("<color=red>we're not in it yet. don't pop the controller applet</color>"); return; } else { UnityEngine.Debug.Log("<color=blue>it's ok to pop the applet.</color>"); } UnityEngine.Debug.Log("Attached: " + inputDevice.Name); ShowControllerSupportForSinglePlayer(false); }; /*InputManager.OnDeviceDetached += inputDevice => * { * UnityEngine.Debug.Log("Detached: " + inputDevice.Name); * ShowControllerSupportForSinglePlayer(false); * }; * InputManager.OnActiveDeviceChanged += inputDevice => * { * UnityEngine.Debug.Log("Switched: " + inputDevice.Name); * ShowControllerSupportForSinglePlayer(false); * };*/ }