Пример #1
0
        /// <summary>
        /// Creates all systems for visual debugging
        /// </summary>
        /// <returns></returns>
        private Systems CreateSystems()
        {
            var systems = new Systems();

            // Create Nested Systems
            systems.Add(CreateNestedSystems());

            // All System Types Combinations
            systems.Add(CreateAllTypesOfSystems());

            // Create Empty Systems
            systems.Add(CreateEmptySystems());

            // Duplicate systems added to same Feature
            systems.Add(CreateSameInstance());

            return(systems);
        }
        private static void AddSystem(PointsSystem system)
        {
            if (Systems.FirstOrDefault(s => s.Loyalty == system.Loyalty) != null)
            {
                return;
            }

            Systems.Add(system);
        }
Пример #3
0
        private void AddSystem(CraftSystem system)
        {
            if (Systems == null)
            {
                Systems = new List <CraftSystem>();
            }

            Systems.Add(system);
        }
Пример #4
0
        /// <summary>
        /// Registers an <see cref="ISharperSystem{T}"/> to the Game. This should not be called from external code.
        /// </summary>
        /// <param name="system">The target system to register.</param>
        public void RegisterSystem(ISharperSystem <BaseSharperComponent> system)
        {
            if (Systems.Contains(system) || Systems.Any(x => x.GetType() == system.GetType()))
            {
                throw new DuplicateSharperObjectException();
            }

            Systems.Add(system);
        }
Пример #5
0
        public MainMenuScene() : base(Woofer.Controller)
        {
            Systems.Add(new MenuSystem());

            ISoundEffect music = Controller.AudioUnit["bgm"];

            music.Looping = true;
            music.Volume  = 0.4f;
            music.PlayAsMusic();
        }
    void Awake()
    {
        var contexts = Contexts.sharedInstance;

        contexts.game.SetGlobals(playerPrefab, enemyPrefab, shotPrefab, enemyCountText);

        systems = new Systems();
        systems.Add(new DeathSystem(contexts));
        systems.Add(new PlayerInstantiateSystem(contexts));
        systems.Add(new ShotInstantiateSystem(contexts));
        systems.Add(new EnemyInstantiateSystem(contexts));
        systems.Add(new ShotMovementSystem(contexts));
        systems.Add(new ShotCollisionSystem(contexts));
        systems.Add(new EnemyMovementSystem(contexts));
        systems.Add(new PlayerInputSystem(contexts));
        systems.Add(new ViewDestroySystem(contexts));
        systems.Add(new TransformApplySystem(contexts));
        systems.Initialize();
    }
Пример #7
0
 public void RegisterSystem(BaseSystem system)
 {
     if (Systems.Contains(system))
     {
         System.Diagnostics.Debug.WriteLine($"System of type {system.GetType()} already registered.");
     }
     else
     {
         Systems.Add(system);
     }
 }
Пример #8
0
 protected override void AddAssetSystems()
 {
     foreach (var systype in AssetWindowConfig.LoadSystems)
     {
         IAssetBundleSystem sys = System.Activator.CreateInstance(systype) as IAssetBundleSystem;
         if (sys != null)
         {
             Systems.Add(sys);
         }
     }
 }
        /// <summary>
        /// Creates all systems for visual debugging
        /// </summary>
        /// <returns></returns>
        private Systems CreateSystems()
        {
            var systems = new Systems();

            // Create Nested Systems
            systems.Add(CreateNestedSystems());

            // All System Types Combinations
            systems.Add(CreateAllTypesOfSystems());

            // Create Empty Systems
            systems.Add(CreateEmptySystems());

            // Duplicate systems added to same Feature
            systems.Add(CreateSameInstance());

            // Add per-context cleanup systems
            systems.Add(new VisualDebugCleanupFeature());

            return(systems);
        }
