jsonEncode() public static method

Converts a Hashtable / ArrayList / Dictionary(string,string) object into a JSON string
public static jsonEncode ( object json ) : string
json object A Hashtable / ArrayList
return string
Exemplo n.º 1
0
    /// <summary>
    /// 配置文件
    /// </summary>
    /// <param name="data"></param>
    public static void SaveJsonFile(Hashtable obj, string savePath, bool isCompress = true)
    {
        string jsonData = MiniJSON.jsonEncode(obj);

        byte[] buff = System.Text.UTF8Encoding.UTF8.GetBytes(jsonData);
        if (isCompress)
        {
            buff = ZipLibUtils.Compress(buff);
        }

        if (jsonData.Length > 0)
        {
            SaveFileByte(buff, savePath);
        }
    }
Exemplo n.º 2
0
 void ShareResultHandler(ResponseState state, PlatformType type, Hashtable shareInfo, Hashtable error, bool end)
 {
     if (state == ResponseState.Success)
     {
         print("share result :");
         print(MiniJSON.jsonEncode(shareInfo));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + error["error_code"] + "; error msg = " + error["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 3
0
    private void SaveSettings()
    {
        DebugView._settings.ShowStackTrace = this.ShowStackTrace.value;
        DebugView._settings.PageSize       = int.Parse(this.PageSizeInput.text);
        DebugView._settings.Names.Clear();
        foreach (string current in LogTagMgr.Instance.TagNames)
        {
            if (LogTagMgr.Instance[current].Enable)
            {
                DebugView._settings.Names.Add(current);
            }
        }
        string value = MiniJSON.jsonEncode(DebugView._settings);

        PlayerPrefs.SetString("cosmore_log", value);
    }
Exemplo n.º 4
0
 public void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     if (state == ResponseState.Success)
     {
         Debug.Log("share result :");
         Debug.Log(MiniJSON.jsonEncode(result));
     }
     else if (state == ResponseState.Fail)
     {
         Debug.Log("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         Debug.Log("cancel !");
     }
 }
Exemplo n.º 5
0
 void GetTokenResultHandler(ResponseState state, PlatformType type, Hashtable credential, Hashtable error)
 {
     if (state == ResponseState.Success)
     {
         print("share result :");
         print(MiniJSON.jsonEncode(credential));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + error["error_code"] + "; error msg = " + error["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
    public void encodeAll()
    {
        var result = new Dictionary <string, object>();

        foreach (PurchasableItem item in config.AllPurchasableItems)
        {
            var localId = item.LocalIds [BillingPlatform.AmazonAppstore];
            result[localId] = purchasableDetailsToDictionary(item);
        }

        var json = MiniJSON.jsonEncode(result);

        using (StreamWriter o = new StreamWriter("Assets/Plugins/unibill/resources/amazon.sdktester.json.txt")) {
            o.Write(json);
        }
    }
Exemplo n.º 7
0
 void OnNitifyHandler(int action, Hashtable resulte)
 {
     Debug.Log("OnNitifyHandler");
     if (action == ResponseState.CoutomMessage)
     {
         Debug.Log("CoutomMessage:" + MiniJSON.jsonEncode(resulte));
     }
     else if (action == ResponseState.MessageRecvice)
     {
         Debug.Log("MessageRecvice:" + MiniJSON.jsonEncode(resulte));
     }
     else if (action == ResponseState.MessageOpened)
     {
         Debug.Log("MessageOpened:" + MiniJSON.jsonEncode(resulte));
     }
 }
Exemplo n.º 8
0
    public static bool SaveMaterialInfo()
    {
        Dictionary <string, string> materialjson = new Dictionary <string, string>();

        foreach (GameMaterial materials in LoadingControl.LoadingData.materialinfo_list)
        {
            if (materials.count > 0)
            {
                materialjson.Add(materials.itemkey, materials.count + "");
            }
        }
        string materialjsonstr = MiniJSON.jsonEncode(materialjson);

        PlayerPrefs.SetString(material_savingstring, materialjsonstr);
        return(true);
    }
Exemplo n.º 9
0
 void GetFriendsResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     if (state == ResponseState.Success)
     {
         print("get friend list result :");
         print(MiniJSON.jsonEncode(result));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 10
0
 void GetUserInfoResultHandler(ResponseState state, PlatformType type, Hashtable user, Hashtable error)
 {
     if (state == ResponseState.Success)
     {
         print("get user result :");
         print(MiniJSON.jsonEncode(user));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + error["error_code"] + "; error msg = " + error["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 11
0
 void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     if (state == ResponseState.Success)
     {
         print("share result :");
         print(MiniJSON.jsonEncode(result));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 12
0
    public static bool SaveEquipmentInfo()
    {
        Dictionary <string, string> equipmentjson = new Dictionary <string, string>();

        foreach (Equipment equipment in LoadingControl.LoadingData.equipmentinfo_list)
        {
            if (equipment.count > 0)
            {
                equipmentjson.Add(equipment.equipmentkey, equipment.count + "");
            }
        }
        string equipmentjsonstr = MiniJSON.jsonEncode(equipmentjson);

        PlayerPrefs.SetString(equipment_savingstring, equipmentjsonstr);
        return(true);
    }
Exemplo n.º 13
0
 void GetFriendsResultHandler(ResponseState state, PlatformType type, ArrayList friends, Hashtable error)
 {
     if (state == ResponseState.Success)
     {
         print("share result :");
         print(MiniJSON.jsonEncode(friends));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + error["error_code"] + "; error msg = " + error["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 14
0
        /// <summary>
        ///  sharesdk登录认证平台后返回的数据
        /// </summary>
        /// <param name="reqID"></param>
        /// <param name="state"></param>
        /// <param name="type"></param>
        /// <param name="result"></param>
        void OnAuthResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
        {
            if (state == ResponseState.Success)
            {
                print("authorize success !" + "Platform :" + type);

                Hashtable res = ssdk.GetAuthInfo(type);

                print(MiniJSON.jsonEncode(res));

//				MessageHint.Show (MiniJSON.jsonEncode(res));
//				var openstr =;
                var openid = "null";
                                #if UNITY_ANDROID
                openid = MiniJSON.jsonEncode(res["userID"]);
                                #elif UNITY_IPHONE
                openid = MiniJSON.jsonEncode(res["uid"]);
                                #endif

//				MessageHint.Show (openid);
                var tmpOpenid = openid.Substring(1, openid.Length - 2);

                if (openid != "" && openid != "null")
                {
                    PlayerPrefs.SetString(GameModel.GetInstance.UserId, tmpOpenid);
                }

                var loginController = UIControllerManager.Instance.GetController <Client.UI.UILoginController> ();
                loginController.WeChatLogin(tmpOpenid);
            }
            else if (state == ResponseState.Fail)
            {
                var str = "";
                                #if UNITY_ANDROID
                print("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
                str = "fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"].ToString();
                                #elif UNITY_IPHONE
                print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
                str = "fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"].ToString();
                                #endif
                MessageHint.Show(MiniJSON.jsonEncode(str));
            }
            else if (state == ResponseState.Cancel)
            {
                print("cancel !");
            }
        }
Exemplo n.º 15
0
 void AuthResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
 {
     //Txt_Loading.text = "获取授权回调";
     if (state == ResponseState.Success)
     {
         //OutLog.PrintLog(MiniJSON.jsonEncode(result));
         //授权成功的话,获取用户信息
         // Txt_Loading.text = "授权成功";
         //myShareSdk.GetUserInfo(PlatformType.WeChat);
         OutLog.log("获取授权," + state + "::" + MiniJSON.jsonEncode(data));
         if (state == ResponseState.Success)
         {
             try
             {
                 GameInfo.NickName = data["nickname"].ToString();
                 GameInfo.OpenID   = data["openid"].ToString();
                 GameInfo.HeadImg  = data["headimgurl"].ToString();
                 GameInfo.Sex      = int.Parse(data["sex"].ToString());
                 //GameInfo.province = data["province"].ToString();
                 //GameInfo.city = data["city"].ToString();
                 GameInfo.unionid = data["unionid"].ToString();
                 //OutLog.PrintLog(MiniJSON.jsonEncode(data));
                 // Txt_Loading.text = "获取用户信息成功";
                 OutLog.log("微信获取openid:" + GameInfo.OpenID);
                 GameInfo.cs.SentUserLoginMessage(GameInfo.OpenID, GameInfo.NickName, GameInfo.Sex.ToString(), GameInfo.province, GameInfo.city, GameInfo.HeadImg, GameInfo.unionid, GameInfo.Latitude);
             }
             catch (Exception ex)
             {
                 EnableLoginButtons();
                 // Txt_Loading.text = ex.ToString();
                 OutLog.log("获取用户信息出错" + ex.ToString());
             }
         }
     }
     else if (state == ResponseState.Fail)
     {
         EnableLoginButtons();
         // Txt_Loading.text = "授权失败";
         //OutLog.PrintLog("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         EnableLoginButtons();
         //  Txt_Loading.text = "授权取消";
         //OutLog.PrintLog("cancel !");
     }
 }
Exemplo n.º 16
0
    IEnumerator LoadAccountInfoCoroutine()
    {
        string baseUrl = "http://127.0.0.1/clickergame/login.php";

        //요청 url 작성
        string url = baseUrl + "?nick_name=" + _nicNameInputField.text.Trim();

        //통신요청
        WWW www = new WWW(url);

        //응답 대기
        yield return(www);

        // 통신 오류가 발생하지 않았다면
        if (string.IsNullOrEmpty(www.error))
        {
            Debug.Log("Response Data : " + www.text);

            //JSON -> 딕셔너리로
            Dictionary <string, object> responseData = MiniJSON.jsonDecode(www.text) as Dictionary <string, object>;

            string result = responseData["RESULT"].ToString();

            if (result.Equals("LOAD_SUCCESS"))
            {
                Dictionary <string, object> userData = responseData["USER_INFO"] as Dictionary <string, object>;

                // 유저 정보 딕셔너리 -> JSON으로 전환
                string saveData = MiniJSON.jsonEncode(userData);

                // PlayerPrefs에 유저정보를 저장함
                PlayerPrefs.SetString("USER_INFO", saveData);
                PlayerPrefs.Save();

                //게임신으로 이동함
                SceneManager.LoadScene("Game");
            }
            else
            {
                _msgText.text = "User infomation load fail.";
            }
        }
        else
        {
            _msgText.text = "Server connect fail.";
        }
    }
Exemplo n.º 17
0
 // 账号回调
 void GetUserInfoResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     if (state == ResponseState.Success)
     {
         print("get user info result :");
         print(MiniJSON.jsonEncode(result));
         ssdk.GetUserInfo(PlatformType.WeChat);
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
     }
 }
Exemplo n.º 18
0
    /// <summary>
    /// 获取用户信息回调
    /// </summary>
    /// <param name="reqID"></param>
    /// <param name="state"></param>
    /// <param name="type"></param>
    /// <param name="result"></param>
    void OnGetUserInfoResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
    {
        if (state == ResponseState.Success)
        {
            SQDebug.Log("获取微信信息成功,正在登陆中...");
            print("get user info result :");
            print(MiniJSON.jsonEncode(result));
            print("Get userInfo success ! Platform :" + type);

            //获取用户信息
            SQDebug.Log(type + "用户信息:" + MiniJSON.jsonEncode(ssdk.GetAuthInfo(type)));
            //SQDebug.Log(MiniJSON.jsonEncode(ssdk.GetAuthInfo(type)));

            Hashtable uuInfo = null;

#if UNITY_ANDROID
            uuInfo = ssdk.GetAuthInfo(type);
#elif UNITY_IPHONE
            uuInfo = result;
#endif
            if (uuInfo.Contains("openID") || uuInfo.Contains("res") || uuInfo.Contains("openid"))
            {
                GetLoginData(uuInfo, result, type);
            }
            else
            {
                SQDebug.Log("没发送登陆指令。。。。。。。" + uuInfo);
            }
        }
        else if (state == ResponseState.Fail)
        {
            Global.Inst.GetController <NetLoadingController>().ShowLoading(false);
            SQDebug.Log("微信获取信息失败");
#if UNITY_ANDROID
            print("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
#elif UNITY_IPHONE
            print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
#endif
        }
        else if (state == ResponseState.Cancel)
        {
            Global.Inst.GetController <NetLoadingController>().ShowLoading(false);
            SQDebug.Log("微信获取信息失败");
            print("cancel !");
        }
    }
Exemplo n.º 19
0
        public override void payWithOrder(PaySDKOrder order, PaySDKChannel channel)
        {
            Hashtable orderHash = new Hashtable();

            orderHash.Add("orderId", order.orderId);
            orderHash.Add("amount", order.amount);
            orderHash.Add("subject", order.subject);
            orderHash.Add("appUserId", order.userId);
            orderHash.Add("appUserNickname", order.nickName);
            orderHash.Add("body", order.body);
            orderHash.Add("desc", order.des);
            orderHash.Add("metadata", order.metadata);

            string orderJson = MiniJSON.jsonEncode(orderHash);

            __iosPaySDKPayWithOrder(orderJson, (int)channel, _callbackObjectName);
        }
Exemplo n.º 20
0
 void OnShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     //print("afe335");
     if (state == ResponseState.Success)
     {
         print("share successfully - share result;");
         print(MiniJSON.jsonEncode(result));
         objname = "分析成功:" + MiniJSON.jsonEncode(result);
     }
     else if (state == ResponseState.Fail)
     {
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel");
     }
 }
Exemplo n.º 21
0
    //获取微信个人信息成功回调,登录
    public void getUserInforCallback(int reqID, ResponseState state, PlatformType type, Hashtable data)
    {
        Debug.Log("ranger getUserInforCallback Start");
        print("ranger " + data.toJson() + MiniJSON.jsonEncode(data));

        _opendid = (string)data["openid"];
        _token   = (string)data["unionid"];


        print("ranger " + data["nickname"] + " Token " + _token + " Openid " + _opendid);

        //     doLogin();

        string loginid = _opendid + "," + _token;

        SceneMain.Instance.OnThirdLogin(loginid);
    }
Exemplo n.º 22
0
 // 分享结果回调
 void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {   //成功
     if (state == ResponseState.Success)
     {
         message.text = ("share result :");
         message.text = (MiniJSON.jsonEncode(result));
     }
     //失败
     else if (state == ResponseState.Fail)
     {
         message.text = ("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
     }
     //关闭
     else if (state == ResponseState.Cancel)
     {
         message.text = ("cancel !");
     }
 }
 /// <summary>
 /// 获取用户信息回调
 /// </summary>
 /// <param name="reqID"></param>
 /// <param name="state"></param>
 /// <param name="type"></param>
 /// <param name="data"></param>
 void OnGetUserInfoResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
 {
     if (state == ResponseState.Success)
     {
         string   strs = MiniJSON.jsonEncode(data);
         JsonData jd   = JsonMapper.ToObject(strs);
         Player.Instance.openID    = jd["openid"].ToString();
         Player.Instance.otherName = jd["nickname"].ToString();
         Player.Instance.headID    = jd["headimgurl"].ToString();
         Player.Instance.sex       = byte.Parse(jd["sex"].ToString());
         UIManager.Instance.HideUiPanel(UIPaths.LoadingObj);
         ClientToServerMsg.Send(Opcodes.Client_Character_Create, Player.Instance.openID, Player.Instance.otherName, Player.Instance.headID, (byte)Player.Instance.sex);
     }
     else
     {
         Debug.Log("获取信息失败");
     }
 }
Exemplo n.º 24
0
        /// <summary>
        /// Shows the share menu.
        /// </summary>
        /// <param name='types'>
        /// Types.
        /// </param>
        /// <param name='content'>
        /// Content.
        /// </param>
        /// <param name='x'>
        /// X.
        /// </param>
        /// <param name='y'>
        /// Y.
        /// </param>
        /// <param name='direction'>
        /// Direction.
        /// </param>
        /// <param name='callback'>
        /// Callback.
        /// </param>
        public static void showShareMenu(PlatformType[] types, Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler)
        {
            _shareResultEvent = resultHandler;

            string platTypesStr = null;

            if (types != null)
            {
                List <int> platTypesArr = new List <int>();
                foreach (PlatformType type in types)
                {
                    platTypesArr.Add((int)type);
                }
                platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray());
            }

            __iosShareSDKShowShareMenu(platTypesStr, MiniJSON.jsonEncode(content), x, y, (int)direction, _callbackObjectName);
        }
Exemplo n.º 25
0
        /// <summary>
        /// share content to multiple platform
        /// </summary>
        /// <param name='types'>
        /// Types.
        /// </param>
        /// <param name='content'>
        /// Content.
        /// </param>
        /// <param name='resultHandler'>
        /// Callback.
        /// </param>
        public static void oneKeyShareContent(PlatformType[] types, Hashtable content, ShareResultEvent resultHandler)
        {
            _shareResultEvent = resultHandler;

            string platTypesStr = null;

            if (types != null)
            {
                List <int> platTypesArr = new List <int>();
                foreach (PlatformType type in types)
                {
                    platTypesArr.Add((int)type);
                }
                platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray());
            }

            __iosShareSDKOneKeyShare(platTypesStr, MiniJSON.jsonEncode(content), _callbackObjectName);
        }
Exemplo n.º 26
0
    private void OnDestroy()
    {
        if (usingRecordFile)
        {
            return;
        }

        recordJson.Add("recordValues", recordValues.ToArray());

        string filePath = recordJson["startTime"] + ".json";

        filePath = Directory.GetParent(Application.dataPath).FullName + Path.DirectorySeparatorChar + filePath;

        File.WriteAllText(filePath, MiniJSON.jsonEncode(recordJson));


        Debug.Log("OnDestroy\n" + filePath + "\n" + MiniJSON.jsonEncode(recordJson));
    }
Exemplo n.º 27
0
 private void GetUserInfoResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
 {
     //Txt_Loading.text = "获取用户信息回调";
     OutLog.log("获取用户消息," + state + "::" + MiniJSON.jsonEncode(data));
     if (state == ResponseState.Success)
     {
         try
         {
             GameInfo.NickName = data["nickname"].ToString();
             GameInfo.OpenID   = data["openid"].ToString();
             GameInfo.HeadImg  = data["headimgurl"].ToString();
             GameInfo.Sex      = int.Parse(data["sex"].ToString());
             //GameInfo.province = data["province"].ToString();
             //GameInfo.city = data["city"].ToString();
             GameInfo.unionid = data["unionid"].ToString();
             //OutLog.PrintLog(MiniJSON.jsonEncode(data));
             // Txt_Loading.text = "获取用户信息成功";
             OutLog.log("微信获取openid:" + GameInfo.OpenID);
             //Txt_Loading.text += "微信获取openid:" + GameInfo.OpenID;
             GameInfo.Latitude = UnityEngine.Random.Range(1f, 1000f).ToString() + " , " + UnityEngine.Random.Range(1f, 1000f).ToString();
             GameInfo.cs.SentUserLoginMessage(GameInfo.OpenID, GameInfo.NickName, GameInfo.Sex.ToString(), GameInfo.province, GameInfo.city, GameInfo.HeadImg, GameInfo.unionid, GameInfo.Latitude);
         }
         catch (Exception ex)
         {
             // Txt_Loading.text = ex.ToString();
             OutLog.log("获取用户信息出错" + ex.ToString());
             EnableLoginButtons();
             //Err.text = ex.StackTrace + ex.Message;
         }
     }
     else if (state == ResponseState.Cancel)
     {
         //Txt_Loading.text = "获取用户信息取消";
         OutLog.log("获取用户信息取消");
         EnableLoginButtons();
     }
     else if (state == ResponseState.Fail)
     {
         // Txt_Loading.text = "获取用户信息失败";
         OutLog.log("获取用户信息失败");
         myShareSdk.Authorize(PlatformType.WeChat);
         EnableLoginButtons();
     }
 }
Exemplo n.º 28
0
    static void CreatFiles()
    {
        //创建各个文件的版本标识
        string outPath = QPathHelper.GetAssetBundleOutPath() + "/" + Modules;
        string file    = outPath + "/files.txt";

        if (File.Exists(file))
        {
            File.Delete(file);
        }

        List <string> pathList = new List <string>();

        DirectoryInfo Direinfo = new DirectoryInfo(outPath);

        GetAllFileName(Direinfo, ref pathList, "concretegame", new List <string>()
        {
            "ModulesConfig.txt", "concretegameConfig.txt"
        });

        FileStream   fs    = new FileStream(file, FileMode.CreateNew);
        StreamWriter sw    = new StreamWriter(fs);
        Hashtable    jd    = new Hashtable();
        Hashtable    files = new Hashtable();

        foreach (var info in pathList)
        {
            string md5 = GetFileMd5(info);

            string fileName = info.Replace(outPath + "/", string.Empty);
            fileName        = Modules + "/" + fileName;
            files[fileName] = md5;
        }
        files[Modules + "/files.txt"] = System.DateTime.Now.ToString();
        files["ModulesConfig.txt"]    = System.DateTime.Now.ToString();
        jd ["files"] = files;
        sw.Write(MiniJSON.jsonEncode(jd));
        sw.Close();
        fs.Close();

        Debug.Log(Modules + "创建文本标识成功");
        AssetDatabase.Refresh();
    }
Exemplo n.º 29
0
 void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
 {
     if (state == ResponseState.Success)
     {
         print("share result :");
         print(MiniJSON.jsonEncode(result));
     }
     else if (state == ResponseState.Fail)
     {
         print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
         var tmpst = "fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"] + "----666----";
         MessageHint.Show(MiniJSON.jsonEncode(result));
     }
     else if (state == ResponseState.Cancel)
     {
         print("cancel !");
         MessageHint.Show("取消的了登录了");
     }
 }
Exemplo n.º 30
0
    public void SetResult(string roomName, string questionID, object[] answer, object[] submit, object actual_score, object total_socre, Action <Hashtable> cb)
    {
        var results = new ArrayList();
        var hash    = new Hashtable();

        hash.Add(questionID, new Hashtable()
        {
            { "answer", answer },
            { "submit", submit },
            { "actual_score", actual_score },
            { "total_score", total_socre }
        });
        results.Add(hash);
        var form = new WWWForm();

        form.AddField("room_name", roomName);
        form.AddField("results", MiniJSON.jsonEncode(results));
        Post("/set_crisispr_result", form, cb);
    }