internal EventTrigger(DDNABase ddna, int index, JSONObject json)
        {
            this.ddna  = ddna;
            this.index = index;

            eventName = json.ContainsKey("eventName")
                ? json["eventName"] as string
                : "";
            response = json.ContainsKey("response")
                ? json["response"] as JSONObject
                : new JSONObject();

            priority  = json.GetOrDefault("priority", 0L);
            limit     = json.GetOrDefault("limit", -1L);
            condition = (json.ContainsKey("condition")
                ? json["condition"] as List <object>
                : new List <object>(0))
                        .Select(e => e as JSONObject)
                        .ToArray();

            campaignId = json.GetOrDefault("campaignID", -1L);
            variantId  = json.GetOrDefault("variantID", -1L);
            var eventParams = response.GetOrDefault("eventParams", new JSONObject());

            campaignName = eventParams.GetOrDefault <string, string>("responseEngagementName", null);
            variantName  = eventParams.GetOrDefault <string, string>("responseVariantName", null);
        }
        public SliderQuestion(JSONObject json) : base(json)
        {
            questiontype = QuestionType.Slider;
            datatype     = QuestionDataType.Integer;

            if (json.ContainsKey("datatype"))
            {
                datatype = json["datatype"].Str == "integer" ? QuestionDataType.Integer : QuestionDataType.Float;
            }

            left  = json["left"].Str;
            right = json["right"].Str;
            if (json.ContainsKey("tick_count"))
            {
                tick_count = (int)json["tick_count"].Number;
            }
            if (json.ContainsKey("min_value"))
            {
                min_value = (float)json["min_value"].Number;
            }
            else
            {
                min_value = 0;
            }
            if (json.ContainsKey("max_value"))
            {
                max_value = (float)json["max_value"].Number;
            }
            else
            {
                max_value = tick_count - 1;
            }
        }
        internal EventTrigger(DDNABase ddna, int index, JSONObject json, ExecutionCountManager executionCountManager)
        {
            this.ddna  = ddna;
            this.index = index;
            this.executionCountManager = executionCountManager;

            eventName = json.ContainsKey("eventName")
                ? json["eventName"] as string
                : "";
            response = json.ContainsKey("response")
                ? json["response"] as JSONObject
                : new JSONObject();

            priority  = json.GetOrDefault("priority", 0L);
            limit     = json.GetOrDefault("limit", -1L);
            condition = (json.ContainsKey("condition")
                    ? json["condition"] as List <object>
                    : new List <object>(0))
                        .Select(e => e as JSONObject)
                        .ToArray();

            campaignId = json.GetOrDefault("campaignID", -1L);
            variantId  = json.GetOrDefault("variantID", -1L);
            var eventParams = response.GetOrDefault("eventParams", new JSONObject());

            campaignName = eventParams.GetOrDefault <string, string>("responseEngagementName", null);
            variantName  = eventParams.GetOrDefault <string, string>("responseVariantName", null);

            JSONObject             campaignLimitsConfig = json.GetOrDefault("campaignExecutionConfig", new JSONObject());
            TriggerConditionParser parser = new TriggerConditionParser(campaignLimitsConfig, variantId);

            this.campaignTriggerConditions = parser.parseConditions(executionCountManager);
        }
示例#4
0
        private void DeserializeData(string data)
        {
            mSpells.Clear();
            JSONObject obj = JSONObject.Parse(data);

            if (obj.ContainsKey("version"))
            {
                mVersion = obj.GetString("version");
            }
            if (obj.ContainsKey("message"))
            {
                mMessage = new List <string>();
                JSONArray jsonMessage = obj.GetArray("message");
                foreach (var val in jsonMessage)
                {
                    mMessage.Add(val.Str);
                }
            }
            JSONArray spells = obj.GetArray("spells");

            foreach (var val in spells)
            {
                Spell spell = new Spell();
                spell.InitiateSpell(val.Obj);
                mSpells.Add(spell);
            }
            WriteList();
        }
示例#5
0
    public bool Import(JSONObject source)
    {
        if (source.ContainsKey("locale") == false ||
            source["locale"].Type != JSONValueType.String ||
            Regex.IsMatch(source["locale"].Str, @"^[a-z]{2}(_[A-Z]{2})?$") == false ||
            source.ContainsKey("keys") == false ||
            source["keys"].Type != JSONValueType.Object)
        {
            return(false);
        }

        entries = new List <KeyValueStore>();
        foreach (KeyValuePair <string, JSONValue> entry in source["keys"].Obj)
        {
            if (entry.Value.Type == JSONValueType.String)
            {
                entries.Add(new KeyValueStore()
                {
                    key   = entry.Key,
                    value = entry.Value.Str
                });
            }
        }

        UnityEditor.EditorUtility.SetDirty(this);

        return(true);
    }
        private static bool ValidConfiguration(JSONObject c)
        {
            if (!c.ContainsKey("url") ||
                !c.ContainsKey("height") ||
                !c.ContainsKey("width") ||
                !c.ContainsKey("spritemap") ||
                !c.ContainsKey("layout"))
            {
                return(false);
            }

            JSONObject layout = c["layout"] as JSONObject;

            if (!layout.ContainsKey("landscape") && !layout.ContainsKey("portrait"))
            {
                return(false);
            }

            JSONObject spritemap = c["spritemap"] as JSONObject;

            if (!spritemap.ContainsKey("background"))
            {
                return(false);
            }

            return(true);
        }
        public Question(JSONObject json)
        {
            if (json == null)
            {
                return;                 // --->
            }

            if (json.ContainsKey("id"))
            {
                id = json["id"].Str;
            }

            if (json.ContainsKey("required"))
            {
                required = json["required"].Boolean;
            }

            if (json.ContainsKey("shuffle"))
            {
                shuffle = json["shuffle"].Boolean;
            }

            if (json.ContainsKey("datatype"))
            {
                datatype = VRestionnaireData.DataTypeFromString(json["datatype"].Str);
            }

            if (json.ContainsKey("instructions"))
            {
                instructions = json["instructions"].Str;
            }
        }
