Пример #1
0
        public void OnCommand_UpdateNumProp(EntityNumPropEventArgs e)
        {
            if (!e.objev.IsHero || e.objev == null)
            {
                return;
            }

            switch (e.data.nPropID)
            {
            case (int)ENTITY_PROPERTY.PROPERTY_ID:
            {
                int           nActorID = e.data.nValue;
                ActorHeroInfo heroInfo = LogicDataCenter.playerSystemDataManager.GetActorAllHero(nActorID);
            }
            break;

            case (int)ENTITY_PROPERTY.PROPERTY_LEVEL:
            {
                checkAllHeroIsHaveCanUpStar();
            }
            break;

            default:
                break;
            }
        }
Пример #2
0
        public void updateHeroCard(IntPtr ptrParam, int nPtrLen)
        {
            IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);
            int nCount  = helper.get <int>();
            int dwPDBID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);

            for (int i = 0; i < nCount; i++)
            {
                cmd_entity_update_card_info node = helper.get <cmd_entity_update_card_info>();
                // Hero更新
                ActorHeroInfo info = null;
                if (actorHero.TryGetValue(dwPDBID, out info))
                {
                    if (info.dicEntityHeroInfo.ContainsKey(node.nCardID))
                    {
                        cmd_entity_hero_info temp = info.dicEntityHeroInfo[node.nCardID];
                        temp.nCardCount = node.nCardCount;
                        info.dicEntityHeroInfo[node.nCardID] = temp;
                    }
                    if (info.dicEntityNoHaveHeroInfo.ContainsKey(node.nCardID))
                    {
                        cmd_entity_nohanve_hero temp = info.dicEntityNoHaveHeroInfo[node.nCardID];
                        temp.nHaveCardCount = node.nCardCount;
                        info.dicEntityNoHaveHeroInfo[node.nCardID] = temp;
                    }
                }
            }

            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_HEROPREVIEWFRAME_GETHEROINFO, null);
            checkAllHeroIsHaveCanUpStar();
        }
Пример #3
0
        // 收到推荐排位请求
        public void OnRecvRecommendRank()
        {
            // 社会服取不到英雄星级数据,客户端判断一次排位要求(int)EMMatchType.MatchType_None
            SMatchRankLimitHeroSchemeInfo info = MatchRankLimitConfig.Instance.getRankLimitHeroShemeInfo((int)EMMatchType.MatchType_Rank);

            if (info == null)
            {
                return;
            }
            ActorHeroInfo heroInfo = LogicDataCenter.playerSystemDataManager.GetActorAllHero();
            int           nCount   = 0;

            foreach (var item in heroInfo.dicEntityHeroInfo)
            {
                if (item.Value.bIsBuy > 0 && item.Value.byStarLv >= info.nLimitHeroStarLevel)
                {
                    nCount++;
                }

                if (nCount >= info.nLimitHeroCount)
                {
                    break;
                }
            }
            if (nCount < info.nLimitHeroCount)
            {
                return;
            }

            // DIDA提醒
            DIDAAddData msg = new DIDAAddData();

            msg.eLayout = EDIDALayout.EDT_Left;
            //msg.nDIDATime = 60;
            msg.nItemID          = (int)EDIDAType.EDIDA_RANK;
            msg.bAllowRepeatItem = false;
            msg.nButtonIconID    = (int)EDIDAType.EDIDA_RANK;
            msg.strTooltip       = ULocalizationService.Instance.Get("UIView", "MatchTimeInfo", "RecommendTooltip");
            msg.sCustomData      = new SideButtonCustomData();
            msg.callBack         = (CustomerInfo) =>
            {
                UIDialogData toolTipData = new UIDialogData(
                    title: ULocalizationService.Instance.Get("UIView", "MatchTimeInfo", "RecommendTitle"),
                    message: ULocalizationService.Instance.Get("UIView", "MatchTimeInfo", "RecommendContent"),
                    buttons: new UIWidgets.DialogActions()
                {
                    { ULocalizationService.Instance.Get("UIView", "Common", "Agree"), onClickAgreeBtn },
                    { ULocalizationService.Instance.Get("UIView", "Common", "Refuse"), onClickRefuseBtn }
                },
                    closeButtonAction: new UnityEngine.Events.UnityAction(onClickCloseBtn)
                    );

                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_COMMON_DIALOG, toolTipData);
            };

            LogicDataCenter.didaDataManager.AddItem(msg);
        }
