This class encodes and decodes JSON strings. Spec. details, see http://www.json.org/ JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable. All numbers are parsed to doubles.
Exemplo n.º 1
0
    void doAction(int id)
    {
#if UNITY_ANDROID
        switch (id)
        {
        case 0:
            RiseSdk.Instance.ShowAd(RiseSdk.M_START);
            break;

        case 1:
            RiseSdk.Instance.ShowAd(RiseSdk.M_PAUSE);
            break;

        case 2:
            RiseSdk.Instance.ShowAd(RiseSdk.M_PASSLEVEL);
            break;

        case 3:
            RiseSdk.Instance.ShowAd(RiseSdk.M_CUSTOM);
            break;

        case 4:
            RiseSdk.Instance.ShowBanner("default", RiseSdk.POS_BANNER_MIDDLE_BOTTOM);
            break;

        case 5:
            RiseSdk.Instance.CloseBanner();
            break;

        case 6:
            RiseSdk.Instance.OnExit();
            break;

        case 7:
            RiseSdk.Instance.Rate();
            break;

        case 8:
            Debug.LogError("get extra data: " + RiseSdk.Instance.GetExtraData());
            break;

        case 9:
            RiseSdk.Instance.TrackEvent("category", "action", "label", 323);
            break;

        case 10:
            RiseSdk.Instance.Pay(1);
            break;

        case 11:
            RiseSdk.Instance.ShowMore();
            break;

        case 12:
            RiseSdk.Instance.ShowRewardAd("default", 1);
            break;

        case 13:
            RiseSdk.Instance.Share();
            break;

        case 14:
            RiseSdk.Instance.Login();
            break;

        case 15:
            Debug.LogError("is login: "******"your see", "speed coming...");
            break;

        case 18:
            RiseSdk.Instance.Invite();
            break;

        case 20:
            string mestring = RiseSdk.Instance.Me();
            object me       = MiniJSON.jsonDecode(mestring);
            if (me == null)
            {
                Debug.LogError("me is null");
            }
            else
            {
                Debug.LogError("me is: " + me);
            }
            break;

        case 21:
            string friendstring = RiseSdk.Instance.GetFriends();
            object friends      = MiniJSON.jsonDecode(friendstring);
            Debug.LogError("friends are: " + friends);
            break;

        /*
         * case 22:
         * RiseSdk.Instance.SubmitScore ("endless", 1234, "userName: haha");
         * break;
         *
         * case 23:
         * RiseSdk.Instance.LoadFriendLeaderBoard ("endless", 1, 32, "");
         * break;
         *
         * case 24:
         * RiseSdk.Instance.LoadGlobalLeaderBoard ("endless", 1, 32);
         * break;
         */

        case 25:
            RiseSdk.Instance.ShowNativeAd("lock_pre", 20);
            break;

        case 26:
            RiseSdk.Instance.HideNativeAd("lock_pre");
            break;

        /*
         * case 27:
         * RiseSdk.Instance.LoadGameData (1);
         * break;
         *
         * case 28:
         * RiseSdk.Instance.ShowSales (1);
         * break;
         */

        case 29:
            RiseSdk.Instance.CacheUrl("http://img4.imgtn.bdimg.com/it/u=3087502007,2322343371&fm=21&gp=0.jpg");
            break;

        case 30:
            Debug.LogError("app id is " + RiseSdk.Instance.GetConfig(RiseSdk.CONFIG_KEY_APP_ID));
            break;

        case 31:
            RiseSdk.Instance.Alert("haha", "Very good");
            //RiseSdk.Instance.Pay (0);
            break;

        case 32:
            RiseSdk.Instance.CacheUrl(1, "http://img4.imgtn.bdimg.com/it/u=3087502007,2322343371&fm=21&gp=0.jpg");
            break;

        case 33:
            changeAvatarImg();
            break;
        }
#elif UNITY_IOS
        switch (id)
        {
        case 0:
            RiseSdk.Instance.ShowAd(RiseSdk.M_START);
            break;

        case 1:
            RiseSdk.Instance.ShowAd(RiseSdk.M_PAUSE);
            break;

        case 2:
            RiseSdk.Instance.ShowAd(RiseSdk.M_PASSLEVEL);
            break;

        case 3:
            RiseSdk.Instance.ShowAd(RiseSdk.M_CUSTOM);
            break;

        case 4:
            RiseSdk.Instance.ShowBanner("default", RiseSdk.POS_BANNER_MIDDLE_BOTTOM);
            break;

        case 5:
            RiseSdk.Instance.CloseBanner();
            break;

        case 6:
            RiseSdk.Instance.Rate();
            break;

        case 7:
            RiseSdk.Instance.Pay(1);
            break;

        case 8:
            RiseSdk.Instance.ShowRewardAd("default", 1);
            break;

        case 9:
            RiseSdk.Instance.ShowIconAd(56, .2f, .2f);
            break;
        }
#endif
    }
 public static string toJson(this Hashtable obj)
 {
     return(MiniJSON.jsonEncode(obj));
 }
 public static ArrayList arrayListFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as ArrayList);
 }
