Exemplo n.º 1
0
        protected virtual void Awake()
        {
            peerId = GameSparksManager.PeerId();
            isHost = GameManager.Instance().IsHost;

            SetId(networkId);
            SetOwner(owner);
        }
Exemplo n.º 2
0
        void Start()
        {
            readyButton.onClick.AddListener(() =>
            {
                OnReadyButton();
                SetPlayerReady(GameSparksManager.PeerId());
            });

            // Player list
            var players = GameSparksManager.Instance().GetSessionInfo().GetPlayerList();

            playerPanels = new List <Transform>();
            foreach (var player in players)
            {
                Transform playerPanel = Instantiate(PlayerPanelPrefab, playerList, false).transform;
                playerPanel.Find("DisplayName").GetComponent <TMP_Text>().text = player.displayName;
                playerPanel.Find("ReadyIcon").GetComponent <Image>().enabled   = false;

                playerPanels.Add(playerPanel);
            }
        }
Exemplo n.º 3
0
        void Awake()
        {
            GameSparks.Api.Messages.MatchNotFoundMessage.Listener = (message) =>
            {
                Debug.Log("No Match Found");
            };

            GameSparks.Api.Messages.MatchFoundMessage.Listener += OnMatchFound;

            GameSparks.Core.GS.GameSparksAvailable += (isAvailable) =>
            {
                if (isAvailable && GameSparksManager.PeerId() == -1)
                {
                    if (useDeviceAuth)
                    {
                        GameSparksManager.Instance().DeviceAuthentication(OnAuthentication);
                    }
                    else
                    {
                        GameSparksManager.Instance().AuthenticateUser(userName, password, OnRegistration, OnAuthentication);
                    }
                }
            };
        }