Пример #10
0
        /// <summary>
        /// 初始化助手
        /// </summary>
        public void OnInitialization()
        {
            List <Type> types = ReflectionToolkit.GetTypesInRunTimeAssemblies(type =>
            {
                return(type.IsSubclassOf(typeof(ECS_System)));
            });

            for (int i = 0; i < types.Count; i++)
            {
                Systems.Add(types[i], Activator.CreateInstance(types[i]) as ECS_System);
            }
        }
Пример #11
0
 /// <summary>
 /// Adds the given <see cref="TransitionSystem"/> to <see cref="Systems"/>.
 /// </summary>
 public bool AddSystem(TransitionSystem system)
 {
     lock (locker)
     {
         bool success = Systems.Add(system);
         if (success)
         {
             IndexSystems();
         }
         return(success);
     }
 }
Пример #12
0
        private void                                    Start(  )
        {
            Contexts.sharedInstance = new Contexts(  );
            _contexts = Contexts.sharedInstance;

            _systems = new Systems(  );
            _systems.Add(
                new HelloSystem(_contexts)
                );

            _systems.Initialize(  );
            StartCoroutine(ClonePrototypes(  ));
        }
Пример #13
0
        public Systems GetSystems()
        {
            Check();

            Systems result = new Systems();

            foreach (var system in systems)
            {
                result.Add(system);
            }

            return(result);
        }
Пример #14
0
        public void AddSystem(ISystem system)
        {
            var applicableHandlers = ConventionalSystemHandlers
                                     .Where(handler => handler.CanHandleSystem(system))
                                     .OrderByPriority();

            foreach (var handler in applicableHandlers)
            {
                handler.SetupSystem(system);
            }

            Systems.Add(system);
        }
    // Use this for initialization
    void Start()
    {
        var contexts = Contexts.sharedInstance;

        _systems = CreateSystems(contexts);
        var logicSystems = CreateLogicSystems(contexts);

        _systems.Add(logicSystems);

        contexts.game.SetLogicSystem(logicSystems);

        _systems.Initialize();
    }
Пример #16
0
    // Use this for initialization
    private void Start()
    {
        var contexts = Contexts.sharedInstance;

        p1entity = contexts.game.CreateEntity();
        p1entity.AddResource(gameSetup.player1);
        p1gameObj = Instantiate(p1entity.resource.prefab);
        p1entity.AddPosition(p1gameObj.transform.position.x, 0);
        p1entity.AddVelocity(0, 0);

        p2entity = contexts.game.CreateEntity();
        p2entity.AddResource(gameSetup.player2);
        p2gameObj = Instantiate(p2entity.resource.prefab);
        p2entity.AddPosition(p2gameObj.transform.position.x, 0);
        p2entity.AddVelocity(0, 0);

        ballEntity = contexts.game.CreateEntity();
        ballEntity.AddResource(gameSetup.ball);
        ballGameObj = Instantiate(ballEntity.resource.prefab);
        ballEntity.AddPosition(0, 0);
        ballEntity.AddVelocity(0.05f, 0);



        contexts.game.SetGameSetup(gameSetup);


        _systems = new Feature("Game");


        //make a new hello world system
        _systems.Add(new HelloWorldSystem());
        _systems.Add(new InitializePlayerSystem(contexts));
        _systems.Add(new AddVelocityToPositionSystem(contexts));
        _systems.Add(new WorldWrapSystem(contexts));

        _systems.Initialize();
    }
        private async Task LoadSystemsStatuses(bool refresh)
        {
            var systems = await SystemStatusManager.Instance.LoadSystemsStatuses(refresh);

            Systems.Clear();

            if (!systems.IsNullOrEmpty())
            {
                foreach (var system in systems)
                {
                    Systems.Add(system);
                }
            }
        }
            public void AddSystemInfluence(long systemAddress, int amount, ulong missionId)
            {
                SystemInfluence si;

                if (!Systems.TryGetValue(systemAddress, out si))
                {
                    si = new SystemInfluence(systemAddress, amount, missionId);
                    Systems.Add(systemAddress, si);
                }
                else
                {
                    si.AddInfluence(amount, missionId);
                }
            }