Exemplo n.º 4
0
        public static void CreatePkgAccPhoneInfos(List <PkgAccPhoneInfo> infos)
        {
            IBridge      bridge       = DBOSManager.getOSBridge();
            GlobalConfig globalConfig = GlobalConfig.GetInstance();

            infos.Clear();

            // 手机平台
            PkgAccPhoneInfo info = new PkgAccPhoneInfo();

            info.key = Encoding.UTF8.GetBytes("platform");
            info.val = Encoding.UTF8.GetBytes(globalConfig.PlatformName);
            GameDebug.Log("platform: " + globalConfig.PlatformName);
            infos.Add(info);

            // 系统版本
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("sys_ver");
            info.val = Encoding.UTF8.GetBytes(SystemInfo.operatingSystem);
            GameDebug.Log("system: " + SystemInfo.operatingSystem);
            infos.Add(info);

            // 手机型号
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("model");
            info.val = Encoding.UTF8.GetBytes(SystemInfo.deviceModel);
            GameDebug.Log("model: " + SystemInfo.deviceModel);
            infos.Add(info);

            // 芯片型号参数
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("chip");
            //CPU核数#CPU主频#CPU名称#GPU名称
            string chip_info = string.Format("{0}#{1}#{2}#{3}", SystemInfo.processorCount, SystemInfo.processorFrequency, SystemInfo.processorType, SystemInfo.graphicsDeviceName);

            info.val = Encoding.UTF8.GetBytes(chip_info);
            GameDebug.Log("chip_info: " + chip_info);
            infos.Add(info);

            // imei
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("imei");
            info.val = Encoding.UTF8.GetBytes(bridge.getPhoneIMEI());
            GameDebug.Log("imei: " + bridge.getPhoneIMEI());
            infos.Add(info);

            // imsi
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("imsi");
            info.val = Encoding.UTF8.GetBytes(bridge.getPhoneIMSI());
            GameDebug.Log("imsi: " + bridge.getPhoneIMSI());
            infos.Add(info);

            // mac
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("mac");
            info.val = Encoding.UTF8.GetBytes(bridge.getPhoneMAC());
            GameDebug.Log("mac: " + bridge.getPhoneMAC());
            infos.Add(info);

            // 画质选择
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("grahics");
            info.val = Encoding.UTF8.GetBytes(QualitySetting.GraphicLevel.ToString());
            GameDebug.Log("grahics: " + QualitySetting.GraphicLevel);
            infos.Add(info);

            // 召唤物开关
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("summon");
            var summon_str_val = (GlobalSettings.Instance.SummonMonsterVisible ? 1 : 0).ToString();

            info.val = Encoding.UTF8.GetBytes(summon_str_val);
            GameDebug.Log("summon: " + summon_str_val);
            infos.Add(info);

            // 同屏人数
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("player");
            info.val = Encoding.UTF8.GetBytes(GlobalSettings.Instance.MaxPlayerCount.ToString());
            GameDebug.Log("player: " + GlobalSettings.Instance.MaxPlayerCount);
            infos.Add(info);

            // 联网方式
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("net");
            var net_str_val = ((uint)Application.internetReachability).ToString();

            info.val = Encoding.UTF8.GetBytes(net_str_val);
            GameDebug.Log("net: " + net_str_val);
            infos.Add(info);

            // 分辨率
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("screen");
            var screnn_str_val = string.Format("{0}*{1}", Screen.width, Screen.height);

            info.val = Encoding.UTF8.GetBytes(screnn_str_val);
            GameDebug.Log("screen: " + screnn_str_val);
            infos.Add(info);

            // DeviceMark
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("device_mark");
            info.val = Encoding.UTF8.GetBytes(globalConfig.DeviceMark);
            GameDebug.Log("device_mark: " + globalConfig.DeviceMark);
            infos.Add(info);

            // appid
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("appid");
            info.val = Encoding.UTF8.GetBytes(globalConfig.AppId.ToString());
            GameDebug.Log("appid: " + globalConfig.AppId);
            infos.Add(info);

            if (globalConfig.LoginInfo.ServerInfo != null)
            {
                // 控制服务器的id
                info     = new PkgAccPhoneInfo();
                info.key = Encoding.UTF8.GetBytes("control_id");
                info.val = Encoding.UTF8.GetBytes(globalConfig.LoginInfo.ServerInfo.ServerId.ToString());
                GameDebug.Log("control_id: " + globalConfig.LoginInfo.ServerInfo.ServerId);
                infos.Add(info);

                // 服务器名字
                info     = new PkgAccPhoneInfo();
                info.key = Encoding.UTF8.GetBytes("server_name");
                info.val = Encoding.UTF8.GetBytes(globalConfig.LoginInfo.ServerInfo.Name);
                GameDebug.Log("server_name: " + globalConfig.LoginInfo.ServerInfo.Name);
                infos.Add(info);
            }

            // did
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("did");
            info.val = Encoding.UTF8.GetBytes(bridge.getSDKDeviceID());
            GameDebug.Log("did: " + bridge.getSDKDeviceID());
            infos.Add(info);

            // idfa
            info     = new PkgAccPhoneInfo();
            info.key = Encoding.UTF8.GetBytes("idfa");
            info.val = Encoding.UTF8.GetBytes(bridge.GetPhoneIDFA());
            GameDebug.Log("idfa: " + bridge.GetPhoneIDFA());
            infos.Add(info);

            // lua扩展
            object[]      param       = { };
            System.Type[] return_type = { typeof(string) };
            object[]      objs        = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GetExtendPhoneInfo", param, return_type);
            if (objs != null && objs.Length > 0)
            {
                if (objs[0] != null)
                {
                    string        ret       = (string)objs[0];
                    System.Object retObject = MiniJSON.JsonDecode(ret);
                    if (retObject != null)
                    {
                        Hashtable hashtable = retObject as Hashtable;
                        if (hashtable != null)
                        {
                            foreach (DictionaryEntry kv in hashtable)
                            {
                                info     = new PkgAccPhoneInfo();
                                info.key = Encoding.UTF8.GetBytes(kv.Key.ToString());
                                info.val = Encoding.UTF8.GetBytes(kv.Value.ToString());
                                GameDebug.Log(kv.Key.ToString() + ": " + kv.Value.ToString());
                                infos.Add(info);
                            }
                        }
                    }
                }
            }

            if (Const.Region == RegionType.SEASIA)
            {
                //当前选中语言
                info     = new PkgAccPhoneInfo();
                info.key = Encoding.UTF8.GetBytes("language");
                info.val = Encoding.UTF8.GetBytes(TranslateManager.GetInstance().ConvertToServerLang(Const.Language).ToString());
                GameDebug.Log("language: " + TranslateManager.GetInstance().ConvertToServerLang(Const.Language).ToString());
                infos.Add(info);
            }

            // os_ext 韩国版用来标识是one_store还是google_play,还是app_store
            if (Const.Region == RegionType.KOREA)
            {
                info     = new PkgAccPhoneInfo();
                info.key = Encoding.UTF8.GetBytes("os_ext");
                info.val = Encoding.UTF8.GetBytes(Application.identifier);
                GameDebug.Log("os_ext: " + Application.identifier);
                infos.Add(info);
            }
        }
Exemplo n.º 5
0
        private static object GetJSONFromURL(string url)
        {
            string text = GetStringFromURL(url);

            return(MiniJSON.jsonDecode(text));
        }
