public virtual void AddListener(EventAction <T0, T1> call) { if (EventActions.Contains(call)) { DebugHandler.LogError("EventActions Contains cal"); return; } EventActions.Add(call); }
/// <summary> /// 移除自身 /// </summary> /// public void RemoveSelf() { if (Parent == null) { DebugHandler.LogError(" null parent"); return; } Parent.Remove(this); }
public static string GetObjectMD5(object obj) { if (obj == null) { DebugHandler.LogError("obj is Null !"); return(""); } return(GetMD5(ByteTool.Object2Bytes(obj))); }
public virtual void RemoveListener(EventAction <T0, T1> call) { if (EventActions.Contains(call)) { EventActions.Remove(call); } else { DebugHandler.LogError("EventActions not Contains cal"); } }
public static T GetDataFromFile <T>(string path) { try { byte[] bytes = File.ReadAllBytes(path); return(ProtoBufUtils.ProtobufDeserialize <T>(bytes)); } catch (System.Exception ex) { DebugHandler.LogError("GetDataFromFile" + ex.ToString()); } return(default(T)); }
public void LoadAssetFromJson(string jsontxt) { JArray jay = (JArray)JsonConvert.DeserializeObject(jsontxt); if (jay == null) { DebugHandler.LogError("Null jay"); } if (!ParseTable(jay)) { DebugHandler.LogError("Null Parse jay" + jsontxt); } }
public bool ParseRow(JObject jobj) { if (jobj == null) { DebugHandler.LogError("Null jobj"); } id = (int)jobj["id"]; AssetBundleName = (string)jobj["AssetBundleName"]; AssetName = (string)jobj["AssetName"]; ResourceName = (string)jobj["ResourceName"]; return(true); }
/// <summary> /// 删除子节点 /// </summary> public virtual void Remove(Node <T> node) { if (m_childs.Contains(node)) { m_childs.Remove(node); node.SetParent(null); node.OnExit(); } else { DebugHandler.LogError("child not contain node"); } }
/// <summary> /// 添加子节点 /// </summary> /// <param name="node"></param> public virtual void Add(Node <T> node) { if (node != null && node.Parent == null) { node.SetParent(this); m_childs.AddLast(node); node.OnEnter(); } else { DebugHandler.LogError("node.Parent not null"); } }
public virtual void FireEvent(uint id, T0 t0, T1 t1) { EventBase <T0, T1> evtbase; if (DictEvents.TryGetValue(id, out evtbase)) { evtbase.Invoke(t0, t1); } else { DebugHandler.LogError(string.Format("FireEvent Has No Evt{0}", id)); } }
public void RemoveEvent(uint id, EventAction <T0, T1> eact) { EventBase <T0, T1> evtbase; if (DictEvents.TryGetValue(id, out evtbase)) { evtbase.RemoveListener(eact); } else//没有事件监听 { DebugHandler.LogError("Has No Evt"); return; } //if(evtbase.EventActions.Count==0)暂时不删除影响不大 }
public static void SaveDataToFile <T>(string path, T dt) { try { if (File.Exists(path)) { File.Delete(path); } byte[] bys = ProtoBufUtils.ProtobufSerialize(dt); CreateFile(path, bys); //File.WriteAllBytes(path, bys); } catch (System.Exception ex) { DebugHandler.LogError("SaveDataToFile error" + ex.ToString()); } //File.Create() }
protected void LoadManifestDirectly(string assetBundleName) { if (m_LoadedAssetBundles.ContainsKey(assetBundleName))//已经加载 { return; } string url = m_BaseDownloadingURL + assetBundleName; var ab = AssetBundle.LoadFromFile(url); if (ab == null) { DebugHandler.LogError("ab Null" + assetBundleName); } m_LoadedAssetBundles.Add(assetBundleName, new LoadedAssetBundle(ab)); AssetBundleManifestObject = ab.LoadAsset <AssetBundleManifest>("AssetBundleManifest"); if (AssetBundleManifestObject == null) { throw new GameFrameworkException("AssetBundleManifest"); } }