當前位置: 首頁>>代碼示例>>C#>>正文


C# SimpleJSON.JSONNode類代碼示例

本文整理匯總了C#中SimpleJSON.JSONNode的典型用法代碼示例。如果您正苦於以下問題:C# JSONNode類的具體用法?C# JSONNode怎麽用?C# JSONNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JSONNode類屬於SimpleJSON命名空間,在下文中一共展示了JSONNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Parse

 public IParseble Parse(JSONNode rootNode)
 {
     IsInvoiceCreated 	= rootNode ["invoice_created"].AsBool;
     OperationId 		= rootNode ["operation_id"].AsInt;
     Error 				= rootNode ["errors"].AsArray [0] ["message"];
     return this;
 }
開發者ID:xsolla,項目名稱:xsolla-unity-sdk,代碼行數:7,代碼來源:XProceed.cs

示例2: Parse

 public IParseble Parse(JSONNode buyDataNode)
 {
     if (buyDataNode ["currency"] != null)
         currency = buyDataNode ["currency"];
     if (buyDataNode ["sum"] != null)
         sum = buyDataNode ["sum"];
     if (buyDataNode ["enabled"] != null)
         enabled = buyDataNode ["enabled"].AsBool;
     if (buyDataNode ["example"] != null)
         example = buyDataNode ["example"];
     if (buyDataNode ["isMandatory"] != null)
         isMandatory = buyDataNode ["isMandatory"];
     if (buyDataNode ["isPakets"] != null)
         isPakets = buyDataNode ["isPakets"];
     if (buyDataNode ["isReadonly"] != null)
         isReadonly = buyDataNode ["isReadonly"];
     if (buyDataNode ["isVisible"] != null)
         isVisible = buyDataNode ["isVisible"];
     if (buyDataNode ["name"] != null)
         name = buyDataNode ["name"];
     if (buyDataNode ["options"] != null)
         options = buyDataNode ["options"];
     if (buyDataNode ["title"] != null)
         title = buyDataNode ["title"];
     if (buyDataNode ["tooltip"] != null)
         tooltip = buyDataNode ["tooltip"];
     if (buyDataNode ["type"] != null)
         type = buyDataNode ["type"];
     if (buyDataNode ["value"] != null)
         value = buyDataNode ["value"];
     return this;
 }
開發者ID:xsolla,項目名稱:xsolla-unity-sdk,代碼行數:32,代碼來源:BuyData.cs

示例3: createLayers

        //  create all layers
        private List<Layer> createLayers(JSONNode json)
        {
            List<Layer> layers = new List<Layer>();

            foreach (JSONNode layerNode in json.AsArray) {
                Layer layer = new Layer();
                layer.Name = layerNode["name"];
                layer.Height = layerNode["properties"]["Height"].AsInt;

                Vector3 rotation = Vector3.zero;

                if (layerNode["properties"]["Rotation-x"].Value != null) {
                    rotation.x = layerNode["properties"]["Rotation-x"].AsFloat;
                }

                if (layerNode["properties"]["Rotation-y"].Value != null) {
                    rotation.y = layerNode["properties"]["Rotation-y"].AsFloat;
                }

                if (layerNode["properties"]["Rotation-z"].Value != null) {
                    rotation.z = layerNode["properties"]["Rotation-z"].AsFloat;
                }

                layer.Rotation = Quaternion.Euler(rotation);

                foreach (JSONNode dataNode in layerNode["data"].AsArray) {
                    layer.Data.Add(dataNode.AsInt);
                }

                layers.Add(layer);
            }

            return layers;
        }
開發者ID:adampassey,項目名稱:Unity-Tiled-Importer,代碼行數:35,代碼來源:JSONMapParser.cs

示例4: ParseJson

 public override void ParseJson(JSONNode json)
 {
     Size = json["size"].AsFloat;
     Shift = json["shift"].AsFloat;
     Direction = (Direction)Enum.Parse(typeof(Direction), json["direction"].ToString().Replace("\"", ""));
     Pivot = (Pivot)Enum.Parse(typeof(Pivot), json["pivot"].ToString().Replace("\"", ""));
 }