示例#8
0
            public TrackEventParamaters(string eventName, string userId, Dictionary <string, JSONValue> eventProperties, string eventId, Action <CoolaDataDeliveryResult> callback)
            {
                this.info = new JSONObject();

                if (string.IsNullOrEmpty(eventName))
                {
                    throw new ArgumentException("The event name cannot be empty - it's the primary identifier of the event and must be populated correctly");
                }

                // Take care of " escape character
                eventName = eventName.Replace("\"", "\\\"");

                info.Add("event_name", eventName);

                if (string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(instance.userId))
                {
                    throw new ArgumentException("User ID must either be Provided at Setup or provided as a parameter to track event. Doing both is allowed, doing neither is not");
                }
                info.Add("user_id", string.IsNullOrEmpty(userId) ? instance.userId : userId);

                this.callback = callback;

                if (!string.IsNullOrEmpty(eventId))
                {
                    info.Add("event_id", eventId);
                }
                // add provided paramators, missing mandatory fields, additional optional fields and UTM data
                foreach (KeyValuePair <string, JSONValue> pair in eventProperties)
                {
                    if (!info.ContainsKey(pair.Key))
                    {
                        info.Add(pair.Key, pair.Value);
                    }
                }
                foreach (var pair in MandatoryFields())
                {
                    if (!info.ContainsKey(pair.Key))
                    {
                        info.Add(pair.Key, pair.Value);
                    }
                }
                foreach (var pair in OptionalFields())
                {
                    if (!info.ContainsKey(pair.Key))
                    {
                        info.Add(pair.Key, pair.Value);
                    }
                }
                foreach (var pair in coolaDataUTM.UTMData)
                {
                    if (!info.ContainsKey(pair.Key))
                    {
                        info.Add(pair.Key, pair.Value);
                    }
                }
            }
示例#9
0
        /// <summary>
        /// 最小对象转为JSONObject
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private static JSONObject DeserializeSingletonObject(string text)
        {
            JSONObject      jsonObject = new JSONObject();
            MatchCollection matches    = Regex.Matches(text, "(\\\"(?<key>[^\\\"]+)\\\":\\\"(?<value>[^,\\\"]*)\\\")|(\\\"(?<key>[^\\\"]+)\\\":(?<value>[^,\\\"\\}]*))");

            foreach (Match match in matches)
            {
                string value = match.Groups["value"].Value;
                jsonObject.Add(match.Groups["key"].Value, _json.ContainsKey(value) ? _json[value] : StrDecode(value));
            }
            return(jsonObject);
        }
        public NumFieldQuestion(JSONObject json) : base(json)
        {
            questiontype = QuestionType.NumField;
            if (json.ContainsKey("spinbutton"))
            {
                spinbutton = json["spinbutton"].Boolean;
            }

            switch (json["datatype"].Str)
            {
            case "integer":
                datatype = QuestionDataType.Integer;
                break;

            case "float":
                datatype = QuestionDataType.Float;
                break;
            }
            if (json.ContainsKey("displaytype"))
            {
                switch (json["displaytype"].Str)
                {
                case "integer":
                    displaytype = QuestionDisplayType.Integer;
                    break;

                case "float":
                    displaytype = QuestionDisplayType.Float;
                    break;

                case "percentage":
                    displaytype = QuestionDisplayType.Percentage;
                    break;
                }
            }
            if (json.ContainsKey("min"))
            {
                min = (float)json["min"].Number;
            }
            else
            {
                min = float.MinValue;
            }
            if (json.ContainsKey("max"))
            {
                max = (float)json["max"].Number;
            }
            else
            {
                max = float.MaxValue;
            }
        }
 public TextViewQuestion(JSONObject json) : base(json)
 {
     questiontype = QuestionType.TextView;
     datatype     = QuestionDataType.String;
     if (json.ContainsKey("title"))
     {
         title = json["title"].Str;
     }
     if (json.ContainsKey("text"))
     {
         text = json["text"].Str;
     }
 }
示例#12
0
 /// <summary>
 /// Parse the loaded level file data.
 ///
 /// If overriding from a base class be sure to call base.ParseLevelFileData()
 /// </summary>
 /// <param name="jsonObject"></param>
 public virtual void ParseLevelFileData(JSONObject jsonObject)
 {
     if (jsonObject.ContainsKey("name"))
     {
         Name = jsonObject.GetString("name");
     }
     if (jsonObject.ContainsKey("description"))
     {
         Description = jsonObject.GetString("description");
     }
     if (jsonObject.ContainsKey("valuetounlock"))
     {
         ValueToUnlock = (int)jsonObject.GetNumber("valuetounlock");
     }
 }
        public void EngageResponse(string id, string response, int statusCode, string error)
        {
            // android sdk expects request listener callbacks on the main thread
            activity.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                AndroidJavaObject listener;
                if (engageListeners.TryGetValue(id, out listener))
                {
                    JSONObject json = null;
                    if (!string.IsNullOrEmpty(response))
                    {
                        try {
                            json = DeltaDNA.MiniJSON.Json.Deserialize(response) as JSONObject;
                        } catch (System.Exception) { /* invalid json */ }
                    }

                    if (json == null ||
                        (statusCode < 200 ||
                         statusCode >= 300 &&
                         !json.ContainsKey("isCachedResponse")))
                    {
                        listener.Call("onFailure", new AndroidJavaObject(Utils.ThrowableClassName, error));
                    }
                    else
                    {
                        listener.Call("onSuccess", new AndroidJavaObject(Utils.JSONObjectClassName, response));
                    }

                    engageListeners.Remove(id);
                }
            }));
        }
