Пример #1
0
    public void SaveAll()
    {
        //如果匹配没有完成,提醒用户,不能上传
        List <int> notcheckinglist = CheckAllMatchDone();

        if (notcheckinglist.Count > 0)
        {
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < notcheckinglist.Count; i++)
            {
                stringBuilder.Append(" " + Tool.NumberToChar(notcheckinglist[i] + 1) + " ");
            }

            string _strs = MSGCenter.FormatMessage("第<color=red>" + stringBuilder.ToString() + "</color>组未匹配", "3");

            TTUIPage.ShowPage <UINotice>(_strs);
            return;
        }
        int currentillnessdataid = PlayerDataCenter.Currentillnessdata.ID;

        string url = Tool.refreshillnessdatasimplepath + currentillnessdataid;

        MyWebRequest.Instance.Get(Tool.requestdetailillnessdatapath + currentillnessdataid, (success, str) =>
        {
            bool hasvalue = false;
            if (success)
            {
                hasvalue        = JsonHelper.ChackMatchingHasValue(str);
                string _url     = "";
                string _message = "";
                if (hasvalue)
                {
                    int pointid = JsonHelper.GetPointID(str);
                    //更新旧的
                    _url     = Tool.refreshmathcingpointpath + pointid;
                    _message = JsonHelper.MergMatchingpointChangeNeed(PlayerDataCenter.Currentillnessdata);
                    MyWebRequest.Instance.Put(_url, _message, (suc, ss) => {
                        TTUIPage.ShowPage <UINotice>(Tool.DownloadDir + ss);
                        if (suc)
                        {
                            //解析路径
                            string downloadurlsjson = JsonHelper.ParseJsonToNeed(str, Tool.datakey, Tool.PieceProtectorURLkey);
                            DownloadSave(downloadurlsjson);
                            TTUIPage.ClosePage <UINotice>();
                        }
                    });
                }
                else
                {
                    //添加新的
                    _url = Tool.addmatchingpointspath;
                    MyWebRequest.Instance.Post(_url, JsonHelper.MergMatchingpointChangeNeed(PlayerDataCenter.Currentillnessdata), (_suc, _str) =>
                    {
                        TTUIPage.ShowPage <UINotice>(Tool.DownloadDir + _str);
                        if (_suc)
                        {
                            //解析路径
                            string downloadurlsjson = JsonHelper.ParseJsonToNeed(str, str, Tool.datakey, Tool.PieceProtectorURLkey);
                            DownloadSave(downloadurlsjson);
                            TTUIPage.ClosePage <UINotice>();
                        }
                    });
                }
            }
        });
    }