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) ); } }
private void OnDestroy() { if (_instance != this) { return; } _instance = null; }
private void Awake() { if (_instance == null) { _instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); }