Esempio n. 1
0
        public static void LoadAll()
        {
            try
            {
                list_user_all.Clear();
                List <string> list_s = TheTool.read_File_getListString(path1);
                foreach (string s in list_s)
                {
                    TheTool.log(s + "READDDDDDD");
                    string[] s2 = TheTool.splitText(s, ",");
                    if (s2.Length >= 6)
                    {
                        Data_UserData d = new Data_UserData();
                        d.total    = TheTool.getInt(s2[0]);
                        d.p1_cheer = TheTool.getInt(s2[1]);
                        d.p1_jeer  = TheTool.getInt(s2[2]);
                        d.p2_cheer = TheTool.getInt(s2[3]);
                        d.p2_jeer  = TheTool.getInt(s2[4]);

                        for (int i = 5; i < s2.Length; i++)
                        {
                            d.username += s2[i];
                        }
                        list_user_all.Add(d);
                    }
                }
            }
            catch (Exception ex) { TheTool.log(ex); }
        }
Esempio n. 2
0
        //--------------------------------

        /* cheer P1 = +1
         * jeer O2 = -2
         * -1
         * +1
         */

        public static void UpdateUser(string username0, int type)
        {
            TheTool.log("UPDATEEEEE" + username0 + " " + type);
            Data_UserData target = null;

            foreach (Data_UserData d in list_user_all)
            {
                if (d.username == username0)
                {
                    target = d;
                    break;
                }
            }
            if (target == null)
            {
                target          = new Data_UserData();
                target.username = username0;
                list_user_all.Add(target);
            }
            if (target != null)
            {
                if (type == 1)
                {
                    target.p1_cheer++;
                }
                else if (type == 2)
                {
                    target.p2_cheer++;
                }
                else if (type == -1)
                {
                    target.p1_jeer++;
                }
                else if (type == -2)
                {
                    target.p2_jeer++;
                }
                target.total++;
            }
        }