Пример #19
0
        public LevelSelect() : base(Woofer.Controller)
        {
            Systems.Add(new EditorInputSystem());

            Systems.Add(new TextInputSystem());
            Systems.Add(new EnumerationSelectViewSystem());

            Systems.Add(new BackToMainMenuSystem());

            Systems.Add(new ModalFocusSystem()
            {
                CurrentSystem = "back_to_menu"
            });
        }
Пример #20
0
        /// <summary>
        /// Creates a system and all of its needed directories and settings for hyperspin to work.
        /// </summary>
        /// <param name="systemName">Name of the system.</param>
        /// <param name="existingDb">if set to <c>true</c> [existing database].</param>
        /// <returns></returns>
        public async Task <bool> CreateSystem(string systemName, string existingDb = "", string mainmenuName = "")
        {
            if (!await _systemCreator.CreateSystem(systemName, existingDb))
            {
                return(false);
            }

            Systems.Add(new MenuItemViewModel(new MainMenu(systemName, 1)));

            _hsSerializer = new HyperspinSerializer(_hyperspinFrontEnd.Path, systemName, mainmenuName);
            await SaveCurrentSystemsListToXmlAsync(mainmenuName, false);

            return(true);
        }
Пример #21
0
        protected override void LoadContent()
        {
            context = new Context();
            systems = new Systems();
            systems
            .Add(new EntitySpawnSystem(context, Window.ClientBounds.Width, Window.ClientBounds.Height))
            .Add(new InputSystem(context))
            .Add(new BoundsSystem(context, Window))
            .Add(new MovementSystem(context))
            .Add(new CollisionSystem(context, Window.ClientBounds.Width, Window.ClientBounds.Height))
            .Add(new RenderSystem(GraphicsDevice, context));

            systems.Initialize();
        }
Пример #22
0
    void Awake()
    {
        var context = Contexts.sharedInstance;

        context.game.SetGlobals(shotPrefab);

        systems = new Systems();
        systems.Add(new DeathSystem(context));
        systems.Add(new PrefabInstantiateSystem(context));
        systems.Add(new PlayerInputSystem(context));
        systems.Add(new ForwardMovementSystem(context));
        systems.Add(new ShotCollisionSystem(context));
        systems.Add(new PlayerCollisionSystem(context));
        systems.Add(new TransformApplySystem(context));
        systems.Add(new ViewDestroySystem(context));
        systems.Initialize();
    }
Пример #23
0
        private void                                    Systems_Add(  )
        {
            if (SystemGuids.Count == 0)
            {
                throw new Exception("No GUIDs provided in setting `SystemGuids`");
            }

            var systems = GetSystemsOrdered(  );

            SystemsOrdered = systems;
            foreach (var system in systems)
            {
                Systems.Add(system);
            }
        }
Пример #24
0
        public SystemsSetup InputSystems()
        {
            _systems
            .Add(_pool.CreateSystem <PlayerRestartSystem>())
            .Add(_pool.CreateSystem <ReturnToPreviousViewSystem>())
            .Add(_pool.CreateSystem <RotateCameraInputSystem>())
            .Add(_pool.CreateSystem <HeroInputSystem>())
            .Add(_pool.CreateSystem <PerformInputQueueSystem>());

            return(this);
        }
