コード例 #1
0
    private void OnInvitationReceived(Invitation invitation, bool shouldAutoAccept)
    {
        Debug.Log("Invitation recieved " + shouldAutoAccept + " " + invitation.Inviter.DisplayName);

        // We use it to automatically to invoke what we want to do or have the user decide
        UnityEngine.Events.UnityAction action = () => {
            ScaneManager.Instance.GoToSceneThenDo("GooglePlayConnectScreen", () => {
                GooglePlayGameManager manager = FindObjectOfType <GooglePlayGameManager>();

                PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, manager);
                manager.ShowRoomMakingPanel();
            });
        };

        if (shouldAutoAccept)
        {
            action.Invoke();
        }
        else
        {
            PopupManager.Instance.PopUp(
                new PopUpTwoButton(invitation.Inviter.DisplayName + "\nwould like to play with you!", "Decline", "Accept")
                .SetButtonColors(new Color(0.95686f, 0.26275f, 0.21176f), new Color(0.29804f, 0.68627f, 0.31373f))
                .SetButtonTextColors(Color.white, Color.white)
                .SetButtonPressActions(() => { }, action)
                );
        }
    }
コード例 #2
0
    private void OnDestroy()
    {
        if (_instance != this)
        {
            return;
        }

        _instance = null;
    }
コード例 #3
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();
    }