Ejemplo 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));
    }
Ejemplo 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);
            }
        }
    }
Ejemplo 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;
        }
    }
Ejemplo 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);
            }
        }
    }
Ejemplo n.º 5
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;
        }
    }
Ejemplo n.º 6
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
            {
            }
        }
    }