From 6a9edae2d5eacbdf769e1bd289b7790d6673bbf2 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期一, 13 八月 2018 20:33:50 +0800
Subject: [PATCH] [2461]随机展现获取寻宝10次物品
---
System/HappyXB/HappyXBModel.cs | 72 ++++++++++++++++++++++++++++-------
1 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/System/HappyXB/HappyXBModel.cs b/System/HappyXB/HappyXBModel.cs
index 20368a5..785b799 100644
--- a/System/HappyXB/HappyXBModel.cs
+++ b/System/HappyXB/HappyXBModel.cs
@@ -101,7 +101,16 @@
public void GetNotifyResult(int itemId, int itemCount)
{
- DesignDebug.Log("GetNotifyResult" + XBNotifyParms.Count);
+ 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)
@@ -110,13 +119,14 @@
int.TryParse(XBNotifyParms[i][1].ToString(), out notifyItemId);
int notifyItemCnt = 0;
int.TryParse(XBNotifyParms[i][3].ToString(), out notifyItemCnt);
- if (notifyItemId == itemId && notifyItemCnt == itemCount)
+ if (notifyItemId == itemId && notifyItemCnt == itemCnt)
{
- SysNotifyMgr.Instance.ShowTip("HappyXB", XBNotifyParms[i].ToArray());
- break;
+ notifyIndex = i;
+ return true;
}
}
}
+ return false;
}
private void SetXBFuncDict(int type,FuncConfigConfig xbSet)
@@ -306,16 +316,17 @@
}
}
}
-
- if(RefreshXBResultAct != null)
+ SetXBResultRecord();
+ if (RefreshXBResultAct != null)
{
RefreshXBResultAct();
}
- SetXBResultRecord();
+
}
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))
@@ -326,22 +337,22 @@
{
itemGetTimeArray.Clear();
}
-
+ xbItemRecordlist.Clear();
getNewItemLoglist.Clear();
- List<XBGetItem> xbItemlist = GetXbResultDict().Values.ToList();
- if (xbItemlist != null)
+ xbItemRecordlist.AddRange(GetXBResultlist());
+ if (xbItemRecordlist != null)
{
- int remianLogNum = (itemGetTimeArray.Count + xbItemlist.Count) - 30;
+ int remianLogNum = (itemGetTimeArray.Count + xbItemRecordlist.Count) - 30;
if (remianLogNum > 0)
{
int startIndex = itemGetTimeArray.Count - remianLogNum;
itemGetTimeArray.RemoveRange(startIndex, remianLogNum);
}
- xbItemlist.Sort(CompareByTime);
- for (int i = 0; i < xbItemlist.Count; i++)
+ xbItemRecordlist.Sort(CompareByTime);
+ for (int i = 0; i < xbItemRecordlist.Count; i++)
{
- string log = Language.Get("HappyXBGetItemTime", xbItemlist[i].createTimeStr, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName),
- xbItemlist[i].itemId, xbItemlist[i].count);
+ 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)
@@ -362,6 +373,37 @@
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;
--
Gitblit v1.8.0