From af6e207c6d185ed66125e85e18c02c63bea597f9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 22 十月 2025 14:25:56 +0800
Subject: [PATCH] 0312 mainwin的内部显示
---
Main/System/HappyXB/HappyXBModel.cs | 991 +++++++++++++++++----------------------------------------
1 files changed, 303 insertions(+), 688 deletions(-)
diff --git a/Main/System/HappyXB/HappyXBModel.cs b/Main/System/HappyXB/HappyXBModel.cs
index a0e2efe..7d072a4 100644
--- a/Main/System/HappyXB/HappyXBModel.cs
+++ b/Main/System/HappyXB/HappyXBModel.cs
@@ -8,349 +8,101 @@
public class HappyXBModel : GameSystemManager<HappyXBModel>
{
- private Dictionary<string, XBGetItemConfig> xbGetItemDict = new Dictionary<string, XBGetItemConfig>();
- private Dictionary<int, List<XBGetItemConfig>> xbTypeItemDict = new Dictionary<int, List<XBGetItemConfig>>();
- private Dictionary<string, Dictionary<int, XBGetItem>> jobXBItemDict = new Dictionary<string, Dictionary<int, XBGetItem>>();
- private Dictionary<int, XBFuncSet> xbFuncSetDict = new Dictionary<int, XBFuncSet>();
- public Dictionary<int, int> XBCostTypeDict = new Dictionary<int, int>();
- public HappXBTitle title = HappXBTitle.Best;
+ //瀵诲疂浜у嚭搴�
+ private Dictionary<int, Dictionary<int, XBGetItemConfig>> xbGetItemDict = new Dictionary<int, Dictionary<int, XBGetItemConfig>>(); //濂栨睜鐨勬墍鏈夌墿鍝侊紙鎸夌被鍨�+绛夌骇锛�
+ private Dictionary<int, List<XBGetItemConfig>> xbTypeItemDict = new Dictionary<int, List<XBGetItemConfig>>(); //濂栨睜鐨勬墍鏈夌墿鍝侊紙鎸夌被鍨嬶級
+ float xbLastTime = 0; //绛夊緟鏈嶅姟绔洖澶� 濡傛灉澶暱灏遍噸缃负涓嶇瓑寰�
+ bool m_IsWaitServerXB = false; // 绛夊緟鏈嶅姟绔洖澶�
+ public bool isXBCoolTime
+ {
+ get
+ {
+ #if UNITY_EDITOR
+ if (Time.time - xbLastTime > 1)
+ #else
+ if (Time.time - xbLastTime > 10)
+ #endif
+ {
+ m_IsWaitServerXB = false;
+ return m_IsWaitServerXB;
+ }
- public string USETOOLXBKey = string.Empty;
- public static string HAPPYXBITEMKEY;
- public List<ArrayList> XBNotifyParms = new List<ArrayList>();
- public bool isXBCoolTime { get; set; }
+ return m_IsWaitServerXB;
+ }
- public bool isJumpBestXB { get; set; }
- public bool isJumpRuneXB { get; set; }
- public bool isJumpGubaoXB { get; set; }
- public bool isJumpGatherSoulXB { get; set; } //鑱氶瓊瀵诲疂锛氭槸鍚﹁烦杩囧姩鐢�
+ set
+ {
+ m_IsWaitServerXB = value;
+ xbLastTime = Time.time;
+ }
+ }
+ private Dictionary<int, XBTypeInfo> xbTypeInfoDict = new Dictionary<int, XBTypeInfo>(); //鎶藉鐘舵�佺浉鍏崇殑 鏈嶅姟鍣ㄨ褰�
+
+ public int lhQuality;
public override void Init()
{
- isJumpBestXB = false;
- isJumpRuneXB = false;
- isJumpGubaoXB = false;
- isJumpGatherSoulXB = false;
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
+ FuncOpen.Instance.OnFuncStateChangeEvent += UpdateFuncState;
+ PackManager.Instance.RefreshItemEvent += RefreshXBTool;
+ TimeMgr.Instance.OnDayEvent += OnDayEvent;
+ DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
+ InvestModel.Instance.onInvestUpdate += OnInvestUpdate;
+
xbGetItemDict.Clear();
xbTypeItemDict.Clear();
- xbFuncSetDict.Clear();
List<XBGetItemConfig> list = XBGetItemConfig.GetValues();
for (int i = 0; i < list.Count; i++)
{
- string key = StringUtility.Contact(list[i].TreasureType, list[i].MinLV);
- if (!xbGetItemDict.ContainsKey(key))
+ if (!xbGetItemDict.ContainsKey(list[i].TreasureType))
{
- xbGetItemDict.Add(key, list[i]);
+ xbGetItemDict.Add(list[i].TreasureType, new Dictionary<int, XBGetItemConfig>());
}
+ xbGetItemDict[list[i].TreasureType].Add(list[i].MinLV, list[i]);
+
if (!xbTypeItemDict.ContainsKey(list[i].TreasureType))
{
- List<XBGetItemConfig> typeItemlist = new List<XBGetItemConfig>();
- typeItemlist.Add(list[i]);
- xbTypeItemDict.Add(list[i].TreasureType, typeItemlist);
+ xbTypeItemDict.Add(list[i].TreasureType, new List<XBGetItemConfig>());
}
- else
- {
- xbTypeItemDict[list[i].TreasureType].Add(list[i]);
- }
+
+ xbTypeItemDict[list[i].TreasureType].Add(list[i]);
}
- SetXBFuncDict(1);
- SetXBFuncDict(2);
- var treasureIDArr = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("TreasureLuckyDraw").Numerical1);
- for (int i = 0; i < treasureIDArr.Length; i++)
- {
- int type = XBGetItemConfig.Get(treasureIDArr[i]).TreasureType;
- SetXBFuncDict(type);
- }
+ var config = FuncConfigConfig.Get("HeroCall");
+ lhQuality = int.Parse(config.Numerical1);
+ }
- SetXBFuncDict(105);
- SetXBFuncDict(106);
- SetXBFuncDict(107);
- SetXBFuncDict(108);
- SysNotifyMgr.Instance.RegisterCondition("HappyXB", SatisfyNotifyCondition);
-
- XBCostTypeDict.Clear();
-
- XBCostTypeDict[(int)HappXBTitle.Best] = TreasureSetConfig.Get(1).CostMoneyType;
- XBCostTypeDict[(int)HappXBTitle.Rune] = TreasureSetConfig.Get(2).CostMoneyType;
- for (int i = 0; i < treasureIDArr.Length; i++)
- {
- int type = XBGetItemConfig.Get(treasureIDArr[i]).TreasureType;
- XBCostTypeDict[(int)HappXBTitle.Gubao1 + i] = TreasureSetConfig.Get(type).CostMoneyType;
- }
- XBCostTypeDict[(int)HappXBTitle.YunShi1] = TreasureSetConfig.Get(105).CostMoneyType;
- XBCostTypeDict[(int)HappXBTitle.YunShi2] = TreasureSetConfig.Get(106).CostMoneyType;
- XBCostTypeDict[(int)HappXBTitle.YunShi3] = TreasureSetConfig.Get(107).CostMoneyType;
- XBCostTypeDict[(int)HappXBTitle.YunShi4] = TreasureSetConfig.Get(108).CostMoneyType;
+ public override void Release()
+ {
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
+ FuncOpen.Instance.OnFuncStateChangeEvent -= UpdateFuncState;
+ PackManager.Instance.RefreshItemEvent -= RefreshXBTool;
+ TimeMgr.Instance.OnDayEvent -= OnDayEvent;
+ DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
+ InvestModel.Instance.onInvestUpdate -= OnInvestUpdate;
}
- public void OnBeforePlayerDataInitialize()
+ void OnBeforePlayerDataInitialize()
{
- PlayerDatas.Instance.playerDataRefreshEvent -= RefreshStoreScore;
- FuncOpen.Instance.OnFuncStateChangeEvent -= UpdateFuncState;
- PackManager.Instance.refreshItemCountEvent -= RefreshXBTool;
isXBCoolTime = false;
- XBNotifyParms.Clear();
xbTypeInfoDict.Clear();
}
- public void OnAfterPlayerDataInitialize()
+
+ void OnPlayerLoginOk()
{
- SetXBGetItemModel();
- }
- public void OnPlayerLoginOk()
- {
- int playerId = (int)PlayerDatas.Instance.baseData.PlayerID;
- HAPPYXBITEMKEY = StringUtility.Contact(playerId, "HappyXBItemTime");
- USETOOLXBKey = StringUtility.Contact(playerId, "UseToolXB");
- XBWarehouseRedPoint();
- PlayerDatas.Instance.playerDataRefreshEvent += RefreshStoreScore;
- PackManager.Instance.refreshItemCountEvent += RefreshXBTool;
- FuncOpen.Instance.OnFuncStateChangeEvent += UpdateFuncState;
+ HeroCallRedPoint();
}
- /// <summary>
- /// 妫�娴嬭嚜韬帺瀹舵槸鍚﹂渶瑕佷俊鎭彁绀�
- /// </summary>
- /// <param name="key"></param>
- /// <param name="paramArray"></param>
- /// <returns></returns>
- private bool SatisfyNotifyCondition(string key, ArrayList paramArray)
+ void OnInvestUpdate(int type)
{
- switch (title)
- {
- case HappXBTitle.Best:
- if (isJumpBestXB)
- {
- return true;
- }
- break;
- case HappXBTitle.Rune:
- if (isJumpRuneXB)
- {
- return true;
- }
- break;
- case HappXBTitle.Gubao1:
- case HappXBTitle.Gubao2:
- case HappXBTitle.Gubao3:
- case HappXBTitle.Gubao4:
- if (isJumpGubaoXB)
- {
- return true;
- }
- break;
- case HappXBTitle.GatherSoul:
- if (isJumpGatherSoulXB)
- {
- return true;
- }
- break;
- case HappXBTitle.YunShi1:
- case HappXBTitle.YunShi2:
- case HappXBTitle.YunShi3:
- case HappXBTitle.YunShi4:
- // if (ModelCenter.Instance.GetModelEx<YunShiXBActModel>().isSkipXB)
- // {
- // return true;
- // }
- break;
- }
-
- XBNotifyParms.Add(new ArrayList(paramArray));
- if (paramArray != null && paramArray.Count > 0 &&
- paramArray[0].Equals(UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName)))
- {
- return false;
- }
- return true;
+ if (type == 7)
+ HeroCallRedPoint();
}
-
- public void GetNotifyResult(int itemId, int itemCount)
- {
- int notifyIndex = 0;
- if (CheckNotifyItemByIdAndCnt(itemId, itemCount, out notifyIndex))
- {
- SysNotifyMgr.Instance.ShowTip("HappyXB", XBNotifyParms[notifyIndex].ToArray());
- }
- }
-
- private bool CheckNotifyItemByIdAndCnt(int itemId, int itemCnt, out int notifyIndex)
- {
- notifyIndex = 0;
- for (int i = 0; i < XBNotifyParms.Count; i++)
- {
- if (XBNotifyParms[i] != null && XBNotifyParms[i].Count > 3)
- {
- int notifyItemId = 0;
- int.TryParse(XBNotifyParms[i][1].ToString(), out notifyItemId);
- int notifyItemCnt = 0;
- int.TryParse(XBNotifyParms[i][3].ToString(), out notifyItemCnt);
- if (notifyItemId == itemId && notifyItemCnt == itemCnt)
- {
- notifyIndex = i;
- return true;
- }
- }
- }
- return false;
- }
-
- private void SetXBFuncDict(int type)
- {
- var treasureSetCfg = TreasureSetConfig.Get(type);
- if (!xbFuncSetDict.ContainsKey(type))
- {
- XBFuncSet funcSet = new XBFuncSet();
- funcSet.xbType = type;
- funcSet.xbNums = treasureSetCfg.TreasureCountList;
-
- funcSet.xbPrices = treasureSetCfg.CostMoneyList;
-
- funcSet.costToolIds = new int[] { treasureSetCfg.CostItemID, treasureSetCfg.CostItemID };
- funcSet.costToolNums = treasureSetCfg.CostItemCountList;
- funcSet.dailyFreeCount = treasureSetCfg.DailyFreeCount;
- funcSet.xbScores = new int[] { treasureSetCfg.AwardMoneyValue, treasureSetCfg.AwardMoneyValue * treasureSetCfg.TreasureCountList[1] };
-
- xbFuncSetDict.Add(funcSet.xbType, funcSet);
- }
- }
-
- public XBFuncSet GetXBFuncSet(int type)
- {
- XBFuncSet funcSet = null;
- xbFuncSetDict.TryGetValue(type, out funcSet);
- return funcSet;
- }
-
- //榛樿浼樺厛浣跨敤閬撳叿瀵诲疂
- public bool IsUseToolXB()
- {
- return true;
- //if (!PlayerPrefs.HasKey(USETOOLXBKey))
- //{
- // LocalSave.SetBool(USETOOLXBKey, true);
- // return true;
- //}
- //else
- //{
- // return LocalSave.GetBool(USETOOLXBKey);
- //}
- }
-
- public void SetUseToolXB(bool isToolXB)
- {
- //LocalSave.SetBool(USETOOLXBKey, isToolXB);
- }
-
- private void SetXBGetItemModel()
- {
- jobXBItemDict.Clear();
- Dictionary<int, XBGetItem> getItemDict = new Dictionary<int, XBGetItem>();
- Dictionary<int, List<int>> jobItemDict = new Dictionary<int, List<int>>();
- int playerJob = PlayerDatas.Instance.baseData.Job;
- foreach (var key in xbGetItemDict.Keys)
- {
-
- getItemDict.Clear();
- jobItemDict.Clear();
- Dictionary<int, XBGetItem> jobGetItemDict = new Dictionary<int, XBGetItem>();
- XBGetItemConfig getItemConfig = xbGetItemDict[key];
- jobXBItemDict.Add(key, jobGetItemDict);
- JsonData getItemJson = JsonMapper.ToObject(getItemConfig.GridItemInfo);
- foreach (var grid in getItemJson.Keys)
- {
- int id = int.Parse(getItemJson[grid][0].ToString());
- int count = int.Parse(getItemJson[grid][1].ToString());
- XBGetItem getItem = new XBGetItem();
- getItem.SetModel(int.Parse(grid), id, count);
- getItemDict.Add(getItem.gridIndex, getItem);
- }
- JsonData jobReplaceJson = JsonMapper.ToObject(getItemConfig.JobItemList);
- if (jobReplaceJson.IsArray)
- {
- for (int i = 0; i < jobReplaceJson.Count; i++)
- {
- List<int> itemIdlist = new List<int>();
- jobItemDict.Add(i, itemIdlist);
- if (jobReplaceJson[i].IsArray)
- {
- for (int j = 0; j < jobReplaceJson[i].Count; j++)
- {
- int id = int.Parse(jobReplaceJson[i][j].ToString());
- itemIdlist.Add(id);
- }
- }
- }
- }
-
- foreach (var model in getItemDict.Values)
- {
- ItemConfig itemConfig = ItemConfig.Get(model.itemId);
- if (itemConfig.JobLimit == 0)
- {
- jobGetItemDict.Add(model.gridIndex, model);
- }
- else
- {
- bool isReplace = false;
- foreach (var list in jobItemDict.Values)
- {
- if (list.Contains(model.itemId))
- {
- for (int i = 0; i < list.Count; i++)
- {
- int equipJob = int.Parse(list[i].ToString().Substring(0, 1));
- if (playerJob == equipJob)
- {
- isReplace = true;
- XBGetItem getItem = new XBGetItem();
- getItem.SetModel(model.gridIndex, list[i], model.count);
- jobGetItemDict.Add(getItem.gridIndex, getItem);
- break;
- }
- }
- break;
- }
- }
- if (!isReplace)
- {
- jobGetItemDict.Add(model.gridIndex, model);
- }
- }
-
- }
-
- }
-
- }
-
- public Dictionary<int, XBGetItem> GetXBGetItemByID(int type)
- {
- int lv = 0;
- List<XBGetItemConfig> configlist = null;
- xbTypeItemDict.TryGetValue(type, out configlist);
- if (configlist != null)
- {
- for (int i = configlist.Count - 1; i > -1; i--)
- {
- if (PlayerDatas.Instance.baseData.LV >= configlist[i].MinLV)
- {
- lv = configlist[i].MinLV;
- break;
- }
- }
- }
- string key = StringUtility.Contact(type, lv);
- Dictionary<int, XBGetItem> dict = null;
- jobXBItemDict.TryGetValue(key, out dict);
- return dict;
- }
-
public XBGetItemConfig GetXBItemConfigByType(int type)
{
int lv = 0;
@@ -363,14 +115,11 @@
if (PlayerDatas.Instance.baseData.LV >= configlist[i].MinLV)
{
lv = configlist[i].MinLV;
- break;
+ return configlist[i];
}
}
}
- XBGetItemConfig xbItemConfig = null;
- string key = StringUtility.Contact(type, lv);
- xbGetItemDict.TryGetValue(key, out xbItemConfig);
- return xbItemConfig;
+ return null;
}
#region 澶勭悊鏈嶅姟绔暟鎹�
@@ -379,10 +128,9 @@
public int addXBScore { get; private set; }
public int addXBScoreType { get; private set; } //瀵诲疂绉垎璐у竵绫诲瀷
public int addXBLuckValue { get; private set; }
- private Dictionary<int, XBGetItem> xbResultDict = new Dictionary<int, XBGetItem>();
+ public Dictionary<int, XBGetItem> xbResultDict { get; private set; } = new Dictionary<int, XBGetItem>(); //濂栧搧椤哄簭锛氬鍝�
public void GetServerXBResult(HA350_tagMCTreasureResult result)
{
- XBNotifyParms.Clear();
xbResultDict.Clear();
addXBScore = result.AddMoneyValue;
addXBScoreType = result.AddMoneyType;
@@ -410,105 +158,41 @@
}
}
}
- SetXBResultRecord();
isXBCoolTime = false;
if (RefreshXBResultAct != null)
{
RefreshXBResultAct();
}
+ if (!UIManager.Instance.IsOpened<HeroCallResultWin>())
+ {
+ UIManager.Instance.OpenWindow<HeroCallResultWin>();
+ }
}
- List<string> itemGetTimeArray = new List<string>();
- List<string> getNewItemLoglist = new List<string>();
- List<XBGetItem> xbItemRecordlist = new List<XBGetItem>();
- public void SetXBResultRecord()
- {
- if (PlayerPrefs.HasKey(HAPPYXBITEMKEY))
+
+ public int GetCountInResult(int itemID)
+ {
+ int count = 0;
+ if (xbResultDict != null && xbResultDict.Count > 0)
{
- itemGetTimeArray = LocalSave.GeStringArray(HappyXBModel.HAPPYXBITEMKEY).ToList();
- }
- else
- {
- itemGetTimeArray.Clear();
- }
- xbItemRecordlist.Clear();
- getNewItemLoglist.Clear();
- xbItemRecordlist.AddRange(GetXBResultlist());
- if (xbItemRecordlist != null)
- {
- int remianLogNum = (itemGetTimeArray.Count + xbItemRecordlist.Count) - 30;
- if (remianLogNum > 0)
+ foreach (var item in xbResultDict)
{
- int startIndex = itemGetTimeArray.Count - remianLogNum;
- itemGetTimeArray.RemoveRange(startIndex, remianLogNum);
+ if (item.Value.itemId == itemID)
+ {
+ count++;
+ }
}
- xbItemRecordlist.Sort(CompareByTime);
- for (int i = 0; i < xbItemRecordlist.Count; i++)
- {
- string log = Language.Get("HappyXBGetItemTime", xbItemRecordlist[i].createTimeStr, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName),
- xbItemRecordlist[i].itemId, xbItemRecordlist[i].count);
- getNewItemLoglist.Add(log);
- }
- if (getNewItemLoglist.Count > 0)
- {
- itemGetTimeArray.InsertRange(0, getNewItemLoglist);
- LocalSave.SetStringArray(HappyXBModel.HAPPYXBITEMKEY, itemGetTimeArray.ToArray());
- }
-
}
+ return count;
}
- public int CompareByTime(XBGetItem start, XBGetItem end)
- {
- DateTime startTime = start.createTime;
- DateTime endTime = end.createTime;
- if (startTime.CompareTo(endTime) != 0) return -startTime.CompareTo(endTime);
-
- return 0;
- }
-
- public List<XBGetItem> rangelist = new List<XBGetItem>();
- List<int> index = new List<int>();
- public List<XBGetItem> GetXBResultlist()
- {
- rangelist.Clear();
- index.Clear();
- List<XBGetItem> xbItemlist = xbResultDict.Values.ToList();
- for (int i = 0; i < xbItemlist.Count; i++)
- {
- index.Add(i);
- }
- SetRandomList(xbItemlist);
- return rangelist;
- }
-
- public void SetRandomList(List<XBGetItem> xbItemlist)
- {
- int currentRandom = UnityEngine.Random.Range(0, index.Count);
- XBGetItem current = xbItemlist[index[currentRandom]];
- if (!rangelist.Contains(current))
- {
- rangelist.Add(current);
- index.Remove(index[currentRandom]);
-
- }
- if (index.Count > 0)
- {
- SetRandomList(xbItemlist);
- }
- }
-
- public Dictionary<int, XBGetItem> GetXbResultDict()
- {
- return xbResultDict;
- }
public void ClearXBRusltData()
{
xbResultDict.Clear();
}
- private Dictionary<int, XBTypeInfo> xbTypeInfoDict = new Dictionary<int, XBTypeInfo>();
+
public void GetServerXBInfo(HA351_tagMCTreasureInfo info)
{
for (int i = 0; i < info.InfoCount; i++)
@@ -556,7 +240,7 @@
RefreshXBTypeInfoAct();
}
- BestAndRuneXBRedPoint();
+ HeroCallRedPoint();
}
public XBTypeInfo GetXBInfoByType(int type)
@@ -567,14 +251,16 @@
}
/// <summary>
- /// type 1 鏋佸搧瀵诲疂 2 绗﹀嵃瀵诲疂 index 0 鍗曟瀵诲疂 1 澶氭瀵诲疂
- ///costType 0-榛樿浠欑帀锛�1-鍏嶈垂娆℃暟锛�2-瀵诲疂閬撳叿
+ /// 璇锋眰瀵诲疂
/// </summary>
- /// <param name="type"></param>
- /// <param name="index"></param>
+ /// <param name="type">瀵诲疂绫诲瀷</param>
+ /// <param name="index">0 鍗曟瀵诲疂 1 澶氭瀵诲疂</param>
+ /// <param name="costType">0-璐у竵锛�1-鍏嶈垂娆℃暟锛�2-瀵诲疂閬撳叿</param>
public event Action<int> StartXBEvent;
public void SendXBQuest(int type, int index, int costType)
{
+ if (isXBCoolTime) return;
+
isXBCoolTime = true;
CA568_tagCMRequestTreasure treasure = new CA568_tagCMRequestTreasure();
treasure.TreasureType = (byte)type;
@@ -593,14 +279,14 @@
{
switch (type)
{
- case PackType.Treasure:
- SinglePack singlePack = PackManager.Instance.GetSinglePack(type);
- if (GeneralDefine.maxXBGridCount - singlePack.GetAllItems().Count < needGrid)
- {
- SysNotifyMgr.Instance.ShowTip("XBWarehouseFull");
- return false;
- }
- break;
+ // case PackType.Treasure:
+ // SinglePack singlePack = PackManager.Instance.GetSinglePack(type);
+ // if (GeneralDefine.maxXBGridCount - singlePack.GetAllItems().Count < needGrid)
+ // {
+ // SysNotifyMgr.Instance.ShowTip("XBWarehouseFull");
+ // return false;
+ // }
+ // break;
case PackType.Item:
if (PackManager.Instance.GetEmptyGridCount(type) < needGrid)
{
@@ -608,11 +294,19 @@
return false;
}
break;
+
+ case PackType.Hero:
+ if (PackManager.Instance.GetEmptyGridCount(type) < needGrid)
+ {
+ SysNotifyMgr.Instance.ShowTip("HeroBagFull");
+ return false;
+ }
+ break;
}
return true;
}
- public void SendOneXBQuest(PackType type, int xbType)
+ public void SendOneXBQuest(int xbType)
{
var config = TreasureSetConfig.Get(xbType);
if (GetXBInfoByType(xbType).treasureCountToday + config.TreasureCountList[0] > config.DailyMaxCount)
@@ -621,38 +315,54 @@
return;
}
- var funcSet = GetXBFuncSet(xbType);
- if (CheckIsEmptyGrid(type))
+ var funcSet = TreasureSetConfig.Get(xbType);
+ if (CheckIsEmptyGrid((PackType)config.PackType))
{
- if (IsHaveOneXBTool(xbType))
+ //閬撳叿瀵诲疂
+ if (funcSet.CostItemID != 0 && IsHaveOneXBTool(xbType))
{
SendXBQuest(xbType, 0, 2);
return;
}
-
-
- int moneyType = XBCostTypeDict[xbType];
- int xbOneMoney = funcSet.xbPrices[0];
-
- if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbOneMoney)
+ //璐у竵瀵诲疂
+ int moneyType = funcSet.CostMoneyType;
+ int xbOneMoney = funcSet.CostMoneyList[0];
+ //鏆傚畾鍏呭�艰揣甯侀渶瑕佷簩娆$‘璁�
+ if (moneyType == 1)
{
- StoreModel.Instance.UseMoneyCheck(xbOneMoney, () =>
+ StoreModel.Instance.UseMoneyCheck(xbOneMoney, moneyType, () =>
{
- SendXBQuest(xbType, 0, 0);
- }, xbType == 1 ? 5 : 6, fullTip: Language.Get("TreasurePavilion08", xbOneMoney, moneyType, funcSet.costToolIds[0], 1));
+ if (UIHelper.GetMoneyCnt(moneyType) >= xbOneMoney)
+ {
+ SendXBQuest(xbType, 0, 0);
+ }
+ else
+ {
+ ItemTipUtility.ShowMoneyTip(moneyType);
+ }
+ }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, xbOneMoney,
+ UIHelper.GetIconNameWithMoneyType(moneyType), funcSet.CostItemCountList[0]));
+
}
else
{
- SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
-
+ if (UIHelper.GetMoneyCnt(moneyType) >= xbOneMoney)
+ {
+ SendXBQuest(xbType, 0, 0);
+ }
+ else
+ {
+ ItemTipUtility.ShowMoneyTip(moneyType);
+ }
}
}
}
- public void SendXBManyQuest(PackType type, int xbType)
+ public void SendXBManyQuest(int xbType)
{
+
var config = TreasureSetConfig.Get(xbType);
if (GetXBInfoByType(xbType).treasureCountToday + config.TreasureCountList[1] > config.DailyMaxCount)
{
@@ -660,83 +370,120 @@
return;
}
- var funcSet = GetXBFuncSet(xbType);
- if (CheckIsEmptyGrid(type))
+ var funcSet = TreasureSetConfig.Get(xbType);
+ if (CheckIsEmptyGrid((PackType)config.PackType, 10))
{
int toolCnt = 0;
int needToolCnt = 0;
int needMoney = 0;
if (IsHaveManyXBToolEx(xbType, out toolCnt, out needToolCnt, out needMoney))
{
- if (toolCnt >= needToolCnt)
- {
- CheckXBManyLimit(0, xbType, 2);
-
- return;
- }
-
+ SendXBQuest(xbType, 1, 2);
}
- int moneyType = XBCostTypeDict[xbType];
- int xbManyMoney = needMoney == 0 ? funcSet.xbPrices[1] : needMoney;
+ //璐у竵瀵诲疂
+ int moneyType = funcSet.CostMoneyType;
- if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbManyMoney)
+ //鏆傚畾鍏呭�艰揣甯侀渶瑕佷簩娆$‘璁�
+ if (moneyType == 1)
{
- StoreModel.Instance.UseMoneyCheck(xbManyMoney, () =>
+ StoreModel.Instance.UseMoneyCheck(needMoney, moneyType, () =>
{
- SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
- }, xbType == 1 ? 5 : 6, fullTip: Language.Get("TreasurePavilion08", xbManyMoney, moneyType, funcSet.costToolIds[1], needToolCnt - toolCnt));
+ //鍙鏈夐亾鍏峰氨鏄亾鍏峰瀹濓紝涓嶈冻閮ㄥ垎鏈嶅姟绔墸璐у竵
+ if (UIHelper.GetMoneyCnt(moneyType) >= needMoney)
+ {
+ SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
+ }
+ else
+ {
+ ItemTipUtility.ShowMoneyTip(moneyType);
+ }
+ }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, needMoney,
+ UIHelper.GetIconNameWithMoneyType(moneyType), needToolCnt - toolCnt));
}
else
{
- SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
-
+ if (UIHelper.GetMoneyCnt(moneyType) >= needMoney)
+ {
+ SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
+ }
+ else
+ {
+ ItemTipUtility.ShowMoneyTip(moneyType);
+ }
}
}
}
- public void CheckXBManyLimit(int needMoney, int xbtype, int costType)
- {
- int moneyType = XBCostTypeDict[xbtype];
- if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)needMoney)
- {
- SendXBQuest(xbtype, 1, costType);
- }
- else
- {
- //WindowCenter.Instance.Open<RechargeTipWin>();
- SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
- }
- }
+
#endregion
public bool IsHaveFreeXB(int type)
{
+ int freeCountToday = 0;
XBTypeInfo typeInfo = GetXBInfoByType(type);
- if (typeInfo == null)
+ if (typeInfo != null)
{
- typeInfo = new XBTypeInfo()
- {
- xbType = type,
- luckValue = 0,
- freeCountToday = 0,
- treasureCount = 0,
- };
+ freeCountToday = typeInfo.freeCountToday;
}
//鍒ゆ柇鏄惁鏈夊厤璐规鏁帮紝涓斿厤璐规鏁版槸鍚︾敤瀹�
- var funcSet = GetXBFuncSet(type);
- return typeInfo.freeCountToday < funcSet.dailyFreeCount;
+ var funcSet = TreasureSetConfig.Get(type);
+ return freeCountToday < funcSet.DailyFreeCount;
+ }
+
+
+ public int GetFreeCountToday(int type)
+ {
+ XBTypeInfo typeInfo = GetXBInfoByType(type);
+ if (typeInfo != null)
+ {
+ return typeInfo.freeCountToday;
+ }
+
+ return 0;
+ }
+
+ public int GetDailyFreeCount(int type)
+ {
+ return TreasureSetConfig.Get(type).DailyFreeCount;
+ }
+
+ //鑾峰彇杩橀渶澶氬皯娆″彲寰楀垢杩愬鍔�
+ public int GetNextXBCountForBigAward(int type, out List<int> qualityList)
+ {
+ qualityList = new List<int>();
+ XBTypeInfo typeInfo = GetXBInfoByType(type);
+ if (typeInfo == null)
+ {
+ return 0;
+ }
+
+ var xbConfig = GetXBItemConfigByType(type);
+ var luckList = xbConfig.LuckyItemRateInfo.Keys.ToList();
+ luckList.Sort();
+ //鎸夐樁姊樉绀�
+ for (int i = 0; i < luckList.Count; i++)
+ {
+ if (typeInfo.luckValue < luckList[i])
+ {
+ //鎶婁簩缁存暟缁勯噷鐨勬墍鏈夌浜屼釜鍏冪礌缁勬垚鏂板垪琛�
+ qualityList = xbConfig.LuckyItemRateInfo[luckList[i]].Select(x => x[1]).ToList();
+ qualityList.Sort();
+ return luckList[i] - typeInfo.luckValue;
+ }
+ }
+ return 0;
}
public bool CheckIsXBTool(int itemId, int type)
{
- XBFuncSet funcSet = GetXBFuncSet(type);
+ var funcSet = TreasureSetConfig.Get(type);
if (funcSet == null) return false;
- if (funcSet.costToolIds.Contains(itemId))
+ if (funcSet.CostItemID == itemId)
{
return true;
}
@@ -744,11 +491,11 @@
}
public bool IsHaveOneXBTool(int type)
{
- XBFuncSet funcSet = GetXBFuncSet(type);
+ var funcSet = TreasureSetConfig.Get(type);
if (funcSet == null) return false;
- int toolCnt = PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.costToolIds[0]);
- if (toolCnt >= funcSet.costToolNums[0])
+ int toolCnt = (int)PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.CostItemID);
+ if (toolCnt >= funcSet.CostItemCountList[0])
{
return true;
}
@@ -756,22 +503,6 @@
return false;
}
- //needToolCnt 涓洪厤琛ㄤ腑闇�瑕佺殑閬撳叿鏁伴噺
- public bool IsHaveManyXBTool(int type, out int toolCnt, out int needToolCnt)
- {
- toolCnt = 0;
- needToolCnt = 0;
- XBFuncSet funcSet = GetXBFuncSet(type);
- if (funcSet == null) return false;
-
- toolCnt = PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.costToolIds[1]);
- needToolCnt = funcSet.costToolNums[1];
- if (toolCnt > 0)
- {
- return true;
- }
- return false;
- }
//needToolCnt 涓洪厤琛ㄤ腑闇�瑕佺殑閬撳叿鏁伴噺
// 鍙幏寰楃湡姝i渶瑕佽ˉ瓒宠喘涔伴亾鍏风殑閲戦
@@ -780,240 +511,133 @@
toolCnt = 0;
needToolCnt = 0; //閰嶇疆涓渶瑕佺殑閬撳叿鏁伴噺
needMoney = 0; //鐪熸闇�瑕佽ˉ瓒宠喘涔伴亾鍏风殑閲戦
- XBFuncSet funcSet = GetXBFuncSet(type);
+ var funcSet = TreasureSetConfig.Get(type);
if (funcSet == null) return false;
- toolCnt = PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.costToolIds[1]);
- needToolCnt = funcSet.costToolNums[1];
+ toolCnt = (int)PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.CostItemID);
+ needToolCnt = funcSet.CostItemCountList[1];
- if (toolCnt > 0)
+ if (toolCnt >= needToolCnt)
{
- if (toolCnt < needToolCnt)
- {
- needMoney = funcSet.xbPrices[1] / needToolCnt * (needToolCnt - toolCnt);
- }
-
+ //閬撳叿瓒冲
return true;
}
+
+ if (funcSet.CostMoneyType != 0)
+ {
+ if (toolCnt != 0 && toolCnt < needToolCnt)
+ {
+ //閮ㄥ垎涓嶈冻鐨勬寜鍗曟浠锋牸绠�
+ needMoney = funcSet.CostMoneyList[0] * (needToolCnt - toolCnt);
+ }
+ else
+ {
+ //鍏ㄩ儴涓嶈冻鐨勬寜澶氭浠锋牸绠� 鍙兘閰嶇疆浜嗘姌鎵�
+ needMoney = funcSet.CostMoneyList[1];
+ }
+ }
+
return false;
}
-
-
- public event Action<float> RefreshBestXBTimeAct;
- public event Action<float> RefreshRuneXBTimeAct;
- public void RefreshBestXBTime(float time)
+ public int GetCostType(int type)
{
- if (RefreshBestXBTimeAct != null)
- {
- RefreshBestXBTimeAct(time);
- }
-
- if (time <= 0)
- {
- BestAndRuneXBRedPoint();
- }
- }
- public void RefreshRuneXBTime(float time)
- {
- if (RefreshRuneXBTimeAct != null)
- {
- RefreshRuneXBTimeAct(time);
- }
-
- if (time <= 0)
- {
- BestAndRuneXBRedPoint();
- }
+ var funcSet = TreasureSetConfig.Get(type);
+ if (funcSet == null) return 0;
+ return funcSet.CostMoneyType;
}
- public event Action<HappXBTitle, int> RefreshAgainXBAct;
- /// <summary>
- /// xbtype 0-鍗曟 1 澶氭
- /// </summary>
- /// <param name="xBTitle"></param>
- /// <param name="xbType"></param>
- public void SetAgainXBEvent(HappXBTitle xBTitle, int xbType)
- {
- if (RefreshAgainXBAct != null)
- {
- RefreshAgainXBAct(xBTitle, xbType);
- }
+ public int GetCostItemID(int type)
+ {
+ var funcSet = TreasureSetConfig.Get(type);
+ if (funcSet == null) return 0;
+ return funcSet.CostItemID;
}
+
#region 绾㈢偣閫昏緫
public const int HappyXB_RedKey = 203;
- public const int BestXB_RedKey = 20301;
- public const int RuneXB_RedKey = 20302;
- public const int XBStore_RedKey = 20303;
- public const int XBWarehouse_RedKey = 20304;
- public const int BestXB_OneRedKey = 20301001;
- public const int BestXB_ManyRedKey = 20301002;
- public const int BestXB_FreeRedKey = 20301003;
- public const int RuneXB_OneRedKey = 20302001;
- public const int RuneXB_ManyRedKey = 20302002;
- public const int RuneXB_FreeRedKey = 20302003;
+ public const int XBHeroCall1_RedKey = 20300; //姝﹀皢鍏嶈垂鍙敜
+ public const int XBHeroCall10_RedKey = 20301; //姝﹀皢10鍙敜
+ public const int XBHeroCallScore_RedKey = 20302; //姝﹀皢绉垎鍙敜
- public Redpoint happyXBRed = new Redpoint(HappyXB_RedKey);
- public Redpoint bestXBRed = new Redpoint(HappyXB_RedKey, BestXB_RedKey);
- public Redpoint runeXBRed = new Redpoint(HappyXB_RedKey, RuneXB_RedKey);
- public Redpoint xbStoreRed = new Redpoint(HappyXB_RedKey, XBStore_RedKey);
- public Redpoint xbWarehouseRed = new Redpoint(HappyXB_RedKey, XBWarehouse_RedKey);
- public Redpoint bestXBOneRed = new Redpoint(BestXB_RedKey, BestXB_OneRedKey);
- public Redpoint bestXBManyRed = new Redpoint(BestXB_RedKey, BestXB_ManyRedKey);
- public Redpoint bestXBFreeRed = new Redpoint(BestXB_RedKey, BestXB_FreeRedKey);
- public Redpoint runeXBOneRed = new Redpoint(RuneXB_RedKey, RuneXB_OneRedKey);
- public Redpoint runeXBManyRed = new Redpoint(RuneXB_RedKey, RuneXB_ManyRedKey);
- public Redpoint runeXBFreeRed = new Redpoint(RuneXB_RedKey, RuneXB_FreeRedKey);
+
+ public Redpoint happyXBRed = new Redpoint(MainRedDot.MainHerosRedpoint, HappyXB_RedKey);
+ public Redpoint bestXBFreeRed = new Redpoint(HappyXB_RedKey, XBHeroCall1_RedKey);
+ public Redpoint bestXB10Red = new Redpoint(HappyXB_RedKey, XBHeroCall10_RedKey);
+ public Redpoint bestXBScoreRed = new Redpoint(HappyXB_RedKey, XBHeroCallScore_RedKey);
+
+
private void UpdateFuncState(int funcId)
{
- if (funcId == (int)FuncOpenEnum.HappyFindTreasure
- || funcId == 184)
- {
- XBWarehouseRedPoint();
- BestAndRuneXBRedPoint();
- XBStoreRedPoint();
- }
+ HeroCallRedPoint();
}
- public void RefreshXBWarehouse()
- {
- if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
-
- xbWarehouseRed.state = RedPointState.Simple;
- }
-
- public void XBWarehouseRedPoint()
- {
- if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
-
- SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Treasure);
- if (singlePack == null) return;
-
- if (singlePack.GetAllItems().Count > 0)
- {
- xbWarehouseRed.state = RedPointState.Simple;
- }
- else
- {
- xbWarehouseRed.state = RedPointState.None;
- }
- }
private void RefreshXBTool(PackType type, int index, int id)
{
if (type != PackType.Item) return;
- if (!CheckIsXBTool(id, 1) && !CheckIsXBTool(id, 2)) return;
- BestAndRuneXBRedPoint();
+ if (!CheckIsXBTool(id, (int)HappXBTitle.HeroCallAdvanced))
+ return;
+
+ HeroCallRedPoint();
}
- public void BestAndRuneXBRedPoint()
- {
- if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
+ void OnDayEvent()
+ {
+ HeroCallRedPoint();
+ }
- int xbtoolCnt = 0;
- int needtoolCnt = 0;
- if (IsHaveFreeXB(1))
+ //鑻遍泟鎷涘嫙
+ public void HeroCallRedPoint()
+ {
+ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure))
+ return;
+ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Hero))
+ return;
+
+ // 鍏嶈垂 10杩� 绉垎
+ bestXB10Red.state = RedPointState.None;
+ bestXBFreeRed.state = RedPointState.None;
+ bestXBScoreRed.state = RedPointState.None;
+
+
+ if (IsHaveFreeXB((int)HappXBTitle.HeroCallAdvanced))
{
bestXBFreeRed.state = RedPointState.Simple;
}
- else
+
+ if (IsHaveManyXBToolEx((int)HappXBTitle.HeroCallAdvanced, out int xbtoolCnt, out int needtoolCnt, out int needMoney))
{
- bestXBFreeRed.state = RedPointState.None;
+ bestXB10Red.state = RedPointState.Simple;
+ return;
}
- if (IsHaveManyXBTool(1, out xbtoolCnt, out needtoolCnt))
- {
- if (xbtoolCnt >= needtoolCnt)
- {
- bestXBManyRed.state = RedPointState.Simple;
- }
- else
- {
- bestXBManyRed.state = RedPointState.None;
- }
- bestXBOneRed.state = RedPointState.Simple;
- }
- else
- {
- bestXBOneRed.state = RedPointState.None;
- bestXBManyRed.state = RedPointState.None;
+ //绉垎瓒冲
+ if ((InvestModel.Instance.IsInvested(InvestModel.monthCardType)
+ || GetXBInfoByType((int)HappXBTitle.HeroCallScore)?.treasureCount == 0)
+ && UIHelper.GetMoneyCnt(51) >= TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0])
+ {
+ bestXBScoreRed.state = RedPointState.Simple;
}
- if (FuncOpen.Instance.IsFuncOpen(184) && IsHaveFreeXB(2))
- {
- runeXBFreeRed.state = RedPointState.Simple;
- }
- else
- {
- runeXBFreeRed.state = RedPointState.None;
- }
-
- if (FuncOpen.Instance.IsFuncOpen(184) &&
- IsHaveManyXBTool(2, out xbtoolCnt, out needtoolCnt))
- {
- if (xbtoolCnt >= needtoolCnt)
- {
- runeXBManyRed.state = RedPointState.Simple;
- }
- else
- {
- runeXBManyRed.state = RedPointState.None;
- }
- runeXBOneRed.state = RedPointState.Simple;
- }
- else
- {
- runeXBOneRed.state = RedPointState.None;
- runeXBManyRed.state = RedPointState.None;
- }
}
-
- private void RefreshStoreScore(PlayerDataType type)
+ //鎸夋牸瀛愬簱閰嶇疆鐨勫姹� 鑾峰緱鑾峰彇鐗╁搧
+ public List<int> GetAllGridLibItemIDByType(int type)
{
- if (type != PlayerDataType.CDBPlayerRefresh_TreasureScore) return;
-
- XBStoreRedPoint();
- }
-
- private List<StoreModel.StoreData> storelist = null;
- public void XBStoreRedPoint()
- {
- if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
-
- ulong moneyNum = UIHelper.GetMoneyCnt(25);
- for (int i = 11; i < 14; i++)
+ List<int> itemIDListTemp = new List<int>();
+ foreach (var kv in GetXBItemConfigByType(type).GridLibInfo)
{
- storelist = StoreModel.Instance.TryGetStoreDatas((StoreFunc)i);
- if (storelist.Count > 0)
- {
- List<StoreModel.StoreData> orderlist = new List<StoreModel.StoreData>();
- orderlist.AddRange(storelist);
- orderlist.Sort(CompareByMoney);
- if (moneyNum >= (ulong)orderlist[0].storeConfig.MoneyNumber)
- {
- xbStoreRed.state = RedPointState.Simple;
- return;
- }
- }
+ itemIDListTemp.AddRange(TreasureItemLibConfig.GetItemIDList(kv.Value));
}
- xbStoreRed.state = RedPointState.None;
- }
+ return itemIDListTemp.Distinct().ToList();
- public int CompareByMoney(StoreModel.StoreData start, StoreModel.StoreData end)
- {
- int money1 = start.storeConfig.MoneyNumber;
- int money2 = end.storeConfig.MoneyNumber;
- if (money1.CompareTo(money2) != 0) return money1.CompareTo(money2);
- int index1 = storelist.IndexOf(start);
- int index2 = storelist.IndexOf(end);
- if (index1.CompareTo(index2) != 0) return index1.CompareTo(index2);
- return 0;
}
+
#endregion
-}
+ }
public class XBTypeInfo
{
@@ -1026,17 +650,7 @@
public Dictionary<int, int> gridLimitCntDict; //<鏈夐檺鍒舵娊鍙栨鏁扮殑鏍煎瓙缂栧彿,宸叉娊鍒版鏁�> 鏈夐檺鍒舵娊鍙栨鏁扮殑鏍煎瓙娆℃暟淇℃伅
}
-public class XBFuncSet
-{
- public int xbType;// 1 鏋佸搧瀵诲疂 2 绗﹀嵃瀵诲疂
- public int[] xbNums;
- public int[] xbPrices;
- public int[] costToolIds;
- public int[] costToolNums;
- public int[] xbFreeCDs;
- public int[] xbScores;
- public int dailyFreeCount;
-}
+
public class XBGetItem
{
@@ -1044,7 +658,6 @@
public int itemId;
public int count;
public DateTime createTime;
- public string createTimeStr;
public void SetModel(int index, int id, int count)
{
@@ -1052,7 +665,6 @@
this.itemId = id;
this.count = count;
createTime = TimeUtility.ServerNow;
- createTimeStr = TimeUtility.ServerNow.ToString("yyyy-MM-dd HH:mm:ss");
}
}
@@ -1067,6 +679,9 @@
Gubao2 = 6,
Gubao3 = 7,
Gubao4 = 8,
+ HeroCallNormal = 11, //11-鏅�氭嫑鍕�
+ HeroCallAdvanced = 12, //12-楂樼骇鎷涘嫙
+ HeroCallScore = 13, //13-绉垎鎷涘嫙
YunShi1 = 105,
YunShi2 = 106,
YunShi3 = 107,
--
Gitblit v1.8.0