Exemplo n.º 6
0
    private void BackString(string content)
    {
        //Guidebug.Log("BACKSTRING CONTENT: " + content);

        try
        {
            if (content == "timeout")
            {
                /*Result TimeOut*/
                ValidateResult rst = new ValidateResult();
                rst.state = ValidateResult.State.ErrorTimeOut;
                SendCheckResult(rst);
                return;
            }

            Hashtable jsonObj = (Hashtable)MiniJSON.jsonDecode(content);
            if (jsonObj["result"].Equals("success"))
            {
                /*Result ShowNum*/
                ValidateResult rst = new ValidateResult();
                rst.state        = ValidateResult.State.Success;
                rst.RemainingNum = Convert.ToInt32(jsonObj["left_times"].ToString());
                rst.productCode  = jsonObj["product_code"].ToString();

                /**MARK_NEEDADD 2016年8月30日10:19:46*/
                if (jsonObj.ContainsKey("left_hours"))
                {
                    rst.ValidHours = Convert.ToInt32(jsonObj["left_hours"].ToString());
                }

                SendCheckResult(rst);
                return;
            }
            else if (jsonObj["result"].Equals("fail"))
            {
                object errorCode = jsonObj["code"];
                if (errorCode.Equals("MORE_THAN_THE_NUMBER_OF_ACTIVATION"))
                {
                    /*Result MaxNum*/
                    ValidateResult rst = new ValidateResult();
                    rst.state       = ValidateResult.State.KeyMaxCount;
                    rst.productCode = jsonObj["product_code"].ToString();
                    SendCheckResult(rst);
                    return;
                }
                else if (errorCode.Equals("USER_BARCODE_NOT_EXIST") || errorCode.Equals("USER_PARAMS_ERROR") || errorCode.Equals("PRODUCT_DOES_NOT_MATCH"))
                {
                    /*Result KeyError*/
                    ValidateResult rst = new ValidateResult();
                    rst.state = ValidateResult.State.KeyError;
                    SendCheckResult(rst);
                    return;
                }
            }
        }
        catch (Exception ex)
        {
            Debug.LogError("BACKSTRING EX: " + ex.ToString());

            ValidateResult rst = new ValidateResult();
            rst.state = ValidateResult.State.ErrorBackContent;
            SendCheckResult(rst);
            return;
        }
    }
Exemplo n.º 7
0
        public void Pay(DBPay.PayItemInfo pay_info)
        {
            if (pay_info == null)
            {
                return;
            }

            var server_id   = 0;
            var server_name = "0";
            var server_info = GlobalConfig.Instance.LoginInfo.ServerInfo;

            if (server_info == null)
            {
                Debug.LogError("OnClickPayButton: server_info is null");
            }
            else
            {
                server_id   = server_info.ServerId;
                server_name = server_info.Name;
            }



#if UNITY_IPHONE
            var pay_request_info = new Dictionary <string, string>();
            //IPHONE 从ProductInfo.json里面读取商品数据
            ProductInfoManager.ProductInfo info = ProductInfoManager.GetInstance().GetProductInfo(pay_info.RmbLow);
            if (info == null)
            {
                //ProductInfo.json   不存在则 读取  C充值商品id.xlsx
                var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>();
                DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow);
                pay_request_info.Add("productID", product_info.ProductId);
                pay_request_info.Add("productName", product_info.ProductName);
                pay_request_info.Add("productDesc", product_info.ProductDesc);
            }
            else
            {
                //ProductInfo.json   存在则  读取  ProductInfo.json
                pay_request_info.Add("productID", info.productId);
                pay_request_info.Add("productName", info.productName);
                pay_request_info.Add("productDesc", info.productDesc);
            }
#else
            var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>();
            DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow);

            var pay_request_info = new Dictionary <string, string>();
            pay_request_info.Add("productID", product_info.ProductId);
            pay_request_info.Add("productName", product_info.ProductName);
            pay_request_info.Add("productDesc", product_info.ProductDesc);