Пример #25
0
        /// <summary>
        /// Gets the Anom data for the specified system, creates it if it doesn't exist
        /// </summary>
        /// <param name="sysName">Name of the System</param>
        /// <returns>Anom Data</returns>
        public AnomData GetSystemAnomData(string sysName)
        {
            AnomData ret;

            if (Systems.Keys.Contains(sysName))
            {
                ret = Systems[sysName];
            }
            else
            {
                ret            = new AnomData();
                ret.SystemName = sysName;
                Systems.Add(sysName, ret);
            }

            return(ret);
        }
        /// <summary>
        /// Finds contained systems.
        /// </summary>
        /// <param name="ifcRelHandle">The relation handle.</param>
        void ProcessIFCRelServicesBuildings(IFCAnyHandle ifcRelHandle)
        {
            IFCAnyHandle relatingSystem = IFCAnyHandleUtil.GetInstanceAttribute(ifcRelHandle, "RelatingSystem");

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatingSystem))
            {
                Importer.TheLog.LogMissingRequiredAttributeError(ifcRelHandle, "RelatingSystem", false);
                return;
            }

            IFCSystem system = IFCSystem.ProcessIFCSystem(relatingSystem);

            if (system != null)
            {
                Systems.Add(system);
            }
        }
Пример #27
0
        public void Execute()
        {
            var filename = GlobalAppSettings.DataFileName;

            if (filename == null)
            {
                Status = LoadStatus.FileNameIsEmpty;
                throw new ArgumentException("Не указан путь к файлу для загрузки");
            }

            if (!File.Exists(filename))
            {
                Status = LoadStatus.FileNotExists;
                throw new ArgumentException("Указанный файл не существует");
            }

            try
            {
                var lines = File.ReadAllLines(filename);
                Systems.Clear();

                foreach (var line in lines)
                {
                    var arr  = line.Split('|');
                    var item = new InformationSystem
                    {
                        OperationSystem = arr[0],
                        Database        = arr[1],
                        RamAmount       = int.Parse(arr[2]),
                        MemoryAmount    = int.Parse(arr[3]),
                        Cost            = int.Parse(arr[4])
                    };

                    Systems.Add(item);
                }
                Status = LoadStatus.Success;
            }
            catch (Exception e)
            {
                Status = LoadStatus.GeneralError;
                Logger.Log(e);
                throw;
            }
        }
Пример #28
0
        /// <summary>
        /// Creates the multi system.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        public Task <bool> CreateMultiSystem(MultiSystemOptions options)
        {
            IMediaCopier mc = new MediaCopier(_hyperspinFrontEnd);

            _hsSerializer = new HyperspinSerializer(_hyperspinFrontEnd.Path, options.MultiSystemName, "");
            IMultiSystem ms    = new MultiSystem(_hsSerializer, _systemCreator, mc, options);
            var          games = MultiSystemGamesList.Select(x => x.Game);

            if (!Systems.Any(x => x.Name == options.MultiSystemName))
            {
                Systems.Add(new MenuItemViewModel(new MainMenu(options.MultiSystemName, 1)));
            }

            //Group the games because we can't have duplicate romnames in the database.
            var filteredGames = games.GroupBy(x => x.RomName).Select(grp => grp.First());

            return(ms.CreateMultiSystem(filteredGames
                                        , _hyperspinFrontEnd.Path, _settingsRepo.HypermintSettings.RlPath));
        }
        public void SystemsDeactivatesSystemsRecursively()
        {
            var system = CreateReactiveSystem(_ctx);

            _systems.Add(system);

            var parentSystems = new Systems();

            parentSystems.Add(_systems);

            parentSystems.Initialize();

            Assert.AreEqual(1, system.DidInitialize);

            parentSystems.Deactivate();
            parentSystems.Update();

            Assert.AreEqual(0, system.DidExecute);
        }
Пример #30
0
        public GameContext(IEnumerable <ISystem> systems, IEnumerable <ISystem> renderingSystems, IBaseGuiScreen contextScreen)
        {
            if (systems != null && systems.Any())
            {
                foreach (var system in systems)
                {
                    Systems.Add(system);
                }
            }
            if (renderingSystems != null && renderingSystems.Any())
            {
                foreach (var system in renderingSystems)
                {
                    RenderingSystems.Add(system);
                }
            }

            ContextScreen = contextScreen;
        }