Esempio n. 1
0
    public void Get()
    {
        //DebugAction(Data.DebugData);
        //return;
        if (isLocksend)
        {
            return;
        }
        msg.Code = HttpCode.FAILED;
        StartLoad();
        Data.ErrorCode = "-1";
        Data.BackData.Clear();
        message = null;
        if (!isLoacl)
        {
            message += "?";
        }
        if (IsLock)
        {
            message += EncryptDecipherTool.UserMd5();
        }

        //URL请求拼接
        string url = null;

        if (isLoacl)
        {
            url = Static.Instance.LocalURL + LocalHttp;
        }
        else
        {
            url = Static.Instance.URL + Data.URL;
        }

        if (Data.SendData.Count > 0)
        {
            foreach (DataValue child in Data.SendData)
            {
                string str = child.GetString();
                if (str == "Error")
                {
                    EndLoad();
                    return;
                }
                if (str == "Gone")
                {
                    continue;
                }
                //if(message.Substring(message.Length-2,1)=="?")
                //    message +=child.Name + "=" + str;
                //else
                message += "&" + child.Name + "=" + str;
            }
        }

        message = EncryptDecipherTool.GetListOld(message, IsLock);
        url     = url + message;
        url     = Uri.EscapeUriString(url);
        StartCoroutine(GetMessage(url));
    }
Esempio n. 2
0
    IEnumerator dlYanZheng()
    {
        if (Static.Instance.Lock)
        {
            url = "ajaxdlyzm.php" + "?" + EncryptDecipherTool.UserMd5() + "&tel" + "=" + Tel.text;
        }
        string tigUrl = Static.Instance.URL + url;
        WWW    www    = new WWW(tigUrl);

        yield return(www);

        Debug.Log(www.text);
        ShowMessage = www.text;

        if (www.error != null)
        {
            Debug.Log("error code = " + www.error);
        }
        else
        {
            string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
            Static.Instance.DeleteFile(Application.persistentDataPath, "json.txt");
            Static.Instance.CreateFile(Application.persistentDataPath, "json.txt", jsondata);
            ArrayList infoall = Static.Instance.LoadFile(Application.persistentDataPath, "json.txt");
            String    sr      = null;
            foreach (string str in infoall)
            {
                sr += str;
            }
            JsonData jd = JsonMapper.ToObject(sr);
            if (Code != null)
            {
                Code.text = jd.Keys.Contains("code")?jd["code"].ToString():"";
            }
            if (result != null)
            {
                result.text = jd.Keys.Contains("result")?jd["result"].ToString():"";
            }
            if (msg != null)
            {
                msg.text = jd.Keys.Contains("msg")?jd["msg"].ToString():"";
            }
            VerCode_ = jd.Keys.Contains("data") ? jd["data"].ToString() : "";
            string msgshow = jd.Keys.Contains("msg")?jd["msg"].ToString():"";
            string code    = jd.Keys.Contains("code")?jd["code"].ToString():"";
            if (code == "2")
            {
                GameObject.Find("ErrorRestart").SendMessage("Restart", msgshow);
            }
        }
    }
Esempio n. 3
0
    public void Get()
    {
        Data.BackData.Clear();
        //加密
        //EncryptDecipherTool.GetList(Data.SendData,Islock);
        message  = null;
        message += "?";
        if (IsLock)
        {
            message += EncryptDecipherTool.UserMd5();
        }
        if (ShowLoad != null)
        {
            ShowLoad.transform.localScale = new Vector3(1, 1, 1);
        }
        if (ShowError != null)
        {
            ShowError.transform.localScale = new Vector3(0, 0, 0);
        }
        switch (DataType)
        {
        case TypeGo.GetTypeA:
            StopAllCoroutines();
            StartCoroutine("GetMessageA");
            break;

        case TypeGo.GetTypeB:
            StopAllCoroutines();
            StartCoroutine("GetMessageB");
            break;

        case TypeGo.GetTypeC:
            StopAllCoroutines();
            StartCoroutine("GetMessageC");

            break;

        case TypeGo.GetTypeD:
            StopAllCoroutines();
            StartCoroutine("GetMessageD");

            break;
        }
    }