Пример #4
0
        public void UpdataAllHero(IntPtr ptrParam, int nPtrLen)
        {
            IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);

            cmd_pdbid_count haveHeroInfo = helper.get <cmd_pdbid_count>();
            ActorHeroInfo   info         = null;

            if (actorHero.TryGetValue(haveHeroInfo.dwPDBID, out info) == false)
            {
                return;
            }

            info.dicEntityHeroInfo.Clear();
            for (int i = 0; i < haveHeroInfo.nCount; ++i)
            {
                cmd_entity_hero_info data = helper.get <cmd_entity_hero_info>();
                info.dicEntityHeroInfo[data.nHeroID] = data;
            }

            cmd_count noHaveHeroInfo = helper.get <cmd_count>();

            info.dicEntityNoHaveHeroInfo.Clear();
            for (int i = 0; i < noHaveHeroInfo.nCount; i++)
            {
                cmd_entity_nohanve_hero data1 = helper.get <cmd_entity_nohanve_hero>();
                info.dicEntityNoHaveHeroInfo[data1.nHeroID] = data1;
            }

            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_HEROPREVIEWFRAME_GETHEROINFO, null);
            checkAllHeroIsHaveCanUpStar();

            // 更新已下发详细英雄信息
            int actorID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);

            foreach (var item in actorHeroDetail)
            {
                if (item.Key.nPDBID == actorID)
                {
                    RequestHeroDetailInfo(item.Key, HeroDetailReqType.HDRT_REFRESH);
                }
            }
        }
Пример #5
0
        /// <summary>
        /// 设置当前英雄列表数据
        /// </summary>
        public void SetPlayerHeroPortraitItemList()
        {
            ActorHeroInfo heroInfo = LogicDataCenter.playerSystemDataManager.GetActorAllHero();

            //数据没下来,等待数据
            if (heroInfo.dicEntityHeroInfo.Count <= 0 || heroInfo.dicEntityNoHaveHeroInfo.Count <= 0)
            {
                return;
            }

            m_nPlayerHeroInfo = heroInfo;

            SetPlayerCurrentHeroPortraitItemList();
            if (CurrentSelectHero <= 0)
            {
                CurrentSelectHero = CurrentHeroPortraitItemList[0].HeroHeadPortraitID;
            }

            TimerManager.KillTimer(this, (int)ETimerHandlerID.HeroPortraitList);
        }
Пример #6
0
        public void RequestHeroDetailInfo(PDBIDandHeroID nMultiKey, HeroDetailReqType eType = HeroDetailReqType.HDRT_INIT)
        {
            // 设置详细英雄界面信息请求标志位
            eHeroDetailReqType = eType;

            cmd_entity_hero_info cmdHeroInfo = new cmd_entity_hero_info();

            // Player界面取一次
            ActorPlayerInfo playerInfo = null;

            if (actorPlayer.TryGetValue(nMultiKey.nPDBID, out playerInfo))
            {
                foreach (var value in playerInfo.strongHeroInfoList)
                {
                    if (value.nHeroID == nMultiKey.nHeroID)
                    {
                        cmdHeroInfo = value;
                        break;
                    }
                }
            }

            // Hero界面取一次
            if (cmdHeroInfo.nHeroID == 0)
            {
                ActorHeroInfo heroInfo = null;
                if (actorHero.TryGetValue(nMultiKey.nPDBID, out heroInfo))
                {
                    heroInfo.dicEntityHeroInfo.TryGetValue(nMultiKey.nHeroID, out cmdHeroInfo);
                }
            }

            // nHeroID > 0,则表示该英雄有数据;bIsBuy > 0,则表示已购买
            cmd_Request_Hero_Detail_Info reqHeroDetailInfo = new cmd_Request_Hero_Detail_Info();

            reqHeroDetailInfo.nActorID = (uint)nMultiKey.nPDBID;
            reqHeroDetailInfo.nHeroID  = nMultiKey.nHeroID;
            reqHeroDetailInfo.heroInfo = cmdHeroInfo;

            EntityEventHelper.Instance.SendCommand <cmd_Request_Hero_Detail_Info>(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_QUERY_HERO_DETAIL_INFO, ref reqHeroDetailInfo);
        }
