Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- using System;
- using System.Collections.Generic;
- using CIG.Extensions;
- using Engine.DependencyTree;
- using SUISS.Core;
- using UnityEngine;
- using UnityEngine.UI;
-
- public abstract class QuestTabContentView : MonoBehaviour
- {
- protected void OnDestroy()
- {
- this.DeinitView();
- }
-
- public void InitView()
- {
- this.DeinitView();
- SingletonMonobehaviour<DependencyTree>.Instance.DependencyActiveChangedEvent += this.OnDependencyActiveChanged;
- this.RefreshQuests();
- this._scrollRect.normalizedPosition = Vector2.zero;
- this.InvokeNextFrame(delegate
- {
- this._scrollRect.normalizedPosition = Vector2.zero;
- });
- }
-
- public void DeinitView()
- {
- if (SingletonMonobehaviour<DependencyTree>.IsAvailable)
- {
- SingletonMonobehaviour<DependencyTree>.Instance.DependencyActiveChangedEvent -= this.OnDependencyActiveChanged;
- }
- this.OnDeinit();
- }
-
- protected bool HasQuest(Dependency dependency)
- {
- return this._quests != null && this._quests.Contains(dependency);
- }
-
- protected abstract void RefreshQuests();
-
- protected virtual void OnDeinit()
- {
- }
-
- private void OnDependencyActiveChanged(Dependency dependency, bool active)
- {
- if (this.HasQuest(dependency))
- {
- this.RefreshQuests();
- }
- }
-
- [SerializeField]
- private ScrollRect _scrollRect;
-
- protected List<Dependency> _quests = new List<Dependency>();
- }
|