Esempio n. 4
0
    IEnumerator YanZheng()
    {
        if (Static.Instance.Lock)
        {
            url = "ajaxyzm.php" + "?" + EncryptDecipherTool.UserMd5();
        }
        string tigUrl = Static.Instance.URL + url;
        WWW    www    = new WWW(tigUrl);

        yield return(www);

        Debug.Log(www.text);
        ShowMessage = www.text;
        if (www.error != null)
        {
            Debug.Log("error code = " + www.error);
        }
        else
        {
//			string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
//			DeleteFile(Application.persistentDataPath, "json.txt");
//			CreateFile(Application.persistentDataPath, "json.txt", jsondata);
//			ArrayList infoall = LoadFile(Application.persistentDataPath, "json.txt");
//			String sr = null;
//			foreach (string str in infoall)
//			{
//				sr += str;
//			}
//            string a = jsondata;
            JsonData jd = JsonMapper.ToObject(www.text);
            VerCode_ = jd.Keys.Contains("data") ? jd["data"].ToString() : "";
            string msgshow = jd.Keys.Contains("msg")?jd["msg"].ToString():"";
            string code    = jd.Keys.Contains("code")?jd["code"].ToString():"";
            if (code == "2")
            {
                GameObject.Find("ErrorRestart").SendMessage("Restart", msgshow);
            }
        }
    }
Esempio n. 5
0
    IEnumerator TradingMessageInfo()
    {
        string url = Static.Instance.URL + Data.URL;

        if (Data.SendData.Length > 0)
        {
            //message += "?";
            foreach (SendMessage child in Data.SendData)
            {
                message += "&" + child.Name + "=" + child.SetValue();
            }
        }

        message = EncryptDecipherTool.GetListOld(message, IsLock);
        url     = url + message;
        Debug.Log(url);
        WWW www = new WWW(url);

        yield return(www);

        Data.ShowMessage = www.text;
        if (www.error != null)
        {
            Data.ShowMessage = "error code = " + www.error;
            ShowError.transform.localScale = new Vector3(1, 1, 1);
        }
        else
        {
            string jsondata = www.text;
            jsondata = jsondata.Remove(0, Data.CutCount);
            int a = 0;
            Static.Instance.DeleteFile(Application.persistentDataPath, "json.txt");
            Static.Instance.CreateFile(Application.persistentDataPath, "json.txt", jsondata);
            ArrayList infoall = Static.Instance.LoadFile(Application.persistentDataPath, "json.txt");
            String    sr      = null;
            foreach (string str in infoall)
            {
                sr += str;
            }
            JsonData jd = JsonMapper.ToObject(sr);
            Data.ShowMessage = jsondata;
            Debug.Log(jsondata);
            Data.GetBase.code   = jd.Keys.Contains("code") ? jd["code"].ToString() : "";
            Data.GetBase.result = jd.Keys.Contains("result") ? jd["result"].ToString() : "";
            Data.GetBase.msg    = jd.Keys.Contains("msg") ? jd["msg"].ToString() : "";

            if (Data.GetBase.code == "1")
            {
                List <string> NameGround = new List <string> ();

                if (jd [Data.DataName] != null)
                {
                    for (int i = 0; i < jd [Data.DataName].Count; i++)
                    {
                        foreach (string name in jd[Data.DataName][i].Keys)
                        {
                            NameGround.Add(name);
                        }
                        Dic GroundData = new Dic();
                        for (int j = 0; j < jd [Data.DataName] [i].Count; j++)
                        {
                            GroundData.DataDic.Add(NameGround [j], jd [Data.DataName] [i] [j].ToString());
                        }
                        Static.Instance.SaveTradingInfo.Add(jd [Data.DataName] [i] ["id"].ToString(), GroundData);
                        NameGround.Clear();
                    }
                }
            }

            if (Data.GetBase.code == "2")
            {
                GameObject.Find("ErrorRestart").SendMessage("Restart", Data.GetBase.msg);
            }
            if (Data.GetBase.code == "1")
            {
                Suc.Invoke();
            }
            else if (Data.GetBase.code == "0")
            {
                Fal.Invoke();
            }
        }
        if (BusinessInfoHelper.Instance != null)
        {
            BusinessInfoHelper.Instance.isDone = true;
        }
        ShowLoad.transform.localScale = new Vector3(0, 0, 0);
    }
