You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 line
1.1 KiB

  1. using System;
  2. using CIG;
  3. using Engine.DependencyTree;
  4. using SUISS.Core;
  5. using UnityEngine;
  6. public sealed class OngoingQuestsView : QuestTabContentView
  7. {
  8. protected override void RefreshQuests()
  9. {
  10. this._quests.Clear();
  11. Dependency dependency = SingletonMonobehaviour<DependencyTree>.Instance["quests"];
  12. int count = dependency.Children.Count;
  13. for (int i = 0; i < count; i++)
  14. {
  15. Dependency dependency2 = dependency.Children[i];
  16. if (dependency2.IsActive)
  17. {
  18. this._quests.Add(dependency2);
  19. }
  20. }
  21. this._recyclerView.Init(this._quests.Count, new Func<GameObject, int, bool>(this.InitQuestItem));
  22. }
  23. protected override void OnDeinit()
  24. {
  25. this._recyclerView.PushInstances();
  26. }
  27. private bool InitQuestItem(GameObject gameObject, int index)
  28. {
  29. if (index < 0 || index >= this._quests.Count)
  30. {
  31. return false;
  32. }
  33. QuestItem component = gameObject.GetComponent<QuestItem>();
  34. component.Initialize(this._quests[index]);
  35. return true;
  36. }
  37. public const string RegularQuestsDependencyIdentifier = "quests";
  38. [SerializeField]
  39. private RecyclerGridLayoutGroup _recyclerView;
  40. }