示例#1
0
    // Convenience
    public void AskHowToPlay(System.Action <GameBuilderApplication.PlayOptions> onResponse)
    {
#if USE_PUN
        Show(new DynamicPopup.Popup
        {
            fullWidthButtons = true,
            getMessage       = () => "<size=80%>Play as single player or multiplayer?",
            isCancellable    = true,
            buttons          = new List <PopupButton.Params>()
            {
                new PopupButton.Params
                {
                    getLabel = () => "Single Player",
                    onClick  = () => onResponse(new GameBuilderApplication.PlayOptions {
                        isMultiplayer = false
                    })
                },
                new PopupButton.Params
                {
                    getLabel = () => "Private Multiplayer",
                    onClick  = () => onResponse(new GameBuilderApplication.PlayOptions {
                        isMultiplayer = true, startAsPublic = false
                    })
                },
                new PopupButton.Params
                {
                    getLabel = () => "Public Multiplayer",
                    onClick  = () => {
                        MultiplayerWarning warning = null;
                        Util.FindIfNotSet(this, ref warning);
                        warning.Open(() => {
                            onResponse(new GameBuilderApplication.PlayOptions {
                                isMultiplayer = true, startAsPublic = true
                            });
                        });
                    }
                },
                new PopupButton.Params
                {
                    getLabel = () => "Cancel",
                    onClick  = () => {}
                },
            }
        });
#else
        StartCoroutine(CallNextFrame(() => onResponse(new GameBuilderApplication.PlayOptions {
            isMultiplayer = false
        })));
#endif
    }