public void Decoratot()
        {
            // 可參考PaymentController SetPayDataStatusToPayment
            var person = new Person("小菜");

            Console.WriteLine($"第一種裝扮");
            var pqx = new Sneakers();
            var kk  = new Trousers();
            var dtx = new TShirts();

            pqx.Decorate(person);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();

            Console.WriteLine($"第二種裝扮");
            var px = new LeatherShoes();
            var ld = new Tie();
            var xz = new BusinessSuit();

            px.Decorate(person);
            ld.Decorate(px);
            xz.Decorate(ld);
            xz.Show();
        }
        public void StorageAndItem_MaxSlotsInventoryNotOverridden_ItemAmountIsTwo()
        {
            IContainer FirstTrousers = new Trousers();
            IChronic   GanjaTest     = new MasterKush();
            IChronic   GanjaTest2    = new MasterKush();
            IChronic   GanjaTest3    = new MasterKush();

            FirstTrousers.Add((IItem)GanjaTest);
            FirstTrousers.Add((IItem)GanjaTest2);
            FirstTrousers.Add((IItem)GanjaTest3);
            // Trousers only have 2 item slots, so should always assert to 2, the 3rd one will not be added.
            Assert.IsTrue(FirstTrousers.ItemAmount == 2);
        }
        public void Decoratot()
        {
            var person = new Person("小菜");

            // 第一種裝扮
            var pqx = new Sneakers();
            var kk  = new Trousers();
            var dtx = new TShirts();

            pqx.Decorate(person);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool pockets, twists, arrows, holes;

            pockets = chbPockets.Checked;
            twists  = chbTwists.Checked;
            arrows  = chbArrows.Checked;
            holes   = chbHoles.Checked;
            object[] value = Form1.GetCommonData(txtName, txtCloth, txtPrice, txtLength, cmbColor);
            if (value != null)
            {
                Trousers top = new Trousers(pockets, twists, arrows, holes, (string)value[0], (string)value[1], (int)value[2], (double)value[3], (CatalogItem.TColor)value[4]);
                Add_Display(top, ObjectIndex);
                this.Close();
            }
        }
Esempio n. 5
0
    public void SpawnItem()
    {
        var chance = 0;

        chance = random.Next(0, 6);
        switch (chance)
        {
        case 0:
            Sword sword = new Sword();
            sword.Initialization();
            inventory.Add(sword);
            break;

        case 1:
            Stick stick = new Stick();
            stick.Initialization();
            inventory.Add(stick);
            break;

        case 2:
            Hat hat = new Hat();
            hat.Initialization();
            inventory.Add(hat);
            break;

        case 3:
            Bib bib = new Bib();
            bib.Initialization();
            inventory.Add(bib);
            break;

        case 4:
            Trousers trousers = new Trousers();
            trousers.Initialization();
            inventory.Add(trousers);
            break;

        case 5:
            Boots boots = new Boots();
            boots.Initialization();
            inventory.Add(boots);
            break;
        }
    }
        public void StorageAndItem_GrowAndSellToShop_ShopItemAmountIncrease()
        {
            IContainer FirstTrousers = new Trousers();
            IChronic   GanjaTest     = new MasterKush();
            IContainer MasonJar      = new SmallMasonJar();

            for (int i = 0; i < GanjaTest.SeedingAge; i++)
            {
                GanjaTest.Grow(Water.Low, Light.None, Food.None);
            }

            for (int i = 0; i < GanjaTest.FloweringAge; i++)
            {
                GanjaTest.Grow(Water.Low, Light.Spring, Food.None);
            }

            for (int i = 0; i < 20; i++)
            {
                GanjaTest.Grow(Water.Medium, Light.Summer, Food.None);
            }

            IChronic SellTest = GanjaTest.Harvest().Harvest;

            for (int i = 0; i < SellTest.DryingAge; i++)
            {
                SellTest.Dry();
            }

            SellTest.Weck();
            for (int i = 0; i < 14; i++)
            {
                SellTest.Cure(MasonJar);
            }

            SellTest.Finish();
            FirstTrousers.Add((IItem)SellTest);

            IShop shop = new Shop();

            shop.Sell((IItem)SellTest);

            Assert.IsTrue(shop.ItemAmount == 1);
        }
