Ejemplo n.º 1
0
 private void RunOnThread(object action)
 {
     try
     {
         (action as Action)();
     }
     catch (Exception e)
     {
         ZLog.Error(e.StackTrace);
     }
     finally
     {
         Interlocked.Decrement(ref curThreadNum);
     }
 }
Ejemplo n.º 2
0
        public void ExecuteCommand(int command, params object[] param)
        {
            List <OnCommand> commandList = null;

            if (commandDic.TryGetValue(command, out commandList))
            {
                int count = commandList.Count;
                for (int i = 0; i < count; i++)
                {
                    commandList[i](param);
                }
            }
            else
            {
                ZLog.Error("no command in " + ToString() + " named " + command);
            }
        }
Ejemplo n.º 3
0
        protected void UnRegisteCommand(int command, OnCommand commandHandler)
        {
            List <OnCommand> commandList = null;

            if (commandDic.TryGetValue(command, out commandList))
            {
                if (commandList.Contains(commandHandler))
                {
                    commandList.Remove(commandHandler);
                }
                else
                {
                    ZLog.Error("no commandHandler with " + command + " named " + commandHandler.Method.Name);
                }
            }
            else
            {
                ZLog.Error("no command in " + ToString() + " named " + command);
            }
        }
Ejemplo n.º 4
0
        public void UnloadAssetBundle(string bundlePath)
        {
            AssetBundle assetBundle = null;

            if (cacheAssetBundleDic.TryGetValue(bundlePath, out assetBundle))
            {
                var dependences = manifest.GetAllDependencies(bundlePath);
                var count       = dependences.Length;
                for (var i = count - 1; i >= 0; i--)
                {
                    var dependence = dependences[i];
                    Unload(dependence);
                }

                Unload(bundlePath);
            }
            else
            {
                ZLog.Error($"No bundle cache named->{bundlePath}");
            }
        }