Beispiel #1
0
        public ControllerSupportResultInfo ShowControllerApplet(bool suspendUnityThreads)
        {
            // See nn::hid::ControllerSupportArg::SetDefault() in the SDK documentation for details.
            var controllerSupportArg = new ControllerSupportArg();

            // Values below are the defaults set by this.
            controllerSupportArg.SetDefault();

            // The minimum number of players that will get wireless controller connections.
            // Must be set to 0 if you want to allow someone to play in handheld mode only.
            // Ignored in single-player mode.
            // controllerSupportArg.playerCountMin = 0;

            // The maximum number of players that will get wireless controller connections.
            // The maximum allowed value appears to be 4. Anything over that will cause a crash.
            // Ignored in single-player mode.
            // controllerSupportArg.playerCountMax = 4;

            // Specifies whether to maintain the connection of controllers that are already connected.
            // Specify false to disconnect all controllers.
            // controllerSupportArg.enableTakeOverConnection = true;

            // Specifies whether to left-justify the controller numbers when controller support is ended.
            // When false is specified, there may be gaps in controller numbers when controller support is ended.
            // Ignored in single-player mode.
            // controllerSupportArg.enableLeftJustify = true;

            // Specifies whether to permit actions when both controllers are being held in a dual-controller grip.
            // When false is specified, actions cannot be made when both controllers are being held in a dual-controller grip.
            // This is designed for times like during local communication when you want to prohibit the dual-controller grip.
            // controllerSupportArg.enablePermitJoyDual = true;

            // Specifies whether to start controller support in single-player mode.
            // Enable this if your game is single-player.
            // controllerSupportArg.enableSingleMode = false;

            // Specifies whether to use colors to identify the individual controller numbers shown in the controller support UI.
            // controllerSupportArg.enableIdentificationColor = false;

            // Specifies the colors to use to identify the individual controller numbers shown in the controller support UI.
            // If enableIdentificationColor is false, the values specified here will not be applied.
            // controllerSupportArg.identificationColor = new nn.util.Color4u8[4];

            // Specifies whether to use explanatory text for the individual controller numbers shown in the controller support UI.
            // controllerSupportArg.enableExplainText = false;

            // The text to use for the individual controller numbers shown in the controller support UI.
            // You can specify up to 32 characters.
            // If enableExplainText is false, the values specified here will not be applied.
            // Check how the text actually displays to make sure it is not too long and otherwise displays appropriately.
            // controllerSupportArg.explainText = new byte[ExplainTextSize];
            // This field is a private data blob and must be set with:
            // ControllerSupport.SetExplainText( ref controllerSupportArg, "Player 1", NpadId.No1 );

            controllerSupportArg.enableIdentificationColor = true;
            controllerSupportArg.identificationColor[0].Set(255, 100, 100, 255);
            controllerSupportArg.identificationColor[1].Set(100, 255, 100, 255);
            controllerSupportArg.identificationColor[2].Set(100, 100, 255, 255);
            controllerSupportArg.identificationColor[3].Set(255, 100, 255, 255);

            controllerSupportArg.enableExplainText = true;
            ControllerSupport.SetExplainText(ref controllerSupportArg, "Player 1", NpadId.No1);
            ControllerSupport.SetExplainText(ref controllerSupportArg, "Player 2", NpadId.No2);
            ControllerSupport.SetExplainText(ref controllerSupportArg, "Player 3", NpadId.No3);
            ControllerSupport.SetExplainText(ref controllerSupportArg, "Player 4", NpadId.No4);

            return(ShowControllerApplet(controllerSupportArg, suspendUnityThreads));
        }