public ZNodeSubTree(ZNodeTree nodeTree, Rect wr, JSON js) : base(BASE_TYPE.SUBTREE, nodeTree, wr) { _imgStyle.normal.background = NodeEditor.SkinItem.GetBaseNodeImage(BaseType) as Texture2D; _inspectorName = BaseType.ToString(); treePath = ""; if (js != null && js.Contains("nodeParams")) { JSON paramsJS = js.ToJSON("nodeParams"); treePath = paramsJS.ToString("treePath"); } }
public BTDecoratorNodeData(JSON js) : base(js, TYPE.DECORATOR) { JSON paramsJS = js.ToJSON("nodeParams"); if (paramsJS.Contains("child")) { JSON childNodeJS = paramsJS.ToJSON("child"); BTNodeData childNode = BTNodeData.CreateNodeData(childNodeJS); if (childNode != null) { AddChild(childNode); } } }
public ZBTActionScale(ZNodeTree nodeTree, Rect wr, JSON js) : base(nodeTree, wr, ZBTActionManager.NODE_TYPE.SCALE) { scaleSpeed = "1"; scaleAmountX = "0"; scaleAmountY = "0"; scaleAmountZ = "0"; if (js != null && js.Contains("nodeParams")) { JSON paramsJS = js.ToJSON("nodeParams"); float[] scaleValues = paramsJS.ToArray <float>("scaleAmount"); Vector3 scaleAmount = new Vector3(scaleValues[0], scaleValues[1], scaleValues[2]); scaleAmountX = scaleAmount.x.ToString(); scaleAmountY = scaleAmount.y.ToString(); scaleAmountZ = scaleAmount.z.ToString(); scaleSpeed = paramsJS.ToFloat("scaleSpeed").ToString(); } }
public static string GetStringValue(ref JSON js, string id, string defaultVal) { return(js.Contains(id) ? js.ToString(id) : defaultVal); }
public static float GetFloatValue(ref JSON js, string id, float defaultVal) { return(js.Contains(id) ? js.ToFloat(id) : defaultVal); }
public static bool GetBoolValue(ref JSON js, string id, bool defaultVal) { return(js.Contains(id) ? js.ToBoolean(id) : defaultVal); }
public static int GetIntValue(ref JSON js, string id, int defaultVal) { return(js.Contains(id) ? js.ToInt(id) : defaultVal); }