示例#1
0
        /// <summary>
        /// 执行初始化过程
        /// </summary>
        //[RuntimeInitializeOnLoadMethod]
        public void Initialize()
        {
            ///命令系统注入
            if (InjectService.Get <IServiceCommand>() == null)
            {
                ServiceCommand commandService = new ServiceCommand();
                commandService.Initialize();
            }

            //注册实体工具
            if (InjectService.Get <IEntityService>() == null)
            {
                InjectService.RegisterSingleton <IEntityService>(new EntityServiceImpl());
            }

            //注册信号塔对象池
            if (InjectService.Get <ObjectPool <TowerModel> >() == null)
            {
                InjectService.RegisterSingleton(new ObjectPool <TowerModel>());
            }

            //注册手机对象池
            if (InjectService.Get <ObjectPool <PhoneModel> >() == null)
            {
                InjectService.RegisterSingleton(new ObjectPool <PhoneModel>());
            }


            //注册实体工具
            if (InjectService.Get <EntityUtils>() == null)
            {
                InjectService.RegisterSingleton(new EntityUtils());
            }
        }
        private void Awake()
        {
            if (InjectService.Get <IServiceCommand>() == null)
            {
                ServiceCommand commandService = new ServiceCommand();
                commandService.Initialize();
            }

            if (InjectService.Get <UIController>() == null)
            {
                InjectService.RegisterSingleton(new UIController());
            }
        }