示例#1
0
 public CS3TablesGroup()
 {
     tablesDirectory = ConfigurationManager.AppSettings["CS3TablesLocation"] + Path.DirectorySeparatorChar;
     Name            = new NameTable(tablesDirectory);
     Status          = new StatusTable(tablesDirectory, Name);
     //var nameR = Name.GetRecords().Where(i => i.OwnerID >= 0).OrderBy(i => i.OwnerID).ToList();
     //var statusR = Status.GetStatusPRecords().ToList();
     Magic = new MagicTable(tablesDirectory, Name);
 }
示例#2
0
        static void Main(string[] args)
        {
            var warPlayer  = new Player(new WarriorFactory());
            var archPlayer = new Player(new ArcherFactory());

            warPlayer.Hit();
            warPlayer.Run();

            archPlayer.Hit();
            archPlayer.Run();

            //check adapter
            AdapterSample();
            //check bridge

            Character myCharacter = new Warrior(new Sword());

            myCharacter.KillMobs();
            myCharacter.GetExp();

            myCharacter.Weapon = new Bridge.Bow();

            //need to kill flying mobs
            myCharacter.KillMobs();
            myCharacter.GetExp();

            BuilderExample();

            //check composite
            var objectsCategory = new Category("Objects");
            var weaponCategory  = new Category("Weapons");
            var armorCategory   = new Category("Armors");

            var item  = new MenuItem("Battle Axe");
            var item1 = new MenuItem("Long Sword");

            var ac  = new MenuItem("Plate");
            var ac1 = new MenuItem("Tights");

            weaponCategory.Add(item);
            weaponCategory.Add(item1);
            armorCategory.Add(ac);
            armorCategory.Add(ac1);
            objectsCategory.Add(weaponCategory);
            objectsCategory.Add(armorCategory);

            objectsCategory.Print();

            weaponCategory.Print();

            armorCategory.Print();


            //check decorator

            Decorator.Weapon mysword = new Decorator.Sword("Player1 Sword");
            Console.WriteLine($"{mysword.Name} cost {mysword.GetCost()} p.");
            Console.WriteLine("Update my sword");

            mysword = new Decorator.FireDecorator(mysword);
            Console.WriteLine($"{mysword.Name} cost {mysword.GetCost()} p.");

            //check facade

            MagicBook       mb = new MagicBook();
            MagicTable      mt = new MagicTable();
            ReagentsCreator rc = new ReagentsCreator();

            MagicRitualFacade mr = new MagicRitualFacade(mb, mt, rc);

            Mage xatab = new Mage();

            xatab.SummonImp(mr);


            //abstact method factory

            Developer dev    = new WoodDeveloper("poor civilization");
            var       castle = dev.Create();

            dev = new StoneDeveloper("grate civilization");
            var castle2 = dev.Create();



            //check flyweight

            double xstart = 0;
            double ystart = 0;

            var houseFactory = new ConstructionFactory();


            for (int i = 0; i < 5; i++)
            {
                var wmConstruction = houseFactory.GetConstruction("WarMachineFactory");
                wmConstruction?.Build(xstart, ystart);
                ystart += 105;

                var brickHouse = houseFactory.GetConstruction("Warehouse");
                brickHouse?.Build(xstart, ystart);
                ystart += 205;
                xstart += 310;
            }


            Console.ReadLine();
        }
示例#3
0
 public MagicTableForm(MagicTable magicTable, NameTable nameTable)
 {
     this.nameTable = nameTable;
     InitializeComponent();
     this.magicTable = magicTable;
 }