internal static LocalTextReaderApplicationLayerMaster Instance(LocalComponent _component, Action disposedFunction, int fileModificationNotificationTimeout)
 {
     return(new LocalTextReaderApplicationLayerMaster(LocalProtocolParent.Instance(), _component, fileModificationNotificationTimeout)
     {
         m_DisposedCalled = disposedFunction
     });
 }
Пример #2
0
        public RheinwerkGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            IsMouseVisible        = true;

            Input             = new InputComponent(this);
            Input.UpdateOrder = 0;
            Components.Add(Input);

            Screen             = new ScreenComponent(this);
            Screen.UpdateOrder = 1;
            Screen.DrawOrder   = 2;
            Components.Add(Screen);

            Local             = new LocalComponent(this);
            Local.UpdateOrder = 2;
            Components.Add(Local);

            var client = new ClientComponent(this);

            Client             = client;
            client.UpdateOrder = 3;
            Components.Add(client);

            var server = new ServerComponent(this);

            Server             = server;
            server.UpdateOrder = 4;
            Components.Add(server);

            Simulation             = new SimulationComponent(this);
            Simulation.UpdateOrder = 5;
            Components.Add(Simulation);

            Scene             = new SceneComponent(this);
            Scene.UpdateOrder = 6;
            Scene.DrawOrder   = 0;
            Components.Add(Scene);

            Hud             = new HudComponent(this);
            Hud.UpdateOrder = 7;
            Hud.DrawOrder   = 1;
            Components.Add(Hud);

            Music             = new MusicComponent(this);
            Music.UpdateOrder = 8;
            Components.Add(Music);

            Sound             = new SoundComponent(this);
            Sound.UpdateOrder = 9;
            Components.Add(Sound);

            // Einstellungen laden
            Settings = Settings.LoadSettings();
        }
        public void DisposeTest()
        {
            int _disposedCalled = 0;

            using (LocalComponent _component = new LocalComponent())
            {
                m_Item2Test = LocalTextReaderApplicationLayerMaster.Instance(_component, () => _disposedCalled++, 10000);
            }
            Assert.AreEqual <int>(1, _disposedCalled);
        }
Пример #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent         = new PlayerComponent();
            LocalComponent          = new LocalComponent();
            RemoteComponent         = new RemoteComponent();
            PositionComponent       = new PositionComponent();
            MovementComponent       = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent         = new SpriteComponent();

            base.Initialize();
        }
