Example #1
0
	// Use this for initialization
	void Start () {
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();

		sysPrp.gameClearFlag = false;

		totalScoreBuff = 100;
		for (int i = 0; i < partySize; i++) {
			totalScoreBuff += partyMember[i].GetComponent<CharaPanel>().scoreBuff;
		}
		for (int i = 0; i < numOfType; i++) {
			totalPanelBuff [i] = 100;
			for (int j = 0; j < partySize; j++) {
				totalPanelBuff [i] += partyMember [j].GetComponent<CharaPanel> ().panelBuff [i];
			}
		}

		currentScore = 0;
		scoreText = scoreObj.GetComponent<Text> ();
		scoreText.text = currentScore.ToString ("###0");
		for (int i = 0; i < numOfType; i++) {
			currentPanelScore [i] = 0;
			panelScoreText[i] = panelScoreObj[i].GetComponent<Text>();
			panelScoreText[i].text = currentPanelScore[i].ToString("###0");
		}
		countdownObj.SetActive (true);
		countdownText = countdownObj.GetComponent<Text> ();
		timerText = timer.GetComponent<Text> ();
		timerText.text = timeLimit.ToString("#0.0");
		for(int i = 0; i < 2; i++){
			touchedPanel[i] = dummyPanel;
		}
		SetArray (0, 0, panel_Row - 1, panel_Column - 1);
		StartCoroutine("CountDown");
	}
    void Start()
    {
        Random.seed = 42;

        _systems = createSystems(Pools.core);
        _systems.Start();
    }
Example #3
0
 public static Base Parse(Systems.Client client, Systems.Server server)
 {
     return new UpdateSector(
         client.Reader.ReadInt32(),
         client.Reader.ReadInt32(),
         client);
 }
Example #4
0
 public EntityUpdate(Entity entity, Entity changes, bool join, Systems.Client client)
     : base(client)
 {
     this.Entity = entity;
     this.Changes = changes;
     this.IsJoin = join;
 }
    void Start()
    {
        Random.seed = 42;

        _systems = createSystems(Pools.pool);
        _systems.Initialize();
    }
Example #6
0
	// Use this for initialization
	void Start () {
		sysPrp = GameObject.Find ("Systems").GetComponent<Systems> ();

		normaScoreText = normaScoreObj.GetComponent<Text> ();
		resultScoreText = resultScoreObj.GetComponent<Text> ();
		resultTextText = resultTextObj.GetComponent<Text> ();
		for (int i = 0; i < numOfType; i++) {
			normaPanelText [i] = normaPanelObj [i].GetComponent<Text> ();
			resultPanelText [i] = resultPanelObj [i].GetComponent<Text> ();
		}

		normaScoreText.text = sysPrp.normaScore.ToString ("0");
		resultScoreText.text = sysPrp.resultScore.ToString ("0");
		for (int i = 0; i < numOfType; i++) {
			normaPanelText [i].text = sysPrp.normaPanel [i].ToString ("0");
			resultPanelText [i].text = sysPrp.resultPanel [i].ToString ("0");
		}
		if (sysPrp.gameClearFlag) {
			resultTextText.text = "YOU WIN!";
		} else {
			resultTextText.text = "YOU LOSE...";
		}

		normaScoreObj.SetActive (false);
		resultScoreObj.SetActive (false);
		resultTextObj.SetActive (false);
		for (int i = 0; i < numOfType; i++) {
			normaPanelObj [i].SetActive (false);
			resultPanelObj [i].SetActive (false);
		}

		StartCoroutine ("ShowText");
	}
 void Start() {
     _pool = new Pool(ComponentIds.TotalComponents, 0, new PoolMetaData("Systems Pool", ComponentIds.componentNames));
     new PoolObserver(_pool, ComponentIds.componentTypes);
     _systems = createNestedSystems();
     _systems.Initialize();
     _pool.CreateEntity().AddMyString("");
 }
 void Start()
 {
     _pool = new Pool(ComponentIds.TotalComponents);
     _systems = createSystems();
     _systems.Start();
     _pool.CreateEntity().AddMyString("");
 }
Example #9
0
 public Command(string connectionString, string commandText, Systems.IOSystem ioSystem, bool noTimeout)
 {
     _connectionString = connectionString;
     _commandText = commandText;
     _ioSystem = ioSystem;
     _noTimeOut = noTimeout;
 }
    static Systems CreateSystems(Pool pool)
    {
        Systems systems;

        #if (UNITY_EDITOR)
        systems = new DebugSystems();
        #else
        systems = new Systems();
        #endif

        systems
            .Add(pool.CreateGameStartSystem())
            .Add(pool.CreateGameOverSystem())

            .Add(pool.CreateGameBoardCacheSystem())
            .Add(pool.CreateCreateGameBoardSystem())

            .Add(pool.CreateTurnSystem())
            .Add(pool.CreateInputSystem())
            .Add(pool.CreateAIMoveSystem())

            .Add(pool.CreateExitSystem())
            .Add(pool.CreateFoodSystem())
            .Add(pool.CreateDestructibleSystem())

            // Render
            .Add(pool.CreateAnimationSystem())
            .Add(pool.CreateDamageSpriteSystem())
            .Add(pool.CreateRemoveViewSystem())
            .Add(pool.CreateAddViewSystem())
            .Add(pool.CreateRenderPositionSystem())
            .Add(pool.CreateSmoothMoveSystem());

        return systems;
    }
Example #11
0
	void Start () {
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		sysChr = sys.GetComponent<Chara> ();
		numChara = sysPrp.party [partyNo];
		typeChara = numChara / 100;
		noChara = numChara % 100;
		scoreBuff = sysChr.scoreBuffs [typeChara] [noChara];
		for (int i = 0; i < numOfType; i++) {
			panelBuff [i] = sysChr.panelBuffs [typeChara] [noChara, i];
		}
		switch (typeChara) {
		case 0:
			spriteChara = sysChr.bluetypeSprites[noChara];
			break;
		case 1:
			spriteChara = sysChr.redtypeSprites[noChara];
			break;
		case 2:
			spriteChara = sysChr.yellowtypeSprites[noChara];
			break;
		}

		charaTexture = transform.gameObject.GetComponent<SpriteRenderer> ();
		charaTexture.sprite = spriteChara;
	}
Example #12
0
            public static Base Parse(Systems.Client client, Systems.Server server)
            {
                NetReader reader = client.Reader;
                var shoot = new Shoot(client);

                shoot.EntityID = reader.ReadUInt64();
                shoot.ChunkX = reader.ReadInt32();
                shoot.ChunkY = reader.ReadInt32();
                shoot.something5 = reader.ReadUInt32();
                reader.ReadBytes(4);
                shoot.Position = reader.ReadQVector3();
                shoot.something13 = reader.ReadUInt32();
                shoot.something14 = reader.ReadUInt32();
                shoot.something15 = reader.ReadUInt32();
                shoot.Velocity = reader.ReadVector3();
                shoot.something19 = reader.ReadSingle();
                shoot.something20 = reader.ReadSingle();
                shoot.something21 = reader.ReadSingle();
                shoot.something22 = reader.ReadSingle();
                shoot.something23 = reader.ReadUInt32();
                shoot.something24 = reader.ReadByte();
                reader.ReadBytes(3);
                shoot.something25 = reader.ReadUInt32();
                shoot.something26 = reader.ReadByte();
                reader.ReadBytes(3);
                shoot.something27 = reader.ReadUInt32();
                shoot.something28 = reader.ReadUInt32();

                return shoot;
            }
 void Start() {
     _pool = new Pool(ComponentIds.TotalComponents);
     new PoolObserver(_pool, ComponentIds.componentNames, ComponentIds.componentTypes, "Systems Pool");
     _systems = createSystems();
     _systems.Initialize();
     _pool.CreateEntity().AddMyString("");
 }
    void Start()
    {
        Random.seed = 42;

        var pool = Pools.core;
        _systems = createSystems(pool);
        _systems.Start();
    }
Example #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="housingSystem"></param>
 /// <param name="cap"></param>
 public Place(Systems.PlaceTransitionNet housingSystem, Marking.Capacity cap)
     : base((Systems.NetSystem)housingSystem)
 {
     Type = Nodes.Node.NodeType.PLACE;
     Marking = 0;
     Capacity = cap;
     placeID = housingSystem.AddPlace(this);
 }
Example #16
0
	// Use this for initialization
	void Start () {
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		scoreText = scoreObj.GetComponent<Text> ();
		for (int i = 0; i < numOfType; i++) {
			panelText [i] = panelObj [i].GetComponent<Text> ();
		}
	}
    void Start()
    {
        systems = new Systems()
          .Add(pool.CreateSystem<AddViewSystem>())
          .Add(pool.CreateSystem<RenderPositionSystem>())
          .Add(pool.CreateSystem<RenderRotationSystem>());

        AddInitialDiscs();
    }
