Example #1
0
    public void AddLifeValue(Toggle toogle)
    {
        string userId = toogle.name;
        string _url   = "http://" + Config.parse("ServerIP") + ":8899/";

        if (!string.IsNullOrEmpty(userId))
        {
            RestFulProxy.CheckEnterButton((checkResult) => {
                checkResult = checkResult.Trim('"');
                if (!checkResult.Equals("0"))
                {
                    string url = _url + "GetPlayerLifeInfoByUser/" + userId;
                    ResourceUtility.Instance.GetHttpText(url, (result) => {
                        Life life = Utils.CollectionsConvert.ToObject <Life>(result);
                        if (life != null)
                        {
                            AddLife.instance.ShowOrHide(true);
                            AddLife.instance.ShowFormData(life);
                        }
                    });
                }
                else
                {
                    GetComponentInParent <RootBaseRoomView>().errorMessage.ShowMessage("操作错误,游戏已处于运行状态。"
                                                                                       , SoundType.Error);
                }
            });
        }
    }
Example #2
0
 private IEnumerator CheckEnterState()
 {
     while (true)
     {
         RestFulProxy.CheckEnterButton((result) => {
             result = result.Trim('"');
             if (result.Equals("0"))
             {
                 GetComponent <Button>().interactable = true;
                 SoundUtilty.PlayResouceSound("Sound/GameStart");
                 //SetAddLifeButton();
                 StopAllCoroutines();
             }
         });
         yield return(new WaitForSeconds(4.0f));
     }
 }