Пример #5
0
        [Test, Ignore] // ignore as long as Shadow Object info is not support by data binary serialization
        public void TestCreateChildAsset()
        {
            // -------------------------
            // Init
            // -------------------------
            var localComponentDescriptor = TypeDescriptorFactory.Default.Find(typeof(LocalComponent));

            var baseAsset = new LocalAsset {
                Name = "base", Value = 1
            };

            baseAsset.Parameters.Set(LocalAsset.StringKey, "string");

            var component = new LocalComponent()
            {
                Name = "comp1", Position = Vector4.UnitX
            };

            component.SetOverride(localComponentDescriptor["Name"], OverrideType.Sealed);
            baseAsset.Parameters.Set(LocalAsset.ComponentKey, component);

            var baseAssetItem = new AssetItem("base1", baseAsset);

            // Create a child asset
            var newAsset = (LocalAsset)baseAssetItem.CreateChildAsset();

            // -------------------------
            // Check base asset
            // -------------------------
            Assert.NotNull(newAsset.Base);
            Assert.IsFalse(newAsset.Base.IsRootImport);
            Assert.AreEqual(baseAsset.Id, newAsset.Base.Id);

            // Check override on member "Name"
            var newComponent = newAsset.Parameters[LocalAsset.ComponentKey];
            var overrideType = newComponent.GetOverride(localComponentDescriptor["Name"]);

            Assert.AreEqual(OverrideType.Sealed, overrideType);
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory   = new AggregateFactory(this);
            WeaponFactory      = new WeaponFactory(this);
            DoorFactory        = new DoorFactory(this);
            RoomFactory        = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory        = new WallFactory(this);
            EnemyFactory       = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory         = new NPCFactory(this);

            // Initialize Components
            PlayerComponent          = new PlayerComponent();
            LocalComponent           = new LocalComponent();
            RemoteComponent          = new RemoteComponent();
            PositionComponent        = new PositionComponent();
            MovementComponent        = new MovementComponent();
            MovementSpriteComponent  = new MovementSpriteComponent();
            SpriteComponent          = new SpriteComponent();
            DoorComponent            = new DoorComponent();
            RoomComponent            = new RoomComponent();
            HUDSpriteComponent       = new HUDSpriteComponent();
            HUDComponent             = new HUDComponent();
            InventoryComponent       = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen    = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent       = new EquipmentComponent();
            WeaponComponent          = new WeaponComponent();
            BulletComponent          = new BulletComponent();
            PlayerInfoComponent      = new PlayerInfoComponent();
            WeaponSpriteComponent    = new WeaponSpriteComponent();
            StatsComponent           = new StatsComponent();
            EnemyAIComponent         = new EnemyAIComponent();
            NpcAIComponent           = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent   = new CollisionComponent();
            TriggerComponent     = new TriggerComponent();
            EnemyComponent       = new EnemyComponent();
            NPCComponent         = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager             = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent        = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent           = new SoundComponent();
            ActorTextComponent       = new ActorTextComponent();
            TurretComponent          = new TurretComponent();
            TrapComponent            = new TrapComponent();
            ExplodingDroidComponent  = new ExplodingDroidComponent();
            HealingStationComponent  = new HealingStationComponent();
            PortableShieldComponent  = new PortableShieldComponent();
            PortableStoreComponent   = new PortableStoreComponent();
            ActiveSkillComponent     = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();
            MatchingPuzzleComponent  = new MatchingPuzzleComponent();
            pI = new PlayerInfo();

            Quests = new List <Quest>();


            #region Initialize Effect Components
            AgroDropComponent          = new AgroDropComponent();
            AgroGainComponent          = new AgroGainComponent();
            BuffComponent              = new BuffComponent();
            ChanceToSucceedComponent   = new ChanceToSucceedComponent();
            ChangeVisibilityComponent  = new ChangeVisibilityComponent();
            CoolDownComponent          = new CoolDownComponent();
            DamageOverTimeComponent    = new DamageOverTimeComponent();
            DirectDamageComponent      = new DirectDamageComponent();
            DirectHealComponent        = new DirectHealComponent();
            FearComponent              = new FearComponent();
            HealOverTimeComponent      = new HealOverTimeComponent();
            PsiOrFatigueRegenComponent = new PsiOrFatigueRegenComponent();
            InstantEffectComponent     = new InstantEffectComponent();
            KnockBackComponent         = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent   = new ReduceAgroRangeComponent();
            ResurrectComponent         = new ResurrectComponent();
            StunComponent              = new StunComponent();
            TimedEffectComponent       = new TimedEffectComponent();
            EnslaveComponent           = new EnslaveComponent();
            CloakComponent             = new CloakComponent();
            #endregion

            base.Initialize();
        }
Пример #8
0
 public static void SetConfigPath(string path)
 {
     LocalHost        = new ConfigFileReader(path).ReadConfig();
     _localTaskRunner = new LocalComponent <TJob>(LocalHost.MachineId, LocalHost.MachineNumber);
 }
