| | |
| | | public int housekeeperEndTime; // 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | public byte[] warehouseIDList; //完成的,包含0空,主要用于领取的索引
|
| | | public Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp> campInfoDict = new Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp>();
|
| | | public Dictionary<int, Dictionary<int, int[]>> tmpCampWorkerSkinIDDict = new Dictionary<int, Dictionary<int, int[]>>(); //最后一次营地淘金对应的皮肤(预分配),纯粹用于显示模型
|
| | | public Dictionary<int, List<int>> tmpCampWorkerSkinIDDict = new Dictionary<int, List<int>>(); //最后一次营地淘金对应的皮肤(预分配),纯粹用于显示模型
|
| | |
|
| | | public event Action<int> OnGoldRushCampEvent; //服务端通知营地信息
|
| | | public event Action OnGoldRushInfoEvent;
|
| | |
| | |
|
| | | //行为事件
|
| | | public event Action<int> OnRefreshItemEvent; //刷新淘金道具
|
| | | public event Action<int, int, int> GoldRushEvent; //营地ID,执行事件(0出发,1返程),监工数量
|
| | | public event Action<PosEvent, bool, int, int, string> PathEvent; //事件,是否返程,营地ID,第几个工人,聊天内容(后续考虑传结构数据)
|
| | |
|
| | | public const int followWorkerCount = 3; //小兵的数量,非监工
|
| | |
| | |
|
| | |
|
| | | public PlayerDataType unLockMoneyType; //刷新用
|
| | | public float lastAssignWorkTime;
|
| | | public float lastCallBackTime;
|
| | |
|
| | |
|
| | | public override void Init()
|
| | |
| | | // }
|
| | | }
|
| | |
|
| | |
|
| | | int skinIDIndex;
|
| | | public int GetRandommSkinID()
|
| | | {
|
| | | var skinID = skinIDs[skinIDIndex % skinIDs.Count];
|
| | | skinIDIndex++;
|
| | | //从已解锁中随机
|
| | | return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | return skinID;
|
| | | }
|
| | |
|
| | | //参考:
|
| | | //未发布 goldid = 0 endtime不定(完成或者从未开始)
|
| | | //已发布未进行 goldid != 0 endtime = 0
|
| | | //已发布进行中 goldid != 0 endtime !=0
|
| | | //预分配监工皮肤
|
| | | void InitWorkerSkinID(HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp campInfo)
|
| | | {
|
| | | if (campInfo.EndTime == 0 && forceStopCampID == 0)
|
| | | {
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID))
|
| | | {
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID].Clear();
|
| | | }
|
| | | return;
|
| | | }
|
| | | if (campInfo.GoldID != 0 && campInfo.EndTime != 0)
|
| | | {
|
| | | //预防重复随机
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID) && tmpCampWorkerSkinIDDict[campInfo.CampID].ContainsKey((int)campInfo.EndTime))
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID) && tmpCampWorkerSkinIDDict[campInfo.CampID].Count != 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (!tmpCampWorkerSkinIDDict.ContainsKey(campInfo.CampID))
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID] = new List<int>();
|
| | | for (int i = 0; i < campInfo.WorkerCnt; i++)
|
| | | {
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID] = new Dictionary<int, int[]>();
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID].Add(GetRandommSkinID());
|
| | | }
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID].Clear();
|
| | |
|
| | | //预分配随机3个
|
| | | tmpCampWorkerSkinIDDict[campInfo.CampID][(int)campInfo.EndTime] = new int[] { GetRandommSkinID(), GetRandommSkinID(), GetRandommSkinID() };
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | if (tmpCampWorkerSkinIDDict.ContainsKey(campID))
|
| | | {
|
| | | var keys = tmpCampWorkerSkinIDDict[campID].Keys.ToList();
|
| | | if (keys.Count > 0)
|
| | | var skinIDs = tmpCampWorkerSkinIDDict[campID];
|
| | | if (index < skinIDs.Count)
|
| | | {
|
| | | var skinIDs = tmpCampWorkerSkinIDDict[campID][keys[0]];
|
| | | if (index < skinIDs.Length)
|
| | | {
|
| | | return skinIDs[index];
|
| | | }
|
| | | return skinIDs[index];
|
| | | }
|
| | | else
|
| | | {
|
| | | var skinID = GetRandommSkinID();
|
| | | skinIDs.Add(skinID);
|
| | | return skinID;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | //没有预分配则随机
|
| | | return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | }
|
| | |
|
| | |
| | | return (workerUnlockState & (1 << workerID)) != 0;
|
| | | }
|
| | |
|
| | | public int forceStopCampID;
|
| | | // 0-发布淘金(消耗淘金令);1-刷新淘金;2-开始淘金或调整监工数;3-取消淘金
|
| | | public void SendGoldRushOP(int opType, int campID, int workerCnt)
|
| | | {
|
| | | if (opType == 3)
|
| | | {
|
| | | forceStopCampID = campID;
|
| | | }
|
| | | if (opType == 2 && workerCnt < GetCampWorkerCnt(campID))
|
| | | { |
| | | forceStopCampID = campID;
|
| | | }
|
| | | var pack = new CB036_tagCSGoldRushOP();
|
| | | pack.OPType = (byte)opType;
|
| | | pack.CampID = (byte)campID;
|
| | |
| | | }
|
| | |
|
| | |
|
| | | //通知外出行为事件
|
| | | public void NotifyGoldRushEvent(int campID, int eventType, int leaderCount)
|
| | | {
|
| | | GoldRushEvent?.Invoke(campID, eventType, leaderCount);
|
| | | }
|
| | |
|
| | | //通知路径行为事件
|
| | | public void NotifyPathEvent(PosEvent posEvent, bool isBack, int tendID, int index, string content)
|