예제 #1
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            var aec = (AshyCore.EngineAPI.EngineCommands.AddEntity)c;
            var res = LevelCmdHelper.InitEntity(aec.Entity);

            return(res);
        }
예제 #2
0
        EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c)
        {
            var aec = (AshyCore.EngineAPI.EngineCommands.AddEntity)c;

            Engine.I.Level.Spawn(aec.Entity);
            return(EngineCommandResult.Success);
        }
예제 #3
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            Engine.I.DestroyWorld();
            Memory.Collect(showLog: true);

            return(EngineCommandResult.Success);
        }
예제 #4
0
        internal void Execute(IEngineCommand command)
        {
            EngineCommandContext ctx = new EngineCommandContext {
                Engine            = this,
                ConnectionManager = this._connectionManager
            };

            command.Execute(ctx);
        }
예제 #5
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            Memory.Collect(showLog: true);

            Engine.I.RenderTechnique?.Free();

            Engine.I.Status = EngineStatus.ReadyToUse;
            return(EngineCommandResult.Success);
        }
예제 #6
0
        public void CreateCommand(IEngineCommand command)
        {
            var commandExists = this.commands.Any(s => s.Id == command.Id);

            if (commandExists)
            {
                throw new Exception("This command already exists!");
            }

            this.commands.Add(command);
        }
예제 #7
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            if (Executers == null)
            {
                throw new NullReferenceException(nameof(c));
            }

            IEngineCommandHandler executer;

            Executers.TryGetValue(c.Type, out executer);

            return(executer?.Execute(c) ?? EngineCommandResult.Success);
        }
예제 #8
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            var ll       = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c;
            var scene    = new RenderingScene(ll.LoadingLevel.Entities);
            var isLoaded = Engine.I.RenderTechnique.Init(scene);

            if (isLoaded)
            {
                Engine.I.Status = EngineStatus.LoadedWorld;
            }

            return(isLoaded ? EngineCommandResult.Success : EngineCommandResult.Failed);
        }
예제 #9
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            var ll  = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c;
            var res = EngineCommandResult.Success;

            Engine.I.CreateWorld();

            foreach (var entity in ll.LoadingLevel.Entities)
            {
                res = LevelCmdHelper.InitEntity(entity).Worst(res);
            }

            return(res);
        }
예제 #10
0
        public EngineCommandResult Execute(IEngineCommand c)
        {
            CoreAPI.I.Game.Level.Entities
            .Where(e => e.HasComponent(ComponentType.Geom))
            .Select(e => e.Get <GeomComponent>(ComponentType.Geom).Mesh)
            .ForEach(m => m.Free());
            var result = LevelCommandsHelper.CollectResources();

            var aliveMeshes     = Mesh.HoldingData.Count(h => h.IsAlive);
            var aliveMeshesData = BufferDataDesctiption.HoldingData.Count(h => h.IsAlive);

            Engine.I.Log.Info($"Alive meshes: {aliveMeshes}, Alive meshes data: {aliveMeshesData}");

            return(result);
        }
예제 #11
0
        private EngineCommandResult ProcessCommand(IEngineCommand c)
        {
            var res = EngineCommandResult.Success;

            foreach (var h in _handlers)
            {
                res = h.Execute(c);
                Proxy.Core.Log.Info("[Proxy Command Processor]-- " + h.GetType().Name + " -- Command status: " + res);
                if (res == EngineCommandResult.CriticalFailed)
                {
                    break;
                }
            }

            return(res);
        }
예제 #12
0
        EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c)
        {
            try
            {
                var ll = (AshyCore.EngineAPI.EngineCommands.LoadLevel)c;
                Engine.I.Level = ll.LoadingLevel;
                Engine.I.Level.Load();
            }
            catch (Exception e)
            {
                GameAPI.I.Core.Log.Error("--- Load level command failed in AshyGame module ---", e);
#if DEBUG
                throw;
#else
                return(EngineCommandResult.CriticalFailed);
#endif
            }
            return(EngineCommandResult.Success);
        }
예제 #13
0
 public void AddCommand(IEngineCommand c)
 {
     ActiveCommands.Enqueue(c);
 }
예제 #14
0
 EngineCommandResult IEngineCommandHandler.Execute(IEngineCommand c)
 {
     Engine.I.Level = null;
     return(EngineCommandResult.Success);
 }
예제 #15
0
 public EngineCommandResult Execute(IEngineCommand c)
 {
     return(LevelCommandsHelper.CollectResources());
 }