//set friends data (called froom gamesparks handler) which then gets all friends records and such
 public void setfriendData(GSData gsDat)
 {
     friends     = gsDat.GetGSData("friends").BaseData;
     friendsIDS  = friends.Keys;
     requests    = gsDat.GetGSData("requests").BaseData;
     requestsIDS = requests.Keys;
     friendsData = new int[friendsIDS.Count, 6];
     gsh         = GameObject.FindGameObjectWithTag("gsh").GetComponent <GameSparksHandler>();
     //sets the number of friend requests on the main screem
     numRequests.text = "" + requests.Count;
     if (requests.Count > 0)
     {
         requestsBackground.gameObject.SetActive(true);
     }
     else
     {
         requestsBackground.gameObject.SetActive(false);
     }
     playerStats     = gsh.getData();
     displayName     = gsh.getName();
     blastLeadAmount = playerStats[0];
     winLeadAmount   = playerStats[2];
     if (playerStats[1] != 0)
     {
         bkLeadAmount = (float)playerStats[0] / playerStats[1];
     }
     else
     {
         bkLeadAmount = (float)playerStats[0];
     }
     getFriendsStats();
 }
Example #2
0
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     SceneManager.sceneLoaded += OnSceneLoaded;
     pView = GetComponent <PhotonView>();
     if (!pView.IsMine)
     {
         return;
     }
     xpEarned          = 0;
     gameOver          = false;
     canExit           = false;
     outOfBounds       = false;
     damaged           = false;
     goldHealth        = false;
     falling           = false;
     handler           = GameObject.FindWithTag("gsh").GetComponent <GameSparksHandler>();
     username          = handler.getName();
     usernameText.text = username;
     pView.RPC("setUsername", RpcTarget.OthersBuffered, username);
     playerProp = new ExitGames.Client.Photon.Hashtable();
     int[] skinMatVals = skins.setMySkin(handler.getProfNum());
     playerProp.Add("skin", skinMatVals[0]);
     playerProp.Add("mat", skinMatVals[1]);
     PhotonNetwork.LocalPlayer.SetCustomProperties(playerProp, null, null);
     redScore         = 0;
     blueScore        = 0;
     countdown        = false;
     gameStarted      = false;
     blasts           = 0;
     deaths           = 0;
     blastText.text   = "" + 0;
     deathText.text   = "" + 0;
     gnc              = GameObject.FindGameObjectWithTag("GNC").GetComponent <gameNetworkController>();
     defaultSpeed     = speed;
     defaultJumpSpeed = jumpSpeed;
     canvas.gameObject.SetActive(true);
     gc.gameObject.SetActive(true);
     goldBlasterText.gameObject.SetActive(false);
     cam = GameObject.FindGameObjectWithTag("cam");
     if (cam == null)
     {
         Debug.Log("null cam found");
     }
     cam.gameObject.GetComponent <SmoothMouseLook>().setTheParent(transform);
     hp              = 100;
     sprinting       = false;
     runTime         = .4f;
     crossHair.color = Color.black;
     chColor         = crossHair.color;
     crossHairChange = false;
     dead            = false;
     cam.GetComponent <SmoothMouseLook>().enabled = true;
     waterPacks         = 0;
     waterPackText.text = "Water Packs: " + waterPacks;
     bubbleImg.gameObject.SetActive(false);
     bubbleImageShown = false;
     crossHitShown    = false;
     crossHairHit.gameObject.SetActive(false);
 }