Esempio n. 1
0
 public virtual void AddListener(EventAction <T0, T1> call)
 {
     if (EventActions.Contains(call))
     {
         DebugHandler.LogError("EventActions Contains cal");
         return;
     }
     EventActions.Add(call);
 }
Esempio n. 2
0
 /// <summary>
 /// 移除自身
 /// </summary>
 ///
 public void RemoveSelf()
 {
     if (Parent == null)
     {
         DebugHandler.LogError(" null  parent");
         return;
     }
     Parent.Remove(this);
 }
Esempio n. 3
0
        public static string GetObjectMD5(object obj)
        {
            if (obj == null)
            {
                DebugHandler.LogError("obj is Null !");
                return("");
            }

            return(GetMD5(ByteTool.Object2Bytes(obj)));
        }
Esempio n. 4
0
 public virtual void RemoveListener(EventAction <T0, T1> call)
 {
     if (EventActions.Contains(call))
     {
         EventActions.Remove(call);
     }
     else
     {
         DebugHandler.LogError("EventActions not Contains cal");
     }
 }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 /// <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");
     }
 }
Esempio n. 9
0
 /// <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");
     }
 }
Esempio n. 10
0
        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));
            }
        }
Esempio n. 11
0
        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)暂时不删除影响不大
        }
Esempio n. 12
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()
        }
Esempio n. 13
0
        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");
            }
        }