Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ResourceProvider.Instance.Initialize(GraphicsDevice, Content);

            var dungeonParser = new DungeonParser();

            dungeonParser.Parse();

            var renderers = new DefaulRenderers(Content, GraphicsDevice);
            var factoreis = new LegacyFactories(dungeonParser.Data, renderers);
            var theron    = new LegacyLeader(factoreis);

            var initializer = new LegacyMapBuilderInitializer();
            var builder     = new LegacyMapBuilder(initializer);

            initializer.Data        = dungeonParser.Data;
            initializer.ItemCreator = new LegacyItemCreator(builder);

            var wallActuatorCreator  = new WallActuatorCreator(builder);
            var floorActuatorCreator = new FloorActuatorCreator(builder);
            var sidesCreator         = new SidesCreator(builder, wallActuatorCreator, floorActuatorCreator);
            var logicActuatorCreator = new LogicActuatorCreator(builder);
            var creatureCreator      = new CreatureCreator(builder);

            initializer.TileCreator = new LegacyTileCreator(builder, sidesCreator, logicActuatorCreator, creatureCreator);
            initializer.Initialize();

            dungeon = new Dungeon(builder, factoreis, theron, GraphicsDevice);

            GameConsole.InitializeConsole(this, dungeon);
            GameConsole.Instance.DrawOrder = 1;
        }
Пример #2
0
        public override async Task Run()
        {
            leader = ConsoleContext.AppContext.Leader;

            if (Parameters.Length == 0)
            {
                if (leader.Hand != null)
                {
                    Output.WriteLine(leader.Hand.ToString());
                }
                else
                {
                    Output.WriteLine("Empty");
                }
            }
            else if (Parameters.Length > 0)
            {
                switch (Parameters[0])
                {
                case "take":
                    await TakeItem();

                    break;

                case "takesub":
                    await TakeSubItem();

                    break;

                case "put":
                    await PutItem();

                    break;

                case "putsub":
                    await PutSubItem();

                    break;

                case "use":
                    await UseItem();

                    break;

                default:
                    Output.WriteLine("invalid command!");
                    break;
                }
            }
            else
            {
                Output.WriteLine("Invalid paramtetes");
            }
        }
Пример #3
0
        public override async Task Run()
        {
            LegacyLeader   t        = ConsoleContext.AppContext.Leader;
            Champion       champoin = null;
            IActionFactory action   = null;

            if (Parameters.Length == 0)
            {
                champoin = await GetFromItemIndex(t.PartyGroup);

                if (!Ready(champoin))
                {
                    return;
                }

                action = await GetFromItemIndex(champoin.CurrentCombos.ToArray());
            }
            else if (Parameters.Length == 1)
            {
                champoin = GetItemAt(t.PartyGroup, 0);
                if (!Ready(champoin))
                {
                    return;
                }
                action = await GetFromItemIndex(champoin?.CurrentCombos.ToArray());
            }
            else if (Parameters.Length == 2)
            {
                champoin = GetItemAt(t.PartyGroup, 0);
                if (!Ready(champoin))
                {
                    return;
                }
                action = GetItemAt(champoin?.CurrentCombos.ToArray(), 1);
            }

            if (champoin != null && action != null)
            {
                champoin.DoAction(action);
            }
            else
            {
                Output.WriteLine("Invalid arguments.");
            }
        }