Esempio n. 6
0
    IEnumerator GetMessageTYC()
    {
        string url = Static.Instance.URL + Data.URL;

        if (Data.SendData.Length > 0)
        {
            //message += "?";
            foreach (SendMessage child in Data.SendData)
            {
                message += "&" + child.Name + "=" + child.SetValue();
            }
        }
        message = EncryptDecipherTool.GetListOld(message, IsLock);
        url     = url + message;
        url     = Uri.EscapeUriString(url);
        Debug.Log(url);
        WWW www = new WWW(url);

        yield return(www);

        Data.ShowMessage = www.text;
        if (www.error != null)
        {
            Data.ShowMessage = "error code = " + www.error;
            ShowError.transform.localScale = new Vector3(1, 1, 1);
        }
        else
        {
            string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
            jsondata         = jsondata.Remove(0, Data.CutCount);
            Data.ShowMessage = jsondata;
            JsonData jd = JsonMapper.ToObject(jsondata);
            Data.GetBase.code   = jd.Keys.Contains("code") ? jd ["code"].ToString() : "";
            Data.GetBase.result = jd.Keys.Contains("result") ? jd ["result"].ToString() : "";
            Data.GetBase.msg    = jd.Keys.Contains("msg") ? jd ["msg"].ToString() : "";
            if (Data.GetBase.codetext != null)
            {
                Data.GetBase.codetext.text = Data.GetBase.code;
            }
            if (Data.GetBase.resulttext != null)
            {
                Data.GetBase.resulttext.text = Data.GetBase.result;
            }
            if (Data.GetBase.msgtext != null)
            {
                Data.GetBase.msgtext.text = Data.GetBase.msg;
            }
            if (Data.GetBase.msgInputtext != null)
            {
                float aaa     = 0;
                bool  HaveInt = float.TryParse(Data.GetBase.msg, out aaa);
                if (HaveInt)
                {
                    Data.GetBase.msgInputtext.text = System.Math.Floor(aaa).ToString();
                }
            }
        }


        if (Data.GetBase.code == "2")
        {
            GameObject.Find("ErrorRestart").SendMessage("Restart", Data.GetBase.msg);
        }
        if (Data.GetBase.code == "1")
        {
            Suc.Invoke();
        }
        else if (Data.GetBase.code == "0")
        {
            Fal.Invoke();
        }
        if (BusinessInfoHelper.Instance != null)
        {
            BusinessInfoHelper.Instance.isDone = true;
        }
        ShowLoad.transform.localScale = new Vector3(0, 0, 0);
    }
Esempio n. 7
0
    IEnumerator GetMessageTYB()
    {
        string url = Static.Instance.URL + Data.URL;

        if (Data.SendData.Length > 0)
        {
            //message += "?";
            foreach (SendMessage child in Data.SendData)
            {
                message += "&" + child.Name + "=" + child.SetValue();
            }
        }
        message = EncryptDecipherTool.GetListOld(message, IsLock);
        url     = url + message;
        Debug.Log(url);

        WWW www = new WWW(url);

        yield return(www);

        Data.ShowMessage = www.text;
        if (www.error != null)
        {
            Data.ShowMessage = "error code = " + www.error;
            ShowError.transform.localScale = new Vector3(1, 1, 1);
        }
        else
        {
            string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
            jsondata = jsondata.Remove(0, Data.CutCount);
            int a = 0;
            Static.Instance.DeleteFile(Application.persistentDataPath, "json.txt");
            Static.Instance.CreateFile(Application.persistentDataPath, "json.txt", jsondata);
            ArrayList infoall = Static.Instance.LoadFile(Application.persistentDataPath, "json.txt");
            String    sr      = null;
            foreach (string str in infoall)
            {
                sr += str;
            }
            JsonData jd = JsonMapper.ToObject(sr);
            Data.ShowMessage = jsondata;
            Debug.Log(jsondata);
            Data.GetBase.code   = jd.Keys.Contains("code") ? jd["code"].ToString() : "";
            Data.GetBase.result = jd.Keys.Contains("result") ? jd["result"].ToString() : "";
            Data.GetBase.msg    = jd.Keys.Contains("msg") ? jd["msg"].ToString() : "";
            if (Data.GetBase.codetext != null)
            {
                Data.GetBase.codetext.text = Data.GetBase.code;
            }
            if (Data.GetBase.resulttext != null)
            {
                Data.GetBase.resulttext.text = Data.GetBase.result;
            }
            if (Data.GetBase.msgtext != null)
            {
                Data.GetBase.msgtext.text = Data.GetBase.msg;
            }

            if (Data.GetBase.code == "1")
            {
                List <string> Savename = new List <string>();
                Dictionary <string, string> SaveMessage = new Dictionary <string, string>();

                foreach (string child in jd[Data.DataName].Keys)
                {
                    Savename.Add(child);
                }

                for (int i = 0; i < jd[Data.DataName].Count; i++)
                {
                    if (jd [Data.DataName] [i] == null)
                    {
                        Data.BackData.Add("null");
                    }
                    else
                    {
                        Data.BackData.Add(jd [Data.DataName] [i].ToString());
                    }

                    SaveMessage.Add(Savename[i], Data.BackData[i]);
                    Data.GetData(Savename[i], Data.BackData[i]);
                }
                if (Data.Action)
                {
                    foreach (GetData child in Data.BackDataGet)
                    {
                        string obj = null;
                        SaveMessage.TryGetValue(child.ShowData, out obj);

                        if (child.IsSave)
                        {
                            Static.Instance.AddValue(child.ShowData, obj);
                        }
                        if (child.GetDataObj != null)
                        {
                            child.GetDataObj.text = obj;
                        }
                    }
                }
            }

            if (Data.GetBase.code == "2")
            {
                GameObject.Find("ErrorRestart").SendMessage("Restart", Data.GetBase.msg);
            }
            if (Data.GetBase.code == "1")
            {
                Suc.Invoke();
            }
            else
            {
                Fal.Invoke();
            }
        }
        if (BusinessInfoHelper.Instance != null)
        {
            BusinessInfoHelper.Instance.isDone = true;
        }
        ShowLoad.transform.localScale = new Vector3(0, 0, 0);
    }
