Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
| | |
| | | |
| | | int arrIndex; |
| | | int itemLV; |
| | | int itemID; |
| | | public void Display(int _index) |
| | | { |
| | | arrIndex = _index; |
| | | int itemID = GoldRushManager.Instance.autoRefreshItemIDs[arrIndex]; |
| | | itemID = GoldRushManager.Instance.autoRefreshItemIDs[arrIndex]; |
| | | itemLV = GoldRushManager.Instance.GetAutoItemLV(arrIndex); |
| | | bool isOn = itemLV > 0; |
| | | itemLV = itemLV > 0 ? itemLV : 1; |
| | |
| | | void ChangeWorkerCount(int lv) |
| | | { |
| | | itemLV = lv; |
| | | var config = GoldRushItemConfig.GetConfig(itemID, itemLV); |
| | | itemCell.Init(new ItemCellModel(itemID, false, config.ItemCount)); |
| | | nameText.text = GoldRushManager.Instance.GetCampItemName(config); |
| | | if (!autoToggle.isOn) |
| | | { |
| | | return; |
| | |
| | | |
| | | Action<bool> OnComplete; |
| | | |
| | | public void Init(GoldRushPosEvent[] _leaderPathPointArr, float waitTime, int _tendID, bool isBack, Action<bool> _OnComplete) |
| | | public void Init(GoldRushPosEvent[] _leaderPathPointArr, float waitTime, int _tendID, int index, bool isBack, Action<bool> _OnComplete) |
| | | { |
| | | tendID = _tendID; |
| | | leaderPathPointArr = _leaderPathPointArr; |
| | |
| | | leaderPathPointArr[leaderPathPointArr.Length - 1].transform.localPosition; |
| | | OnComplete = _OnComplete; |
| | | this.SetActive(true); |
| | | leader.Create(GoldRushManager.Instance.GetRandommSkinID(), leaderScale); |
| | | leader.Create(GoldRushManager.Instance.GetWorkerSkinID(tendID, index), leaderScale); |
| | | Go(waitTime, isBack).Forget(); |
| | | } |
| | | |
| | |
| | | using System;
|
| | | using System;
|
| | | using LitJson;
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | 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 event Action<int> OnGoldRushCampEvent; //服务端通知营地信息
|
| | | public event Action OnGoldRushInfoEvent;
|
| | |
| | | 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()
|
| | | {
|
| | | skinIDs.Clear();
|
| | |
| | | {
|
| | | for (int i = 0; i < netPack.CampCnt; i++)
|
| | | {
|
| | | campInfoDict[netPack.CampList[i].CampID] = netPack.CampList[i]; ;
|
| | | campInfoDict[netPack.CampList[i].CampID] = netPack.CampList[i];
|
| | | InitWorkerSkinID(netPack.CampList[i]);
|
| | | OnGoldRushCampEvent?.Invoke(netPack.CampList[i].CampID);
|
| | |
|
| | | }
|
| | | UpdateRedpoint();
|
| | |
|
| | |
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | //获取营地工人
|
| | | public int GetCampWorkerCnt(int campID)
|
| | | {
|
| | |
| | | float waitTime = i * 0.6f; |
| | | var newLeader = RequestLeader(); |
| | | workingLeaderList.Add(newLeader); |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, false, (bool value) => |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, i, false, (bool value) => |
| | | { |
| | | if (!value) |
| | | { |
| | |
| | | float waitTime = i * 0.6f; |
| | | var newLeader = RequestLeader(); |
| | | callBackLeaderList.Add(newLeader); |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, true, (bool value) => |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, i, true, (bool value) => |
| | | { |
| | | if (value) |
| | | { |
| | |
| | | if (i < workCnt) |
| | | { |
| | | heroModels[i].SetActive(true); |
| | | var skinID = GoldRushManager.Instance.skinIDs[(goldID % skinCnt + i) % skinCnt]; |
| | | var skinID = GoldRushManager.Instance.GetWorkerSkinID(campID, i); |
| | | heroModels[i].Create(skinID, 0.5f); |
| | | } |
| | | else |