示例#14
0
        // ================================================================================
        //  JSON IMPORT
        // --------------------------------------------------------------------------------

        public static ImportedAnimationInfo GetAnimationInfo(JSONObject root)
        {
            if (root == null)
            {
                Debug.LogWarning("Error importing JSON animation info: JSONObject is NULL");
                return(null);
            }

            ImportedAnimationInfo importedInfos = new ImportedAnimationInfo();

            // import all informations from JSON

            if (!root.ContainsKey("meta"))
            {
                Debug.LogWarning("Error importing JSON animation info: no 'meta' object");
                return(null);
            }
            var meta = root["meta"].Obj;

            GetMetaInfosFromJSON(importedInfos, meta);

            if (GetAnimationsFromJSON(importedInfos, meta) == false)
            {
                return(null);
            }

            if (GetSpritesFromJSON(root, importedInfos) == false)
            {
                return(null);
            }

            importedInfos.CalculateTimings();

            return(importedInfos);
        }
 public void UpdateRowData(JSONObject data)
 {
     rowData      = data;
     leftUserData = data.GetObject("left");
     if (data.ContainsKey("right"))
     {
         rightUserData = data.GetObject("right");
     }
     else
     {
         rightUserData = null;
     }
     if (leftUserData != null)
     {
         Utils.SetActive(leftUser, true);
         leftUsernameLabel.text = leftUserData.GetString("displayName");
         leftCheckbox.value     = leftCheckboxState;
         EventDelegate.Set(leftCheckboxListener.onClick, delegate() { EventCheckboxChanged(true); });
     }
     else
     {
         Utils.SetActive(leftUser, false);
     }
     if (rightUserData != null)
     {
         Utils.SetActive(rightUser, true);
         rightUsernameLabel.text = rightUserData.GetString("displayName");
         rightCheckbox.value     = rightCheckboxState;
         EventDelegate.Set(rightCheckboxListener.onClick, delegate() { EventCheckboxChanged(false); });
     }
     else
     {
         Utils.SetActive(rightUser, false);
     }
 }
示例#16
0
 public void UpdateRowData(JSONObject data) {
   rowData = data;
   leftUserData = data.GetObject("left");
   if (data.ContainsKey("right")) {
     rightUserData = data.GetObject("right");
   } else {
     rightUserData = null;
   }
   if (leftUserData != null) {
     Utils.SetActive(leftUser, true);
     leftUsernameLabel.text = leftUserData.GetString("displayName");
     leftCheckbox.value = leftCheckboxState;
     EventDelegate.Set(leftCheckboxListener.onClick, delegate() { EventCheckboxChanged(true); });
   } else {
     Utils.SetActive(leftUser, false);
   }
   if (rightUserData != null) {
     Utils.SetActive(rightUser, true);
     rightUsernameLabel.text = rightUserData.GetString("displayName");
     rightCheckbox.value = rightCheckboxState;
     EventDelegate.Set(rightCheckboxListener.onClick, delegate() { EventCheckboxChanged(false); });
   } else {
     Utils.SetActive(rightUser, false);
   }
 }
示例#17
0
    public void ImportData(JSONObject json_data)
    {
        m_letters_to_animate            = json_data["m_letters_to_animate"].Array.JSONtoListInt();
        m_letters_to_animate_custom_idx = (int)json_data["m_letters_to_animate_custom_idx"].Number;
        m_letters_to_animate_option     = (LETTERS_TO_ANIMATE)(int)json_data["m_letters_to_animate_option"].Number;


        m_loop_cycles = new List <ActionLoopCycle>();

        if (json_data.ContainsKey("LOOPS_DATA"))
        {
            ActionLoopCycle loop_cycle;

            foreach (JSONValue loop_data in json_data["LOOPS_DATA"].Array)
            {
                loop_cycle = new ActionLoopCycle();
                loop_cycle.ImportData(loop_data.Obj);
                m_loop_cycles.Add(loop_cycle);
            }
        }

        m_letter_actions = new List <LetterAction>();
        LetterAction letter_action;

        foreach (JSONValue action_data in json_data["ACTIONS_DATA"].Array)
        {
            letter_action = new LetterAction();
            letter_action.ImportData(action_data.Obj);
            m_letter_actions.Add(letter_action);
        }
    }
    public override void UpdateSeats(JSONObject jsonData)
    {
        JSONArray userList = jsonData.GetObject("gameRoom").GetArray("userGames");

        users = new JSONObject();
        for (int i = 0; i < userList.Length; i++)
        {
            users.Add(userList[i].Obj.GetInt("seatIndex").ToString(), userList[i].Obj);
        }
        // FAKE user joined
        for (int i = 0; i < 4; i++)
        {
            GameObject       tempUser;
            PlayerSlotScript playerScript = playerHolder[i];
            JSONObject       user         = users.ContainsKey(i.ToString()) ? users.GetObject(i.ToString()) : null;
            if (user != null)
            {
                playerScript.Init(user.GetString("userId"), "Dan Choi" + (i + 1), (i + 1) * 200000, string.Empty);
            }
            else
            {
                playerScript.InitEmpty();
            }
        }
    }
示例#19
0
        private List <string> ReadStrings(JSONObject jsonObject, string key)
        {
            List <string> list = new List <string>();;

            if (jsonObject.ContainsKey(key))
            {
                JSONArray array = jsonObject.GetArray(key);
                if (array != null)
                {
                    foreach (JSONValue jsonvalue in array)
                    {
                        list.Add(jsonvalue.Str);
                    }
                }
                else
                {
                    string str = jsonObject.GetString(key);
                    if (str != null)
                    {
                        list.Add(str);
                    }
                }
            }
            return(list);
        }
示例#20
0
        private static ImportedAnimationSheet GetAnimationInfo(JSONObject root)
        {
            if (root == null)
            {
                Debug.LogWarning("Error importing JSON animation info: JSONObject is NULL");
                return(null);
            }

            ImportedAnimationSheet animationSheet = new ImportedAnimationSheet();

            // import all informations from JSON

            if (!root.ContainsKey("meta"))
            {
                Debug.LogWarning("Error importing JSON animation info: no 'meta' object");
                return(null);
            }
            var meta = root["meta"].Obj;

            GetMetaInfosFromJSON(animationSheet, meta);

            if (GetAnimationsFromJSON(animationSheet, meta) == false)
            {
                return(null);
            }

            if (GetFramesFromJSON(animationSheet, root) == false)
            {
                return(null);
            }

            animationSheet.ApplyGlobalFramesToAnimationFrames();

            return(animationSheet);
        }
        public static ImageMessage Create(DDNA ddna, Engagement engagement, JSONObject options)
        {
            if (engagement == null || engagement.JSON == null || !engagement.JSON.ContainsKey("image"))
            {
                return(null);
            }

            string name  = "DeltaDNA Image Message";
            int    depth = 0;

            if (options != null)
            {
                if (options.ContainsKey("name"))
                {
                    name = options["name"] as string;
                }

                if (options.ContainsKey("depth"))
                {
                    depth = (int)options["depth"];
                }
            }

            ImageMessage imageMessage = null;

            try{
                var configuration = engagement.JSON["image"] as JSONObject;
                if (ValidConfiguration(configuration))
                {
                    imageMessage = new ImageMessage(ddna, configuration, name, depth, engagement);
                    if (engagement.JSON.ContainsKey("parameters"))
                    {
                        imageMessage.Parameters = engagement.JSON["parameters"] as JSONObject;
                    }
                }
                else
                {
                    Logger.LogWarning("Invalid image message configuration.");
                }
            }
            catch (Exception exception) {
                Logger.LogWarning("Failed to create image message: " + exception.Message);
            }

            return(imageMessage);
        }