Пример #9
0
        public void TestAccessor()
        {
            // -------------------------
            // Init
            // -------------------------
            var localAssetDescriptor     = TypeDescriptorFactory.Default.Find(typeof(LocalAsset));
            var localComponentDescriptor = TypeDescriptorFactory.Default.Find(typeof(LocalComponent));
            var collectionDescriptor     = (DictionaryDescriptor)TypeDescriptorFactory.Default.Find(typeof(CustomParameterCollection));

            var baseAsset = new LocalAsset {
                Name = "base", Value = 1
            };

            baseAsset.Parameters.Set(LocalAsset.StringKey, "string");

            var component = new LocalComponent()
            {
                Name = "comp1", Position = Vector4.UnitX
            };

            component.SetOverride(localComponentDescriptor["Name"], OverrideType.Sealed);
            baseAsset.Parameters.Set(LocalAsset.ComponentKey, component);

            var baseAssetItem = new AssetItem("base1", baseAsset);

            // Create a child asset
            var newAsset     = (LocalAsset)baseAssetItem.CreateChildAsset();
            var newAssetItem = new AssetItem("new1", newAsset);

            // -------------------------
            // Setup project + assets
            // -------------------------
            var project = new Package();

            project.Assets.Add(baseAssetItem);
            project.Assets.Add(newAssetItem);
            var session = new PackageSession(project);

            // Create accessor on new item
            var accessor = new AssetItemAccessor(newAssetItem);

            var memberPath = new MemberPath();

            memberPath.Push(localAssetDescriptor["Parameters"]);
            memberPath.Push(collectionDescriptor, LocalAsset.ComponentKey);
            memberPath.Push(localComponentDescriptor["Name"]);

            // Get value for member path
            var memberValue = accessor.TryGetMemberValue(memberPath);

            Assert.IsTrue(memberValue.IsValid);
            Assert.AreEqual(OverrideType.Sealed, memberValue.Override);
            Assert.NotNull(memberValue.OverriderItem);
            Assert.AreEqual(baseAsset.Id, memberValue.OverriderItem.Id);

            memberPath.Pop();
            memberPath.Push(localComponentDescriptor["Position"]);

            // Get value for member path
            memberValue = accessor.TryGetMemberValue(memberPath);

            Assert.IsTrue(memberValue.IsValid);
            Assert.AreEqual(OverrideType.Base, memberValue.Override);
            Assert.NotNull(memberValue.OverriderItem);
            Assert.AreEqual(baseAsset.Id, memberValue.OverriderItem.Id);

            // Set Position as a new value
            newAsset.Parameters[LocalAsset.ComponentKey].SetOverride(localComponentDescriptor["Position"], OverrideType.New);
            memberValue = accessor.TryGetMemberValue(memberPath);

            Assert.IsTrue(memberValue.IsValid);
            Assert.AreEqual(OverrideType.New, memberValue.Override);
            Assert.IsNull(memberValue.OverriderItem);
        }
Пример #10
0
        public static ComponentJsonModel ToModel(this LocalComponent component)
        {
            if (component == null)
            {
                return(null);
            }

            var model = new ComponentJsonModel();

            if (component is LocalRowComponent rowComponent)
            {
                model.Type       = ComponentType.Row;
                model.Components = rowComponent.Components.Select(x => x.ToModel()).ToArray();
            }
            else if (component is LocalNestedComponent nestedComponent)
            {
                model.Disabled = Optional.Conditional(nestedComponent.IsDisabled, true);
                if (component is ILocalInteractiveComponent interactiveComponent)
                {
                    model.CustomId = interactiveComponent.CustomId;
                }

                if (component is LocalButtonComponentBase buttonComponentBase)
                {
                    model.Type  = ComponentType.Button;
                    model.Label = Optional.FromNullable(buttonComponentBase.Label);
                    model.Emoji = Optional.FromNullable(buttonComponentBase.Emoji.ToModel());

                    if (buttonComponentBase is LocalButtonComponent buttonComponent)
                    {
                        model.Style = (ButtonComponentStyle)buttonComponent.Style;
                    }
                    else if (buttonComponentBase is LocalLinkButtonComponent linkButtonComponent)
                    {
                        model.Style = ButtonComponentStyle.Link;
                        model.Url   = linkButtonComponent.Url;
                    }
                    else
                    {
                        throw new InvalidOperationException("Unknown local button component type.");
                    }
                }
                else if (component is LocalSelectionComponent selectionComponent)
                {
                    model.Type        = ComponentType.Selection;
                    model.Placeholder = Optional.FromNullable(selectionComponent.Placeholder);
                    model.MinValues   = Optional.FromNullable(selectionComponent.MinimumSelectedOptions);
                    model.MaxValues   = Optional.FromNullable(selectionComponent.MaximumSelectedOptions);
                    model.Options     = selectionComponent.Options.Select(x => x.ToModel()).ToArray();
                }
                else
                {
                    throw new InvalidOperationException("Unknown local nested component type.");
                }
            }
            else
            {
                throw new InvalidOperationException("Unknown local component type.");
            }

            return(model);
        }
 internal static LocalTextReaderApplicationLayerMaster Instance(int fileModificationNotificationTimeout)
 {
     return(new LocalTextReaderApplicationLayerMaster(LocalProtocolParent.Instance(), LocalComponent.Instance(), fileModificationNotificationTimeout));
 }
Пример #12
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }
Пример #13
0
 public EventArgs(EventTypeEnum eventType, LocalComponent other)
 {
     EventType = eventType;
     Other     = other;
 }
Пример #14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();

            base.Initialize();
        }
Пример #15
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();

            CharacterSelectionScreen = new CharacterSelectionScreen(graphics, this);

            LevelManager = new LevelManager(this);

            base.Initialize();
        }
Пример #16
0
 public void RemoveComponent(LocalComponent component)
 {
     World.RemoveComponentLazy(component);
 }