12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System.Collections.Generic;
- using Excel2Json;
- using Fort23.UTool;
- using Utility;
- namespace Mono.Player
- {
- public class PlayerGuideDataComponent
- {
- /// <summary>
- /// key 引导组 value 第几步
- /// </summary>
- public Map<int, int> AllGuideData = new Map<int, int>();
- public Map<int, List<int>> ALLGuideStepData = new Map<int, List<int>>();
- //
- // public void Init(RepeatedField<Guide> repeatedField)
- // {
- // foreach (var playerGuideConfig in ConfigComponent.Instance.GetAll<PlayerGuideConfig>())
- // {
- // if (!ALLGuideStepData.ContainsKey(playerGuideConfig.groupID))
- // {
- // List<int> list = new List<int>();
- // list.Add(playerGuideConfig.ID);
- // ALLGuideStepData.Add(playerGuideConfig.groupID, list);
- // }
- // else
- // {
- // ALLGuideStepData[playerGuideConfig.groupID].Add(playerGuideConfig.ID);
- // }
- // }
- //
- // for (var i = 0; i < repeatedField.Count; i++)
- // {
- // int index = ALLGuideStepData[repeatedField[i].GroupId].IndexOf(repeatedField[i].GuideId);
- // if (index == -1)
- // {
- // index = ALLGuideStepData[repeatedField[i].GroupId].Count - 1;
- // }
- //
- // AllGuideData.Add(repeatedField[i].GroupId, index);
- // }
- //
- // if (AllGuideData.Count == 0)
- // {
- // PlayerManager.Instance.curGuideGroupId = 0;
- // }
- // }
- /// <summary>
- /// 更新本地引导缓存
- /// </summary>
- /// <param name="id"></param>
- public void UpdateData(int id)
- {
- PlayerGuideConfig playerGuideConfig = ConfigComponent.Instance.Get<PlayerGuideConfig>(id);
- int index = ALLGuideStepData[playerGuideConfig.groupID].IndexOf(id);
- AllGuideData[playerGuideConfig.groupID] = index;
- }
- public int GetGuideIndex(int id)
- {
- if (AllGuideData.ContainsKey(id))
- {
- return AllGuideData[id];
- }
- return -1;
- }
- }
- }
|