本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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("\"", ""));
}
示例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"]);
}
示例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;
}
示例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;
}
示例8: Component
public Component(GameObject obj, JSONNode node)
: base(node)
{
GameObject = obj;
this.Transform = GameObject.Transform;
this.Scene = GameObject.Scene;
this.Enabled = true;
}
示例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;
}
示例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;
}
示例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
};
}
示例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();
}
示例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;
}
示例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());
}
}
示例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"];
}