コード例 #1
0
        private void InitEventAllocator()
        {
            var types = FindAllGameComponentType(typeof(IEvent));

            foreach (var type in types)
            {
                try
                {
                    IEvent instance = (IEvent)Activator.CreateInstance(type);

                    int id = (int)instance.EventType;
                    if (ArrayUtility.SafeGet(_types, id) != null)
                    {
                        var msg = String.Format("component id already exist id {0}, type {1}, type {2}", id, _types[id],
                                                instance.GetType());
                        AssertUtility.Assert(false, msg);
                        _logger.Error(msg);
                    }
                    else
                    {
                        ArrayUtility.SafeSet(ref _types, id, type);
                        ArrayUtility.SafeSet(ref _allocators, id, ObjectAllocators.GetAllocator(type));
                    }

                    _maxId = Mathf.Max(id, _maxId);
                }
                catch (Exception e)
                {
                    _logger.ErrorFormat("construct instance of type {0} failed {1}", type, e);
                }
            }
        }
コード例 #2
0
 static ObjectAllocatorHolder()
 {
     if (_allocator == null)
     {
         _allocator = ObjectAllocators.GetAllocator(typeof(T));
     }
 }
コード例 #3
0
ファイル: MyHttpServer.cs プロジェクト: yangfan111/CsharpCode
        public override string HandlerRequest()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<div><p>==================================================================</div>");
            sb.Append(ObjectAllocators.PrintAllDebugInfo());
            sb.Append("<div><p>==================================================================</div>");
            sb.Append(EntityMapCompareExecutor.PrintDebugInfo());
            sb.Append("<div><p>==================================================================</div>");
            sb.Append(AbstractNetworkService.PrintDebugInfo());
            return(sb.ToString());
        }
コード例 #4
0
ファイル: MyHttpServer.cs プロジェクト: zuojiashun/CsharpCode
            public string GetResponse()
            {
                StringBuilder sb = new StringBuilder();

                sb.Append("<div><p>==================================================================</div>");
                sb.Append(ObjectAllocators.PrintAllDebugInfo());
                sb.Append("<div><p>==================================================================</div>");
                sb.Append(EntityMapComparator.PrintDebugInfo());
                sb.Append("<div><p>==================================================================</div>");
                sb.Append(AbstractNetworkService.PrintDebugInfo());
                return(sb.ToString());
            }
コード例 #5
0
ファイル: MyHttpServer.cs プロジェクト: yangfan111/CsharpCode
 public override string HandlerRequest()
 {
     return(ObjectAllocators.PrintAllDebugInfo());
 }
コード例 #6
0
ファイル: MyHttpServer.cs プロジェクト: zuojiashun/CsharpCode
 public string GetResponse()
 {
     return(ObjectAllocators.PrintAllDebugInfo());
 }