| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | using System.Collections.Generic;using System.Linq;using ET;using FairyGUI;namespace GFGGame{    public class GuideDataManager    {        private static Dictionary<int, Dictionary<int, int>> _guideDicIndex = new Dictionary<int, Dictionary<int, int>>();        public static int _currentGuideId;        public static void Clear()        {            _guideDicIndex.Clear();        }        public static int currentGuideId        {            get            {                return _currentGuideId;            }            set            {                if (_currentGuideId == value) return;                _currentGuideId = value;            }        }        public static async ETTask<bool> TryCompleteGuide(int guideId)        {            if (GameGlobal.skipGuide)            {                return false;            }            if (currentGuideId == guideId)            {                LogServerHelper.SendNodeLog(GuideDataManager.currentGuideId * 100 + 2);                bool result = await StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_GUIDE + guideId, 1);                return result;            }            return false;        }        public static int _currentGuideIdIndex;        public static int currentGuideIdIndex        {            get            {                return _currentGuideIdIndex;            }            set            {                _currentGuideIdIndex = value;            }        }        public static void SetGuideIndex(int guideId, int index)        {            if (!_guideDicIndex.ContainsKey(guideId))            {                _guideDicIndex.Add(guideId, new Dictionary<int, int>());            }            if (_guideDicIndex[guideId].ContainsKey(index)) return;            _guideDicIndex[guideId][index] = 0;        }        public static int IsGuideFinish(string guideKey)        {            if (GameGlobal.skipGuide) return 1;            GuideCfg cfg = GuideCfgArray.Instance.GetCfg(guideKey);            return StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_GUIDE + cfg.id);        }        public static bool TryCompleteGuideIndex(int guideId, int index, bool checkInde = true)        {            if (GameGlobal.skipGuide)            {                return false;            }            if (!checkInde && guideId == currentGuideId || checkInde && guideId == currentGuideId && index == currentGuideIdIndex && !IsGuideIndexFinish(guideId, index))            {                _guideDicIndex[guideId][index] = 1;                return true;            }            return false;        }        public static void SetGuideIndexState(int guideId, int index, int state)        {            if (guideId == currentGuideId && index == currentGuideIdIndex && _guideDicIndex.ContainsKey(guideId) && _guideDicIndex[guideId].ContainsKey(index))            {                _guideDicIndex[guideId][index] = state;            }        }        public static bool CheckAllIndexFinish(int guideId, int count)        {            for (int i = 1; i <= count; i++)            {                if (!IsGuideIndexFinish(guideId, i)) return false;            }            return true;        }        public static bool IsGuideIndexFinish(int guideId, int index)        {            if (index == 0) return true;            if (_guideDicIndex.ContainsKey(guideId) && _guideDicIndex[guideId].ContainsKey(index) && _guideDicIndex[guideId][index] == 1)            {                return true;            }            return false;        }    }}
 |