public object GetVarValue(string name) { plyVar plyVar = this.FindVariable(name); if (plyVar == null) { return(null); } return(plyVar.GetValue()); }
public T GetUnityObjectVarValue <T>(string name) where T : Object { plyVar plyVar = this.variables.FindVariable(name); if (plyVar == null) { return(null); } return((T)plyVar.GetValue()); }
public override object GetValue() { this.CacheVariable(); plyVar obj = this.v; if (obj == null) { return(null); } return(obj.GetValue()); }
public override void DecodeValues(plyVar wrapper, string data) { JsonUtility.FromJsonOverwrite(data, this); this._baseType = (string.IsNullOrEmpty(this.baseTypeName) ? null : Type.GetType(this.baseTypeName)); this._plyVarType = (string.IsNullOrEmpty(this.plyVarTypeName) ? null : Type.GetType(this.plyVarTypeName)); if (this._baseType == null || this._plyVarType == null) { Debug.LogErrorFormat("Could not find the Array's element type [{0}] or plyVar type [{1}]", this.baseTypeName, this.plyVarTypeName); this._arrayType = null; } else { this._arrayType = this._baseType.MakeArrayType(); this.variables = new List <plyVar>(); if (this.storedEntriesDataData == null) { this.arr = Array.CreateInstance(this._baseType, 0); } else if (typeof(UnityEngine.Object).IsAssignableFrom(this._baseType)) { if (((wrapper.objRefs != null) ? wrapper.objRefs.Length : 0) != 0) { this.arr = Array.CreateInstance(this._baseType, wrapper.objRefs.Length); for (int i = 0; i < wrapper.objRefs.Length; i++) { plyVar plyVar = plyVar.Create(this._plyVarType); plyVar.name = i.ToString(); plyVar.ValueHandler.SetStoredType(this._baseType); this.variables.Add(plyVar); this.arr.SetValue(wrapper.objRefs[i], i); } } } else { this.arr = Array.CreateInstance(this._baseType, this.storedEntriesDataData.Length); for (int j = 0; j < this.storedEntriesDataData.Length; j++) { if (!string.IsNullOrEmpty(this.storedEntriesDataData[j])) { plyVar plyVar2 = plyVar.Create(this._plyVarType); plyVar2.name = j.ToString(); plyVar2.ValueHandler.DecodeValues(wrapper, this.storedEntriesDataData[j]); this.variables.Add(plyVar2); this.arr.SetValue(plyVar2.GetValue(), j); } } } } }
public GameObject GetGameObjectVarValue(string name) { plyVar plyVar = this.variables.FindVariable(name); if (plyVar == null) { return(null); } plyVar_Component plyVar_Component = plyVar.ValueHandler as plyVar_Component; if (plyVar_Component != null) { return(plyVar_Component.GetGameObject()); } return((GameObject)plyVar.GetValue()); }
public T GetComponentVarValue <T>(string name) where T : Component { plyVar plyVar = this.variables.FindVariable(name); if (plyVar == null) { return(null); } plyVar_Component plyVar_Component = plyVar.ValueHandler as plyVar_Component; if (plyVar_Component != null) { return(plyVar_Component.GetComponent <T>()); } plyVar_GameObject plyVar_GameObject = plyVar.ValueHandler as plyVar_GameObject; if (plyVar_GameObject != null) { return(plyVar_GameObject.GetComponent <T>()); } return((T)plyVar.GetValue()); }