Exemplo n.º 1
0
    void CreateFriendDragons()
    {
        int playerDataCount = topPlayerDatas.Length;

        friendDragons = new GameObject[MaxFriendDragon];
        for (int i = 0; i < MaxFriendDragon; i++)
        {
            PlayerData pData        = topPlayerDatas[i];
            GameObject friendDragon = (GameObject)Instantiate(friendDragonPrefab, Vector3.zero, Quaternion.identity);

            if (i < playerDataCount)
            {
                // Set data for controller component
                FriendDragonController controller = friendDragon.GetComponent <FriendDragonController> ();
                controller.JumpData = pData.JumpData;
                controller.ExtractJumpData();

                // Set data for scroller component
                FriendScroller scroller = friendDragon.GetComponent <FriendScroller> ();
                scroller.BonusData = pData.BonusData;
                scroller.ExtractBonusData();

                friendDragon.GetComponentInChildren <TextMesh>().text = pData.FacebookName;

                // Cached your data on SQL server
                if (pData.FacebookID.Equals(playerData.FacebookID))
                {
                    playerDataSaved = pData;

                    if (friendDragon != null)
                    {
                        friendDragon.GetComponentInChildren <TextMesh>().text = "You";
                    }
                }
            }
            else
            {
                friendDragon.SetActive(false);
            }

            friendDragons[i] = friendDragon;
        }
    }
Exemplo n.º 2
0
    void UpdateFriendDragonsInfo()
    {
        int playerDataCount = topPlayerDatas.Length;

        for (int i = 0; i < MaxFriendDragon; i++)
        {
            PlayerData pData        = topPlayerDatas[i];
            GameObject friendDragon = friendDragons[i];

            if (i < playerDataCount)
            {
                friendDragon.SetActive(true);

                // Set data for controller component
                FriendDragonController controller = friendDragon.GetComponent <FriendDragonController> ();
                controller.JumpData = pData.JumpData;
                controller.ExtractJumpData();

                // Set data for scroller component
                FriendScroller scroller = friendDragon.GetComponent <FriendScroller> ();
                scroller.BonusData = pData.BonusData;
                scroller.ExtractBonusData();

                friendDragon.GetComponentInChildren <TextMesh>().text = pData.FacebookName;

                // Cached your data on SQL server
                if (pData.FacebookID.Equals(playerData.FacebookID))
                {
                    playerDataSaved = pData;

                    if (friendDragon != null)
                    {
                        friendDragon.GetComponentInChildren <TextMesh>().text = "You";
                    }
                }
            }
            else
            {
                friendDragon.SetActive(false);
            }
        }
    }