Example #18
0
	void Start()
	{
		Pools.pool.DestroyAllEntities();
		
		_systems = createSystems(Pools.pool);
		_systems.Start();
		
		Pools.pool.StartGame();
	}
Example #19
0
	void Start (){
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		button = transform.gameObject.GetComponent<Button>();
		if (stageNo <= sysPrp.openedStage) {
			button.interactable = true;
		} else {
			button.interactable = false;
		}
	}
Example #20
0
            public static Base Parse(Systems.Client client, Systems.Server Server)
            {
                int length = client.Reader.ReadInt32();
                string message = Encoding.Unicode.GetString(client.Reader.ReadBytes(length * 2));

                if (message.Length > 250)
                    message = message.Substring(0, 250);

                return new ChatMessage(message, client);
            }
    void Start()
    {
        if (useSeed)
        {
            Random.seed = randomSeed;
        }

        Debug.Log("Starting GameController using seed " + Random.seed);
        systems = CreateSystems(Pools.pool);
        systems.Initialize();
    }
Example #22
0
        public Command(int connectionIndex, string commandText, List<KeyValuePair<string, object>> parametersList, Systems.IOSystem ioSystem, bool noTimeout)
        {
            _connectionString = ioSystem.Connection(connectionIndex).ConnectionString;
            _commandText = commandText;
            _ioSystem = ioSystem;
            _isStoredProcedure = true;
            _noTimeOut = noTimeout;

            if (parametersList != null)
                _parametersList = parametersList;
        }
Example #23
0
	// Use this for initialization
	void Start () {
		playedGachaFlag = true;
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		sysChr = sys.GetComponent<Chara> ();
		newCharaTexture = newCharaobj.GetComponent<SpriteRenderer> ();
		scoreBuffText = scoreBuffObj.GetComponent<Text> ();
		for (int i = 0; i < numOfType; i++) {
			panelBuffText[i] = panelBuffObj [i].GetComponent<Text> ();
		}
	}
Example #24
0
        public Command(int connectionIndex, string commandText, Systems.IOSystem ioSystem, bool noTimeout)
        {
            try
            {
                _connectionString = ioSystem.Connection(connectionIndex).ConnectionString;
                _commandText = commandText;
                _ioSystem = ioSystem;
                _noTimeOut = noTimeout;
            }
            catch
            {

            }
        }
Example #25
0
        public Arc(Nodes.Node fromNode, Nodes.Node toNode, Systems.PlaceTransitionNet housingSystem)
            : base()
        {
            SortNodes();

            if (!IsAllowed())
            {
                throw new System.Exception("Arc " + arcID + " not allowed!");
            }

            fromNode.AddArc(this);
            toNode.AddArc(this);
            arcID = housingSystem.AddElement(this);
        }
Example #26
0
 public static Base Parse(Systems.Client client, Systems.Server server)
 {
     Item Item = new Item();
     Item.Read(client.Reader);
     return new Interact(client)
     {
         Item = Item,
         ChunkX = client.Reader.ReadInt32(),
         ChunkY = client.Reader.ReadInt32(),
         ItemIndex = client.Reader.ReadInt32(),
         Something4 = client.Reader.ReadUInt32(),
         InteractType = (InteractType)client.Reader.ReadByte(),
         Something6 = client.Reader.ReadByte(),
         Something7 = client.Reader.ReadUInt16()
     };
 }
Example #27
0
 public SaveFormatDialog(Systems system)
 {
     InitializeComponent();
     switch (system)
     {
         case Systems.Dreamcast:
             systemDreamcast.Checked = true;
             break;
         case Systems.GameCube:
             systemGamecube.Checked = true;
             break;
         case Systems.PC:
             systemPC.Checked = true;
             break;
         case Systems.Steam:
             systemSteam.Checked = true;
             break;
     }
 }
Example #28
0
            public static Base Parse(Systems.Client client, Systems.Server server)
            {
                var hit = new Hit(client);

                hit.EntityID = client.Reader.ReadUInt64();
                hit.TargetID = client.Reader.ReadUInt64();
                hit.Damage = client.Reader.ReadSingle();
                hit.Critical = client.Reader.ReadByte();
                client.Reader.ReadBytes(3);
                hit.StunDuration = client.Reader.ReadUInt32();
                hit.Something8 = client.Reader.ReadUInt32();
                hit.Position = client.Reader.ReadQVector3();
                hit.HitDirection = client.Reader.ReadVector3();
                hit.Skill = client.Reader.ReadByte();
                hit.HitType = client.Reader.ReadByte();
                hit.ShowLight = client.Reader.ReadByte();
                client.Reader.ReadBytes(1);
                return hit;
            }
Example #29
0
            public static Base Parse(Systems.Client client, Systems.Server server)
            {
                int length = client.Reader.ReadInt32();

                byte[] compressedData = client.Reader.ReadBytes(length);
                byte[] maskedData = Systems.zlibscript.Uncompress(compressedData);

                Entity entity;

                using (var ms = new MemoryStream(maskedData))
                using (var br = new BinaryReader(ms))
                {
                    ulong id = br.ReadUInt64();

                    if (id != client.ID)
                        throw new NotImplementedException();

                    if (client.Entity == null)
                    {
                        entity = new Entity();

                        client.Entity = entity;
                        entity.ID = client.ID;
                        //server.World.Entities[client.ID] = client.Entity;

                        entity.ReadByMask(br);

                        return new EntityUpdate(client.Entity, client.Entity, true, client);
                    }
                    else
                    {
                        //entity = server.World.Entities[id];

                        Entity changes = new Entity();
                        changes.ReadByMask(br);

                        return new EntityUpdate(client.Entity, changes, false, client);
                    }
                }
            }
    static Systems CreateSystems(Pool pool)
    {
        Systems systems;

        #if (UNITY_EDITOR)
        systems = new DebugSystems();
        #else
        systems = new Systems();
        #endif

        systems
            .Add(pool.CreateSystem<CoroutineSystem>())
            .Add(pool.CreateSystem<GameStartSystem>())
            .Add(pool.CreateSystem<GameOverSystem>())

            .Add(pool.CreateSystem<GameBoardCacheSystem>())
            .Add(pool.CreateSystem<CreateGameBoardSystem>())

            .Add(pool.CreateSystem<TurnSystem>())
            .Add(pool.CreateSystem<InputSystem>())
            .Add(pool.CreateSystem<AIMoveSystem>())

            .Add(pool.CreateSystem<ExitSystem>())
            .Add(pool.CreateSystem<FoodSystem>())
            .Add(pool.CreateSystem<DestructibleSystem>())

            // Render
            .Add(pool.CreateSystem<AnimationSystem>())
            .Add(pool.CreateSystem<DamageSpriteSystem>())
            .Add(pool.CreateSystem<RemoveViewSystem>())
            .Add(pool.CreateSystem<AddViewSystem>())
            .Add(pool.CreateSystem<RenderPositionSystem>())
            .Add(pool.CreateSystem<SmoothMoveSystem>());

        return systems;
    }
Example #31
0
 public static void HandleQuest(Mobile from, Server.Engines.Quests.BaseQuest quest)
 {
     Systems.ForEach(s => s.ProcessQuest(from, quest));
 }
Example #32
0
 public void InvokeSystems() => Systems.ForEach(a => a.Invoke(Entities));
Example #33
0
    void Start()
    {
        Systems.New <TestGameViewSystem>();

        var palm = Entity.FromID("palm01").AddComponent <GameView>();
    }
 public void Setup()
 {
     _ctx     = new MyTestContext();
     _systems = new Systems();
 }