Esempio n. 8
0
    public void Get()
    {
//		string A = Static.Instance.URL;
//		string B = Static.Instance.URLold;
//		if (A != null) {
//			A = Data.URL.Replace (B, A);
//			Data.URL = A;
//		}
//		Debug.Log (Data.URL);


        Data.BackData.Clear();
        //EncryptDecipherTool.GetListOld(Data.SendData,IsLock);

        message  = null;
        message += "?";
        if (IsLock)
        {
            message += EncryptDecipherTool.UserMd5();
        }
        ShowLoad.transform.localScale = new Vector3(1, 1, 1);
        if (ShowError != null)
        {
            ShowError.transform.localScale = new Vector3(0, 0, 0);
        }
        switch (DataType)
        {
        case TypeGo.GetTypeA:
            StopAllCoroutines();
            StartCoroutine("GetMessageTYA");
            break;

        case TypeGo.GetTypeB:
            StopAllCoroutines();
            StartCoroutine(GetMessageTYB());
            break;

        case TypeGo.GetTypeC:
            StopAllCoroutines();
            StartCoroutine("GetMessageTYC");
            break;

        case TypeGo.GetTypeD:
            StopAllCoroutines();
            StartCoroutine(GetMessageTYD());
            break;

        case TypeGo.GetTypeE:
            StopAllCoroutines();
            StartCoroutine(GetMessageTYE());
            break;

        case TypeGo.GetGrownInfoTyppe:
            StopAllCoroutines();
            StartCoroutine(GetMessageGrown());
            break;

        case TypeGo.GetTradingInfo:
            StopAllCoroutines();
            StartCoroutine(TradingMessageInfo());
            break;

        case TypeGo.Send:
            StopAllCoroutines();
            StartCoroutine(Send());
            break;

        case TypeGo.GetTypeShopList:
            StopAllCoroutines();
            StartCoroutine(GetMessageShopList());
            break;

        case TypeGo.GetTypeShopType:
            StopAllCoroutines();
            StartCoroutine(GetMessageShopTypeList());
            break;
        }
    }