#endif


            pay_request_info.Add("passport", GlobalConfig.Instance.LoginInfo.AccName);
            pay_request_info.Add("serverID", server_id.ToString());
            pay_request_info.Add("roleId", GlobalConfig.Instance.LoginInfo.RId.ToString());
            pay_request_info.Add("price", pay_info.RmbLow.ToString());
            if (Const.Region == RegionType.HKTW || Const.Region == RegionType.SEASIA)
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_USD"));
            }
            else if (Const.Region == RegionType.KOREA)
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_KR"));
            }
            else
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY"));
            }
            pay_request_info.Add("serverName", server_name);
            pay_request_info.Add("roleName", GlobalConfig.Instance.LoginInfo.Name);
            pay_request_info.Add("roleLevel", GlobalConfig.Instance.LoginInfo.Level.ToString());
            pay_request_info.Add("vip", VipHelper.GetVipValidLevel().ToString());                                                     //角色VIP等级
            pay_request_info.Add("coinNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString());         //当前玩家身上拥有的金锭数量
            if (DBOSManager.getOSBridge().getAppID() == 529)                                                                          // 卓梦
            {
                pay_request_info.Add("currencyNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString()); //当前玩家身上拥有的金锭数量
            }
#if UNITY_IPHONE
            pay_request_info.Add("gameMark", GlobalConfig.Instance.GameMark); //角色VIP等级
#endif


            //使用sdk接口发送充值请求
            string pay_requeset_str = MiniJSON.JsonEncode(new Hashtable(pay_request_info));
            DBOSManager.getDBOSManager().getBridge().pay(pay_requeset_str);
            Debug.Log(string.Format("OnClickPayButton pay_rmb: {0}", pay_info.RmbLow));
        }
Exemplo n.º 8
0
    protected static int nextToken(char[] json, ref int index)
    {
        MiniJSON.eatWhitespace(json, ref index);
        if (index == json.Length)
        {
            return(0);
        }
        char c = json[index];

        index++;
        char c2 = c;

        switch (c2)
        {
        case '"':
            return(7);

        case '#':
        case '$':
        case '%':
        case '&':
        case '\'':
        case '(':
        case ')':
        case '*':
        case '+':
        case '.':
        case '/':
IL_8D:
            switch (c2)
            {
            case '[':
                return(3);

            case '\\':
            {
IL_A2:
                switch (c2)
                {
                case '{':
                    return(1);

                case '}':
                    return(2);
                }
                index--;
                int num = json.Length - index;
                if (num >= 5 && json[index] == 'f' && json[index + 1] == 'a' && json[index + 2] == 'l' && json[index + 3] == 's' && json[index + 4] == 'e')
                {
                    index += 5;
                    return(10);
                }
                if (num >= 4 && json[index] == 't' && json[index + 1] == 'r' && json[index + 2] == 'u' && json[index + 3] == 'e')
                {
                    index += 4;
                    return(9);
                }
                if (num >= 4 && json[index] == 'n' && json[index + 1] == 'u' && json[index + 2] == 'l' && json[index + 3] == 'l')
                {
                    index += 4;
                    return(11);
                }
                return(0);
            }

            case ']':
                return(4);
            }
            goto IL_A2;

        case ',':
            return(6);

        case '-':
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            return(8);

        case ':':
            return(5);
        }
        goto IL_8D;
    }
Exemplo n.º 9
0
    private void OnGUI()
    {
        GUI.skin = this.demoSkin;
        float num = 1f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            num = (float)(Screen.width / 320);
        }
        float num2 = 165f * num;
        float num3 = 30f * num;
        float num4 = 20f * num;
        float num5 = 20f * num;

        GUI.skin.button.fontSize = Convert.ToInt32(14f * num);
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Authorize"))
        {
            Debug.Log(this.ssdk == null);
            this.ssdk.Authorize(PlatformType.SinaWeibo);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get User Info"))
        {
            this.ssdk.GetUserInfo(PlatformType.SinaWeibo);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Show Share Menu"))
        {
            ShareContent shareContent = new ShareContent();
            shareContent.SetText("this is a test string.");
            shareContent.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent.SetTitle("test title");
            shareContent.SetTitleUrl("http://www.mob.com");
            shareContent.SetSite("Mob-ShareSDK");
            shareContent.SetSiteUrl("http://www.mob.com");
            shareContent.SetUrl("http://www.mob.com");
            shareContent.SetComment("test description");
            shareContent.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent.SetShareType(2);
            ShareContent shareContent2 = new ShareContent();
            shareContent2.SetText("Sina share content");
            shareContent2.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            shareContent2.SetShareType(2);
            shareContent2.SetObjectID("SinaID");
            shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, shareContent2);
            this.ssdk.ShowPlatformList(null, shareContent, 100, 100);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Show Share View"))
        {
            ShareContent shareContent3 = new ShareContent();
            shareContent3.SetText("this is a test string.");
            shareContent3.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent3.SetTitle("test title");
            shareContent3.SetTitleUrl("http://www.mob.com");
            shareContent3.SetSite("Mob-ShareSDK");
            shareContent3.SetSiteUrl("http://www.mob.com");
            shareContent3.SetUrl("http://www.mob.com");
            shareContent3.SetComment("test description");
            shareContent3.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent3.SetShareType(2);
            this.ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, shareContent3);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Share Content"))
        {
            ShareContent shareContent4 = new ShareContent();
            shareContent4.SetText("this is a test string.");
            shareContent4.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent4.SetTitle("test title");
            shareContent4.SetTitleUrl("http://www.mob.com");
            shareContent4.SetSite("Mob-ShareSDK");
            shareContent4.SetSiteUrl("http://www.mob.com");
            shareContent4.SetUrl("http://www.mob.com");
            shareContent4.SetComment("test description");
            shareContent4.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent4.SetShareType(2);
            this.ssdk.ShareContent(PlatformType.SinaWeibo, shareContent4);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get Friends SinaWeibo "))
        {
            Debug.Log("Click Btn Of Get Friends SinaWeibo");
            this.ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = this.ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            Debug.Log("share result :");
            Debug.Log(MiniJSON.jsonEncode(authInfo));
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Close SSO Auth"))
        {
            this.ssdk.DisableSSO(true);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Remove Authorize "))
        {
            this.ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Add Friend "))
        {
            this.ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShareWithContentName"))
        {
            Hashtable hashtable = new Hashtable();
            hashtable["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable);
        }
        num2 += 80f * num;
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareMenuWithContentName"))
        {
            Hashtable hashtable2 = new Hashtable();
            hashtable2["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShowPlatformListWithContentName("ShareSDK", hashtable2, null, 100, 100);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareViewWithContentName"))
        {
            Hashtable hashtable3 = new Hashtable();
            hashtable3["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable3);
        }
    }
Exemplo n.º 10
0
    protected static string parseString(char[] json, ref int index)
    {
        string text = string.Empty;

        MiniJSON.eatWhitespace(json, ref index);
        char c    = json[index++];
        bool flag = false;

        while (!flag)
        {
            if (index == json.Length)
            {
                break;
            }
            c = json[index++];
            if (c == '"')
            {
                flag = true;
                break;
            }
            if (c == '\\')
            {
                if (index == json.Length)
                {
                    break;
                }
                c = json[index++];
                if (c == '"')
                {
                    text += '"';
                }
                else if (c == '\\')
                {
                    text += '\\';
                }
                else if (c == '/')
                {
                    text += '/';
                }
                else if (c == 'b')
                {
                    text += '\b';
                }
                else if (c == 'f')
                {
                    text += '\f';
                }
                else if (c == 'n')
                {
                    text += '\n';
                }
                else if (c == 'r')
                {
                    text += '\r';
                }
                else if (c == 't')
                {
                    text += '\t';
                }
                else if (c == 'u')
                {
                    int num = json.Length - index;
                    if (num < 4)
                    {
                        break;
                    }
                    char[] array = new char[4];
                    Array.Copy(json, index, array, 0, 4);
                    uint utf = uint.Parse(new string(array), NumberStyles.HexNumber);
                    text  += char.ConvertFromUtf32((int)utf);
                    index += 4;
                }
            }
            else
            {
                text += c;
            }
        }
        if (!flag)
        {
            return(null);
        }
        return(text);
    }
Exemplo n.º 11
0
    protected static int lookAhead(char[] json, int index)
    {
        int num = index;

        return(MiniJSON.nextToken(json, ref num));
    }
Exemplo n.º 12
0
 public virtual string ToString()
 {
     return(MiniJSON.jsonEncode(jsonArray));
 }
Exemplo n.º 13
0
        public ActionResult AddOrRemoveButtons()
        {
            String json = Request["data"];
            var    rows = (ArrayList)MiniJSON.Decode(json);

            foreach (Hashtable row in rows)
            {
                //根据记录状态,进行不同的增加、删除、修改操作
                String state = row["_state"] != null ? row["_state"].ToString() : "";

                //更新:_state为空或modified
                if (state == "modified" || state == "")
                {
                    string functionIdStr = row["FunctionId"] == null ? null : row["FunctionId"].ToString();
                    Guid?  functionId    = string.IsNullOrEmpty(functionIdStr) ? null : new Guid?(new Guid(functionIdStr));
                    if (functionId.HasValue)
                    {
                        FunctionState function;
                        if (!AcDomain.FunctionSet.TryGetFunction(functionId.Value, out function))
                        {
                            throw new ValidationException("意外的托管功能标识" + functionId.Value);
                        }
                    }
                    var inputModel = new UiViewButton
                    {
                        Id         = new Guid(row["Id"].ToString()),
                        IsEnabled  = int.Parse(row["IsEnabled"].ToString()),
                        ButtonId   = new Guid(row["ButtonId"].ToString()),
                        UiViewId   = new Guid(row["UiViewId"].ToString()),
                        FunctionId = functionId
                    };

                    if (bool.Parse(row["IsAssigned"].ToString()))
                    {
                        if (AcDomain.RetrieveRequiredService <IRepository <UiViewButton> >().AsQueryable().Any(a => a.Id == inputModel.Id))
                        {
                            var updateModel = new UiViewButtonUpdateInput()
                            {
                                Id         = inputModel.Id,
                                IsEnabled  = inputModel.IsEnabled,
                                FunctionId = inputModel.FunctionId
                            };
                            AcDomain.Handle(updateModel.ToCommand(AcSession));
                        }
                        else
                        {
                            var input = new UiViewButtonCreateInput()
                            {
                                Id         = inputModel.Id,
                                ButtonId   = inputModel.ButtonId,
                                IsEnabled  = inputModel.IsEnabled,
                                FunctionId = inputModel.FunctionId,
                                UiViewId   = inputModel.UiViewId
                            };
                            AcDomain.Handle(input.ToCommand(AcSession));
                        }
                    }
                    else
                    {
                        AcDomain.Handle(new RemoveUiViewButtonCommand(AcSession, inputModel.Id));
                    }
                    if (functionId.HasValue)
                    {
                        int           functionIsEnabled = int.Parse(row["FunctionIsEnabled"].ToString());
                        FunctionState function;
                        if (!AcDomain.FunctionSet.TryGetFunction(functionId.Value, out function))
                        {
                            throw new AnycmdException("意外的功能标识" + functionId.Value);
                        }
                        var input = new FunctionUpdateInput
                        {
                            Id          = function.Id,
                            Code        = function.Code,
                            SortCode    = function.SortCode,
                            IsManaged   = function.IsManaged,
                            IsEnabled   = function.IsEnabled,
                            DeveloperId = function.DeveloperId,
                            Description = function.Description
                        };
                        input.IsEnabled = functionIsEnabled;
                        AcDomain.Handle(input.ToCommand(AcSession));
                    }
                }
            }

            return(this.JsonResult(new ResponseData {
                success = true
            }));
        }
Exemplo n.º 14
0
        public void setExtras(Hashtable extras)
        {
            string extrasStr = MiniJSON.jsonEncode(extras);

            styleParams["extras"] = extrasStr;
        }
Exemplo n.º 15
0
        void OnCancel(LGOpenAction act, string message, Hashtable result)
        {
            Debug.LogFormat("LinkGameOpenSDK ===> OnCancel: act[{0}] data[{1}]", act.ToString(), MiniJSON.jsonEncode(result));

            switch (act)
            {
            case LGOpenAction.AUTHORIZING:
            {
                lgopenAuth.OnAuthResultHandler(LGOpenResponseState.Cancel, message, result);
            }
            break;

            case LGOpenAction.SHARE:
            {
                shareHandler(LGOpenResponseState.Cancel, message, result);
            }
            break;
            }
        }
Exemplo n.º 16
0
 public static string toJson(this ArrayList obj)
 {
     return(MiniJSON.jsonEncode(obj));
 }
Exemplo n.º 17
0
    public static Hashtable ReadFromMemory(string text)
    {
        Hashtable hashtable = new Hashtable();

        return(MiniJSON.jsonDecode(text) as Hashtable);
    }
Exemplo n.º 18
0
        public static void BuildIOS()
        {
            //string luaCompilerPath = PlayerPrefs.GetString( "luac_path" );
            string luaCompilerPath = PlayerPrefs.GetString("luajit_path");
            string luaPath         = PlayerPrefs.GetString("lua_path");

            DirectoryInfo di = new DirectoryInfo(luaCompilerPath);

            if (string.IsNullOrEmpty(luaCompilerPath) || !di.Exists)
            {
                throw new Exception("Luajit path not exist.");
            }

            di = new DirectoryInfo(luaPath);
            if (string.IsNullOrEmpty(luaPath) || !di.Exists)
            {
                throw new Exception("Lua path not exist.");
            }

            //md5
            Hashtable md5Map;
            string    v = luaPath + "/ver.txt";

            if (File.Exists(v))
            {
                string vJson = File.ReadAllText(v);
                md5Map = ( Hashtable )MiniJSON.JsonDecode(vJson);
            }
            else
            {
                md5Map = new Hashtable();
            }

            FileInfo[] fis = di.GetFiles("*.lua", SearchOption.AllDirectories);
            foreach (FileInfo fi in fis)
            {
                string md5Digest = MD5Util.GetMd5HexDigest(fi);
                string subPath   = fi.DirectoryName.Replace(luaPath, string.Empty);
                string toPath    = Application.dataPath + "/Sources/Lua" + subPath;
                string destName  = fi.Name.Replace(".lua", ".bytes");
                string dest      = toPath + "/" + destName;

                string key = subPath + "/" + fi.Name;
                if (md5Map.ContainsKey(key) &&
                    ( string )md5Map[key] == md5Digest &&
                    File.Exists(dest))
                {
                    continue;
                }
                md5Map[key] = md5Digest;

                if (!Directory.Exists(toPath))
                {
                    Directory.CreateDirectory(toPath);
                }

                string text  = File.ReadAllText(fi.FullName);
                byte[] bytes = Encoding.UTF8.GetBytes(text);
                bytes = AesUtil.AesEncrypt(bytes);
                File.WriteAllBytes(dest, bytes);
            }

            AssetDatabase.Refresh();

            List <string> assets    = new List <string>();
            string        assetPath = Application.dataPath + "/Sources/Lua";
            DirectoryInfo di2       = new DirectoryInfo(assetPath);

            DirectoryInfo[] di2S = di2.GetDirectories();
            foreach (DirectoryInfo di3 in di2S)
            {
                assets.Add("Assets/Sources/Lua/" + di3.Name);
            }

            FileInfo[] fi2S = di2.GetFiles();
            foreach (FileInfo fi2 in fi2S)
            {
                if (fi2.Extension == ".bytes")
                {
                    assets.Add("Assets/Sources/Lua/" + fi2.Name);
                }
            }

            for (int i = 0; i < assets.Count; i++)
            {
                string assetPath2 = assets[i];
                WriteAssetBundleName(assetPath2, "lua");
            }

            AssetDatabase.Refresh();

            string nv = MiniJSON.JsonEncode(md5Map);

            File.WriteAllText(v, nv);
        }
Exemplo n.º 19
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        float btnWidth  = 165 * scale;
        float btnHeight = 30 * scale;
        float btnTop    = 20 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(14 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize"))
        {
            print(ssdk == null);

            ssdk.Authorize(PlatformType.WeChat);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            ssdk.GetUserInfo(PlatformType.SinaWeibo);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Image);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

            //通过分享菜单分享
            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);
            ssdk.ShareContent(PlatformType.SinaWeibo, content);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo "))
        {
            //获取新浪微博好友,第一页,每页15条数据
            print("Click Btn Of Get Friends SinaWeibo");
            ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        {
            ssdk.DisableSSO(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend "))
        {
            //关注新浪微博
            ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "ShareWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件分享【本接口功能仅暂时支持iOS】
            ssdk.ShareWithContentName(PlatformType.SinaWeibo, "mob", customFields);
        }
    }
Exemplo n.º 20
0
        public static void Build()
        {
            string luaCompilerPath = PlayerPrefs.GetString("luajit_path");
            string luaPath         = PlayerPrefs.GetString("lua_path");

            DirectoryInfo di = new DirectoryInfo(luaCompilerPath);

            if (string.IsNullOrEmpty(luaCompilerPath) || !di.Exists)
            {
                throw new Exception("Luajit path not exist.");
            }

            di = new DirectoryInfo(luaPath);
            if (string.IsNullOrEmpty(luaPath) || !di.Exists)
            {
                throw new Exception("Lua path not exist.");
            }

            //md5
            Hashtable md5Map;
            string    v = luaPath + "\\ver.txt";

            if (File.Exists(v))
            {
                string vJson = File.ReadAllText(v);
                md5Map = ( Hashtable )MiniJSON.JsonDecode(vJson);
            }
            else
            {
                md5Map = new Hashtable();
            }

            string        driver = luaCompilerPath.Substring(0, luaCompilerPath.IndexOf("\\", StringComparison.Ordinal)).ToLower();
            StringBuilder sb     = new StringBuilder();

            sb.AppendLine("@echo off");
            sb.AppendLine(driver);
            sb.AppendLine("cd " + luaCompilerPath);

            FileInfo[] fis = di.GetFiles("*.lua", SearchOption.AllDirectories);
            foreach (FileInfo fi in fis)
            {
                if (fi.Extension != ".lua")
                {
                    continue;
                }
                string md5Digest = MD5Util.GetMd5HexDigest(fi);
                string subPath   = fi.DirectoryName.Replace(luaPath, string.Empty);
                string toPath    = Application.dataPath.Replace("/", "\\") + "\\Sources\\Lua" + subPath;
                string destName  = fi.Name.Replace(".lua", ".bytes");
                string dest      = toPath + "\\" + destName;

                string key = subPath + "\\" + fi.Name;
                if (md5Map.ContainsKey(key) &&
                    ( string )md5Map[key] == md5Digest &&
                    File.Exists(dest))
                {
                    continue;
                }
                md5Map[key] = md5Digest;

                if (!Directory.Exists(toPath))
                {
                    Directory.CreateDirectory(toPath);
                }

                string cmd = $"luajit -b {fi.FullName} {dest}";

                sb.AppendLine(cmd);
                sb.AppendLine("echo Compiled: " + subPath + "\\" + destName);

                //string bundlePath = subPath.Replace( "\\", "/" ) + "/";
                //assets.Add( "Assets/Sources/Lua" + bundlePath + destName );
                ////assetNames.Add( "lua" + bundlePath + fi.Name.Replace( fi.Extension, string.Empty ) );
                ////打成一个包
                //bundleNames.Add( "lua" );
            }

            string bat = luaPath + "\\Build.bat";

            File.WriteAllText(bat, sb.ToString());

            RunCmd(bat);

            AssetDatabase.Refresh();

            List <string> assets    = new List <string>();
            string        assetPath = Application.dataPath.Replace("/", "\\") + "\\Sources\\Lua";
            DirectoryInfo di2       = new DirectoryInfo(assetPath);

            DirectoryInfo[] di2S = di2.GetDirectories();
            foreach (DirectoryInfo di3 in di2S)
            {
                assets.Add("Assets/Sources/Lua/" + di3.Name);
            }

            FileInfo[] fi2S = di2.GetFiles();
            foreach (FileInfo fi2 in fi2S)
            {
                if (fi2.Extension == ".bytes")
                {
                    assets.Add("Assets/Sources/Lua/" + fi2.Name);
                }
            }

            for (int i = 0; i < assets.Count; i++)
            {
                string assetPath2 = assets[i];
                WriteAssetBundleName(assetPath2, "lua");
            }

            AssetDatabase.Refresh();

            string nv = MiniJSON.JsonEncode(md5Map);

            File.WriteAllText(v, nv);
        }
Exemplo n.º 21
0
        public void OnPostDeviceInitFinished(string url, string error, string reply, System.Object userData)
        {
            int       result    = 0;
            Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable;

            if (hashtable != null)
            {
                result = DBTextResource.ParseI(hashtable["result"].ToString());
            }

            bool      ret           = false;
            string    errorMsg      = "";
            Hashtable argsHashtable = hashtable["args"] as Hashtable;

            if (result == 1)
            {
                if (argsHashtable != null)
                {
                    string deviceMark = argsHashtable["device_mark"].ToString();

                    if (GlobalConfig.Instance.DeviceMark.Equals(deviceMark) == false)
                    {
                        GlobalConfig.Instance.DeviceMark = deviceMark;

                        GlobalSettings.GetInstance();
                        UserPlayerPrefs.Instance.SetString("DeviceMark", deviceMark);
                        UserPlayerPrefs.Instance.Save();
                    }

                    ret = true;
                }
            }
            else
            {
                if (argsHashtable != null)
                {
                    errorMsg = argsHashtable["error_msg"].ToString();
                }
            }

            if (ret == true)
            {
                // DeviceInit成功
                ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.DeviceInitEnd, "", false);
                ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.boot_app);
            }
            else
            {
                // DeviceInit失败
                if (string.IsNullOrEmpty(errorMsg) == true)
                {
                    if (string.IsNullOrEmpty(error) == false)
                    {
                        ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.DeviceInitFail, error, false);
                    }
                    else
                    {
                        ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.DeviceInitFail, "Unknown error", false);
                    }
                }
                else
                {
                    ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.DeviceInitFail, errorMsg, false);
                }
            }

            // action保存了NewInitSceneLoader中的函数,调用之后需要赋空
            if (mPostDeviceInitFinishedCallback != null)
            {
                mPostDeviceInitFinishedCallback.Invoke(ret);
                mPostDeviceInitFinishedCallback = null;
            }
        }
Exemplo n.º 22
0
 public static void Init(string defs)
 {
     _defs = ( Hashtable )MiniJSON.JsonDecode(defs);
 }
Exemplo n.º 23
0
        public void OnGetFeedbackInfo(string url, string error, string reply, System.Object userData)
        {
            LuaTable replyTable = LuaScriptMgr.Instance.Lua.NewTable();

            if (replyTable == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(error))
            {
                GameDebug.LogWarning("OnGetFeedbackInfo reply: " + reply);
                Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable;
                if (hashtable != null)
                {
                    Hashtable argsTable = hashtable["args"] as Hashtable;
                    if (argsTable == null)
                    {
                        return;
                    }
                    replyTable.Set("day_num", argsTable["day_num"]);
                    LuaTable contactsTable = LuaScriptMgr.Instance.Lua.NewTable();
                    if (contactsTable == null)
                    {
                        return;
                    }
                    ArrayList contactArrayList = argsTable["contact"] as ArrayList;
                    if (contactArrayList == null)
                    {
                        return;
                    }
                    for (int i = 0; i < contactArrayList.Count; i++)
                    {
                        Hashtable contactHashtable = contactArrayList[i] as Hashtable;
                        LuaTable  contactTable     = LuaScriptMgr.Instance.Lua.NewTable();
                        if (contactHashtable == null || contactTable == null)
                        {
                            return;
                        }
                        contactTable.Set("name", contactHashtable["name"]);
                        contactTable.Set("type", contactHashtable["type"]);
                        contactTable.Set("value", contactHashtable["value"]);
                        contactsTable.Set(i + 1, contactTable);
                    }
                    replyTable.Set("contacts", contactsTable);
                    LuaTable  typeTable     = LuaScriptMgr.Instance.Lua.NewTable();
                    ArrayList typeArrayList = argsTable["types"] as ArrayList;
                    if (typeTable == null || typeArrayList == null)
                    {
                        return;
                    }
                    foreach (Hashtable typeHashTable in typeArrayList)
                    {
                        if (typeHashTable == null)
                        {
                            return;
                        }
                        typeTable.Set(typeHashTable["type"], typeHashTable["value"]);
                    }
                    replyTable.Set("types", typeTable);
                }
                mGetFeedbackCallback?.Invoke(replyTable);
            }
        }
Exemplo n.º 24
0
        public static Task PasteTask(BehaviorSource behaviorSource, TaskSerializer serializer)
        {
            Dictionary <int, Task> dictionary = new Dictionary <int, Task>();

            return(DeserializeJSON.DeserializeTask(behaviorSource, MiniJSON.Deserialize(serializer.serialization) as Dictionary <string, object>, ref dictionary, serializer.unityObjects));
        }
Exemplo n.º 25
0
    void OnAuthResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
    {
        if (state == ResponseState.Success)
        {
            if (result != null && result.Count > 0)
            {
                string res = MiniJSON.jsonEncode(result);
                //PrintDebugInfo.Add("Authorize Success !" + "Platform:" + type + " Result:" + res);
                Debug.Log("==========================================");
                Debug.Log(res);
                Debug.Log("==========================================");

                /*switch(CurPlatformType)
                 * {
                 *  case PlatformType.WeChat:
                 *      {
                 *          PrintDebugInfo.Add("解析:");
                 *          PrintDebugInfo.Add("country:" + resData["country"].ToString());
                 *          PrintDebugInfo.Add("refresh_token:" + resData["refresh_token"].ToString());
                 *          PrintDebugInfo.Add("province:" + resData["province"].ToString());
                 *          PrintDebugInfo.Add("gender:" + resData["gender"].ToString());
                 *          PrintDebugInfo.Add("icon:" + resData["icon"].ToString());
                 *          PrintDebugInfo.Add("unionid:" + resData["unionid"].ToString());
                 *          PrintDebugInfo.Add("openid:" + resData["openid"].ToString());
                 *          PrintDebugInfo.Add("nickname:" + resData["nickname"].ToString());
                 *          PrintDebugInfo.Add("userID:" + resData["userID"].ToString());
                 *          PrintDebugInfo.Add("city:" + resData["city"].ToString());
                 *          PrintDebugInfo.Add("expiresTime:" + resData["expiresTime"].ToString());
                 *          PrintDebugInfo.Add("expiresIn:" + resData["expiresIn"].ToString());
                 *          PrintDebugInfo.Add("token:" + resData["token"].ToString());
                 *      }
                 *      break;
                 *  case PlatformType.QQ:
                 *      {
                 *          PrintDebugInfo.Add("解析:");
                 *          PrintDebugInfo.Add("expiresIn:" + resData["expiresIn"].ToString());
                 *          PrintDebugInfo.Add("pfkey:" + resData["pfkey"].ToString());
                 *          PrintDebugInfo.Add("secret:" + resData["secret"].ToString());
                 *          PrintDebugInfo.Add("iconQzone:" + resData["iconQzone"].ToString());
                 *          PrintDebugInfo.Add("gender:" + resData["gender"].ToString());
                 *          PrintDebugInfo.Add("icon:" + resData["icon"].ToString());
                 *          PrintDebugInfo.Add("pay_token:" + resData["pay_token"].ToString());
                 *          PrintDebugInfo.Add("unionid:" + resData["unionid"].ToString());
                 *          PrintDebugInfo.Add("nickname:" + resData["nickname"].ToString());
                 *          PrintDebugInfo.Add("pf:" + resData["pf"].ToString());
                 *          PrintDebugInfo.Add("secretType:" + resData["secretType"].ToString());
                 *          PrintDebugInfo.Add("userID:" + resData["userID"].ToString());
                 *          PrintDebugInfo.Add("expiresTime:" + resData["expiresTime"].ToString());
                 *          PrintDebugInfo.Add("token:" + resData["token"].ToString());
                 *      }
                 *      break;
                 * }*/

                /*iOS 微信返回值
                 * {
                 *  "country":"",
                 *  "province":"",
                 *  "nickname":"\u732b\u62d6\u9aa1\u62c9",
                 *  "credential":
                 *  {
                 *      "access_token":"16_dKg-yNotgs3urDeZUGDbgSRkqh3O68CrFMFERufG_w9PBjM0rloVJhS0conFX-R184-h1ClBikAmyeXz4p_9F3_eeYsPEXYLdxiUrq3sw-k",
                 *      "openid":"oRaVf5m9CxHO9NUwOTe5KdAUKsbQ",
                 *      "scope":"snsapi_userinfo",
                 *      "refresh_token":"16_B2Z9Bk0-ZTNt6vpm5F9bAfsw4GfSX6QdCRBb-OecuCizAh8b7YYtU5lbbMgXDr7hEpz9RZjzIkp7AzghiIKpfSI7Bn1IrdMEvQWhW82jubE",
                 *      "expires_in":7200,
                 *      "unionid":"oUqxL1Bbbw0zFBxL4bMRWhb4hbzI"
                 *  },
                 *  "unionid":"oUqxL1Bbbw0zFBxL4bMRWhb4hbzI",
                 *  "openid":"oRaVf5m9CxHO9NUwOTe5KdAUKsbQ",
                 *  "privilege":[],
                 *  "city":"",
                 *  "sex":0,
                 *  "language":"zh_CN",
                 *  "headimgurl":"http://thirdwx.qlogo.cn/mmopen/vi_32/b9KoSo6KV9AlDjeViaEhFssSSBv9iaCB0NTF3rw3BXBic1yF4q6CicUjOicLElH2TPliaqiceVEG4ljIahic5JQmyVWcLg/132"
                 * }*/


                if (CurCB != null)
                {
                    Dictionary <string, object> resData = Json.Deserialize(res) as Dictionary <string, object>;
                    CurCB(resData["userID"].ToString(), resData["nickname"].ToString());
                    CurCB = null;
                }

                if (CurCB4WeChat != null)
                {
                    LitJson.JsonData jsonRes        = LitJson.JsonMapper.ToObject(res);
                    LitJson.JsonData credentialData = jsonRes["credential"];

                    CurCB4WeChat(jsonRes["openid"].ToString(), jsonRes["unionid"].ToString(), credentialData["access_token"].ToString(), jsonRes["nickname"].ToString());
                    CurCB4WeChat = null;
                }
            }
            else
            {
                PrintDebugInfo.Add("Authorize Success !" + " Platform:" + type);
            }
        }
        else if (state == ResponseState.Fail)
        {
                        #if UNITY_ANDROID
            PrintDebugInfo.Add("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
            if (CurFailureCB != null)
            {
                CurFailureCB(result["msg"].ToString());
            }
            CurFailureCB = null;
                        #elif UNITY_IPHONE
            print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
                        #endif
        }
        else if (state == ResponseState.Cancel)
        {
            PrintDebugInfo.Add("cancel !");
            if (CurFailureCB != null)
            {
                CurFailureCB("用户取消授权登录!");
            }
            CurFailureCB = null;
        }
    }
Exemplo n.º 26
0
        void CheckSDK(int code, string message, Hashtable result)
        {
            Debug.LogFormat("LinkGameOpenSDK ===> CheckSDK: code[{0}] message[{1}] result[{2}]", code, message, MiniJSON.jsonEncode(result));

            if (result == null || result.Count <= 0)
            {
                return;
            }

            int type = Convert.ToInt32(result["type"]);

            switch (code)
            {
            //sdk获取token成功
            case 20000:
            {
                OnComplete((LGOpenAction)type, message, result);
            }
            break;

            //用户取消
            case 20001:
            //用户拒绝
            case 20002:
            {
                OnCancel((LGOpenAction)type, message, result);
            }
            break;

            //参数错误
            case 20003:
            //超时
            case 20004:
            //其他错误
            case 20005:
            {
                OnError((LGOpenAction)type, message, result);
            }
            break;
            }
        }
 public static string toJson(this Dictionary <string, string> obj)
 {
     return(MiniJSON.jsonEncode(obj));
 }
Exemplo n.º 28
0
        void CheckGetUser(int code, string message, Hashtable result)
        {
            Debug.LogFormat("LinkGameOpenSDK ===> CheckGetUser: code[{0}] json[{1}]", code, MiniJSON.jsonEncode(result));

            switch (code)
            {
            //获取用户信息成功
            case 200:
            {
                OnComplete(LGOpenAction.GET_USER, message, result);
            }
            break;

            case 20100:
            case 20101:
            case 20103:
            case 20104:
            case 20105:
            case 30400:
            {
                OnError(LGOpenAction.GET_USER, message, result);
            }
            break;
            }
        }
 public static Hashtable hashtableFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as Hashtable);
 }
Exemplo n.º 30
0
 public static object Deserialize(string json)
 {
     return(MiniJSON.Deserialize(json));
 }