Example #35
0
    void when_systems()
    {
        Pool pool = null;

        before = () => {
            pool = new Pool(10);
        };

        context["fixtures"] = () => {
            it["initializes InitializeSystemSpy"] = () => {
                var system = new InitializeSystemSpy();
                system.didInitialize.should_be(0);
                system.Initialize();
                system.didInitialize.should_be(1);
            };

            it["executes ExecuteSystemSpy"] = () => {
                var system = new ExecuteSystemSpy();
                system.didExecute.should_be(0);
                system.Execute();
                system.didExecute.should_be(1);
            };

            it["cleans up CleanupSystemSpy"] = () => {
                var system = new CleanupSystemSpy();
                system.didCleanup.should_be(0);
                system.Cleanup();
                system.didCleanup.should_be(1);
            };

            it["tears down TearDownSystemSpy"] = () => {
                var system = new TearDownSystemSpy();
                system.didTearDown.should_be(0);
                system.TearDown();
                system.didTearDown.should_be(1);
            };

            it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => {
                var system = new InitializeExecuteCleanupTearDownSystemSpy();

                system.didInitialize.should_be(0);
                system.Initialize();
                system.didInitialize.should_be(1);

                system.didExecute.should_be(0);
                system.Execute();
                system.didExecute.should_be(1);

                system.didCleanup.should_be(0);
                system.Cleanup();
                system.didCleanup.should_be(1);

                system.didTearDown.should_be(0);
                system.TearDown();
                system.didTearDown.should_be(1);
            };

            it["executes ReactiveSystemSpy"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                system.Execute();

                spy.entities.Length.should_be(1);
            };
        };

        context["systems"] = () => {
            Systems systems = null;

            before = () => {
                systems = new Systems();
            };

            it["returns systems when adding system"] = () => {
                systems.Add(new InitializeSystemSpy()).should_be_same(systems);
            };

            it["initializes IInitializeSystem"] = () => {
                var system = new InitializeSystemSpy();
                systems.Add(system);
                systems.Initialize();
                system.didInitialize.should_be(1);
            };

            it["executes IExecuteSystem"] = () => {
                var system = new ExecuteSystemSpy();
                systems.Add(system);
                systems.Execute();
                system.didExecute.should_be(1);
            };

            it["cleans up ICleanupSystem"] = () => {
                var system = new CleanupSystemSpy();
                systems.Add(system);
                systems.Cleanup();
                system.didCleanup.should_be(1);
            };

            it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => {
                var system = new InitializeExecuteCleanupTearDownSystemSpy();
                systems.Add(system);

                system.didInitialize.should_be(0);
                systems.Initialize();
                system.didInitialize.should_be(1);

                system.didExecute.should_be(0);
                systems.Execute();
                system.didExecute.should_be(1);

                system.didCleanup.should_be(0);
                systems.Cleanup();
                system.didCleanup.should_be(1);

                system.didTearDown.should_be(0);
                systems.TearDown();
                system.didTearDown.should_be(1);
            };

            it["initializes, executes, cleans up and tears down ReactiveSystem"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                systems.Add(system);

                spy.didInitialize.should_be(0);
                systems.Initialize();
                spy.didInitialize.should_be(1);

                spy.didExecute.should_be(0);
                systems.Execute();
                systems.Execute();
                spy.didExecute.should_be(1);

                spy.didCleanup.should_be(0);
                systems.Cleanup();
                spy.didCleanup.should_be(1);

                spy.didTearDown.should_be(0);
                systems.TearDown();
                spy.didTearDown.should_be(1);
            };


            it["initializes, executes, cleans up and tears down systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                systems.Add(system);

                var parentSystems = new Systems();
                parentSystems.Add(systems);

                spy.didInitialize.should_be(0);
                parentSystems.Initialize();
                spy.didInitialize.should_be(1);

                spy.didExecute.should_be(0);
                parentSystems.Execute();
                parentSystems.Execute();
                spy.didExecute.should_be(1);

                spy.didCleanup.should_be(0);
                parentSystems.Cleanup();
                spy.didCleanup.should_be(1);

                spy.didTearDown.should_be(0);
                parentSystems.TearDown();
                spy.didTearDown.should_be(1);
            };

            it["clears reactive systems"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                systems.Add(system);

                systems.Initialize();
                spy.didInitialize.should_be(1);

                systems.ClearReactiveSystems();
                systems.Execute();
                spy.didExecute.should_be(0);
            };

            it["clears reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;
                systems.Add(system);

                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                spy.didInitialize.should_be(1);

                parentSystems.ClearReactiveSystems();
                parentSystems.Execute();
                spy.didExecute.should_be(0);
            };

            it["deactivates reactive systems"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                systems.Add(system);

                systems.Initialize();
                spy.didInitialize.should_be(1);

                systems.DeactivateReactiveSystems();
                systems.Execute();
                spy.didExecute.should_be(0);
            };

            it["deactivates reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;
                systems.Add(system);

                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                spy.didInitialize.should_be(1);

                parentSystems.DeactivateReactiveSystems();
                parentSystems.Execute();
                spy.didExecute.should_be(0);
            };

            it["activates reactive systems"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;

                systems.Add(system);

                systems.Initialize();
                spy.didInitialize.should_be(1);

                systems.DeactivateReactiveSystems();
                systems.ActivateReactiveSystems();
                systems.Execute();
                spy.didExecute.should_be(0);

                pool.CreateEntity().AddComponentA();
                systems.Execute();

                spy.didExecute.should_be(1);
            };

            it["activates reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;
                systems.Add(system);

                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                spy.didInitialize.should_be(1);

                parentSystems.DeactivateReactiveSystems();
                parentSystems.ActivateReactiveSystems();
                parentSystems.Execute();
                spy.didExecute.should_be(0);

                pool.CreateEntity().AddComponentA();
                systems.Execute();

                spy.didExecute.should_be(1);
            };
        };
    }
Example #36
0
 /// constructor from int
 public TimeSystem(int system)
 {
     System = Num2System(system);
 }
Example #37
0
 // Use this for initialization
 void Start()
 {
     _context = Contexts.sharedInstance;
     _system  = new Feature("System").Add(new DestroyFeature(_context)).Add(new ViewFeature(_context));
 }
Example #38
0
        public TestScene() : base()
        {
            //Entities.Add(new TestEntity(0, 0));
            //Entities.Add(new TestEntity(10, 10));
            //Entities.Add(new TestEntity(137+10, 125));
            //CurrentViewport.X = 16;

            /*for(int i = 0; i < 100; i++)
             * {
             *  Entities.Add(new TestEntity(0, i));
             * }*/
            //CurrentViewport.Scale = 0.5f;
            CurrentViewport.Y = 64;

            //Entities.Add(new TestEntity(0, 0));

            /*SpriteSheet sprites0 = new SpriteSheet(Properties.Resources.sprites0);
             * sprites0.AddRegion("grass", 0, 0, 16, 16);
             * sprites0.AddRegion("brick", 16, 0, 16, 16);
             * sprites0.AddRegion("brick_slope_right", 16, 16, 16, 16);
             * sprites0.AddRegion("brick_slope_left", 16, 32, 16, 16);
             * sprites0.AddRegion("brick_slope_upside_down", 16, 48, 16, 16);
             * Sprites.AddSpriteSheet(sprites0);
             *
             * SpriteSheet note = new SpriteSheet(Properties.Resources.notes);
             * note.AddRegion("note", 0, 0, 32, 32);
             * Sprites.AddSpriteSheet(note);*/

            //Entities.Add(new TileEntity("grass", 16, 8));
            Entities.Add(new Room0(0, 128));

            /*for (int x = -1; x <= 100; x++)
             * {
             *  int h = (int) Math.Round(5*Math.Sin(x / Math.PI));
             *  for(int y = 0; y <= h+5; y++)
             *  {
             *      Entities.Add(new TileEntity("brick", x, y-5));
             *  }
             * }*/
            /*Slope sl;
             * Entities.Add(sl = new Slope("brick_slope_right", 3, 5));
             * Entities.Add(sl = new Slope("brick_slope_right", 2, 4));
             * Entities.Add(sl = new Slope("brick_slope_right", 1, 3));
             * Entities.Add(sl = new Slope("brick_slope_right", 0, 1));
             * Entities.Add(sl = new Slope("brick_slope_right", -1, -1));*/
            //sl.Components.Get<Physical>().Velocity = new Vector2D(8, -2);

            for (int x = -1; x <= 20; x++)
            {
                Entities.Add(new TileEntity("brick", x, 0));


                //Entities.Add(new TileEntity("brick", x, 8));

                //if (x < 2 || x > 18) Entities.Add(new TileEntity("brick", x, 1));
                //else if(x < 10) Entities.Add(new Box(x * 16, 2));
            }
            for (int y = 1; y <= 5; y++)
            {
                //Entities.Add(new TileEntity("brick", 7, y));
            }
            //Entities.Add(new TileEntity("brick", 15, 1));
            Entities.Add(new TileEntity("brick", 0, 128 / 16));


            Entities.Add(player = new PlayerEntity(-24, 64));

            //Entities.Add(new Box(0f, 16f));
            //Entities.Add(new Slope(0, 1, true));
            //Entities.Add(new Slope(1, 1, false));

            //Input
            Systems.Add(new PlayerMovement());
            Systems.Add(new PlayerOrientationSystem());

            //Tick
            Systems.Add(new PhysicsSystem());
            Systems.Add(new PulseSystem());
            Systems.Add(new CameraSystem());

            //Rendering
            Systems.Add(new LevelRenderer());
        }
Example #39
0
 protected void Setup()
 {
     _contexts = new Contexts();
     _systems  = new Systems();
 }
