| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System;
- using System.Collections.Generic;
- using FairyGUI;
- using UnityEngine;
- namespace GFGGame
- {
- public class TravelDataManager : SingletonBase<TravelDataManager>
- {
- public TravelData TravelData { get; set; }
- public List<int> ListTravelLocationCount = new List<int>();//下标对应TravelLoactionCfg表格id
- public List<int> ListTravelAreaRewardState = new List<int>();//下标对应TravelGuide表格id
- public void Clear()
- {
- TravelData = null;
- ListTravelLocationCount.Clear();
- ListTravelAreaRewardState.Clear();
- }
- public int GetTravelIndexByLocationId(int locationId)
- {
- for (int i = 0; i < CommonDataManager.Tables.TblTravelLoactionCfg.DataList.Count; i++)
- {
- if (CommonDataManager.Tables.TblTravelLoactionCfg.DataList[i].Id == locationId)
- {
- return i;
- }
- }
- return -1;
- }
- public int GetTravelCountByLocationId(int locationId)
- {
- if (ListTravelLocationCount.Count == 0) return 0;
- int index = GetTravelIndexByLocationId(locationId);
- return ListTravelLocationCount[index];
- }
- public int GetGuideIndexByAreaId(int areaId)
- {
- for (int i = 0; i < CommonDataManager.Tables.TblTravelGuideCfg.DataList.Count ; i++)
- {
- if (CommonDataManager.Tables.TblTravelGuideCfg.DataList[i].Id == areaId)
- {
- return i;
- }
- }
- return -1;
- }
- public int GetGuideRewardStateByAreaId(int areaId)
- {
- if (ListTravelAreaRewardState.Count == 0) return ConstBonusStatus.CAN_NOT_GET;
- int index = GetGuideIndexByAreaId(areaId);
- return TravelDataManager.Instance.ListTravelAreaRewardState[index];
- }
- public void GetTotalTravelProgress(out int count, out int totalCount)
- {
- totalCount = 1;
- count = 0;
- if (ListTravelLocationCount == null) return;
- for (int i = 0; i < ListTravelLocationCount.Count; i++)
- {
- if (ListTravelLocationCount[i] > 0)
- {
- count++;
- }
- }
- totalCount = ListTravelLocationCount.Count;
- }
- }
- }
|