Ejemplo n.º 1
0
    void ParseAccessData(string wtxt)
    {
        try
        {
            JsonData data = JsonMapper.ToObject(wtxt);
            lst.Clear();

            for (int i = 0; i < data.Count; i++)
            {
                if (int.Parse("" + data[i]["Coin"]) > 20)
                {
                    continue;
                }
                UserVi cb = new UserVi();
                cb.Stt = "" + (i + 1);
                string nameschool = "" + data[i]["Name"];
                if (nameschool.Contains(")"))
                {
                    string[] m = nameschool.Split(')');
                    cb.Name   = doHoanSau("" + m[0], "_", " ");
                    cb.School = doHoanSau("" + m[1], "_", " ");
                }
                else
                {
                    cb.Name = doHoanSau("" + data[i]["Name"], "_", " ");
                }



                cb.Level = "" + data[i]["Coin"];


                lst.Add(cb);

                if (mYear == 0)
                {
                    mYear = int.Parse("" + data[i]["Namxephang"]);
                }
            }



            doLoading();
        }
        catch
        {
        }
    }
Ejemplo n.º 2
0
    //private void writeNewUser(string userId, string pName, int pLevel,string pSchool,int pSecond, int pYear)
    //{
    //   // User user = new User(userId, level, rate, name, "" + Application.systemLanguage.ToString().ToLower().Trim(), year);
    //    UserVi user = new UserVi(pName, userId, pLevel, pSchool, "" + Application.systemLanguage.ToString().ToLower().Trim(), pSecond, pYear);
    //    string json = JsonUtility.ToJson(user);

    //    mDatabaseRef.Child("users9").Child(userId).SetRawJsonValueAsync(json);
    //}

    public void doLoadData()
    {
        for (int i = 0; i < 30; i++)
        {
            UserVi vi = new UserVi("name:" + i, "Top " + i, 20, "le quy don", "Viet Nam", 300, 2017);
            lstUser.Add(vi);
        }

        for (int i = 0; i < lstUser.Count; i++)
        {
            itemGD.transform.GetChild(0).GetComponent <Text>().text = "Top:" + i;
            itemGD.transform.GetChild(1).GetComponent <Text>().text = "" + lstUser[i].Name;
            itemGD.transform.GetChild(2).GetComponent <Text>().text = "" + lstUser[i].School;
            itemGD.transform.GetChild(3).GetComponent <Text>().text = "Level " + lstUser[i].Level;
            itemGD.transform.GetChild(4).GetComponent <Text>().text = "" + lstUser[i].Contri;
            GameObject item = (GameObject)Instantiate(itemGD, lstGD.transform);

            item.transform.localScale = new Vector3(1, 1, 1);
        }
        scroll.verticalNormalizedPosition = 1;
    }