DressUpRemoveOperation.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using UnityEngine;
  2. using YooAsset;
  3. namespace GFGGame
  4. {
  5. public class DressUpRemoveOperation : DressUpOperationBase
  6. {
  7. private int itemID;
  8. private GameObject sceneObj;
  9. private GameObject parentObj;
  10. public DressUpRemoveOperation(int itemID, GameObject sceneObj, GameObject parentObj)
  11. {
  12. this.itemID = itemID;
  13. this.sceneObj = sceneObj;
  14. this.parentObj = parentObj;
  15. Debug.Log($"remove {itemID}");
  16. }
  17. internal override void Release()
  18. {
  19. this.sceneObj = null;
  20. this.parentObj = null;
  21. }
  22. internal override void Start()
  23. {
  24. Status = EOperationStatus.Succeed;
  25. }
  26. internal override void Update()
  27. {
  28. }
  29. internal override void Cancel()
  30. {
  31. Status = EOperationStatus.Failed;
  32. Error = "User cancel.";
  33. }
  34. internal override bool CheckRepeated(DressUpOperationBase t)
  35. {
  36. var operation = t as DressUpRemoveOperation;
  37. return (operation != null
  38. && operation.itemID == this.itemID
  39. && operation.sceneObj == this.sceneObj);
  40. }
  41. internal override void UpdateView()
  42. {
  43. if(sceneObj == null)
  44. {
  45. this.Release();
  46. return;
  47. }
  48. Debug.Log($"UpdateView remove {itemID}");
  49. DressUpUtil.RemoveItem(this.itemID, this.sceneObj, this.parentObj);
  50. }
  51. }
  52. }