GoodsComponen.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XRTool.Util;
  5. namespace ShadowStudio.Model
  6. {
  7. /// <summary>
  8. /// 物体的组件
  9. /// </summary>
  10. public class GoodsComponen : MonoBehaviour, ArtComponent
  11. {
  12. private ArtContainerHandler container;
  13. public ArtContainerHandler Container { get => container; }
  14. /// <summary>
  15. /// 删除资源
  16. /// </summary>
  17. public virtual void DestroyArt()
  18. {
  19. if (Container)
  20. {
  21. if(Container.gameObject.activeSelf)
  22. {
  23. Container.gameObject.SetActive(false);
  24. HttpsSendLog.Instance.SendLog("ClickOnDelete", " DestroyArt" + Container.gameObject.name);
  25. Destroy(Container.gameObject);
  26. }
  27. }
  28. //Destroy(gameObject);
  29. }
  30. /// <summary>
  31. /// 引用实例
  32. /// </summary>
  33. /// <returns></returns>
  34. public virtual GameObject GetInstace()
  35. {
  36. return gameObject;
  37. }
  38. /// <summary>
  39. /// 发送同步数据
  40. /// </summary>
  41. /// <param name="state"></param>
  42. /// <param name="status"></param>
  43. public virtual void SendTransfer(int state, int status)
  44. {
  45. if (Container != null)
  46. {
  47. Container.SendTransfer(state, status);
  48. }
  49. }
  50. /// <summary>
  51. /// 设置容器
  52. /// </summary>
  53. /// <param name="container"></param>
  54. /// <param name="art"></param>
  55. /// <param name="info"></param>
  56. public virtual void SetContainer(ArtContainerHandler container, Object art, ArtInfo info)
  57. {
  58. this.container = container;
  59. //if (art is GameObject)
  60. //{
  61. // GameObject obj = art as GameObject;
  62. // UnityUtil.SetParent(transform, obj.transform);
  63. //}
  64. }
  65. /// <summary>
  66. /// 同步数据
  67. /// </summary>
  68. /// <param name="goods"></param>
  69. /// <param name="smooth"></param>
  70. public virtual void TransferSyn(GoodsInfo goods, bool smooth = true)
  71. {
  72. }
  73. }
  74. }