public void Handle(SimpleProto simpleProto)
        {
            bool isLock = simpleProto.Bs[0];

            if (isLock)
            {
                CursorLocker.SystemUnlock = false;
                //Lock
                SingletonManager.Get <FreeUiManager>().Contexts1.ui.uI.IsShowCrossHair = true;

                SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.UnblockKey(CursorLocker.SystemBlockKeyId);
                SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.UnblockPointer(CursorLocker.SystemBlockPointerId);
            }
            else
            {
                UiModule.CloseGameSettingUI();
                //chat
                SingletonManager.Get <FreeUiManager>().Contexts1.ui.chat.CloseChatView();
                //bag
                CursorLocker.SystemUnlock = true;
                if (SingletonManager.Get <FreeUiManager>().GetUi("bagSystemUI").Visible)
                {
                    SingletonManager.Get <FreeUiManager>().GetUi("bagSystemUI").Show(-1);
                }
                else
                {
                    //Unlock
                    SingletonManager.Get <FreeUiManager>().Contexts1.ui.uI.IsShowCrossHair = false;
                    CursorLocker.SystemBlockKeyId     = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockKey(Layer.System);
                    CursorLocker.SystemBlockPointerId = SingletonManager.Get <FreeUiManager>().Contexts1.userInput.userInputManager.Helper.BlockPointer(Layer.System);
                }
            }
        }
示例#2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            MapperConfig.Initialize();
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            NinjectModule orderModule   = new UiModule();
            NinjectModule serviceModule = new BlModule();
            var           kernel        = new StandardKernel(orderModule, serviceModule);

            kernel.Unbind <ModelValidatorProvider>();
            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
示例#3
0
        public string OnDebugMessage(DebugCommand message, SessionStateMachine stateMachine)
        {
            var sb = new System.Text.StringBuilder();

            foreach (var arg in message.Args)
            {
                sb.Append(arg);
                sb.Append(",");
            }
            Logger.InfoFormat("OnDebugMessage {0} with arg {1}", message.Command, sb.ToString());
            var result = string.Empty;

            result += SharedCommandHandler.ProcessGameSettingCommnands(message, stateMachine);
            if (!string.IsNullOrEmpty(result))
            {
                return(result);
            }
            SharedCommandHandler.ProcessHitBoxCommands(message);
            result += SharedCommandHandler.ProcessDebugCommand(message, _contexts);
            if (!string.IsNullOrEmpty(result))
            {
                return(result);
            }
            result += UiModule.ProcessDebugCommand(message);
            if (!string.IsNullOrEmpty(result))
            {
                return(result);
            }

            PlayerEntity self = _contexts.player.flagSelfEntity;

            if (self != null)
            {
                result = SharedCommandHandler.ProcessPlayerCommands(message, _contexts, self, _contexts.session.commonSession, _contexts.session.currentTimeObject);
                SharedCommandHandler.ProcessVehicleCommand(message, _contexts.vehicle, self);
                SharedCommandHandler.ProcessSceneObjectCommand(
                    message,
                    _contexts.sceneObject,
                    _contexts.session.entityFactoryObject.SceneObjectEntityFactory,
                    self);
                SharedCommandHandler.ProcessMapObjectCommand(message, _contexts.mapObject,
                                                             _contexts.session.entityFactoryObject.MapObjectEntityFactory, self);
                result = SharedCommandHandler.ProcessCommands(message, _contexts, self);
            }
            return(result);
        }
示例#4
0
 private void OnModelInitialized(AbstractModel model)
 {
     UiModule.AddModel(model);
 }
示例#5
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;
            _clientSessionStateMachine.Dispose();
            FreePrefabLoader.Destroy();
            var _sessionObjects = _contexts.session.commonSession;

            _contexts.session.commonSession.Dispose();
            _contexts.session.clientSessionObjects.Dispose();

            if (_contexts.session.clientSessionObjects.NetworkChannel != null)
            {
                _contexts.session.clientSessionObjects.NetworkChannel.Dispose();
            }

            foreach (var info in _sessionObjects.GameContexts.AllContexts)
            {
                foreach (IGameEntity entity in info.GetEntities())
                {
                    foreach (var comp in entity.ComponentList)
                    {
                        if (comp is IAssetComponent)
                        {
                            ((IAssetComponent)comp).Recycle(_sessionObjects.AssetManager);
                        }
                    }

                    if (_sessionObjects.AssetManager != null)
                    {
                        _sessionObjects.AssetManager.LoadCancel(entity.RealEntity);
                    }
                    entity.Destroy();
                }
            }

            foreach (Entity entity in _contexts.ui.GetEntities())
            {
                DestroyEntity(_sessionObjects, entity);
            }


            foreach (Entity entity in _contexts.sceneObject.GetEntities())
            {
                DestroyEntity(_sessionObjects, entity);
            }

            _clientSessionStateMachine.ShutDown();
            try
            {
                _contexts.Reset();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("contexts.Reset error:{0}", ex.Message);
            }

            UiModule.DestroyAll();
            FreeUILoader.Destroy();
        }
示例#6
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;
            try
            {
                _clientSessionStateMachine.Dispose();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("_clientSessionStateMachine.Disposeerror:{0}", ex);
            }

            try
            {
                FreePrefabLoader.Destroy();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("FreePrefabLoader.Destroy(){0}", ex);
            }

            try
            {
                _contexts.session.commonSession.Dispose();
                _contexts.session.clientSessionObjects.Dispose();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat(" _contexts.session {0}", ex);
            }

            var _sessionObjects = _contexts.session.commonSession;

            try
            {
                if (_contexts.session.clientSessionObjects.NetworkChannel != null)
                {
                    _contexts.session.clientSessionObjects.NetworkChannel.Dispose();
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat(" _contexts.NetworkChannel {0}", ex);
            }


            RecycleEntitys(_contexts);

            try
            {
                _clientSessionStateMachine.ShutDown();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat(" _clientSessionStateMachine.ShutDown {0}", ex);
            }

            try
            {
                _contexts.Reset();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("contexts.Reset error:{0}", ex.Message);
            }

            try
            {
                UiModule.DestroyAll();
                FreeUILoader.Destroy();
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("contexts.Reset error:{0}", ex.Message);
            }
        }