| | |
| | |
|
| | | 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)
|
| | |
| | | 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)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | 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))
|
| | |
| | | {
|
| | | 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)
|
| | |
| | | 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;
|