示例#22
0
    void Start()
    {
        infoText.gameObject.SetActive(false);

        //JSONObject usage example:

        //Parse string into a JSONObject:
        JSONObject jsonObject = JSONObject.Parse(stringToEvaluate);

        //You can also create an "empty" JSONObject
        JSONObject emptyObject = new JSONObject();

        //Adding values is easy (values are implicitly converted to JSONValues):
        emptyObject.Add("key", "value");
        emptyObject.Add("otherKey", 123);
        emptyObject.Add("thirdKey", false);
        emptyObject.Add("fourthKey", new JSONValue(JSONValueType.Null));

        //You can iterate through all values with a simple for-each loop
        foreach (KeyValuePair <string, JSONValue> pair in emptyObject)
        {
            Debug.Log("key : value -> " + pair.Key + " : " + pair.Value);

            //Each JSONValue has a JSONValueType that tells you what type of value it is. Valid values are: String, Number, Object, Array, Boolean or Null.
            Debug.Log("pair.Value.Type.ToString() -> " + pair.Value.Type.ToString());

            if (pair.Value.Type == JSONValueType.Number)
            {
                //You can access values with the properties Str, Number, Obj, Array and Boolean
                Debug.Log("Value is a number: " + pair.Value.Number);
            }
        }

        //JSONObject's can also be created using this syntax:
        JSONObject newObject = new JSONObject {
            { "key", "value" }, { "otherKey", 123 }, { "thirdKey", false }
        };

        //JSONObject overrides ToString() and outputs valid JSON
        Debug.Log("newObject.ToString() -> " + newObject.ToString());

        //JSONObjects support array accessors
        Debug.Log("newObject[\"key\"].Str -> " + newObject["key"].Str);

        //It also has a method to do the same
        Debug.Log("newObject.GetValue(\"otherKey\").ToString() -> " + newObject.GetValue("otherKey").ToString());

        //As well as a method to determine whether a key exists or not
        Debug.Log("newObject.ContainsKey(\"NotAKey\") -> " + newObject.ContainsKey("NotAKey"));

        //Elements can removed with Remove() and the whole object emptied with Clear()
        newObject.Remove("key");
        Debug.Log("newObject with \"key\" removed: " + newObject.ToString());

        newObject.Clear();
        Debug.Log("newObject cleared: " + newObject.ToString());
    }
示例#23
0
    public static bool HasKey(string key)
    {
        if (jsonObject == null)
        {
            return(false);
        }

        return(jsonObject.ContainsKey(key));
    }
示例#24
0
        public ObjectInstance(JSONValue record)
        {
            JSONObject recordObject = record.Obj;

            id = recordObject.GetString("Id");
            float x = (float)recordObject.GetNumber("x__c");
            float y = (float)recordObject.GetNumber("y__c");
            float z = (float)recordObject.GetNumber("z__c");

            position = new Vector3(x, y, z);
            yAngle   = (int)recordObject.GetNumber("y_Angle__c");
            isPlaced = recordObject.GetBoolean("Is_Placed__c");

            // Get configuration id
            if (recordObject.ContainsKey("Configuration__c"))
            {
                configurationId = recordObject.GetString("Configuration__c");
            }
            else
            {
                JSONObject configurationObject = recordObject.GetObject("Configuration__r");
                configurationId = configurationObject.GetValue("Id").Str;
            }
            // Get object definition id
            string definitionId;

            if (recordObject.ContainsKey("Object_Definition__c"))
            {
                definitionId = recordObject.GetString("Object_Definition__c");
            }
            else
            {
                JSONObject definitionObject = recordObject.GetObject("Object_Definition__r");
                definitionId = definitionObject.GetValue("Id").Str;
            }
            // Load object definition from cache
            definition = CacheManager.getObjectDefinitions().get(definitionId);
            if (definition == null)
            {
                throw new System.Exception("Could not find definition " + definitionId + " of object instance " + id + " in cache");
            }
        }
示例#25
0
 public void RegisterForAds(JSONObject config, bool userConsent, bool ageRestricted)
 {
     #if DDNA_SMARTADS
     adService.Call(
         "configure",
         new AndroidJavaObject(Utils.JSONObjectClassName, MiniJSON.Json.Serialize(config)),
         config.ContainsKey("isCachedResponse") && (config["isCachedResponse"] as bool? ?? false),
         userConsent,
         ageRestricted);
     #endif
 }
