void WearSlippers(Slippers slip) { if (slippers) { // trash old slippers Destroy(slippers.left.gameObject); Destroy(slippers.right.gameObject); Destroy(slippers.gameObject); } slippers = slip; if (slippers.audio) { slippers.audio.Play(); } // attatch new slippers; slippers.left.SetParent(left, true); slippers.left.localPosition = Vector3.zero; slippers.left.localScale = Vector3.one; slippers.left.localEulerAngles = Vector3.zero; slippers.right.SetParent(right, true); slippers.right.localPosition = Vector3.zero; slippers.right.localScale = Vector3.one; slippers.right.localEulerAngles = new Vector3(0, 180, 180); var scoreUI = FindObjectOfType <PlayerScoreUI>(); if (scoreUI) { scoreUI.SetSlipper(Id, slippers.left); } }
public static void Main(string[] args) { Sneakers mySneakers = new Sneakers(); mySneakers.Brand(); mySneakers.Color(); mySneakers.Price(); Slippers mySlippers = new Slippers(); mySlippers.Brand(); mySlippers.Color(); mySlippers.Price(); //ถ้ากด start ไม่ขึ้น กด Ctrl+F5 }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } Slippers = await _context.Slippers.FirstOrDefaultAsync(m => m.Id == id); if (Slippers == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Slippers = await _context.Slippers.FindAsync(id); if (Slippers != null) { _context.Slippers.Remove(Slippers); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
static void Main(string[] args) { #region 修饰模式基本例子 var cc = new ConcreateComponent(); var a1 = new ConcreateDecoratorA(); var b1 = new ConcreateDecoratorB(); a1.SetComponent(cc); //ConcreateDecoratorA包装cc b1.SetComponent(a1); //ConcreateDecoratorB包装a1 b1.Operation(); #endregion #region 饰修饰例子 var tShirt = new TShirt(); var bigTrouser = new BigTrouser(); var slippers = new Slippers(); tShirt.Decorate(new Person("李雷雷")); bigTrouser.Decorate(tShirt); slippers.Decorate(bigTrouser); slippers.Show(); tShirt = new TShirt(); var skirt = new Skirt(); var whiteShoes = new WhiteShoes(); tShirt.Decorate(new Person("韩梅梅")); skirt.Decorate(tShirt); whiteShoes.Decorate(skirt); whiteShoes.Show(); //personList.ForEach(user => { // Console.WriteLine($"{user.Name}的装扮如下:"); //}); #endregion Console.ReadLine(); }