開發者ID:arahis,項目名稱:LinesClient,代碼行數:7,代碼來源:LinesStructure.cs

示例5: FromJSON

 public override void FromJSON(Tile tile, JSONNode node)
 {
     tile.position.x = node ["x"].AsInt;
     tile.position.y = node ["y"].AsInt;
     tile.text = node ["text"];
     tile.color = Util.Color.HexToColor (node["color"]);
 }
開發者ID:ChoiIngon,項目名稱:Rpg1994,代碼行數:7,代碼來源:Tree.cs

示例6: checkBindings

        public static RfidBinding checkBindings(JSONNode JSONatt, touchType smartTouchType)
        {
            //Debug.LogError ("Checking rfid bindings that contains attributes...");
            RfidBinding rfidObject = null;
            for (int i = 0; i < bindedObjects.Count; i++) {
                RfidBinding temp = bindedObjects [i];
                for (int k = 0; k<JSONatt.Count; k++) {
                    string tempAttribute = JSONatt [k].Value;
                    if (temp.attribute.Contains (tempAttribute)) {
                        i = bindedObjects.Count;
                        k = JSONatt.Count;
                        //Debug.LogError ("Attributes found!...'" + tempAttribute + "', checking if binding is enabled and functions exists!");
                        if(temp.enableBinding &&
                            ((smartTouchType == touchType.smartTouchStart && temp.smartTouchStart != null) ||
                         (smartTouchType == touchType.smartTouchEnd && temp.smartTouchEnd != null))){
                            rfidObject = temp;
                        }

                    } else {
                        //Debug.LogError ("No bindings exists with attributes, " + tempAttribute);
                        rfidObject = null; //object exits, but not enabled or does not contain executable function
                    }
                }
            }
            return rfidObject;
        }
開發者ID:prizm-labs,項目名稱:PrizmStarterKit_01,代碼行數:26,代碼來源:Prizm.cs

示例7: make

        public static BaseRule<PlayerState> make(JSONNode ruleNode)
        {
            string ruletype = ruleNode["type"];
            //Debug.Log("ruletype:"+ruletype);
            BaseRule<PlayerState> rule = null;

            ReallySimpleLogger.ReallySimpleLogger.WriteLog(
                typeof(JsonGameRuleFactory),string.Format("building rule of type:{0}",ruletype));

            if(ruletype.Equals("PlayerCrumbAllStateRule")){
                JSONArray crumbJson = ruleNode["state_crumb"].AsArray;
                string[] iA = new string[crumbJson.Count];

                int index = 0;
                foreach(JSONNode item in crumbJson){
                    iA[index] = (string)item;
                    index+=1;
                }

                string baseState = ruleNode["baseState"];
                string resultState = ruleNode["resultState"];

                //iAPlayer.state_crumbs = CollectionUtils.AsSet(iA);
                Player iAPlayer = new Player(){ State_crumbs = CollectionUtils.AsList(iA) };
                rule = new PlayerCrumbAllStateRule(new PlayerState(iAPlayer, baseState), resultState);

            } else if(ruletype.Equals("PlayerCrumbAnyStateRule")){
                JSONArray inventoryJson = ruleNode["state_crumb"].AsArray;
                string[] iA = new string[inventoryJson.Count];

                int index = 0;
                foreach(JSONNode item in inventoryJson){
                    iA[index] = (string)item;
                    index+=1;
                }

                string baseState = ruleNode["baseState"];
                string resultState = ruleNode["resultState"];

                Player iAPlayer = new Player(){ State_crumbs = CollectionUtils.AsList(iA) };
                //iAPlayer.state_crumbs = CollectionUtils.AsSet(iA);
                rule = new PlayerCrumbAnyStateRule(new PlayerState(iAPlayer, baseState), resultState);

            }
            //			else if(ruletype.Equals("PlayerStateFactorsRule")){
            //				//JSONNode playerNode = ruleNode["player"];
            //				Player p = new Player(ruleNode["player"]);
            //
            //				string baseState = ruleNode["baseState"];
            //				string resultState = ruleNode["resultState"];
            //				rule = new PlayerCrumbAnyStateRule(new PlayerState(p);
            //			}
            // Guard against a NULL rule
            if (rule == null)
            {
                throw new ArgumentNullException("rule is empty");
            }
            return rule;
        }