示例#26
0
//	IEnumerator TestRoundWinner() {
//		JSONObject jsonRoomState = new JSONObject();
//		jsonRoomState.Add("result", 1015);
//
//		JSONObject jsonData = new JSONObject ();
//		jsonData.Add ("room_id", 1);
//		jsonRoomState.Add ("data", jsonData);
//
//		JSONArray userList = new JSONArray ();
//		for (int i = 1; i <= 2; i ++) {
//			JSONObject jsonUser = new JSONObject();
//			jsonUser.Add("user_id", "testuser" + i);
//			jsonUser.Add("character_type", i);
//			jsonUser.Add("level", i * 3);
//			userList.Add (jsonUser);
//		}
//		jsonData.Add ("user_list", userList);
//
//		SocketWrapper.Instance.messageQueue.AddLast (jsonRoomState.ToString());
//		SocketWrapper.Instance.onMessageReceived ();
//
//		JSONObject jsonGameStart = new JSONObject ();
//		jsonGameStart.Add ("result", ResultCodes.RESULT_OK_NOTIFYING_START_GAME);
//		SocketWrapper.Instance.messageQueue.AddLast (jsonGameStart.ToString());
//		SocketWrapper.Instance.onMessageReceived ();
//
//
//		for( int i = 0; i < 5; i ++ ) {
//			JSONObject json;
//
//
//			json = GetTestJSONRoundStart();
//			SocketWrapper.Instance.messageQueue.AddLast(json.ToString());
//			SocketWrapper.Instance.onMessageReceived();
//			yield return new WaitForSeconds(5.0f);
//
//
//			json = GetTestJSONRoundResult();
//			SocketWrapper.Instance.messageQueue.AddLast(json.ToString());
//			SocketWrapper.Instance.onMessageReceived();
//			yield return new WaitForSeconds(3.0f);
//		}
//	}
//
//	JSONObject GetTestJSONRoundStart() {
//		JSONObject json = new JSONObject();
//		json.Add("result", ResultCodes.RESULT_OK_MAKE_QUIZ);
//		json.Add("quiz_string", "test test");
//		json.Add("time", 5.0f);
//
//		return json;
//	}
//
//	JSONObject GetTestJSONRoundResult() {
//		JSONObject json = new JSONObject();
//		json.Add("result", ResultCodes.RESULT_OK_ROUND_RESULT);
//		json.Add("winner_id", "testuser" + Random.Range(1, 3));
//		json.Add("remain_round", 9);
//
//		return json;
//	}

    public override void OnMessageReceived()
    {
        JSONObject json = JSONObject.Parse(SocketWrapper.Instance.Pop());

        if (!json.ContainsKey("result"))
        {
            return;
        }

        int resultCode = (int)json.GetNumber("result");

        switch (resultCode)
        {
        case ResultCodes.RESULT_OK_STATE_GAME_ROOM:
            UpdateGameRoom(json);
            break;

        case ResultCodes.RESULT_OK_START_GAME:
            break;

        case ResultCodes.RESULT_OK_NOTIFYING_START_GAME:
            StartGame();
            break;

        case ResultCodes.RESULT_OK_MAKE_QUIZ:
            UpdateQuiz(json);
            break;

        case ResultCodes.RESULT_OK_ROUND_RESULT:
            ShowRoundResult(json);
            break;

        case ResultCodes.RESULT_OK_TOTAL_RESULT:
            ShowTotalResult(json);
            break;

        case ResultCodes.RESULT_OK_REQUEST_ROOM_MEMBER_UPDATE:
            SendRequestRoomMemberUpdate();
            break;

        case ResultCodes.RESULT_OK_CHAT_MESSAGE:
            ReceiveChatMessage(json);
            break;

        case ResultCodes.RESULT_OK_LEAVE_ROOM:
            LeaveGameRoom();
            break;

        case ResultCodes.RESULT_ERROR_INVALID_CONNECTION:
        default:
            Application.LoadLevel("login");
            break;
        }
    }
        internal static LogFilter From(JSONObject filterJson)
        {
            if (filterJson == null)
            {
                return(null);
            }

            return(new LogFilter
            {
                Name = filterJson.ContainsKey("name") ? filterJson["name"] : null
            });
        }
        public void ImportData(JSONObject jsonData)
        {
            m_setting_name  = jsonData ["name"].Str;
            m_data_type     = (ANIMATION_DATA_TYPE)((int)jsonData ["data_type"].Number);
            m_animation_idx = (int)jsonData ["anim_idx"].Number;
            m_action_idx    = (int)jsonData ["action_idx"].Number;

            if (jsonData.ContainsKey("startState"))
            {
                m_startState = jsonData["startState"].Boolean;
            }
        }
示例#29
0
        private static PyxelEditData ReadJson(string jsonData)
        {
            PyxelEditData data = new PyxelEditData();

            JSONObject obj = JSONObject.Parse(jsonData);

            if (obj.ContainsKey("name"))
            {
                data.name = obj["name"].Str;
            }
            if (obj.ContainsKey("tileset"))
            {
                data.tileset.tileWidth  = (int)obj["tileset"].Obj["tileWidth"].Number;
                data.tileset.tileHeight = (int)obj["tileset"].Obj["tileHeight"].Number;
                data.tileset.tilesWide  = (int)obj["tileset"].Obj["tilesWide"].Number;
                data.tileset.fixedWidth = obj["tileset"].Obj["fixedWidth"].Boolean;
                data.tileset.numTiles   = (int)obj["tileset"].Obj["numTiles"].Number;
            }
            if (obj.ContainsKey("animations"))
            {
                foreach (var item in obj["animations"].Obj)
                {
                    data.animations[int.Parse(item.Key)] = new Animation(item.Value.Obj);
                }
            }
            if (obj.ContainsKey("canvas"))
            {
                data.canvas.width      = (int)obj["canvas"].Obj["width"].Number;
                data.canvas.height     = (int)obj["canvas"].Obj["height"].Number;
                data.canvas.tileWidth  = (int)obj["canvas"].Obj["tileWidth"].Number;
                data.canvas.tileHeight = (int)obj["canvas"].Obj["tileHeight"].Number;
                data.canvas.numLayers  = (int)obj["canvas"].Obj["numLayers"].Number;
                foreach (var item in obj["canvas"].Obj["layers"].Obj)
                {
                    data.canvas.layers[int.Parse(item.Key)] = new Layer(item.Value.Obj);
                }
            }

            return(data);
        }
    public override void Init(object[] data)
    {
        base.Init(data);
        EventDelegate.Set(btnBack.onClick, BackToSelectRoom);
        EventDelegate.Set(btnThrowCard.onClick, EventPlayCards);
        Debug.Log(data[1]);
        JSONObject roomData = (JSONObject)data[1];
        JSONArray  userList = roomData.GetObject("gameRoom").GetArray("userGames");

        for (int i = 0; i < userList.Length; i++)
        {
            users.Add(userList[i].Obj.GetInt("seatIndex").ToString(), userList[i].Obj);
        }
        // FAKE user joined
        for (int i = 0; i < 4; i++)
        {
            GameObject tempUser;
            if (i < 2)
            {
                tempUser = NGUITools.AddChild(playerLeftGrid.gameObject, Resources.Load(Global.SCREEN_PATH + "/GameScreen/TienLenMN/PlayerSlot", typeof(GameObject)) as GameObject);
            }
            else
            {
                tempUser = NGUITools.AddChild(playerRightGrid.gameObject, Resources.Load(Global.SCREEN_PATH + "/GameScreen/TienLenMN/PlayerSlot", typeof(GameObject)) as GameObject);
            }
            tempUser.name = "PlayerSlot" + (i + 1);
            PlayerSlotScript playerScript = tempUser.GetComponent <PlayerSlotScript>();
            JSONObject       user         = users.ContainsKey(i.ToString()) ? users.GetObject(i.ToString()) : null;
            if (user != null)
            {
                playerScript.Init(user.GetString("userId"), "Dan Choi" + (i + 1), (i + 1) * 200000, string.Empty);
            }
            else
            {
                playerScript.InitEmpty();
            }
            playerHolder.Add(playerScript);
        }

        playerLeftGrid.Reposition();
        playerRightGrid.Reposition();

        // for (int i = 0; i < playerHolder.Count; i++) {
        //  UIButton tempBtn = playerHolder[i].btnThrowCard;
        //  tempBtn.inputParams = new object[] {playerHolder[i]};
        //       EventDelegate.Set(tempBtn.onClick, delegate() { PlayCardFromOther((PlayerSlotScript)tempBtn.inputParams[0]); });
        //       // Test Player turn circle display
        //       StartCoroutine(DisplayPlayerTurn(i));
        // }

        StartNewGame();
    }
        internal virtual string GetAction()
        {
            if (response.ContainsKey("image"))
            {
                var image = response["image"] as JSONObject;
                if (image.Count > 0)
                {
                    return("imageMessage");
                }
            }

            return("gameParameters");
        }
