| | |
| | | }
|
| | | private Dictionary<int, XBTypeInfo> xbTypeInfoDict = new Dictionary<int, XBTypeInfo>(); //抽奖状态相关的 服务器记录
|
| | |
|
| | | public int lhQuality;
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | 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();
|
| | |
| | |
|
| | | xbTypeItemDict[list[i].TreasureType].Add(list[i]);
|
| | | }
|
| | |
|
| | | var config = FuncConfigConfig.Get("HeroCall");
|
| | | lhQuality = int.Parse(config.Numerical1);
|
| | | }
|
| | |
|
| | | 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()
|
| | | {
|
| | | isXBCoolTime = false;
|
| | | xbTypeInfoDict.Clear();
|
| | | }
|
| | |
|
| | | void OnPlayerLoginOk()
|
| | | {
|
| | | HeroCallRedPoint();
|
| | | }
|
| | |
|
| | |
|
| | | void OnInvestUpdate(int type)
|
| | | {
|
| | | if (type == 7)
|
| | | HeroCallRedPoint();
|
| | | }
|
| | | public XBGetItemConfig GetXBItemConfigByType(int type)
|
| | | {
|
| | | int lv = 0;
|
| | |
| | | //货币寻宝
|
| | | int moneyType = funcSet.CostMoneyType;
|
| | | int xbOneMoney = funcSet.CostMoneyList[0];
|
| | |
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbOneMoney)
|
| | | //暂定充值货币需要二次确认
|
| | | if (moneyType == 1)
|
| | | {
|
| | | //暂定充值货币需要二次确认
|
| | | if (moneyType == 1)
|
| | | StoreModel.Instance.UseMoneyCheck(xbOneMoney, moneyType, () =>
|
| | | {
|
| | | StoreModel.Instance.UseMoneyCheck(xbOneMoney, moneyType, () =>
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= xbOneMoney)
|
| | | {
|
| | | SendXBQuest(xbType, 0, 0);
|
| | | }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, xbOneMoney,
|
| | | UIHelper.GetIconNameWithMoneyType(moneyType), funcSet.CostItemCountList[0]));
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.ShowMoneyTip(moneyType);
|
| | | }
|
| | | }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, xbOneMoney,
|
| | | UIHelper.GetIconNameWithMoneyType(moneyType), funcSet.CostItemCountList[0]));
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | SendXBQuest(xbType, 0, 0);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (!GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType))
|
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= xbOneMoney)
|
| | | {
|
| | | SendXBQuest(xbType, 0, 0);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true);
|
| | | ItemTipUtility.ShowMoneyTip(moneyType);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | //货币寻宝
|
| | | int moneyType = funcSet.CostMoneyType;
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)needMoney)
|
| | |
|
| | | //暂定充值货币需要二次确认
|
| | | if (moneyType == 1)
|
| | | {
|
| | | //暂定充值货币需要二次确认
|
| | | if (moneyType == 1)
|
| | | StoreModel.Instance.UseMoneyCheck(needMoney, moneyType, () =>
|
| | | {
|
| | | StoreModel.Instance.UseMoneyCheck(needMoney, moneyType, () =>
|
| | | //只要有道具就是道具寻宝,不足部分服务端扣货币
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= needMoney)
|
| | | {
|
| | | //只要有道具就是道具寻宝,不足部分服务端扣货币
|
| | | SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
|
| | | }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, needMoney,
|
| | | UIHelper.GetIconNameWithMoneyType(moneyType), needToolCnt - toolCnt));
|
| | | }
|
| | | else
|
| | | {
|
| | | 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
|
| | | {
|
| | | if (!GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType))
|
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
|
| | | if (UIHelper.GetMoneyCnt(moneyType) >= needMoney)
|
| | | {
|
| | | SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true);
|
| | | ItemTipUtility.ShowMoneyTip(moneyType);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //判断是否有免费次数,且免费次数是否用完
|
| | | 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;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | #region 红点逻辑
|
| | | public const int HappyXB_RedKey = 203;
|
| | | 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 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)
|
| | |
| | | HeroCallRedPoint();
|
| | | }
|
| | |
|
| | | void OnDayEvent()
|
| | | { |
| | | HeroCallRedPoint();
|
| | | }
|
| | |
|
| | | //英雄招募
|
| | | public void HeroCallRedPoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return;
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure))
|
| | | return;
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Hero))
|
| | | return;
|
| | |
|
| | | // 免费 10连 积分
|
| | | happyXBRed.state = RedPointState.None;
|
| | | bestXB10Red.state = RedPointState.None;
|
| | | bestXBFreeRed.state = RedPointState.None;
|
| | | bestXBScoreRed.state = RedPointState.None;
|
| | |
|
| | |
|
| | | if (IsHaveFreeXB((int)HappXBTitle.HeroCallAdvanced))
|
| | | {
|
| | | bestXBFreeRed.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | else
|
| | | {
|
| | | bestXBFreeRed.state = RedPointState.None;
|
| | | }
|
| | |
|
| | | if (IsHaveManyXBToolEx((int)HappXBTitle.HeroCallAdvanced, out int xbtoolCnt, out int needtoolCnt, out int needMoney))
|
| | | {
|
| | | happyXBRed.state = RedPointState.Simple;
|
| | | bestXB10Red.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | |
|
| | | //积分足够
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //按格子库配置的奖池 获得获取物品
|
| | | public List<int> GetAllGridLibItemIDByType(int type)
|
| | | {
|
| | | List<int> itemIDListTemp = new List<int>();
|
| | | foreach (var kv in GetXBItemConfigByType(type).GridLibInfo)
|
| | | {
|
| | | itemIDListTemp.AddRange(TreasureItemLibConfig.GetItemIDList(kv.Value));
|
| | | }
|
| | | return itemIDListTemp.Distinct().ToList();
|
| | |
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
|
| | | public class XBTypeInfo
|
| | | {
|