using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using TableConfig;
|
using LitJson;
|
using UnityEngine;
|
using System.Collections;
|
|
namespace Snxxz.UI
|
{
|
public class HappyXBModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk
|
{
|
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 HappXBTitle title = HappXBTitle.Best;
|
PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
|
StoreModel _storeModel;
|
StoreModel m_storeModel
|
{
|
get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); }
|
}
|
|
public static string HAPPYXBITEMKEY;
|
public List<ArrayList> XBNotifyParms = new List<ArrayList>();
|
|
public override void Init()
|
{
|
xbGetItemDict.Clear();
|
xbTypeItemDict.Clear();
|
xbFuncSetDict.Clear();
|
List<XBGetItemConfig> list = ConfigManager.Instance.GetAllValues<XBGetItemConfig>();
|
for(int i = 0;i < list.Count; i++)
|
{
|
string key = StringUtility.Contact(list[i].TreasureType,list[i].MinLV);
|
if(!xbGetItemDict.ContainsKey(key))
|
{
|
xbGetItemDict.Add(key,list[i]);
|
}
|
|
if(!xbTypeItemDict.ContainsKey(list[i].TreasureType))
|
{
|
List<XBGetItemConfig> typeItemlist = new List<XBGetItemConfig>();
|
typeItemlist.Add(list[i]);
|
xbTypeItemDict.Add(list[i].TreasureType,typeItemlist);
|
}
|
else
|
{
|
xbTypeItemDict[list[i].TreasureType].Add(list[i]);
|
}
|
}
|
|
FuncConfigConfig treasureSet11 = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("TreasureSet11");
|
SetXBFuncDict(1,treasureSet11);
|
FuncConfigConfig treasureSet12 = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("TreasureSet12");
|
SetXBFuncDict(2, treasureSet12);
|
|
SysNotifyMgr.Instance.RegisterCondition("HappyXB", SatisfyNotifyCondition);
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
XBNotifyParms.Clear();
|
xbTypeInfoDict.Clear();
|
}
|
public void OnAfterPlayerDataInitialize()
|
{
|
SetXBGetItemModel();
|
}
|
public void OnPlayerLoginOk()
|
{
|
HAPPYXBITEMKEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "HappyXBItemTime");
|
XBWarehouseRedPoint();
|
XBStoreRedPoint();
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
/// <summary>
|
/// 检测自身玩家是否需要信息提示
|
/// </summary>
|
/// <param name="key"></param>
|
/// <param name="paramArray"></param>
|
/// <returns></returns>
|
private bool SatisfyNotifyCondition(string key, ArrayList paramArray)
|
{
|
XBNotifyParms.Add(new ArrayList(paramArray));
|
if (paramArray != null && paramArray.Count > 0 &&
|
paramArray[0].Equals(UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName)))
|
{
|
return false;
|
}
|
return true;
|
}
|
|
public void GetNotifyResult(int itemId, int itemCount)
|
{
|
DesignDebug.Log("GetNotifyResult" + XBNotifyParms.Count);
|
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 == itemCount)
|
{
|
SysNotifyMgr.Instance.ShowTip("HappyXB", XBNotifyParms[i].ToArray());
|
break;
|
}
|
}
|
}
|
}
|
|
private void SetXBFuncDict(int type,FuncConfigConfig xbSet)
|
{
|
if (!xbFuncSetDict.ContainsKey(type))
|
{
|
XBFuncSet funcSet = new XBFuncSet();
|
funcSet.xbType = type;
|
JsonData jsonData = JsonMapper.ToObject(xbSet.Numerical1);
|
funcSet.xbNums = new int[jsonData.Count];
|
for (int i = 0; i < jsonData.Count; i++)
|
{
|
funcSet.xbNums[i] = int.Parse(jsonData[i].ToString());
|
}
|
jsonData = JsonMapper.ToObject(xbSet.Numerical2);
|
funcSet.xbPrices = new int[jsonData.Count];
|
for (int i = 0; i < jsonData.Count; i++)
|
{
|
funcSet.xbPrices[i] = int.Parse(jsonData[i].ToString());
|
}
|
jsonData = JsonMapper.ToObject(xbSet.Numerical3);
|
funcSet.costTools = new int[jsonData.Count];
|
for (int i = 0; i < jsonData.Count; i++)
|
{
|
funcSet.costTools[i] = int.Parse(jsonData[i].ToString());
|
}
|
jsonData = JsonMapper.ToObject(xbSet.Numerical4);
|
funcSet.xbFreeCDs = new int[jsonData.Count];
|
for (int i = 0; i < jsonData.Count; i++)
|
{
|
funcSet.xbFreeCDs[i] = int.Parse(jsonData[i].ToString());
|
}
|
jsonData = JsonMapper.ToObject(xbSet.Numerical5);
|
funcSet.xbScores = new int[jsonData.Count];
|
for (int i = 0; i < jsonData.Count; i++)
|
{
|
funcSet.xbScores[i] = int.Parse(jsonData[i].ToString());
|
}
|
xbFuncSetDict.Add(funcSet.xbType, funcSet);
|
}
|
}
|
|
public XBFuncSet GetXBFuncSet(int type)
|
{
|
XBFuncSet funcSet = null;
|
xbFuncSetDict.TryGetValue(type,out funcSet);
|
return funcSet;
|
}
|
|
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, 0);
|
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 = ConfigManager.Instance.GetTemplate<ItemConfig>(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, model.isBind);
|
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;
|
}
|
|
#region 处理服务端数据
|
public event Action RefreshXBTypeInfoAct;
|
public event Action RefreshXBResultAct;
|
public int addXBScore { get; private set; }
|
public int addXBLuckValue { get; private set; }
|
private Dictionary<int, XBGetItem> xbResultDict = new Dictionary<int, XBGetItem>();
|
public void GetServerXBResult(HA350_tagMCTreasureResult result)
|
{
|
XBNotifyParms.Clear();
|
xbResultDict.Clear();
|
addXBScore = result.AddTreasureScore;
|
addXBLuckValue = result.AddTreasureLuck;
|
JsonData resultData = JsonMapper.ToObject(result.TreasureResult);
|
if(resultData.IsArray)
|
{
|
for(int i = 0; i < resultData.Count;i++)
|
{
|
if(resultData[i].IsArray)
|
{
|
int index = int.Parse(resultData[i][0].ToString());
|
int itemId = int.Parse(resultData[i][1].ToString());
|
int count = int.Parse(resultData[i][2].ToString());
|
int isBind = int.Parse(resultData[i][3].ToString());
|
XBGetItem getItem = new XBGetItem();
|
getItem.SetModel(index,itemId,count,isBind);
|
if (!xbResultDict.ContainsKey(i))
|
{
|
xbResultDict.Add(i,getItem);
|
}
|
else
|
{
|
xbResultDict[i] = getItem;
|
}
|
}
|
}
|
}
|
|
if(RefreshXBResultAct != null)
|
{
|
RefreshXBResultAct();
|
}
|
SetXBResultRecord();
|
}
|
|
List<string> itemGetTimeArray = new List<string>();
|
List<string> getNewItemLoglist = new List<string>();
|
public void SetXBResultRecord()
|
{
|
if (PlayerPrefs.HasKey(HAPPYXBITEMKEY))
|
{
|
itemGetTimeArray = LocalSave.GeStringArray(HappyXBModel.HAPPYXBITEMKEY).ToList();
|
}
|
else
|
{
|
itemGetTimeArray.Clear();
|
}
|
|
getNewItemLoglist.Clear();
|
List<XBGetItem> xbItemlist = GetXbResultDict().Values.ToList();
|
if (xbItemlist != null)
|
{
|
int remianLogNum = (itemGetTimeArray.Count + xbItemlist.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++)
|
{
|
string log = Language.Get("HappyXBGetItemTime", xbItemlist[i].createTimeStr, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName),
|
xbItemlist[i].itemId, xbItemlist[i].count);
|
getNewItemLoglist.Add(log);
|
}
|
if (getNewItemLoglist.Count > 0)
|
{
|
itemGetTimeArray.InsertRange(0, getNewItemLoglist);
|
LocalSave.SetStringArray(HappyXBModel.HAPPYXBITEMKEY, itemGetTimeArray.ToArray());
|
}
|
|
}
|
}
|
|
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 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++)
|
{
|
if(!xbTypeInfoDict.ContainsKey(info.TreasuerInfoList[i].TreasureType))
|
{
|
XBTypeInfo typeInfo = new XBTypeInfo();
|
typeInfo.xbType = info.TreasuerInfoList[i].TreasureType;
|
typeInfo.luckValue = info.TreasuerInfoList[i].LuckValue;
|
typeInfo.freeTimeDict = new Dictionary<int, int>();
|
for(int j = 0; j < info.TreasuerInfoList[i].IndexCount; j++)
|
{
|
typeInfo.freeTimeDict.Add(j,(int)info.TreasuerInfoList[i].FreeCountTime[j]);
|
}
|
xbTypeInfoDict.Add(info.TreasuerInfoList[i].TreasureType,typeInfo);
|
}
|
else
|
{
|
xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].luckValue = info.TreasuerInfoList[i].LuckValue;
|
xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].freeTimeDict.Clear();
|
for (int j = 0; j < info.TreasuerInfoList[i].IndexCount; j++)
|
{
|
xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].freeTimeDict.Add(j, (int)info.TreasuerInfoList[i].FreeCountTime[j]);
|
}
|
}
|
}
|
|
RecordFreeXBTime();
|
|
if(RefreshXBTypeInfoAct != null)
|
{
|
RefreshXBTypeInfoAct();
|
}
|
|
BestAndRuneXBRedPoint();
|
}
|
|
public XBTypeInfo GetXBInfoByType(int type)
|
{
|
XBTypeInfo typeInfo = null;
|
xbTypeInfoDict.TryGetValue(type,out typeInfo);
|
return typeInfo;
|
}
|
|
/// <summary>
|
/// type 1 极品寻宝 2 符印寻宝 index 0 单次寻宝 1 多次寻宝
|
///costType 0-默认仙玉;1-免费次数;2-寻宝道具
|
/// </summary>
|
/// <param name="type"></param>
|
/// <param name="index"></param>
|
public void SendXBQuest(int type,int index,int costType)
|
{
|
CA568_tagCMRequestTreasure treasure = new CA568_tagCMRequestTreasure();
|
treasure.TreasureType = (byte)type;
|
treasure.TreasureIndex = (byte)index;
|
treasure.CostType = (byte)costType;
|
GameNetSystem.Instance.SendInfo(treasure);
|
}
|
|
public void SendPutOutXBItem(PackType curType,PackType targetType,int index,int isAll)
|
{
|
CA309_tagCMDropItemToOtherPack itemToOtherPack = new CA309_tagCMDropItemToOtherPack();
|
itemToOtherPack.SrcBackpack = (byte)curType;
|
itemToOtherPack.DesBackPack = (byte)targetType;
|
itemToOtherPack.SrcIndex = (ushort)index;
|
itemToOtherPack.IsAll = (byte)isAll;
|
GameNetSystem.Instance.SendInfo(itemToOtherPack);
|
}
|
|
public bool CheckIsEmptyGrid(PackType type,int needGrid = 1)
|
{
|
switch (type)
|
{
|
case PackType.rptTreasure:
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(type);
|
if(100 - singlePack.GetPackModelIndexDict().Count < needGrid)
|
{
|
SysNotifyMgr.Instance.ShowTip("XBWarehouseFull");
|
return false;
|
}
|
break;
|
case PackType.rptRunePack:
|
var runeModel = ModelCenter.Instance.GetModel<RuneModel>();
|
if (runeModel.SurplusRunePackCnt < needGrid)
|
{
|
SysNotifyMgr.Instance.ShowTip("RuneBagFull");
|
return false;
|
}
|
break;
|
}
|
return true;
|
}
|
#endregion
|
|
public bool IsHaveFreeXB(int type)
|
{
|
XBTypeInfo typeInfo = GetXBInfoByType(type);
|
if (typeInfo == null) return false;
|
|
foreach(var key in typeInfo.freeTimeDict.Keys)
|
{
|
if(typeInfo.freeTimeDict[key] != 0 && xbFuncSetDict[type].xbFreeCDs[key] > 0)
|
{
|
TimeSpan t = TimeUtility.ServerNow - TimeUtility.GetTime((uint)typeInfo.freeTimeDict[key]);
|
if (t.TotalMinutes > 0)
|
{
|
if (t.TotalMinutes > xbFuncSetDict[type].xbFreeCDs[key])
|
{
|
return true;
|
}
|
}
|
}
|
}
|
return false;
|
}
|
|
public bool IsHaveFreeXBTime(int type)
|
{
|
XBFuncSet funcSet = GetXBFuncSet(type);
|
if (funcSet == null) return false;
|
|
for(int i = 0; i < funcSet.xbFreeCDs.Length;i++)
|
{
|
if(funcSet.xbFreeCDs[i] > 0)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
|
public void RecordFreeXBTime()
|
{
|
foreach (var type in xbFuncSetDict.Keys)
|
{
|
XBTypeInfo typeInfo = GetXBInfoByType(type);
|
if(typeInfo != null)
|
{
|
int[] freeCDs = xbFuncSetDict[type].xbFreeCDs;
|
for (int i = 0; i < freeCDs.Length; i++)
|
{
|
if(freeCDs[i] != 0)
|
{
|
DesignDebug.Log("现在时间:" + TimeUtility.ServerNow + "免费时间:" + TimeUtility.GetTime((uint)typeInfo.freeTimeDict[i]));
|
TimeSpan t = TimeUtility.ServerNow - TimeUtility.GetTime((uint)typeInfo.freeTimeDict[i]);
|
float minutes = Mathf.Max(0.1f, (float)t.TotalMinutes);
|
float seconds = Mathf.Max(0.1f, (float)t.TotalSeconds);
|
if (minutes > 0)
|
{
|
if (minutes < freeCDs[i])
|
{
|
float reamainSeconds = freeCDs[i] * 60 - (int)seconds;
|
if (type == 1)
|
{
|
TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.HappyFreeBestXB, reamainSeconds, RefreshBestXBTime);
|
}
|
else if(type == 2)
|
{
|
TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.HappyFreeRuneXB, reamainSeconds, RefreshRuneXBTime);
|
}
|
|
}
|
}
|
}
|
}
|
}
|
|
}
|
}
|
|
public event Action<float> RefreshBestXBTimeAct;
|
public event Action<float> RefreshRuneXBTimeAct;
|
public void RefreshBestXBTime(float time)
|
{
|
if(RefreshBestXBTimeAct != null)
|
{
|
RefreshBestXBTimeAct(time);
|
}
|
|
if (time <= 0)
|
{
|
BestAndRuneXBRedPoint();
|
}
|
}
|
public void RefreshRuneXBTime(float time)
|
{
|
if (RefreshRuneXBTimeAct != null)
|
{
|
RefreshRuneXBTimeAct(time);
|
}
|
|
if(time <= 0)
|
{
|
BestAndRuneXBRedPoint();
|
}
|
}
|
|
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);
|
}
|
}
|
|
#region 红点逻辑
|
public const int MainTop_RedKey = 2;
|
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 Redpoint mainTopRed = new Redpoint(MainTop_RedKey);
|
public Redpoint happyXBRed = new Redpoint(MainTop_RedKey, 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 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;
|
|
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptTreasure);
|
if (singlePack == null) return;
|
|
if (singlePack.GetPackModelIndexDict().Count > 0)
|
{
|
xbWarehouseRed.state = RedPointState.Simple;
|
}
|
else
|
{
|
xbWarehouseRed.state = RedPointState.None;
|
}
|
}
|
|
public void BestAndRuneXBRedPoint()
|
{
|
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
|
|
if (IsHaveFreeXB(1))
|
{
|
bestXBRed.state = RedPointState.Simple;
|
}
|
else
|
{
|
bestXBRed.state = RedPointState.None;
|
}
|
|
if (IsHaveFreeXB(2))
|
{
|
runeXBRed.state = RedPointState.Simple;
|
}
|
else
|
{
|
runeXBRed.state = RedPointState.None;
|
}
|
}
|
|
private List<StoreConfig> 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++)
|
{
|
storelist = StoreConfig.GetTypeStoreModel(i);
|
if(storelist.Count > 0)
|
{
|
List<StoreConfig> orderlist = new List<StoreConfig>();
|
orderlist.AddRange(storelist);
|
orderlist.Sort(CompareByMoney);
|
if(moneyNum >= (ulong)orderlist[0].MoneyNumber)
|
{
|
xbStoreRed.state = RedPointState.Simple;
|
return;
|
}
|
}
|
}
|
xbStoreRed.state = RedPointState.None;
|
}
|
|
public int CompareByMoney(StoreConfig start, StoreConfig end)
|
{
|
int money1 = start.MoneyNumber;
|
int money2 = end.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
|
{
|
public int xbType; // 1 极品寻宝 2 符印寻宝
|
public int luckValue;
|
public Dictionary<int, int> freeTimeDict; // key 0 抽取一次 1 抽取多次 value 时间
|
}
|
|
public class XBFuncSet
|
{
|
public int xbType;// 1 极品寻宝 2 符印寻宝
|
public int[] xbNums;
|
public int[] xbPrices;
|
public int[] costTools;
|
public int[] xbFreeCDs;
|
public int[] xbScores;
|
}
|
|
public class XBGetItem
|
{
|
public int gridIndex;
|
public int itemId;
|
public int count;
|
public int isBind;
|
public DateTime createTime;
|
public string createTimeStr;
|
|
public void SetModel(int index, int id, int count, int isBind)
|
{
|
this.gridIndex = index;
|
this.itemId = id;
|
this.count = count;
|
this.isBind = isBind;
|
createTime = TimeUtility.ServerNow;
|
createTimeStr = TimeUtility.ServerNow.ToString("yyyy-MM-dd HH:mm:ss");
|
}
|
}
|
|
public enum HappXBTitle
|
{
|
Best = 1,
|
Rune = 2,
|
Store = 3,
|
Warehouse = 4,
|
}
|
}
|