示例#32
0
 public override void UpdateSeats(JSONObject jsonData) {
   JSONArray userList = jsonData.GetObject("gameRoom").GetArray("userGames");
   users = new JSONObject();
   for (int i = 0 ; i < userList.Length; i++) {
     users.Add(userList[i].Obj.GetInt("seatIndex").ToString(), userList[i].Obj);
   }
   // FAKE user joined
   for (int i = 0; i < 4; i++) {
     GameObject tempUser;
     PlayerSlotScript playerScript = playerHolder[i];
     JSONObject user = users.ContainsKey(i.ToString()) ? users.GetObject(i.ToString()) : null;
     if (user != null) {
       playerScript.Init(user.GetString("userId"), "Dan Choi" + (i + 1), (i + 1) * 200000, string.Empty);
     } else {
       playerScript.InitEmpty();
     }
   }
 }
示例#33
0
	public void update(JSONObject json, bool all = false)
    {
        is_connected = true;
        id = (int)json.GetNumber("id");
        username = json.GetString("username");
        email = json.GetString("email");
        score = (int)json.GetNumber("score");
        room = json.GetString("room");

        if (!json.ContainsKey("friends"))
        {
            this.friends = new Friends();
            return;
        } // Info private
        phi = (int)json.GetNumber("phi");
		if (all)
			ProcessSwungMens(json.GetArray("swungmens"));


        // -- Friends
        JSONArray friends = json.GetArray("friends");
        this.friends = new Friends(friends);
	}
		public override void ImportData(JSONObject json_data)
		{
			m_from = json_data["m_from"].Obj.JSONtoVector3();
			m_to = json_data["m_to"].Obj.JSONtoVector3();
			m_to_to = json_data["m_to_to"].Obj.JSONtoVector3();
			m_ease_curve_per_axis = json_data["m_ease_curve_per_axis"].Boolean;
			if(json_data.ContainsKey("m_custom_ease_curve_y"))
			{
				m_custom_ease_curve_y = json_data["m_custom_ease_curve_y"].Array.JSONtoAnimationCurve();
				m_custom_ease_curve_z = json_data["m_custom_ease_curve_z"].Array.JSONtoAnimationCurve();
			}
			
			ImportBaseData(json_data);
			
		}
示例#35
0
	// wemePush urlscheme parse
	public JSONObject getResultForWemePush(string scheme,string host,JSONObject jsonObject){
		host = host.ToLower();
		switch(host){
			case "isallowpushmessage":
				JSONObject pushallowResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				pushallowResult.Remove("allow");
				pushallowResult.Add("allow",onPush);
				return pushallowResult;

			case "requestallowpushmessage":
				if(jsonObject.ContainsKey("allow")){
					JSONObject requestPushResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					onPush = jsonObject.GetBoolean("allow");
					requestPushResult.Remove("allow");
					requestPushResult.Add("allow",onPush);
					return requestPushResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}
		}
		return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
	}