Example #40
0
        public void EntityQueryWithChangeFilter()
        {
            var systems = new Systems(Helpers.NewWorld());
            var system0 = new ChangeFilterSystem <SampleStructs.Foo>();
            var system1 = new ChangeFilterSystem <SampleStructs.Foo>();

            systems
            .Add(system0)
            .Add(system1)
            .Create();

            var entity1 = systems.World.NewEntity();

            entity1.GetComponent <SampleStructs.Foo>();
            var entity2 = systems.World.NewEntity();

            entity2.GetComponent <SampleStructs.Foo>();
            var entity3 = systems.World.NewEntity();

            entity3.GetComponent <SampleStructs.Foo>();

            GC.Collect();
            var cc1 = GC.CollectionCount(0);

            systems.Run(1);

            // All components dirty
            Assert.Equal(3, system0.LastFilteredEntityCount);

            entity1.GetComponent <SampleStructs.Foo>();

            systems.Run(1);

            // 1 component dirty
            Assert.Equal(1, system0.LastFilteredEntityCount);

            systems.Run(1);

            // 0 components dirty
            Assert.Equal(0, system0.LastFilteredEntityCount);

            entity1.GetReadOnlyComponent <SampleStructs.Foo>();
            entity2.GetComponent <SampleStructs.Foo>();

            systems.Run(1);

            // 1 components dirty
            Assert.Equal(1, system0.LastFilteredEntityCount);

            // Reset
            systems.Run(1);

            // 0 components dirty
            Assert.Equal(0, system0.LastFilteredEntityCount);

            // Modify component state during Run()
            system0.OnUpdateAction = () =>
            {
                ref var component = ref entity1.GetComponent <SampleStructs.Foo>();
                component.x = 17;
                component.y = 42;
            };
Example #41
0
 private void Start()
 {
     contexts = Contexts.sharedInstance;
     systems  = new Feature("System").Add(new GameFeature(contexts));
 }
Example #42
0
        public static void ItemDatabase(string path)
        {
            //Split information lines
            TxtFile.ReadFromFile(path, '\t');
            //Set string info
            string Stringinformation = null;

            //Repeat for each line in the file
            for (int t = 0; t <= TxtFile.amountLine - 1; t++)
            {
                //Load from file
                #region Load file info
                Stringinformation = TxtFile.lines[t].ToString();
                TxtFile.commands  = Stringinformation.Split('\t');
                item_database it = new item_database();
                it.Name          = TxtFile.commands[2];
                it.ID            = Convert.ToInt32(TxtFile.commands[1]);
                it.Class_A       = Convert.ToInt32(TxtFile.commands[9]);
                it.Class_D       = Convert.ToInt32(TxtFile.commands[10]);
                it.Class_B       = Convert.ToInt32(TxtFile.commands[11]);
                it.Class_C       = Convert.ToInt32(TxtFile.commands[12]);
                it.Race          = Convert.ToByte(TxtFile.commands[14]);
                it.SOX           = Convert.ToByte(TxtFile.commands[15]);
                it.SoulBound     = Convert.ToByte(TxtFile.commands[18]);
                it.Shop_price    = Convert.ToInt32(TxtFile.commands[26]);
                it.Storage_price = Convert.ToInt32(TxtFile.commands[30]);
                it.Sell_Price    = Convert.ToInt32(TxtFile.commands[31]);
                it.Level         = Convert.ToByte(TxtFile.commands[33]);
                it.Max_Stack     = Convert.ToInt32(TxtFile.commands[57]);
                it.Gender        = Convert.ToByte(TxtFile.commands[58]);
                it.Degree        = Convert.ToByte(TxtFile.commands[61]);
                //Stone related (Stone creation)
                #region Stone creation
                it.EARTH_ELEMENTS_AMOUNT_REQ = Convert.ToInt32(TxtFile.commands[118]);
                it.EARTH_ELEMENTS_NAME       = Convert.ToString(TxtFile.commands[119]);
                it.WATER_ELEMENTS_AMOUNT_REQ = Convert.ToInt32(TxtFile.commands[120]);
                it.WATER_ELEMENTS_NAME       = Convert.ToString(TxtFile.commands[121]);
                it.FIRE_ELEMENTS_AMOUNT_REQ  = Convert.ToInt32(TxtFile.commands[122]);
                it.FIRE_ELEMENTS_NAME        = Convert.ToString(TxtFile.commands[123]);
                it.WIND_ELEMENTS_AMOUNT_REQ  = Convert.ToInt32(TxtFile.commands[124]);
                it.WIND_ELEMENTS_NAME        = Convert.ToString(TxtFile.commands[125]);
                #endregion
                it.Defans.Durability      = Convert.ToDouble(TxtFile.commands[63]);
                it.Defans.MinPhyDef       = Convert.ToDouble(TxtFile.commands[65]);
                it.Defans.PhyDefINC       = Convert.ToDouble(TxtFile.commands[67]);
                it.Defans.Parry           = Convert.ToDouble(TxtFile.commands[68]);
                it.Defans.MinBlock        = Convert.ToByte(Math.Round(Convert.ToDouble(TxtFile.commands[74])));
                it.Defans.MaxBlock        = Convert.ToByte(Math.Round(Convert.ToDouble(TxtFile.commands[75])));
                it.Defans.MinMagDef       = Convert.ToDouble(TxtFile.commands[76]);
                it.Defans.MagDefINC       = Convert.ToDouble(TxtFile.commands[78]);
                it.Defans.PhyAbsorb       = Convert.ToDouble(TxtFile.commands[79]);
                it.Defans.MagAbsorb       = Convert.ToDouble(TxtFile.commands[80]);
                it.Defans.AbsorbINC       = Convert.ToDouble(TxtFile.commands[81]);
                it.needEquip              = Convert.ToBoolean(Convert.ToByte(TxtFile.commands[93]));
                it.ATTACK_DISTANCE        = Convert.ToInt16(TxtFile.commands[94]);
                it.Attack.Min_LPhyAttack  = Convert.ToDouble(TxtFile.commands[95]);
                it.Attack.Min_HPhyAttack  = Convert.ToDouble(TxtFile.commands[97]);
                it.Attack.PhyAttackInc    = Convert.ToDouble(TxtFile.commands[99]);
                it.Attack.Min_LMagAttack  = Convert.ToDouble(TxtFile.commands[100]);
                it.Attack.Min_HMagAttack  = Convert.ToDouble(TxtFile.commands[102]);
                it.Attack.MagAttackINC    = Convert.ToDouble(TxtFile.commands[104]);
                it.Attack.MinAttackRating = Convert.ToDouble(TxtFile.commands[113]);
                it.Attack.MaxAttackRating = Convert.ToDouble(TxtFile.commands[114]);
                it.Attack.MinCrit         = Convert.ToByte(Convert.ToDouble(TxtFile.commands[116]));
                it.Attack.MaxCrit         = Convert.ToByte(Convert.ToDouble(TxtFile.commands[117]));
                it.ObjectName             = TxtFile.commands[119];
                it.Use_Time      = Convert.ToInt32(TxtFile.commands[118]);
                it.Use_Time2     = Convert.ToInt32(TxtFile.commands[122]);
                it.MaxBlueAmount = Convert.ToByte(TxtFile.commands[158]);

                if (it.ObjectName.Contains("SKILL"))
                {
                    foreach (s_data sd in Data.SkillBase)
                    {
                        if (sd != null)
                        {
                            if (sd.Name == it.ObjectName)
                            {
                                it.SkillID = sd.ID;
                                break;
                            }
                        }
                    }
                }
                Data.ItemBase[it.ID] = it;
                #endregion
                //Item slot types all ot
                #region Item Slot Types
                if (it.Name.Contains("SHIELD") && it.Name.Contains("EU") && !it.Name.Contains("ETC"))
                {
                    it.Itemtype = item_database.ItemType.EU_SHIELD;
                }
                else if (it.Name.Contains("SHIELD") && it.Name.Contains("CH") && !it.Name.Contains("ETC"))
                {
                    it.Itemtype = item_database.ItemType.CH_SHIELD;
                }
                else if (it.Class_B == 4 && it.Class_C == 1 && it.Class_D == 3)
                {
                    it.Itemtype = item_database.ItemType.ARROW;
                }
                else if (it.Class_B == 4 && it.Class_C == 2 && it.Class_D == 3)
                {
                    it.Itemtype = item_database.ItemType.BOLT;
                }
                else if (it.Class_B == 1 && it.Class_C == 1 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.HAT;
                }
                else if (it.Class_B == 3 && it.Class_C == 2 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.SHOULDER;
                }
                else if (it.Class_B == 3 && it.Class_C == 3 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.SUIT;
                }
                else if (it.Class_B == 3 && it.Class_C == 4 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.TROUSERS;
                }
                else if (it.Class_B == 3 && it.Class_C == 5 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.HANDS;
                }
                else if (it.Class_B == 3 && it.Class_C == 6 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.SHOES;
                }
                else if (it.Class_B == 6 && it.Class_C == 7 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_SWORD;
                }
                else if (it.Class_B == 6 && it.Class_C == 8 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_TSWORD;
                }
                else if (it.Class_B == 6 && it.Class_C == 9 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_AXE;
                }
                else if (it.Class_B == 6 && it.Class_C == 10 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_DARKSTAFF;
                }
                else if (it.Class_B == 6 && it.Class_C == 11 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_TSTAFF;
                }
                else if (it.Class_B == 6 && it.Class_C == 12 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_CROSSBOW;
                }
                else if (it.Class_B == 6 && it.Class_C == 13 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_DAGGER;
                }
                else if (it.Class_B == 6 && it.Class_C == 14 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_HARP;
                }
                else if (it.Class_B == 6 && it.Class_C == 15 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EU_STAFF;
                }
                else if (it.Class_B == 5 && it.Class_C == 1 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.EARRING;
                }
                else if (it.Class_B == 5 && it.Class_C == 3 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.RING;
                }
                else if (it.Class_B == 5 && it.Class_C == 2 && it.Class_D == 1)
                {
                    it.Itemtype = item_database.ItemType.NECKLACE;
                }
                else if (it.Class_A == 3 && it.Class_C == 2 && it.Class_D == 1 && it.Class_B == 6)
                {
                    it.Itemtype = item_database.ItemType.SWORD;
                }
                else if (it.Class_A == 3 && it.Class_C == 3 && it.Class_D == 1 && it.Class_B == 6)
                {
                    it.Itemtype = item_database.ItemType.BLADE;
                }
                else if (it.Class_A == 3 && it.Class_C == 4 && it.Class_D == 1 && it.Class_B == 6)
                {
                    it.Itemtype = item_database.ItemType.SPEAR;
                }
                else if (it.Class_A == 3 && it.Class_C == 5 && it.Class_D == 1 && it.Class_B == 6)
                {
                    it.Itemtype = item_database.ItemType.GLAVIE;
                }
                else if (it.Class_A == 3 && it.Class_C == 6 && it.Class_D == 1 && it.Class_B == 6)
                {
                    it.Itemtype = item_database.ItemType.BOW;
                }
                #endregion
                //Item armor type:
                #region Item Armor Types
                if (it.Name.Contains("LIGHT") && it.Name.Contains("EU"))
                {
                    it.Type = item_database.ArmorType.LIGHT;
                }
                else if (it.Name.Contains("LIGHT") && it.Name.Contains("CH"))
                {
                    it.Type = item_database.ArmorType.PROTECTOR;
                }
                else if (it.Name.Contains("HEAVY") && it.Name.Contains("EU"))
                {
                    it.Type = item_database.ArmorType.HEAVY;
                }
                else if (it.Name.Contains("HEAVY") && it.Name.Contains("CH"))
                {
                    it.Type = item_database.ArmorType.ARMOR;
                }
                else if (it.Name.Contains("CLOTHES") && it.Name.Contains("EU"))
                {
                    it.Type = item_database.ArmorType.ROBE;
                }
                else if (it.Name.Contains("CLOTHES") && it.Name.Contains("CH"))
                {
                    it.Type = item_database.ArmorType.GARMENT;
                }
                else if (it.Name.Contains("C_SUPER"))
                {
                    it.Type = item_database.ArmorType.GM;
                }
                #endregion
                //Jewelry
                #region Jewelry
                else if (it.Name.Contains("_RING_") && !it.Name.Contains("ETC"))
                {
                    it.Itemtype = Global.item_database.ItemType.RING;
                }
                else if (it.Name.Contains("_EARRING_") && !it.Name.Contains("ETC"))
                {
                    it.Itemtype = Global.item_database.ItemType.EARRING;
                }
                else if (it.Name.Contains("_NECKLACE_") && !it.Name.Contains("ETC"))
                {
                    it.Itemtype = Global.item_database.ItemType.NECKLACE;
                }
                #endregion
                //Grabpets
                #region Grabpet
                else if (it.Name.Contains("COS_P") && it.Class_A == 3 && it.Class_B == 1 && it.Class_C == 2 && it.Class_D == 2)
                {
                    it.Pettype = item_database.PetType.GRABPET;
                }
                #endregion
                //Attackpets
                #region Attack pets
                else if (it.Name.Contains("COS_P") && it.Class_A == 3 && it.Class_B == 1 && it.Class_C == 1 && it.Class_D == 2)
                {
                    it.Pettype = item_database.PetType.ATTACKPET;
                }
                #endregion
                //Transport horses
                #region Transport horses
                else if (it.Name.Contains("COS_T"))
                {
                    it.Pettype = item_database.PetType.JOBTRANSPORT;
                }
                #endregion
                //Normal horses
                #region Transport horses
                else if (it.Name.Contains("COS_C"))
                {
                    it.Pettype = item_database.PetType.TRANSPORT;
                }
                #endregion
                //Quest items , define more later.
                #region Quest Items
                else if (it.Name.Contains("QNQ"))
                {
                    it.Questtype = item_database.QuestType.QUEST;
                }
                #endregion
                //Avatars
                #region Avatar related
                #region Avatars
                else if (it.Name.Contains("AVATAR") && it.Name.Contains("AVATAR"))
                {
                    it.Type = item_database.ArmorType.AVATAR;
                }
                #endregion
                //Avatars Attach
                #region Avatars Attach
                else if (it.Name.Contains("AVATAR") && it.Name.Contains("ATTACH"))
                {
                    it.Type = item_database.ArmorType.AVATARATTACH;
                }
                #endregion
                //Avatars Hat
                #region Avatars Hat
                else if (it.Name.Contains("AVATAR") && it.Name.Contains("HAT"))
                {
                    it.Type = item_database.ArmorType.AVATARHAT;
                }
                #endregion
                #endregion
                //Potions
                #region Potions
                #region Normal potions
                else if (it.Name.Contains("CANDY") && it.Name.Contains("RED"))
                {
                    it.Etctype = item_database.EtcType.HP_POTION;
                }
                else if (it.Name.Contains("POTION") && it.Name.Contains("HP") && it.Class_C == 1 && it.Item_Mall_Type != 2)
                {
                    it.Etctype = item_database.EtcType.HP_POTION;
                }
                else if (it.Name.Contains("CANDY") && it.Name.Contains("BLUE"))
                {
                    it.Etctype = item_database.EtcType.MP_POTION;
                }
                else if (it.Name.Contains("POTION") && it.Name.Contains("MP") && it.Class_C == 2 && it.Item_Mall_Type != 2)
                {
                    it.Etctype = item_database.EtcType.MP_POTION;
                }
                else if (it.Name.Contains("CANDY") && it.Name.Contains("VIOLET"))
                {
                    it.Etctype = item_database.EtcType.VIGOR_POTION;
                }
                else if (it.Name.Contains("ITEM_ETC_ALL_POTION"))
                {
                    it.Etctype = item_database.EtcType.VIGOR_POTION;
                }

                #endregion
                #region HP / MP Changing potions
                else if (it.Name.Contains("HP_INC"))
                {
                    it.Etctype = item_database.EtcType.HPSTATPOTION;
                }
                else if (it.Name.Contains("MP_INC"))
                {
                    it.Etctype = item_database.EtcType.MPSTATPOTION;
                }
                #endregion
                #region Speed Potions
                else if (it.Name.Contains("POTION_SPEED"))
                {
                    it.Etctype = item_database.EtcType.SPEED_POTION;
                }
                #endregion
                #region Berserk potions
                else if (it.Name.Contains("HWAN_POTION"))
                {
                    it.Etctype = Global.item_database.EtcType.BERSERKPOTION;
                }
                #endregion
                #endregion
                //Tickets all types
                #region Silver Skill Tickets
                else if (it.Name.Contains("TICKET") && it.Name.Contains("SILVER") && it.Name.Contains("1D") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_SILVER_1_DAY;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("SILVER") && it.Name.Contains("4W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_SILVER_4_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("SILVER") && it.Name.Contains("8W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_SILVER_8_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("SILVER") && it.Name.Contains("12W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_SILVER_12_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("SILVER") && it.Name.Contains("16W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_SILVER_16_WEEKS;
                }
                #endregion
                #region Gold Skill Tickets
                else if (it.Name.Contains("TICKET") && it.Name.Contains("GOLD") && it.Name.Contains("1D") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_GOLD_1_DAY;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("GOLD") && it.Name.Contains("4W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_GOLD_4_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("GOLD") && it.Name.Contains("8W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_GOLD_8_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("GOLD") && it.Name.Contains("12W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_GOLD_12_WEEKS;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("GOLD") && it.Name.Contains("16W") && it.Name.Contains("SKILL"))
                {
                    it.Ticket = item_database.Tickets.SKILL_GOLD_16_WEEKS;
                }
                #endregion
                #region Silver Tickets
                else if (it.Name.Contains("MALL_SILVER_TIME") && it.Name.Contains("1D"))
                {
                    it.Ticket = item_database.Tickets.SILVER_1_DAY;
                }
                else if (it.Name.Contains("MALL_SILVER_TIME") && it.Name.Contains("4W"))
                {
                    it.Ticket = item_database.Tickets.SILVER_4_WEEKS;
                }
                else if (it.Name.Contains("MALL_SILVER_TIME") && it.Name.Contains("8W"))
                {
                    it.Ticket = item_database.Tickets.SILVER_8_WEEKS;
                }
                else if (it.Name.Contains("MALL_SILVER_TIME") && it.Name.Contains("12W"))
                {
                    it.Ticket = item_database.Tickets.SILVER_12_WEEKS;
                }
                else if (it.Name.Contains("MALL_SILVER_TIME") && it.Name.Contains("16W"))
                {
                    it.Ticket = item_database.Tickets.SILVER_16_WEEKS;
                }
                #endregion
                #region Gold Tickets
                else if (it.Name.Contains("MALL_GOLD_TIME") && it.Name.Contains("1D"))
                {
                    it.Ticket = item_database.Tickets.GOLD_1_DAY;
                }
                else if (it.Name.Contains("MALL_GOLD_TIME") && it.Name.Contains("4W"))
                {
                    it.Ticket = item_database.Tickets.GOLD_4_WEEKS;
                }
                else if (it.Name.Contains("MALL_GOLD_TIME") && it.Name.Contains("8W"))
                {
                    it.Ticket = item_database.Tickets.GOLD_8_WEEKS;
                }
                else if (it.Name.Contains("MALL_GOLD_TIME") && it.Name.Contains("12W"))
                {
                    it.Ticket = item_database.Tickets.GOLD_12_WEEKS;
                }
                else if (it.Name.Contains("MALL_GOLD_TIME") && it.Name.Contains("16W"))
                {
                    it.Ticket = item_database.Tickets.GOLD_16_WEEKS;
                }
                #endregion
                #region Premium Quest Tickets
                else if (it.Name.Contains("TICKET") && it.Name.Contains("PREM"))
                {
                    it.Ticket = item_database.Tickets.PREMIUM_QUEST_TICKET;
                }
                #endregion
                #region Open Market
                else if (it.Name.Contains("OPEN_MARKET"))
                {
                    it.Ticket = item_database.Tickets.OPEN_MARKET;
                }
                #endregion
                #region Dungeon tickets
                else if (it.Name.Contains("TICKET") && it.Name.Contains("EGYPT"))
                {
                    it.Ticket = item_database.Tickets.DUNGEON_EGYPT;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("FORGOTTEN"))
                {
                    it.Ticket = item_database.Tickets.DUNGEON_FORGOTTEN_WORLD;
                }
                else if (it.Name.Contains("TICKET") && it.Name.Contains("BATTLE_ARENA"))
                {
                    it.Ticket = item_database.Tickets.BATTLE_ARENA;
                }
                else if (it.Name.Contains("ITEM_ETC_TELEPORT_HOLE"))
                {
                    it.Ticket = item_database.Tickets.DUNGEON_FORGOTTEN_WORLD;
                }
                #endregion
                #region Warehouse
                else if (it.Name.Contains("TICKET") && it.Name.Contains("WAREHOUSE"))
                {
                    it.Ticket = item_database.Tickets.WAREHOUSE;
                }
                #endregion
                #region Auto Potion Ticket
                else if (it.Name.Contains("TICKET") && it.Name.Contains("AUTO_POTION"))
                {
                    it.Ticket = item_database.Tickets.AUTO_POTION;
                }
                #endregion
                #region Beginner tickets
                else if (it.Name.Contains("ETC") && it.Name.Contains("_HELP"))
                {
                    it.Ticket = item_database.Tickets.BEGINNER_HELPERS;
                }
                #endregion
                //Chat related items
                #region Global chat
                else if (it.Name.Contains("GLOBAL") && it.Name.Contains("CHAT"))
                {
                    it.Etctype = item_database.EtcType.GLOBALCHAT;
                }
                #endregion
                //Stall decoration
                #region Stall decoration
                else if (it.Name.Contains("BOOTH"))
                {
                    it.Etctype = item_database.EtcType.STALLDECORATION;
                }
                #endregion
                //Monster mask
                #region Monster Masks
                else if (it.Name.Contains("TRANS_MONSTER"))
                {
                    it.Etctype = item_database.EtcType.MONSTERMASK;
                }
                #endregion
                //Elixirs
                #region Elixirs
                else if (it.Name.Contains("ETC") && it.Name.Contains("REINFORCE") && it.Name.Contains("RECIPE") && it.Name.Contains("_B") && it.Class_C == 1)
                {
                    it.Etctype = item_database.EtcType.ELIXIR;
                }
                #endregion
                //Job suits
                #region Job Suits
                //Hunter suits
                else if (it.Name.Contains("TRADE_HUNTER") && it.Name.Contains("CH"))
                {
                    it.Type = item_database.ArmorType.HUNTER;
                }
                else if (it.Name.Contains("TRADE_HUNTER") && it.Name.Contains("EU"))
                {
                    it.Type = item_database.ArmorType.HUNTER;
                }
                //Thief suits
                else if (it.Name.Contains("TRADE_THIEF") && it.Name.Contains("CH"))
                {
                    it.Type = item_database.ArmorType.THIEF;
                }
                else if (it.Name.Contains("TRADE_THIEF") && it.Name.Contains("EU"))
                {
                    it.Type = item_database.ArmorType.THIEF;
                }
                #endregion
                //Return scrolls
                #region Return scrolls
                else if (it.Name.Contains("SCROLL_RETURN"))
                {
                    it.Etctype = item_database.EtcType.RETURNSCROLL;
                }
                #endregion
                //Reverse scrolls
                #region Reverse scrolls
                else if (it.Name.Contains("SCROLL") && it.Name.Contains("REVERSE"))
                {
                    it.Etctype = item_database.EtcType.REVERSESCROLL;
                }
                #endregion
                //Thief scrolls
                #region Thief scrolls
                else if (it.Name.Contains("SCROLL") && it.Name.Contains("THIEF"))
                {
                    it.Etctype = item_database.EtcType.BANDITSCROLL;
                }
                #endregion
                //Summon scrolls
                #region Summon scrolls
                else if (it.Name.Contains("SUMMON") && it.Name.Contains("SCROLL"))
                {
                    it.Etctype = item_database.EtcType.SUMMONSCROLL;
                }
                #endregion
                //Skin change scrolls
                #region Skin change scrolls
                else if (it.Name.Contains("SKIN_CHANGE"))
                {
                    it.Etctype = item_database.EtcType.CHANGESKIN;
                }
                #endregion
                //Inventory expansion
                #region Inventory expansions
                else if (it.Name.Contains("INVENTORY") && it.Name.Contains("ADDITION"))
                {
                    it.Etctype = item_database.EtcType.INVENTORYEXPANSION;
                }
                #endregion
                //Warehouse expansion
                #region Warehouse expansions
                else if (it.Name.Contains("WAREHOUSE") && it.Name.Contains("ADDITION"))
                {
                    it.Etctype = item_database.EtcType.WAREHOUSE;
                }
                #endregion
                //Alchemy materials
                #region Alchemy materials
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("MAT"))
                {
                    it.Etctype = item_database.EtcType.ALCHEMY_MATERIAL;
                }
                #endregion
                //Tablets
                #region Tablets
                // later have to differ assimilate stones that has % not like astral and steady
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("MAGICTABLET"))
                {
                    it.Itemtype = item_database.ItemType.MAGICTABLET;
                }
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("ATTRTABLET"))
                {
                    it.Itemtype = item_database.ItemType.MAGICTABLET;
                }
                #endregion
                //Elements
                #region Elements
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("ELEMENT"))
                {
                    it.Etctype = item_database.EtcType.ELEMENTS;
                }
                #endregion
                //Stones (Note: Need to filter it more detailed later to deny some stones).
                #region Stones
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("ATTRSTONE") && !it.Name.Contains("AST"))
                {
                    it.Etctype = item_database.EtcType.STONES;
                }
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("MAGICSTONE") && !it.Name.Contains("AST"))
                {
                    it.Etctype = item_database.EtcType.STONES;
                }
                else if (it.Name.Contains("ARCHEMY") && it.Name.Contains("MAGICSTONE") && it.Name.Contains("ASTRAL"))
                {
                    it.Etctype = item_database.EtcType.ASTRALSTONE;
                }
                #endregion
                //Destroyer rondo
                #region Destroyer rondo
                else if (it.Name.Contains("ITEM_ETC_ARCHEMY_RONDO_02"))
                {
                    it.Etctype = item_database.EtcType.DESTROYER_RONDO;
                }
                #endregion
                //Gender switch tools
                #region Gender switch
                else if (it.Name.Contains("TRANSGENDER"))
                {
                    it.Etctype = item_database.EtcType.ITEMCHANGETOOL;
                }
                #endregion
                //Guild items
                #region Guild Items
                else if (it.Name.Contains("GUILD_CREST"))
                {
                    it.Etctype = item_database.EtcType.GUILD_ICON;
                }
                #endregion
                //Event items
                #region Event
                else if (it.Name.Contains("TREASURE"))
                {
                    it.Etctype = item_database.EtcType.EVENT;
                }
                #endregion
                //########################################################
                // Silk Prices Definitions
                //########################################################
                #region Silk pricing
                if (it.Etctype == item_database.EtcType.AVATAR28D ||
                    it.Etctype == item_database.EtcType.CHANGESKIN ||
                    it.Etctype == item_database.EtcType.GLOBALCHAT ||
                    it.Etctype == item_database.EtcType.INVENTORYEXPANSION ||
                    it.Etctype == item_database.EtcType.RETURNSCROLL ||
                    it.Etctype == item_database.EtcType.REVERSESCROLL ||
                    it.Etctype == item_database.EtcType.STALLDECORATION ||
                    it.Etctype == item_database.EtcType.WAREHOUSE ||
                    it.Pettype == item_database.PetType.GRABPET ||
                    it.Type == item_database.ArmorType.AVATAR ||
                    it.Type == item_database.ArmorType.AVATARHAT ||
                    it.Type == item_database.ArmorType.AVATARATTACH)
                {
                    it.Shop_price = Systems.SetSilk(it.ID);
                }
                #endregion
                //########################################################
                // Drop Database
                //########################################################
                //Armors
                #region Armors
                if ((it.Name.Contains("LIGHT") && it.Name.Contains("EU") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) ||
                    (it.Name.Contains("LIGHT") && it.Name.Contains("CH") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) ||
                    (it.Name.Contains("HEAVY") && it.Name.Contains("EU") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) ||
                    (it.Name.Contains("HEAVY") && it.Name.Contains("CH") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) ||
                    (it.Name.Contains("CLOTHES") && it.Name.Contains("EU") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) ||
                    (it.Name.Contains("CLOTHES") && it.Name.Contains("CH") && !it.Name.Contains("DEF") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("SUPER")) &&
                    it.SOX == 0)
                {
                    Data.ArmorDataBase.ID.Add(it.ID);
                }
                #endregion
                //Weapons
                #region Weapons
                if ((it.Name.Contains("ITEM_EU_AXE") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_CROSSBOW") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_DAGGER") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_DARKSTAFF") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_HARP") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_STAFF") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_SWORD") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_TSTAFF") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_TSWORD") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_TBLADE") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_BLADE") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_BOW") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_EU_SHIELD") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_SHIELD") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_SPEAR") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")) ||
                    (it.Name.Contains("ITEM_CH_SWORD") && !it.Name.Contains("_DEF") && !it.Name.Contains("RARE") && !it.Name.Contains("SET")))
                {
                    Data.WeaponDataBase.ID.Add(it.ID);
                }
                #endregion
                //Jewelerys
                #region Jewelerys
                if ((it.Name.Contains("RING") && !it.Name.Contains("DEF")) && (it.Name.Contains("ITEM_CH") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("BASIC")) ||
                    (it.Name.Contains("NECKLACE") && !it.Name.Contains("DEF")) && (it.Name.Contains("ITEM_CH") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("BASIC")) ||
                    (it.Name.Contains("NECKLACE") && !it.Name.Contains("DEF")) && (it.Name.Contains("ITEM_EU") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("BASIC")) ||
                    (it.Name.Contains("RING") && !it.Name.Contains("DEF")) && (it.Name.Contains("ITEM_EU") && !it.Name.Contains("RARE") && !it.Name.Contains("SET") && !it.Name.Contains("BASIC")))
                {
                    Data.JewelDataBase.ID.Add(it.ID);
                }
                #endregion
                //Seal items
                #region Seal items
                if (it.SOX == 2 && !it.Name.Contains("_SET") && !it.Name.Contains("_HONOR") && !it.Name.Contains("EVENT") && !it.Name.Contains("ETC") && !it.Name.Contains("ROC") && !it.Name.Contains("BASIC") && !it.Name.Contains("DEF"))
                {
                    Data.SoxDataBase.ID.Add(it.ID);
                }
                #endregion
                //Stones
                #region Stones
                else if (it.Itemtype == Global.item_database.ItemType.MAGICTABLET && !it.Name.Contains("ASTRAL") || it.Itemtype == Global.item_database.ItemType.ATTRTABLET && !it.Name.Contains("ASTRAL"))
                {
                    Data.StoneDataBase.ID.Add(it.ID);
                }
                #endregion
                //Alchemy materials
                #region Alchemy materials
                else if (it.Etctype == Global.item_database.EtcType.ALCHEMY_MATERIAL)
                {
                    Data.MaterialDataBase.ID.Add(it.ID);
                }
                #endregion
                //Elixirs
                #region Elixirs
                else if (it.Etctype == Global.item_database.EtcType.ELIXIR)
                {
                    Data.ElixirDataBase.ID.Add(it.ID);
                }
                #endregion
                //Soulbound
                #region Soulbound information
                //Tmp
                if (it.Name.Contains("PRE_MALL"))
                {
                    it.Accountbound = 0;
                }

                #endregion
                //Distances
                #region Distances
                if (it.Itemtype == item_database.ItemType.SWORD || it.Itemtype == item_database.ItemType.EU_SWORD)
                {
                    it.ATTACK_DISTANCE = 1;
                }
                else if (it.Itemtype == item_database.ItemType.SPEAR)
                {
                    it.ATTACK_DISTANCE = 2;
                }
                else if (it.Itemtype == item_database.ItemType.GLAVIE)
                {
                    it.ATTACK_DISTANCE = 2;
                }
                else if (it.Itemtype == item_database.ItemType.BOW || it.Itemtype == item_database.ItemType.EU_CROSSBOW)
                {
                    it.ATTACK_DISTANCE = 8;
                }
                #endregion
                //Race fixes
                #region Race fixes
                if (it.Name.Contains("_EU_") || it.Name.Contains("BOLT"))
                {
                    it.Race = 1;
                }
                else if (it.Name.Contains("_CH_") || it.Name.Contains("ARROW") || it.Name.Contains("QUIVER"))
                {
                    it.Race = 0;
                }
                #endregion
                //1 damage weapon fixes.
                #region Weapon fixes
                if (it.Name.Contains("DEF") && it.Name.Contains("STAFF"))
                {
                    it.Attack.Min_HPhyAttack = it.Attack.Min_HMagAttack;
                    it.Attack.Min_LPhyAttack = it.Attack.Min_LMagAttack;
                }
                #endregion
            }
            Console.WriteLine("[INFO] Loaded " + TxtFile.amountLine + " items");
        }
