QuestUIData.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. public class QuestUIData : MonoBehaviour
  4. {
  5. [SerializeField]
  6. private Text title;
  7. [SerializeField]
  8. private Text experience;
  9. [SerializeField]
  10. private Text motivation;
  11. [SerializeField]
  12. private Text dollars;
  13. [SerializeField]
  14. private Text glam;
  15. [SerializeField]
  16. private Image questStateIcon;
  17. [SerializeField]
  18. private Sprite completed;
  19. [SerializeField]
  20. private Sprite noCompleted;
  21. private string id;
  22. public string Id
  23. {
  24. get { return id; }
  25. }
  26. public void Setup(DataTools.Quest quest, bool isCompleted = false)
  27. {
  28. id = quest.Id;
  29. title.text = quest.Description;
  30. experience.text = quest.Reward.Experience.ToString();
  31. motivation.text = quest.Reward.Motivation.ToString();
  32. dollars.text = quest.Reward.Dollars.ToString();
  33. glam.text = quest.Reward.Glam.ToString();
  34. if(isCompleted)
  35. Completed();
  36. }
  37. public void Completed()
  38. {
  39. questStateIcon.sprite = completed;
  40. }
  41. }