示例#36
0
		public override void Deserialize(JSONObject obj)
		{
			mName = obj.GetString(NAME);
			mGender = (CharacterGender)(int)obj.GetNumber(GENDER);
			mExperience = (int)obj.GetNumber(EXPERIENCE);
			mAvatar = obj.GetString(AVATAR);
			mAlignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
			mRace = (DnDRace)(int)obj.GetNumber(RACE);
			mAge = (int)obj.GetNumber(AGE);
			if (obj.ContainsKey(DEITY))
			{
				mDeity = new DnDDeity();
				mDeity.Deserialize(obj.GetObject(DEITY));
			}
			mSize = (DnDCharacterSize)(int)obj.GetNumber(SIZE);
			// souls:
			JSONObject jSouls = obj.GetObject(CLASS_SOULS);
			var classes = Enum.GetValues(typeof(DnDCharClass)).Cast<DnDCharClass>();
			foreach (DnDCharClass charClass in classes)
			{
				if (jSouls.ContainsKey(charClass.ToString()))
				{
					if (!string.IsNullOrEmpty(jSouls.GetObject(charClass.ToString()).ToString()))
					{
						DnDClassSoul newSoul = null;
						switch (charClass)
						{
							case DnDCharClass.Wizard:
								newSoul = new DnDWizard(this);
								break;
							default:
								break;
						}
						if (newSoul != null)
						{
							newSoul.Deserialize(jSouls.GetObject(charClass.ToString()));
							mClasses.Add(newSoul);
						}
					}
				}
			}
			// abilities:
			JSONArray tempArray = obj.GetArray(ABILITIES);
			foreach (var val in tempArray)
			{
				mAbilities[(DnDAbilities)((int)val.Array[0].Number)] = (int)val.Array[1].Number;
			}
		}
    void Start()
    {
        infoText.gameObject.SetActive(false);

        //JSONObject usage example:

        //Parse string into a JSONObject:
        JSONObject.Parse(stringToEvaluate);

        //You can also create an "empty" JSONObject
        JSONObject emptyObject = new JSONObject();

        //Adding values is easy (values are implicitly converted to JSONValues):
        emptyObject.Add("key", "value");
        emptyObject.Add("otherKey", 123);
        emptyObject.Add("thirdKey", false);
        emptyObject.Add("fourthKey", new JSONValue(JSONValueType.Null));

        //You can iterate through all values with a simple for-each loop
        foreach (KeyValuePair<string, JSONValue> pair in emptyObject) {
            Debug.Log("key : value -> " + pair.Key + " : " + pair.Value);

            //Each JSONValue has a JSONValueType that tells you what type of value it is. Valid values are: String, Number, Object, Array, Boolean or Null.
            Debug.Log("pair.Value.Type.ToString() -> " + pair.Value.Type.ToString());

            if (pair.Value.Type == JSONValueType.Number) {
                //You can access values with the properties Str, Number, Obj, Array and Boolean
                Debug.Log("Value is a number: " + pair.Value.Number);
            }
        }

        //JSONObject's can also be created using this syntax:
        JSONObject newObject = new JSONObject {{"key", "value"}, {"otherKey", 123}, {"thirdKey", false}};

        //JSONObject overrides ToString() and outputs valid JSON
        Debug.Log("newObject.ToString() -> " + newObject.ToString());

        //JSONObjects support array accessors
        Debug.Log("newObject[\"key\"].Str -> " + newObject["key"].Str);

        //It also has a method to do the same
        Debug.Log("newObject.GetValue(\"otherKey\").ToString() -> " + newObject.GetValue("otherKey").ToString());

        //As well as a method to determine whether a key exists or not
        Debug.Log("newObject.ContainsKey(\"NotAKey\") -> " + newObject.ContainsKey("NotAKey"));

        //Elements can removed with Remove() and the whole object emptied with Clear()
        newObject.Remove("key");
        Debug.Log("newObject with \"key\" removed: " + newObject.ToString());

        newObject.Clear();
        Debug.Log("newObject cleared: " + newObject.ToString());
    }
示例#38
0
    public void ImportData(JSONObject json_data)
    {
        m_letters_to_animate = json_data["m_letters_to_animate"].Array.JSONtoListInt();
        m_letters_to_animate_custom_idx = (int)json_data["m_letters_to_animate_custom_idx"].Number;
        m_letters_to_animate_option = (LETTERS_TO_ANIMATE)(int)json_data["m_letters_to_animate_option"].Number;

        m_loop_cycles = new List<ActionLoopCycle>();

        if (json_data.ContainsKey("LOOPS_DATA"))
        {
            ActionLoopCycle loop_cycle;

            foreach (var loop_data in json_data["LOOPS_DATA"].Array)
            {
                loop_cycle = new ActionLoopCycle();
                loop_cycle.ImportData(loop_data.Obj);
                m_loop_cycles.Add(loop_cycle);
            }
        }

        m_letter_actions = new List<LetterAction>();
        LetterAction letter_action;
        foreach (var action_data in json_data["ACTIONS_DATA"].Array)
        {
            letter_action = new LetterAction();
            letter_action.ImportData(action_data.Obj);
            m_letter_actions.Add(letter_action);
        }
    }
示例#39
0
	// wemeOauth urlscheme parse
	private JSONObject getResultForWemeOAuth(string scheme,string host,JSONObject jsonObject){
		host = host.ToLower();
		switch(host){
		case "loginfacebook":
			if(jsonObject.ContainsKey("appId")&&jsonObject.ContainsKey("redirectUri")&&jsonObject.ContainsKey("permissions")){
				JSONObject facebookResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return facebookResult;
			}else{
				return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
			}
			case "logintwitter":
				if(jsonObject.ContainsKey("consumerKey")&&jsonObject.ContainsKey("consumerSecret")&&jsonObject.ContainsKey("callbackUrl")){
					JSONObject twitterResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					return twitterResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}

			case "loginweme":
				if(jsonObject.ContainsKey("clientId")&&jsonObject.ContainsKey("clientSecret")){
					JSONObject wemeResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					return wemeResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}

		default:
			break;
		}
		return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
	}
		public void ImportData(JSONObject jsonData)
		{
			m_setting_name = jsonData ["name"].Str;
			m_data_type = (ANIMATION_DATA_TYPE) ((int) jsonData ["data_type"].Number);
			m_animation_idx = (int) jsonData ["anim_idx"].Number;
			m_action_idx = (int) jsonData ["action_idx"].Number;

			if(jsonData.ContainsKey("startState"))
				m_startState = jsonData["startState"].Boolean;
		}
