Esempio n. 1
0
        public void BootstrapPlayer()
        {
            myPlayerData = new PlayerDescriptor();
            myPlayerData.GenerateNewGuid();

            TTManager.instance.myPlayers.Add(this);

            Debug.Log("New player with name: " + myPlayerData.playerName);

            //TODO: make this better
            //transform.FindChild("Canvas/Name").GetComponent<Text>().text = "name: " + myPlayerData.playerName;

            //TODO: might replace ttdockzone with throwzone for consistency
            myDockZone          = GetComponent <TTDockZone> ();
            myDockZone.myPlayer = this;

            myDockZone.UpdateDock();

            foreach (TargetZone tz in myTargetZones)
            {
                tz.SetOwner(this);
                //tz.BroadcastToHH ();	//broadcasting happens during tether phase
            }

            //GameManager.instance.SendPlayerDockStatus (myPlayerData);
            UpdateHHPlayerDesc();
        }
Esempio n. 2
0
        // DELEAGTES
        //==========


        void OnSeatRequestMesage(JSONObject message)
        {
            Debug.Log("OnSeatRequestMessage: " + message.ToString());

            bool             seatWasGranted = message.GetField("granted").b;
            PlayerDescriptor playerInfo     = new PlayerDescriptor(message.GetField("data"));

            // if seat granted
            if (seatWasGranted)
            {
                Debug.Log("setting player");

                // TODO INSTANTIATE PLAYER & DOCK
                //GameObject newPlayer = Instantiate();
                //myPlayer = newPlayer.GetComponent<HHPlayer>();
                //myPlayer.BootstrapPlayer(playerInfo);

                playerSeated = true;

                // update name in player settings
                GameViewManager.instance.playerInfoView.SendMessage("OnSeatGranted", playerInfo);

                // update name in footer bar
                GameViewManager.instance.footerPanel.SendMessage("UpdatePlayerInfo", playerInfo);
            }
        }
Esempio n. 3
0
        // SEATING PROCESS
        //================


        public void RequestSeatForPlayer(PlayerDescriptor selectedPlayer)
        {
            Debug.Log("selecting this player" + selectedPlayer);
            Debug.Log("complete information around this player: " + new JSONObject(JsonUtility.ToJson(selectedPlayer)).ToString());

            NetworkingManager.instance.RequestSeat(selectedPlayer);
        }
Esempio n. 4
0
        //anytime the TTPlayer receives info from HH about itself, it updates itself
        void PlayerDescriptorFunction(JSONObject data)
        {
            PlayerDescriptor playerData = new PlayerDescriptor(data);

            if (playerData.playerGuid == myPlayerData.playerGuid)
            {
                //Debug.Log ("this is data meant for us!");
                myPlayerData = playerData;                      //sets our new name or victory points or whatever

                myDockZone.UpdateDock();
            }
        }
Esempio n. 5
0
        //called when player selects their seat
        public void BootstrapPlayer(PlayerDescriptor thisPlayersData)
        {
            myPlayerData = thisPlayersData;

            foreach (TargetZone tz in myTargetZones)
            {
                tz.SetOwner(this);
            }

            //SendPlayerDescriptor ();
            SendTargetZoneDescriptors();
        }