開發者ID:claytantor,項目名稱:shadow-haven-unity,代碼行數:59,代碼來源:JsonGameRuleFactory.cs

示例8: Component

 public Component(GameObject obj, JSONNode node) 
     : base(node)
 {
     GameObject = obj;
     this.Transform = GameObject.Transform;
     this.Scene = GameObject.Scene;
     this.Enabled = true;
 }
開發者ID:mlohstroh,項目名稱:LXE,代碼行數:8,代碼來源:Component.cs

示例9: GetList

 public List<string> GetList(JSONNode N)
 {
     List<string> l = new List<string>();
     foreach(string value in N.Childs){
         l.Add(value);
     }
     return l;
 }
開發者ID:kesumu,項目名稱:dokidoki,代碼行數:8,代碼來源:BattleManager.cs

示例10: ParsePlanningCards

 private static int[] ParsePlanningCards(JSONNode json)
 {
     var len = json.Count;
     var result = new int[len];
     for (var i = 0; i < len; i++)
         result[i] = json[i].AsInt;
     return result;
 }
開發者ID:kleber-swf,項目名稱:Risk-Management-Board-Game,代碼行數:8,代碼來源:Player.cs

示例11: Deserialize

 public static Player Deserialize(JSONNode json)
 {
     return new Player {
         Name = json["name"].Value,
         PlanningCards = ParsePlanningCards(json["planning-cards"]),
         UseOneMorePlanningSprint = json["use-one-more-planning-sprint"].AsBool
     };
 }
開發者ID:kleber-swf,項目名稱:Risk-Management-Board-Game,代碼行數:8,代碼來源:Player.cs

示例12: Init

 public void Init(JSONNode enemyData)
 {
     var data = enemyData[Name];
     if (data["hp"] != null) Health = data["hp"].AsInt;
     if (data["sp"] != null) Shield = data["sp"].AsInt;
     if (data["delay"] != null) ShootDelay = data["delay"].AsFloat;
     Weapons = (from JSONNode weapon in data["weapons"].AsArray select new Weapon(weapon[1], weapon[0])).ToList();
 }
開發者ID:nightwolfz,項目名稱:Game1,代碼行數:8,代碼來源:Model.cs

示例13: FromJson

 public static Ticket FromJson(JSONNode json)
 {
     Ticket ticket = new Ticket();
     ticket.Uri = json["uri"].Value;
     ticket.CompleteUri = json["complete_uri"].Value;
     ticket.TicketId = json["ticket_id"].Value;
     ticket.UploadLinkSecure = json["upload_link_secure"].Value;
     return ticket;
 }
開發者ID:uptredlabs,項目名稱:Mobile,代碼行數:9,代碼來源:Ticket.cs

示例14: LoadJSON

 private void LoadJSON(string s)
 {
     try {
     JSONNode n = SimpleJSON.JSON.Parse(s);
     this.jsonConfig = n;
     } catch (JSONException e) {
     Debug.Log("No config loaded..." + e.ToString());
     }
 }
開發者ID:rlawther,項目名稱:AmnesiaMuseumUnity,代碼行數:9,代碼來源:ConfigLoader.cs

示例15: FromJSON

 public override void FromJSON(Tile tile, JSONNode node)
 {
     tile.position.x = node ["x"].AsInt;
     tile.position.y = node ["y"].AsInt;
     tile.text = "E";
     tile.color = Color.green;
     name = node ["name"];
     description = node ["description"];
 }
開發者ID:ChoiIngon,項目名稱:Rpg1994,代碼行數:9,代碼來源:EnterPoint.cs


注:本文中的SimpleJSON.JSONNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。