示例#41
0
        private void LoadMatches()
        {
            FileInfo summaryFile = new FileInfo(App.SummaryPath);
              var dir = new DirectoryInfo(App.Rootpath);
              if (!dir.Exists) dir.Create();

              Logger.WriteLine("Loading replays from {0}", App.Rootpath);

              FileStream loadSummary;
              if (!summaryFile.Exists) loadSummary = summaryFile.Create();
              else loadSummary = summaryFile.Open(FileMode.Open);
              var mems = new MemoryStream();
              loadSummary.CopyTo(mems);
              loadSummary.Close();

              dynamic summary;
              try {
            summary = MFroehlich.Parsing.MFro.MFroFormat.Deserialize(mems.ToArray());
            Logger.WriteLine("Loaded {0} summaries from {1}", summary.Count, summaryFile.FullName);
              } catch (Exception x) {
            summary = new JSONObject();
            Logger.WriteLine(Priority.Error, "Error loading summaries {0}, starting new summary list", x.Message);
              }
              dynamic newSummary = new JSONObject();

              List<FileInfo> files = new DirectoryInfo(App.Rootpath).EnumerateFiles("*.lol").ToList();
              files.Sort((a, b) => b.Name.CompareTo(a.Name));

              int summaries = 0;
              var timer = new System.Diagnostics.Stopwatch(); timer.Start();

              for (int i = 0; i < files.Count; i++) {
            string filename = files[i].Name.Substring(0, files[i].Name.Length - 4);

            ReplayItem item;
            if (summary.ContainsKey(filename)) {
              item = new ReplayItem((SummaryData) summary[filename], files[i]);
              newSummary.Add(filename, summary[filename]);
            } else {
              SummaryData data = new SummaryData(new MFroReplay(files[i]));
              newSummary.Add(filename, JSONObject.From(data));
              item = new ReplayItem(data, files[i]);
              summaries++;
            }
            item.MouseUp += OpenDetails;
            replays.Add(item);
              }

              Logger.WriteLine("All replays loaded, took {0}ms", timer.ElapsedMilliseconds);

              using (FileStream saveSummary = summaryFile.Open(FileMode.Open)) {
            byte[] summBytes = MFroehlich.Parsing.MFro.MFroFormat.Serialize(newSummary);
            saveSummary.Write(summBytes, 0, summBytes.Length);
            Logger.WriteLine("Saved summaries, {0} total summaries, {1} newly generated", newSummary.Count, summaries);
              }
              Search();
              ReplayArea.Visibility = System.Windows.Visibility.Visible;
              LoadArea.Visibility = System.Windows.Visibility.Hidden;
              Console.WriteLine("DONE");
        }
		public override void ImportData(JSONObject json_data)
		{
			base.ImportData(json_data);
			
			m_force_position_override = json_data["m_force_position_override"].Boolean;
			
			if(json_data.ContainsKey("m_bezier_curve"))
			{
				m_bezier_curve.ImportData(json_data["m_bezier_curve"].Obj);
			}
		}
		protected void ImportBaseData(JSONObject json_data)
		{
			m_progression_idx = (int) json_data["m_progression"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			m_is_offset_from_last = json_data["m_is_offset_from_last"].Boolean;
			m_to_to_bool = json_data["m_to_to_bool"].Boolean;
			m_unique_randoms = json_data["m_unique_randoms"].Boolean;
			m_animate_per = (AnimatePerOptions) (int) json_data["m_animate_per"].Number;
			m_override_animate_per_option = json_data["m_override_animate_per_option"].Boolean;
			if(json_data.ContainsKey("m_custom_ease_curve"))
				m_custom_ease_curve = json_data["m_custom_ease_curve"].Array.JSONtoAnimationCurve();
		}
	public SpinData(string username, JSONObject jsonData, bool isYou) {
		Debug.Log("SpinData: " + jsonData.ToString());
		this.isYou = isYou;
		this.username = username;
		JSONArray resultsData = jsonData.GetArray("items");
		JSONObject extraData = SlotCombination.CalculateCombination(resultsData, jsonData.GetInt("nL"));
	  JSONArray winningCount = extraData.GetArray("wCount");  
	  JSONArray winningType = extraData.GetArray("wType");
    JSONArray winningGold = jsonData.GetArray("wGold");
		
    for (int i = 0; i < winningGold.Length; i++) {
      totalDamage += (int)winningGold[i].Number;
    }
		
		if (jsonData.ContainsKey("newBoss")) {
			newBossData = jsonData.GetObject("newBoss");
			JSONArray bossDrops = jsonData.GetArray("dropItems");
			dropCash = (int)bossDrops[0].Number;
			dropGem = (int)bossDrops[1].Number;
			bossDrops = null;
			AccountManager.Instance.bossKilled++;
		}
		

		for (int i = 0; i < winningCount.Length; i++) {
			if (winningCount[i].Number >= 3 || ((int)winningType[i].Number == (int)SlotItem.Type.TILE_1 && winningCount[i].Number >= 2)) {
				spawnSkills.Add(new SpawnableSkill((int)winningType[i].Number, (int)winningCount[i].Number, (int)winningGold[i].Number, isYou));
			}
		}
		extraData = null;
		resultsData = null;
		winningCount = null;
		winningType = null;
		winningGold = null;
	}
示例#45
0
	// weme urlscheme parse
	private JSONObject getResultForWeme(string scheme,string host,JSONObject jsonObject){
		host = host.ToLower();
		switch(host){
			case "start":
				if(jsonObject.ContainsKey("serverZone")&&jsonObject.ContainsKey("gameCode")&&jsonObject.ContainsKey("domain")&&jsonObject.ContainsKey("gameVersion")&&jsonObject.ContainsKey("marketCode")){
					JSONObject jsonResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					onStart=true;
					return jsonResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}
			case "gateinfo":
				JSONObject gateResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return gateResult;
			
			case "isauthorized":
				JSONObject authResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				authResult.Remove("authorized");
				authResult.Add("authorized",onLogin);
				return authResult;
			
			case "login":
				if(jsonObject.ContainsKey("authData")){
					JSONObject jsonResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					onLogin=true;
					return jsonResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}
			
			case "playerkey":
				JSONObject playerKeyResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return playerKeyResult;
			case "logout":
				JSONObject logoutResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return logoutResult;
			case "withdraw":
				JSONObject withdrawResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return withdrawResult;
			
			case "gameid":
				JSONObject gameidResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return gameidResult;
			case "request":
				if(jsonObject.ContainsKey("uri")){
					JSONObject jsonResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
					onLogin=true;
					return jsonResult;
				}else{
					return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
				}
			
			case "configuration":
				JSONObject configurationResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return configurationResult;
			
			case "authdata":
				JSONObject authdataResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return authdataResult;
			
			case "sdkversion":
				JSONObject sdkversionResult = JSONObject.Parse(((TextAsset)Resources.Load("JSONRequests/"+scheme+"/"+host)).text);
				return sdkversionResult;
			
		}
		return jsonResultForError("WmInterfaceBroker",(long)WemeManager.WemeErrType.WM_ERR_INVALID_PARAMETER,"invalid_parameter",scheme+"://"+host);
	}