From aebae35feef4ff2a5815aad1e140402cf25231c1 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 29 九月 2025 15:24:40 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/InternalAffairs/GoldRushAutoCell.cs | 6 ++
Main/System/InternalAffairs/GoldRushWorkCell.cs | 2
Main/System/InternalAffairs/GoldRushTentCell.cs | 4 +-
Main/System/InternalAffairs/GoldRushLeader.cs | 4 +-
Main/System/InternalAffairs/GoldRushManager.cs | 48 +++++++++++++++++++++++-
5 files changed, 56 insertions(+), 8 deletions(-)
diff --git a/Main/System/InternalAffairs/GoldRushAutoCell.cs b/Main/System/InternalAffairs/GoldRushAutoCell.cs
index 2f2ca18..f585c51 100644
--- a/Main/System/InternalAffairs/GoldRushAutoCell.cs
+++ b/Main/System/InternalAffairs/GoldRushAutoCell.cs
@@ -17,10 +17,11 @@
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;
@@ -68,6 +69,9 @@
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;
diff --git a/Main/System/InternalAffairs/GoldRushLeader.cs b/Main/System/InternalAffairs/GoldRushLeader.cs
index 396bee5..59cfcba 100644
--- a/Main/System/InternalAffairs/GoldRushLeader.cs
+++ b/Main/System/InternalAffairs/GoldRushLeader.cs
@@ -23,7 +23,7 @@
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;
@@ -36,7 +36,7 @@
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();
}
diff --git a/Main/System/InternalAffairs/GoldRushManager.cs b/Main/System/InternalAffairs/GoldRushManager.cs
index 8b72679..5c02418 100644
--- a/Main/System/InternalAffairs/GoldRushManager.cs
+++ b/Main/System/InternalAffairs/GoldRushManager.cs
@@ -1,4 +1,4 @@
-锘縰sing System;
+using System;
using LitJson;
using System.Collections.Generic;
@@ -15,6 +15,7 @@
public int housekeeperEndTime; // 鑷姩绠″鍒版湡鏃堕棿鎴筹紝鏈夊�煎悓鏃朵篃浠h〃鍏嶈垂璇曠敤宸蹭娇鐢�
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;
@@ -224,6 +225,46 @@
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();
@@ -258,8 +299,10 @@
{
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();
@@ -297,6 +340,7 @@
return 0;
}
+
//鑾峰彇钀ュ湴宸ヤ汉
public int GetCampWorkerCnt(int campID)
{
diff --git a/Main/System/InternalAffairs/GoldRushTentCell.cs b/Main/System/InternalAffairs/GoldRushTentCell.cs
index 19edd93..39c9d28 100644
--- a/Main/System/InternalAffairs/GoldRushTentCell.cs
+++ b/Main/System/InternalAffairs/GoldRushTentCell.cs
@@ -429,7 +429,7 @@
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)
{
@@ -487,7 +487,7 @@
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)
{
diff --git a/Main/System/InternalAffairs/GoldRushWorkCell.cs b/Main/System/InternalAffairs/GoldRushWorkCell.cs
index fc32eda..d3f16ed 100644
--- a/Main/System/InternalAffairs/GoldRushWorkCell.cs
+++ b/Main/System/InternalAffairs/GoldRushWorkCell.cs
@@ -76,7 +76,7 @@
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
--
Gitblit v1.8.0