Example #43
0
        public static byte[] UnionInfo(Systems c)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_GUILD_UNIONS);
            Writer.DWord(c.Character.Information.CharacterID);                // Union owner id
            Writer.DWord(7);                                                  // ??Need to check
            Writer.DWord(c.Character.Network.Guild.Guildid);                  // Union leader guild id
            Writer.Byte(c.Character.Network.Guild.Unions.Count);              // Count guilds in union
            //Get all guilds details
            foreach (int guild in c.Character.Network.Guild.Unions)
            {
                //Load other guild data
                Systems.MsSQL guild_data = new Systems.MsSQL("SELECT * FROM guild WHERE id='" + guild + "'");

                using (System.Data.SqlClient.SqlDataReader reader = guild_data.Read())
                {
                    while (reader.Read())
                    {
                        string Guildname        = reader.GetString(1);
                        byte   Guildlevel       = reader.GetByte(2);
                        byte   Guildmembercount = reader.GetByte(6);
                        int    Ownerid          = reader.GetInt32(9);

                        string Charname  = Systems.MsSQL.GetData("SELECT name FROM character WHERE id='" + Ownerid + "'", "name").ToString();
                        int    Charmodel = Convert.ToInt32(Systems.MsSQL.GetData("SELECT chartype FROM character WHERE id='" + Ownerid + "'", "chartype"));

                        Writer.DWord(guild);                        //Guild ID
                        Writer.Text(reader.GetString(1));           //Guildname
                        Writer.Byte(reader.GetByte(2));             //Guildlevel
                        Writer.Text(Charname);                      //Ownername
                        Writer.DWord(Charmodel);                    //Owner model
                        Writer.Byte(reader.GetByte(6));             //Guild member count

                        //Get guild details
                        Systems Guildmembers = Systems.GetGuildPlayer(guild);
                        //Add clients that are online to union list
                        //Null check
                        if (Guildmembers != null)
                        {
                            foreach (int member in Guildmembers.Character.Network.Guild.Members)
                            {
                                //make sure member isnt 0
                                if (member != 0)
                                {
                                    //Get player details
                                    Systems getmember = Systems.GetPlayerMainid(member);
                                    //Make sure that the player is there
                                    if (getmember != null)
                                    {
                                        //Add client to union list
                                        c.Character.Network.Guild.UnionMembers.Add(getmember.Character.Information.CharacterID);
                                        //Add to member
                                        if (c.Character.Information.CharacterID != getmember.Character.Information.CharacterID)
                                        {
                                            getmember.Character.Network.Guild.UnionMembers.Add(c.Character.Information.CharacterID);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(Writer.GetBytes());
        }
Example #44
0
 // Use this for initialization
 void Start()
 {
     m_Context = Contexts.sharedInstance;
     m_System  = CreateSystem(m_Context);
     m_System.Initialize();
 }
Example #45
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (InputCheck())
     {
         if (conbll.Exists(int.Parse(this.txtcontractno.Text.Trim())) == true)
         {
             App_Code.Message.InfoMsg("合同编号出现重复");
             return;
         }
         else
         {
             if (InsertIncome() == 1 && InsertContract() == 1)
             {
                 App_Code.Message.InfoMsg("操作成功");
                 Log_BLL.Add(DateTime.Now, "财务收入(合同收入)", App_Code.Canshu.LoginName, "财务收入(合同收入)", Dns.GetHostName().ToUpperInvariant(), Systems.GetOSNameByUserAgent(Environment.OSVersion.ToString()), 8);
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
         }
     }
 }
Example #46
0
 public IntroScreen() : base(Woofer.Controller)
 {
     Systems.Add(new IntroSystem());
 }
Example #47
0
 public TimeSystem()
 {
     System = Systems.Unknown;
 }
Example #48
0
 public static void OnKilledBy(Mobile victim, Mobile damager)
 {
     Systems.ForEach(s => s.ProcessKill(victim, damager));
 }
Example #49
0
 public TimeSystem(string system)
 {
     System = Str2System(system);
 }
Example #50
0
 public GameController(Contexts contexts)
 {
     _contexts = contexts;
     _system   = new GameSystems(contexts);
 }
 void Start()
 {
     Random.seed = 42;
     _systems    = createSystems(Pools.pool);
     _systems.Initialize();
 }
Example #52
0
 void Start()
 {
     _systems = CreateSystems(_contexts);
     _systems.Initialize();
 }
Example #53
0
 public static void CompleteQuest(QuestCompleteEventArgs e)
 {
     Systems.ForEach(s => s.ProcessQuest(e.Mobile, e.QuestType));
 }
Example #54
0
 void Start()
 {
     _contexts = Contexts.sharedInstance;
     _systems  = CreateSystems(_contexts);
     _systems.Initialize();
 }
Example #55
0
    void when_systems()
    {
        Pool pool = null;

        before = () => {
            pool = new Pool(10);
        };

        context["fixtures"] = () => {
            it["initializes InitializeSystemSpy"] = () => {
                var initializeSystem = new InitializeSystemSpy();
                initializeSystem.initialized.should_be_false();
                initializeSystem.Initialize();
                initializeSystem.initialized.should_be_true();
            };

            it["executes ExecuteSystemSpy"] = () => {
                var initializeSystem = new ExecuteSystemSpy();
                initializeSystem.executed.should_be_false();
                initializeSystem.Execute();
                initializeSystem.executed.should_be_true();
            };

            it["initializes and executes InitializeExecuteSystemSpy"] = () => {
                var initializeSystem = new InitializeExecuteSystemSpy();
                initializeSystem.initialized.should_be_false();
                initializeSystem.executed.should_be_false();
                initializeSystem.Initialize();
                initializeSystem.Execute();
                initializeSystem.initialized.should_be_true();
                initializeSystem.executed.should_be_true();
            };

            it["executes ReactiveSystemSpy"] = () => {
                var system = createReactiveSystem(pool);
                var spy    = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_false();
                system.Execute();
                spy.didExecute.should_be(1);
                spy.initialized.should_be_false();
            };
        };

        context["systems"] = () => {
            Systems systems = null;
            before = () => {
                systems = new Systems();
            };

            it["returns systems when adding system"] = () => {
                systems.Add(new InitializeSystemSpy()).should_be_same(systems);
            };

            it["initializes IInitializeSystem"] = () => {
                var system = new InitializeSystemSpy();
                systems.Add(system);
                systems.Initialize();
                system.initialized.should_be_true();
            };

            it["executes IExecuteSystem"] = () => {
                var system = new ExecuteSystemSpy();
                systems.Add(system);
                systems.Execute();
                system.executed.should_be_true();
            };

            it["initializes and executes IInitializeSystem, IExecuteSystem"] = () => {
                var system = new InitializeExecuteSystemSpy();
                systems.Add(system);
                systems.Initialize();
                systems.Execute();
                system.initialized.should_be_true();
                system.executed.should_be_true();
            };

            it["initializes and executes ReactiveSystem"] = () => {
                var system = createReactiveSystem(pool);

                systems.Add(system);
                systems.Initialize();
                systems.Execute();
                systems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(1);
                spy.initialized.should_be_true();
            };

            it["clears reactive systems"] = () => {
                var system = createReactiveSystem(pool);

                systems.Add(system);
                systems.Initialize();
                systems.ClearReactiveSystems();
                systems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();
            };

            it["clears reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                systems.Add(system);
                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                parentSystems.ClearReactiveSystems();
                parentSystems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();
            };

            it["deactivates reactive systems"] = () => {
                var system = createReactiveSystem(pool);

                systems.Add(system);
                systems.Initialize();
                systems.DeactivateReactiveSystems();
                systems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();
            };

            it["deactivates reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                systems.Add(system);
                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                parentSystems.DeactivateReactiveSystems();
                parentSystems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();
            };

            it["activates reactive systems"] = () => {
                var system = createReactiveSystem(pool);

                systems.Add(system);
                systems.Initialize();
                systems.DeactivateReactiveSystems();
                systems.ActivateReactiveSystems();
                systems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();

                pool.CreateEntity().AddComponentA();
                systems.Execute();
                spy.didExecute.should_be(1);
            };

            it["activates reactive systems recursively"] = () => {
                var system = createReactiveSystem(pool);
                systems.Add(system);
                var parentSystems = new Systems();
                parentSystems.Add(systems);

                parentSystems.Initialize();
                parentSystems.DeactivateReactiveSystems();
                parentSystems.ActivateReactiveSystems();
                parentSystems.Execute();

                var spy = (ReactiveSubSystemSpy)system.subsystem;
                spy.didExecute.should_be(0);
                spy.initialized.should_be_true();

                pool.CreateEntity().AddComponentA();
                systems.Execute();
                spy.didExecute.should_be(1);
            };
        };
    }
Example #56
0
 /// <summary><see cref="object.ToString"/></summary>
 public override string ToString()
 {
     return(GetType().Name
            + "\n" + nameof(Connector) + ": " + Connector
            + "\n" + nameof(Systems) + " (" + Systems.Count + "): " + string.Join(", ", Systems.Select(x => x.ModelAction.Name).ToArray())
            + "\n" + nameof(CurrentSystem) + ": " + CurrentSystem
            + "\n" + nameof(ModelInputs) + " (" + ModelInputs.Count + "): " + string.Join(", ", ModelInputs.Select(x => x.Name).ToArray())
            + "\n" + nameof(ModelOutputs) + " (" + ModelOutputs.Count + "): " + string.Join(", ", ModelOutputs.Select(x => x.Name).ToArray())
            + "\n" + nameof(SystemCommands) + " (" + SystemCommands.Count + "): " + string.Join(", ", SystemCommands.Select(x => x.Name).ToArray())
            + "\n" + nameof(SystemEvents) + " (" + SystemEvents.Count + "): " + string.Join(", ", SystemEvents.Select(x => x.Name).ToArray()));
 }
Example #57
0
 public static PointsSystem GetSystemInstance(PointsType t)
 {
     return(Systems.FirstOrDefault(s => s.Loyalty == t));
 }
Example #58
0
 public static void HandleKill(BaseCreature victim, Mobile damager, int index)
 {
     Systems.ForEach(s => s.ProcessKill(victim, damager, index));
 }
Example #59
0
 /// <summary>
 /// 终结助手
 /// </summary>
 public void OnTermination()
 {
     Systems.Clear();
     Entities.Clear();
 }
Example #60
0
 private void Start()
 {
     contexts = Contexts.sharedInstance; // 上下文对象
     systems  = CreateSystems(contexts);
     //systems.Initialize();
 }