Пример #7
0
        public ActorHeroInfo GetActorAllHero(int actorID = nDefaultSelfActorID)
        {
            CheckGetSelfPDBID(ref actorID);

            ActorHeroInfo info = null;

            if (actorHero.TryGetValue(actorID, out info))
            {
                return(info);
            }
            else
            {
                info = new ActorHeroInfo();
                info.dicEntityHeroInfo       = new Dictionary <int, cmd_entity_hero_info>();
                info.dicEntityNoHaveHeroInfo = new Dictionary <int, cmd_entity_nohanve_hero>();
                actorHero[actorID]           = info;
            }

            RequestAllHero(actorID);
            return(info);
        }
Пример #8
0
        public bool CheckIsHaveHero(int nHeroID, int nActorID = nDefaultSelfActorID)
        {
            ActorHeroInfo info = GetActorAllHero(nDefaultSelfActorID);

            if (info == null)
            {
                return(false);
            }

            foreach (cmd_entity_hero_info item in info.dicEntityHeroInfo.Values)
            {
                if (item.nHeroID == nHeroID)
                {
                    if (item.bIsBuy > 0)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #9
0
        public void UpdateHeroInfo(IntPtr ptrParam, int nPtrLen)
        {
            int actorID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);

            IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);

            int nCount = helper.get <int>();

            for (int i = 0; i < nCount; ++i)
            {
                bool bNewBuy = false;
                bool bOldBuy = false;

                cmd_entity_hero_info data     = helper.get <cmd_entity_hero_info>();
                ActorPlayerInfo      playInfo = null;
                ActorHeroInfo        info     = null;
                int nHeroID = data.nHeroID;
                bNewBuy = data.bIsBuy > 0;

                if (actorHero.TryGetValue(actorID, out info) == true)
                {
                    // 英雄总览界面数据更新
                    if (info.dicEntityHeroInfo.ContainsKey(nHeroID) == true)
                    {
                        bOldBuy = info.dicEntityHeroInfo[nHeroID].bIsBuy > 0;
                        info.dicEntityHeroInfo[nHeroID] = data;
                    }
                    else if (info.dicEntityNoHaveHeroInfo.ContainsKey(nHeroID) == true)
                    {
                        info.dicEntityNoHaveHeroInfo.Remove(nHeroID);
                        info.dicEntityHeroInfo[nHeroID] = data;
                    }
                }

                if ((actorPlayer.TryGetValue(actorID, out playInfo) == true))
                {
                    // 玩家界面数据更新
                    for (int j = 0; j < playInfo.strongHeroInfoList.Count; j++)
                    {
                        if (playInfo.strongHeroInfoList[j].nHeroID == nHeroID)
                        {
                            playInfo.strongHeroInfoList[j] = data;
                        }
                    }
                }

                PlayerHeroUpdateData msgData = new PlayerHeroUpdateData();
                msgData.nHeroID   = nHeroID;
                msgData.nReqPDBID = actorID;
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_HEROPREVIEWFRAME_GETHEROINFO, msgData);

                if (bNewBuy && !bOldBuy)
                {
                    UISystem.Instance.SendWndMessage(WndMsgID.WND_ID_GAMEWAITINGROOMVIEW_ROOMBUYHERO, msgData);
                }

                // 英雄详细界面数据更新
                PDBIDandHeroID multiKey = new PDBIDandHeroID(actorID, nHeroID);
                RequestHeroDetailInfo(multiKey, HeroDetailReqType.HDRT_REFRESH);
            }
        }
