| | |
| | | public int housekeeperEndTime; // 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | public byte[] warehouseIDList; //完成的,包含0空,主要用于领取的索引
|
| | | public Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp> campInfoDict = new Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp>();
|
| | | public Dictionary<int, int> tmpCampIDToGoldID = new Dictionary<int, int>(); //最后一次营地淘金对应的物品,纯粹用于显示模型
|
| | | public Dictionary<int, Dictionary<int, int[]>> tmpCampWorkerSkinIDDict = new Dictionary<int, Dictionary<int, int[]>>(); //最后一次营地淘金对应的皮肤(预分配),纯粹用于显示模型
|
| | |
|
| | | public event Action<int> OnGoldRushCampEvent; //服务端通知营地信息
|
| | | public event Action OnGoldRushInfoEvent;
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public int GetRandommSkinID(int goldID, int index)
|
| | | public int GetRandommSkinID()
|
| | | {
|
| | | return skinIDs[(goldID % skinIDs.Count + index) % skinIDs.Count]; ;
|
| | | //从已解锁中随机
|
| | | // return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | }
|
| | |
|
| | | //预分配监工皮肤
|
| | | void InitWorkerSkinID(HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp campInfo)
|
| | | {
|
| | | if (campInfo.GoldID != 0 && campInfo.EndTime != 0)
|
| | | {
|
| | | //预防重复随机
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID) && tmpCampWorkerSkinIDDict[campInfo.CampID].ContainsKey((int)campInfo.EndTime))
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (!tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID))
|
| | | {
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID] = new Dictionary<int, int[]>();
|
| | | }
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID].Clear();
|
| | |
|
| | | //预分配随机3个
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID][(int)campInfo.EndTime] = new int[] { GetRandommSkinID(), GetRandommSkinID(), GetRandommSkinID() };
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetWorkerSkinID(int campID, int index)
|
| | | {
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campID))
|
| | | { |
| | | var keys = tmpCampWorkerSkinIDDict[campID].Keys.ToList();
|
| | | if (keys.Count > 0)
|
| | | {
|
| | | var skinIDs = tmpCampWorkerSkinIDDict[campID][keys[0]];
|
| | | if (index < skinIDs.Length)
|
| | | {
|
| | | return skinIDs[index];
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | }
|
| | |
|
| | | void RefreshUnLockSkinID()
|
| | |
| | | for (int i = 0; i < netPack.CampCnt; i++)
|
| | | {
|
| | | campInfoDict[netPack.CampList[i].CampID] = netPack.CampList[i];
|
| | | if (netPack.CampList[i].GoldID != 0)
|
| | | { |
| | | tmpCampIDToGoldID[netPack.CampList[i].CampID] = netPack.CampList[i].GoldID;
|
| | | }
|
| | | InitWorkerSkinID(netPack.CampList[i]);
|
| | | OnGoldRushCampEvent?.Invoke(netPack.CampList[i].CampID);
|
| | |
|
| | | }
|
| | |
| | | return 0;
|
| | | }
|
| | |
|
| | | public int GetCampLastGoldID(int campID)
|
| | | {
|
| | | if (tmpCampIDToGoldID.ContainsKey(campID))
|
| | | {
|
| | | return tmpCampIDToGoldID[campID];
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //获取营地工人
|
| | | public int GetCampWorkerCnt(int campID)
|