Exemple #1
0
 async void onRecv(Dictionary <string, string> dic)
 {
     WX.onRecvMsg -= onRecv;
     try
     {
         if (int.Parse(dic["type"]) == 0 && int.Parse(dic["errcode"]) == 0)
         {
             JObject json = new JObject();
             json.Add("code", dic["code"]);
             json.Add("version", info.version);
             json.Add("game", info.package);
             json.Add("device", UniqueId.GetUniteId());
             log?.Log(json);
             var jo = JsonConvert.DeserializeObject <JObject>(await http.PostStr(api.getApi("login"), json.ToString()));
             log?.Log(jo);
             int code = jo.Value <int>("code");
             if (code == 200)
             {
                 info.openid  = jo["data"]["token"].Value <string>("openid");
                 head.nick    = jo["data"]["token"].Value <string>("nickname");
                 head.headUrl = jo["data"]["token"].Value <string>("avatar");
                 GetGold();
                 list.Init();
                 //UpdateInfo();
             }
             tcs.SetResult(code == 200);
         }
     }
     catch (System.Exception e)
     {
         log?.Log(e);
         throw;
     }
 }
Exemple #2
0
        async void LoadMoney()
        {
            await list.Init();

            var infos = list.GetMoneys();

            for (int i = 0; i < infos.Count; i++)
            {
                var clone = item.Instantiate(parent);
                clone.transform.localScale = Vector3.one;
                items.Add(clone);
                clone.id = i;
                clone.button.onClick.AddListener(() =>
                {
                    currId = clone.id;
                    Select(currId);
                });
                clone.newUser.SetActive(i == 0);
                clone.select.SetActive(false);
                clone.dia = infos[i];
                clone.people.SetValues("1000");
            }
        }