Esempio n. 7
0
        public List <Trousers> showTrousers()
        {
            List <Trousers> trousersList = new List <Trousers>();

            Connection();
            SqlDataReader reader;
            //Creating an instance of SqlCommand
            SqlCommand cmd;

            //Intialising SqlCommand
            cmd             = new SqlCommand("uspShowAllTrousers", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                conn.Open();
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Trousers trousers = new Trousers();
                    trousers.ProductId           = reader["TrousersID"].ToString();
                    trousers.ProductName         = reader["TrousersName"].ToString();
                    trousers.ProductDescription  = reader["TrousersDescription"].ToString();
                    trousers.ProductPricePerUnit = decimal.Parse(reader["TrousersPricePerUnit"].ToString());
                    trousers.ProductQuantity     = int.Parse(reader["TrousersQuantity"].ToString());
                    trousers.ProductSize         = reader["TrousersSize"].ToString();
                    trousers.ProductColour       = reader["TrouserColour"].ToString();
                    trousers.TrouserImage        = (byte[])reader["TrouserImage"];
                    trousersList.Add(trousers);
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            finally
            {
                conn.Close();
            }

            return(trousersList);
        }
        public void StorageAndItem_MasterKushAddToInventory_ItemAmountIncrease()
        {
            IContainer FirstTrousers = new Trousers();
            IChronic   GanjaTest     = new MasterKush();
            IContainer MasonJar      = new SmallMasonJar();

            for (int i = 0; i < GanjaTest.SeedingAge; i++)
            {
                GanjaTest.Grow(Water.Low, Light.None, Food.None);
            }

            for (int i = 0; i < GanjaTest.FloweringAge; i++)
            {
                GanjaTest.Grow(Water.Low, Light.Spring, Food.None);
            }

            for (int i = 0; i < 20; i++)
            {
                GanjaTest.Grow(Water.Medium, Light.Summer, Food.None);
            }


            var InventoryTestResult = GanjaTest.Harvest().Harvest;

            for (int i = 0; i < InventoryTestResult.DryingAge; i++)
            {
                InventoryTestResult.Dry();
            }

            InventoryTestResult.Weck();
            for (int i = 0; i < 14; i++)
            {
                InventoryTestResult.Cure(MasonJar);
            }

            InventoryTestResult.Finish();
            FirstTrousers.Add(InventoryTestResult);
            Assert.IsTrue(FirstTrousers.ItemAmount == 1);
            Assert.IsInstanceOfType(InventoryTestResult, typeof(IChronic));
        }
Esempio n. 9
0
        public void new_pants_product(int _pants_category)
        {
            _pants_category = 0;
            _pants_category = rnd.Next(1, 5);

            if (_pants_category == 1)
            {
                Cargo cargo = new Cargo();
            }
            else if (_pants_category == 2)
            {
                Chinos chinos = new Chinos();
            }
            else if (_pants_category == 3)
            {
                Denim denim = new Denim();
            }
            else if (_pants_category == 4)
            {
                Trousers trousers = new Trousers();
            }
        }
Esempio n. 10
0
 public Client(ClothesFactory factory)
 {
     _shirt    = factory.CreateShirt();
     _trousers = factory.CreateTrousers();
     _eyewear  = factory.CreateEyewear();
 }
 public Client(clothesFactory factory)
 {
     _shirt    = factory.CreateShirt();
     _trousers = factory.CreateTrousers();
 }
Esempio n. 12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            PersonOne personOne = new PersonOne()
            {
                Name = "小黑"
            };

            personOne.Show();

            Console.WriteLine();
            SuitPersonOne suitPersonOne = new SuitPersonOne()
            {
                Name = "小黑"
            };

            suitPersonOne.Show();
            Console.WriteLine();

            TShirtPersonOne shirtPersonOne = new TShirtPersonOne()
            {
                Name = "小黑"
            };

            shirtPersonOne.Show();
            Console.WriteLine();

            Console.WriteLine();
            Console.WriteLine("==============================");

            // 首先要有打扮的人
            AbstractPerson xiaoXin = new Person()
            {
                Name = "小新"
            };
            // 然后准备要穿的衣服
            Finery personWithSuit     = new Suit();     // 西装
            Finery personWithTie      = new Tie();      // 领带
            Finery personWithTrousers = new Trousers(); // 长裤
            Finery personWithLeather  = new Leather();  // 皮鞋

            // 最后按顺序把衣服穿上
            // 先穿裤子
            personWithTrousers.SetPerson(xiaoXin);
            // 再让穿裤子的小新穿西装
            personWithSuit.SetPerson(personWithTrousers);
            // 最后把鞋子领带都穿上
            personWithTie.SetPerson(personWithSuit);
            personWithLeather.SetPerson(personWithTie);

            // 照下镜子
            personWithLeather.Show();

            Console.WriteLine();
            Console.WriteLine("==============================");

            AbstractPerson xiaoHei = new Person()
            {
                Name = "小黑"
            };

            Finery personWithTShirt  = new TShirt();  // 大t恤
            Finery personWithSneaker = new Sneaker(); // 网鞋

            personWithTShirt.SetPerson(xiaoHei);
            personWithSneaker.SetPerson(personWithTShirt);

            personWithSneaker.Show();



            Console.ReadKey();
        }
    public Item GenerateItem(CraftableItem mould)
    {
        if (CanCraftItem(mould))
        {
            if (mould.MyCraftedItemType == CraftedItemType.WEAPON)
            {
                Weapon ret = null;
                switch ((mould as CraftedWeapon).tarType)
                {
                case (WeaponType.RECURVEBOW):
                    ret = new RecurveBow(ALib);
                    break;

                case (WeaponType.SWORD):
                    ret = new Sword(ALib);
                    break;

                case (WeaponType.CENSER):
                    ret = new Censer(ALib);
                    break;

                case (WeaponType.STAFF):
                    ret = new Staff(ALib);
                    break;

                case (WeaponType.SACRIFICIALKNIFE):
                    ret = new SacrificialKnife(ALib);
                    break;

                case (WeaponType.VESSEL):
                    ret = new Vessel(ALib);
                    break;
                }

                ret.CopyStats(mould as CraftedWeapon);
                Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp);
                return(ret);
            }
            else if (mould.MyCraftedItemType == CraftedItemType.ARMOR)
            {
                Armor ret = null;
                switch ((mould as CraftedArmor).tarType)
                {
                case (ArmorType.CHESTPLATE):
                    ret            = new Chestplate();
                    ret.MyItemType = ItemType.CHESTPLATE;
                    break;

                case (ArmorType.PLATELEGS):
                    ret            = new Platelegs();
                    ret.MyItemType = ItemType.PLATELEGS;
                    break;

                case (ArmorType.HELMET):
                    ret            = new Helmet();
                    ret.MyItemType = ItemType.HELMET;
                    break;

                case (ArmorType.CHESTGUARD):
                    ret            = new Chestguard();
                    ret.MyItemType = ItemType.CHESTGUARD;
                    break;

                case (ArmorType.CHAPS):
                    ret            = new Chaps();
                    ret.MyItemType = ItemType.CHAPS;
                    break;

                case (ArmorType.COIF):
                    ret            = new Coif();
                    ret.MyItemType = ItemType.COIF;
                    break;

                case (ArmorType.ROBE):
                    ret            = new Robe();
                    ret.MyItemType = ItemType.ROBE;
                    break;

                case (ArmorType.TROUSERS):
                    ret            = new Trousers();
                    ret.MyItemType = ItemType.TROUSERS;
                    break;

                case (ArmorType.HAT):
                    ret            = new Hat();
                    ret.MyItemType = ItemType.HAT;
                    break;
                }

                ret.CopyStats(mould as CraftedArmor);
                Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp);
                return(ret);
            }
            else if (mould.MyCraftedItemType == CraftedItemType.REAGENT)
            {
                print("Reagent Type: " + mould.ItemName);
                Reagent newReagent = new Reagent();
                newReagent.ReagentName     = mould.ItemName;
                newReagent.ReagentQuantity = 1;
                newReagent.ReagentSprite   = mould.SpritePath;
                Player_Accessor_Script.InventoryScript.AddResourceType(newReagent, newReagent.ReagentQuantity);
                Player_Accessor_Script.SkillsScript.AddExperience(mould.RequiredProfession, mould.RewardedExp);
            }
            else
            {
                print("Unknown crafting type");
            }
        }
        return(null);
    }