Пример #10
0
        public void checkAllHeroIsHaveCanUpStar(int nCurGold = 0)
        {
            if (EntityFactory.MainHeroView == null)
            {
                return;
            }
            int           dwPDBID  = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);
            ActorHeroInfo heroInfo = null;

            if (!actorHero.TryGetValue(dwPDBID, out heroInfo))
            {
                return;
            }

            int nHaveGold = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_GOLD);

            nHaveGold = nCurGold > 0 ? nCurGold : nHaveGold;

            bool bCanUpstar = false;

            foreach (var item in heroInfo.dicEntityHeroInfo)
            {
                if (item.Value.bIsBuy <= 0)
                {
                    continue;
                }
                SHeroStarSchemeInfo pStarScheme = new SHeroStarSchemeInfo();
                if (!GameLogicAPI.getHeroStarConfig(item.Value.nHeroID, item.Value.byStarLv, ref pStarScheme))
                {
                    continue;
                }
                if (item.Value.byStarLv >= pStarScheme.nLimitLV)
                {
                    continue;
                }

                bool bIsLifeHero = LogicDataCenter.lifeHeroDataManager.AllLifeHero.ContainsKey(item.Value.nHeroID);
                int  nNeedCard   = bIsLifeHero && pStarScheme.nCardDiscount > 0 ? pStarScheme.nCardDiscount : pStarScheme.nNeedCount;
                int  nNeedGold   = bIsLifeHero && pStarScheme.nGoldDiscount > 0 ? pStarScheme.nGoldDiscount : pStarScheme.nExpendGold;
                if (nNeedCard > item.Value.nCardCount || nNeedGold > nHaveGold)
                {
                    continue;
                }

                bCanUpstar = true;
                break;
            }

            int playerLv = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_LEVEL);
            SSchemeSideButtonInfo config = SideButtonConfig.Instance.GetSideButtonConfig((int)ESideButtonItemType.ESBT_HeroStar);

            if (bCanUpstar && playerLv >= config.nLowLv && playerLv <= config.nHighLv)
            {
                // 满足升星条件,显示升星提示
                SideButtonListAddData msg = new SideButtonListAddData();
                msg.nItemID       = (int)ESideButtonItemType.ESBT_HeroStar;
                msg.nButtonIconID = config.nIconID;
                msg.strButtonText = config.strName;
                msg.strTooltip    = config.strHint;
                msg.callBack      = (customData) =>
                {
                    UIButtonType ButtonType = new UIButtonType((int)PlayerSubWndType.WND_HERO);
                    ButtonType.bIsRequestSelf = true;
                    ButtonType.nRequestPDBID  = dwPDBID;
                    UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_PLAYERBUTTONFRAME_OPENFRAME, ButtonType);
                };
                LogicDataCenter.sideButtonDataManager.AddItem(msg);
            }
            else
            {
                // 不满足升星条件, 隐藏升星提示
                SideButtonListRemoveData msg = new SideButtonListRemoveData();
                msg.nItemID = (int)ESideButtonItemType.ESBT_HeroStar;
                LogicDataCenter.sideButtonDataManager.RemoveItem(msg);
            }
        }
Пример #11
0
        public bool CheckCanBuyGoods(int nSellID, int nNum)
        {
            SSchemePointShopGoodsConfig goodsConfig = PointShopConfig.Instance.GetPointShopGoodsConfig(nSellID);

            if (goodsConfig == null)
            {
                return(false);
            }

            SSchemeActorPrizeConfig prizeConfig = ActorPrizeConfig.Instance.GetActorPrizeConfig(goodsConfig.nPrizeID);

            if (prizeConfig == null)
            {
                return(false);
            }

            if (prizeConfig.nPrizeType == (int)EMActorPrizeType.ACTOR_PRIZE_HERO)
            {
                int           nHeroID       = prizeConfig.nPrizeParam[0];
                ActorHeroInfo actorHeroInfo = LogicDataCenter.playerSystemDataManager.GetActorAllHero();
                if (actorHeroInfo == null)
                {
                    return(false);
                }

                cmd_entity_hero_info heroData;
                if (actorHeroInfo.dicEntityHeroInfo.TryGetValue(nHeroID, out heroData))
                {
                    if (heroData.bIsBuy > 0)
                    {
                        return(false);
                    }
                }
            }

            if (prizeConfig.nPrizeType == (int)EMActorPrizeType.ACTOR_PRIZE_HEROSKIN)
            {
                cmd_Hero_Skin_Info cmdSkinInfo = new cmd_Hero_Skin_Info();
                SkinInfoScheme     skinConfig  = new SkinInfoScheme();
                if (!GameLogicAPI.GetHeroSkinInfo(prizeConfig.nPrizeParam[1], ref skinConfig))
                {
                    return(false);
                }

                bool bHaveSkin;
                if (LogicDataCenter.heroSkinDataManager.GetHeroSkinInfo(prizeConfig.nPrizeParam[0], prizeConfig.nPrizeParam[1], ref cmdSkinInfo))
                {
                    bHaveSkin = true;
                }
                else
                {
                    bHaveSkin = skinConfig.nSkinLevel == (int)SKIN_LEVEL_TYPE.ESLT_NORMAL ? true : false;
                }

                if (bHaveSkin)
                {
                    return(false);
                }
            }

            return(true);
        }