public void ButtonPressed(Button button) { option = button.name; Debug.Log(option); switch (option) { case ("Beach"): requirements.Location = 1; break; case ("Venue"): requirements.Location = 2; break; case ("Office"): requirements.Location = 3; break; case ("House"): requirements.Location = 4; break; case ("Woman"): requirements.Woman = true; break; case ("Man"): requirements.Woman = false; break; case ("Formal"): requirements.Formal = true; break; case ("Informal"): requirements.Formal = false; break; case ("Create"): ClothesFactory factory = new ClothesFactory(requirements); IClothes v = factory.Create(); createPressed(v); break; default: requirements.Location = 2; requirements.Woman = true; requirements.Formal = false; break; } //return 0; }
public void Run() { IWearFactory wear = new BlackWearFactory(); IClothes clothes = wear.CreateClothes(); ITrousers trousers = wear.CreateTrousers(); IShoes shoes = wear.CreateShoes(); clothes.Wear(); trousers.Wear(); shoes.Wear(); }
void Start() { ClothesRequirements requirements = new ClothesRequirements(); requirements.Woman = Woman; requirements.Location = Mathf.Max(Location); requirements.Woman = Formal; requirements.Formal = Formal; ClothesFactory factory = new ClothesFactory(requirements); IClothes v = factory.Create(); Debug.Log(v); }
private static bool AreAllTheItemsOfClothingOn(IClothes clothes, HashSet <string> set) { if (clothes.GetType() == typeof(HotTemperatureClothes)) { return (Enum.GetValues(typeof(ClothesDescription)) .Cast <object>() .Where( cd => cd.ToString() != ClothesDescription.PutOnSocks.ToString() && cd.ToString() != ClothesDescription.PutOnJacket.ToString() && cd.ToString() != ClothesDescription.LeaveHouse.ToString()) .All(cd => set.Contains(cd.ToString()))); } return (Enum.GetValues(typeof(ClothesDescription)) .Cast <object>() .Where(cd => cd.ToString() != ClothesDescription.LeaveHouse.ToString()) .All(cd => set.Contains(cd.ToString()))); }
public void createPressed(IClothes v) { DestroyAllObjects(); if (v.ToString() == "Tuxedo" && (GameObject.Find("Tux(Clone)") == null)) { Instantiate(Tux); } if (v.ToString() == "Swimwear" && (GameObject.Find("Swimwear(Clone)") == null)) { Instantiate(Swimwear); } if (v.ToString() == "SunDress" && (GameObject.Find("Sundress(Clone)") == null)) { Instantiate(Sundress); } if (v.ToString() == "BusinessProfessional" && (GameObject.Find("BusinessProf(Clone)") == null)) { Instantiate(BusinessProf); } if (v.ToString() == "BusinessCasual" && (GameObject.Find("BusinessCas(Clone)") == null)) { Instantiate(BusinessCas); } if (v.ToString() == "CocktailDress" && (GameObject.Find("CocktailDress(Clone)") == null)) { Instantiate(CocktailDress); } if (v.ToString() == "DressyCasual" && (GameObject.Find("DressyCas(Clone)") == null)) { Instantiate(DressyCas); } if (v.ToString() == "CasualWear" && (GameObject.Find("Casual(Clone)") == null)) { Instantiate(Casual); } if (v.ToString() == "EveningDress" && (GameObject.Find("EveningDress(Clone)") == null)) { Instantiate(EveningDress); } }
public GoToShop(IClothes clo) { clothes = clo; }
static void Main(string[] args) { try { ClothesFactory clothesFactory = new ClothesFactory(); IClothes shirt = null; // User make choice. Console.WriteLine("Please choose clothing you want to trading:"); Console.WriteLine("1: TShirt, 2: DShirt"); switch (int.Parse(Console.ReadLine().ToString())) { case 1: shirt = clothesFactory.GetClothes(ClothesType.TShirt); break; case 2: shirt = clothesFactory.GetClothes(ClothesType.TShirt); break; default: break; } // Execute action. Console.WriteLine("Please choose action you want to trading:"); Console.WriteLine("1: Sell, 2: Buy"); var tradetype = int.Parse(Console.ReadLine().ToString()); // User make a number to trade. Console.WriteLine("Please choose number of item you want to trading:"); var tradeNo = int.Parse(Console.ReadLine().ToString()); // User make a number to trade. Console.WriteLine("Please choose option for item you want to trading:"); var opts = OptionUtility.GetOption(shirt.Options); switch (tradetype) { case 1: Console.WriteLine(shirt.Trade(TradeType.Sell, tradeNo, opts)); break; case 2: Console.WriteLine(shirt.Trade(TradeType.Buy, tradeNo, opts)); break; default: break; } } catch (Exception ex) { Console.WriteLine(ex); } Console.Read(); }