Esempio n. 9
0
    IEnumerator GetMessageA()
    {
        string url = Static.Instance.URL + Data.URL;

        if (Data.SendData.Count > 0)
        {
            foreach (DataValue child in Data.SendData)
            {
                message += "&" + child.Name + "=" + child.GetString();
            }
        }
        message = EncryptDecipherTool.GetListOld(message, IsLock);

        url = url + message;
        Debug.Log(url);
        url = Uri.EscapeUriString(url);
        WWW www = new WWW(url);

        yield return(www);

        if (www.error != null)
        {
            Data.ShowMessage = "error code = " + www.error;
            if (ShowError != null && !NoShow)
            {
                ShowError.transform.localScale = new Vector3(1, 1, 1);
            }
            DoAction.Invoke();
        }
        else
        {
            string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
            jsondata         = jsondata.Remove(0, Data.CutCount);
            Data.ShowMessage = jsondata;
            //CreateFile(Application.streamingAssetsPath, "json.txt", jsondata);
            Static.Instance.DeleteFile(Application.persistentDataPath, "json.txt");
            Static.Instance.CreateFile(Application.persistentDataPath, "json.txt", jsondata);
            ArrayList infoall = Static.Instance.LoadFile(Application.persistentDataPath, "json.txt");
            String    sr      = null;
            foreach (string str in infoall)
            {
                sr += str;
            }
            JsonData jd = JsonMapper.ToObject(sr);
            Data.GetBase.code   = jd.Keys.Contains("code")?jd["code"].ToString():"";
            Data.GetBase.result = jd.Keys.Contains("result")?jd["result"].ToString():"";
            Data.GetBase.msg    = jd.Keys.Contains("msg")?jd["msg"].ToString():"";
            Data.GetBase.url    = jd.Keys.Contains("url")?jd["url"].ToString():"";
            if (Data.GetBase.msgInputtext != null)
            {
                Data.GetBase.msgInputtext.text = System.Math.Floor(float.Parse(Data.GetBase.msg)).ToString();
            }
            if (Data.GetBase.codetext != null)
            {
                Data.GetBase.codetext.text = Data.GetBase.code;
            }
            if (Data.GetBase.resulttext != null)
            {
                Data.GetBase.resulttext.text = Data.GetBase.result;
            }
            if (Data.GetBase.msgtext != null)
            {
                Data.GetBase.msgtext.text = Data.GetBase.msg;
            }
            if (Data.GetBase.urltext != null)
            {
                Data.GetBase.urltext.text = Data.GetBase.url;
            }
        }

        if (Data.GetBase.code == "2")
        {
            GameObject.Find("ErrorRestart").SendMessage("Restart", Data.GetBase.msg);
        }
        if (Data.GetBase.code == "1")
        {
            Suc.Invoke();
        }
        else if (Data.GetBase.code == "0")
        {
            Fal.Invoke();
        }

        if (BusinessInfoHelper.Instance != null)
        {
            BusinessInfoHelper.Instance.isDone = true;
        }

        ShowLoad.transform.localScale = new Vector3(0, 0, 0);
    }
Esempio n. 10
0
    IEnumerator UploadTexture(string GetTex, int typeimg)
    {
        EncryptDecipherTool.UserMd5();
        //MessageManager._Instantiate.Show("上传开始");
        string  url  = Static.Instance.URL + "ajax_fenxiang_put.php"; /*Static.Instance.URL + "upimage";*/
        WWWForm form = new WWWForm();
        img     data = new img();

        data.imgData = GetTex;
        Debug.Log(GetTex);
        Debug.Log(url);
        form.AddField("huiyuan_id", Static.Instance.GetValue("huiyuan_id"));
        form.AddField("time", Static.Instance.GetValue("time"));
        form.AddField("token", Static.Instance.GetValue("token"));
        form.AddField("img_url", GetTex);
        //Debug.Log(Static.Instance.GetValue("huiyuan_id"));
        //Debug.Log(Static.Instance.GetValue("time"));
        //Debug.Log(Static.Instance.GetValue("token"));
        //MessageManager._Instantiate.AddLockNub();
        WWW www = new WWW(url, form);

        yield return(www);

        MSG.text = string.Empty;
        //MessageManager._Instantiate.DisLockNub();
        if (www.error != null)
        {
            MSG.text = www.error;
            //MessageManager._Instantiate.Show("图片上传失败");
        }
        else
        {
            Debug.Log(www.text + "++++++++");
            MSG.text = www.text;
            Debug.Log(www.text);
            //MessageManager._Instantiate.Show("图片上传成功");

            string jsondata = System.Text.Encoding.UTF8.GetString(www.bytes, 3, www.bytes.Length - 3);
            jsondata = jsondata.Remove(0, 0);
            //CreateFile(Application.streamingAssetsPath, "json.txt", jsondata);
            Static.Instance.DeleteFile(Application.persistentDataPath, "json.txt");
            Static.Instance.CreateFile(Application.persistentDataPath, "json.txt", jsondata);
            ArrayList infoall = Static.Instance.LoadFile(Application.persistentDataPath, "json.txt");
            String    sr      = null;
            foreach (string str in infoall)
            {
                sr += str;
            }
            JsonData jd = JsonMapper.ToObject(sr);
            tiptxt.text = jd["msg"].ToString();



            if (typeimg == 0)
            {
            }
            else
            {
            }
        }
    }