示例#1
0
        public void FillData(Texture avatarSprite, string name, LudoPlayerData data)
        {
            if (avatarSprite == null)
            {
                avatar.texture = defaultAvatar;
            }
            else
            {
                avatar.texture = avatarSprite;
            }

            playername.GetComponent <Text>().text         = name;
            TotalEarningsValue.GetComponent <Text>().text = data.GetTotalEarnings().ToString();
            GamesPlayedValue.GetComponent <Text>().text   = data.GetPlayedGamesCount().ToString();
            CurrentMoneyValue.GetComponent <Text>().text  = data.GetCoins().ToString();
            GamesWonValue.GetComponent <Text>().text      = (data.GetTwoPlayerWins() + data.GetFourPlayerWins()).ToString();
            float gamesWon = (data.GetTwoPlayerWins() + data.GetFourPlayerWins());

            Debug.Log("WON: " + gamesWon);
            Debug.Log("played: " + data.GetPlayedGamesCount());
            if (data.GetPlayedGamesCount() != 0 && gamesWon != 0)
            {
                WinRateValue.GetComponent <Text>().text = Mathf.RoundToInt((gamesWon / data.GetPlayedGamesCount() * 100)).ToString() + "%";
            }
            else
            {
                WinRateValue.GetComponent <Text>().text = "0%";
            }
            TwoPlayerWinsValue.GetComponent <Text>().text  = data.GetTwoPlayerWins().ToString();
            FourPlayerWinsValue.GetComponent <Text>().text = data.GetFourPlayerWins().ToString();
        }
示例#2
0
        public void ShowPlayerInfo(Texture avatarSprite, string name, LudoPlayerData data)
        {
            editProfileButton.SetActive(false);
            addFriendButton.SetActive(true);

            window.SetActive(true);

            FillData(avatarSprite, name, data);
        }
示例#3
0
        public PlayerObject(string name, string id, Texture avatar)
        {
            this.name   = name;
            this.id     = id;
            this.avatar = avatar;
            //this.timer = timer;
            if (!id.Contains("_BOT"))
            {
                this.isBot = false;
                id         = UserDetailsManager.userId;
                name       = UserDetailsManager.userName;
                avatar     = UserDetailsManager.userImageTexture;
            }
            else
            {
                this.isBot     = true;
                this.data      = new LudoPlayerData();
                this.data.data = new Dictionary <string, UserDataRecord>();


                UserDataRecord record3 = new UserDataRecord();
                record3.Value = Random.Range(500, 1000).ToString();
                this.data.data.Add(LudoPlayerData.GamesPlayedKey, record3);
                UserDataRecord record4 = new UserDataRecord();
                record4.Value = Random.Range(1, 250).ToString();
                this.data.data.Add(LudoPlayerData.TwoPlayerWinsKey, record4);
                UserDataRecord record5 = new UserDataRecord();
                record5.Value = Random.Range(1, 250).ToString();
                this.data.data.Add(LudoPlayerData.FourPlayerWinsKey, record5);
                UserDataRecord record = new UserDataRecord();
                record.Value = (Random.Range(10000, 50000) * 100).ToString();
                this.data.data.Add(LudoPlayerData.TotalEarningsKey, record);
                UserDataRecord record2 = new UserDataRecord();
                record2.Value = (Random.Range(1, 10000) * 100).ToString();
                this.data.data.Add(LudoPlayerData.CoinsKey, record2);
            }
        }
示例#4
0
        public void setInitNewAccountData(bool fb)
        {
            Dictionary <string, string> data = LudoPlayerData.InitialUserData(fb);

            GameManager.Instance.myPlayerData.UpdateUserData(data);
        }