Exemplo n.º 1
0
        // 玩家天赋激活
        public void recvActiveTalentList(IntPtr ptr, int nLen)
        {
            if (ptr == null || nLen == 0)
            {
                return;
            }

            IntPtrVaArgParseHelper     helper = new IntPtrVaArgParseHelper(ptr, nLen);
            cmd_war_active_talent_list cmd    = helper.get <cmd_war_active_talent_list>();

            if (!activeTalentInfo.ContainsKey((ulong)cmd.pdbid))
            {
                activeTalentInfo.Add((ulong)cmd.pdbid, cmd);
            }
            else
            {
                activeTalentInfo[(ulong)cmd.pdbid] = cmd;
            }

            // 判断是否当前主角
            int pdbid = EntityUtil.getMainHeroPdbid();

            if (cmd.pdbid == pdbid)
            {
                // 通知界面已激活天赋列表更新
                UIMsgCmdData uiResult = new UIMsgCmdData((int)WndMsgID.WND_ID_HEROTALENTVIEW_ACTIVEDTALENTLISTUPDATE, cmd.nCurTalent, "", IntPtr.Zero, 0);
                UISystem.Instance.SendWndMessage(WndMsgID.WND_ID_HEROTALENTVIEW_ACTIVEDTALENTLISTUPDATE, uiResult);
            }
        }
Exemplo n.º 2
0
        // 获取某个玩家的已激活天赋列表
        public bool getActiveTalentList(ulong pdbid, out cmd_war_active_talent_list talentList)
        {
            if (activeTalentInfo.TryGetValue(pdbid, out talentList))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        // 清空自己已激活天赋
        public void clearSelfActivedTalentList()
        {
            ulong pdbid = (ulong)EntityUtil.getMainHeroPdbid();
            cmd_war_active_talent_list talentList = new cmd_war_active_talent_list();

            if (activeTalentInfo.TryGetValue(pdbid, out talentList))
            {
                talentList.nCurTalent = 0;
                for (int i = 0; i < talentList.nTalentList.Length; ++i)
                {
                    talentList.nTalentList[i] = 0;
                }
            }
        }
Exemplo n.º 4
0
        // 接受消息
        public override void OnMessage(WndMsgID msgID, UIMsgData msgData)
        {
            saveCacheUIMsg(msgID, msgData);

            switch (msgID)
            {
            case WndMsgID.WND_MSG_COMMON_BATTLESTATE_ENTER:
            {
                if (m_wndView == null)
                {
                    LoadView();
                    SetVisible(true);
                }

                // 运行缓存的消息
                runCacheUIMsg();
            }
            break;

            case WndMsgID.WND_ID_HEROTALENTVIEW_HEROTALENTVISIBLE:
            {
                if (m_wndView == null)
                {
                    return;
                }

                HeroTalentVisibleData uiTalent = (HeroTalentVisibleData)msgData;
                if (uiTalent.bVisible)
                {
                    // 显示
                    SetHeroTalentViewOpen();
                }
                else
                {
                    // 不显示
                    m_wndView.ShowMainTalent(false, false);
                }
            }
            break;

            case WndMsgID.WND_MSG_COMMON_WAREND:
            case WndMsgID.WND_MSG_COMMON_BATTLESTATE_LEAVE:
            {
                this.UnloadView();
                m_CacheUIMsgList.Clear();
            }
            break;

            case WndMsgID.WND_MSG_COMMON_MAINHEROFIGHTSTATE:
            {
                // 战斗状态关闭天赋窗口
                if (m_bIsGuiding == false)
                {
                    CloseMainHeroTalentView();
                }
            }
            break;

            case WndMsgID.WND_ID_HEROTALENTVIEW_INITWARTALENT:
            {
                if (m_wndView == null)
                {
                    return;
                }

                if (EntityUtil.getMainHeroHeroID() <= 0)
                {
                    return;
                }

                Debug.LogWarning("WND_ID_HEROTALENTVIEW_INITWARTALENT");

                // 初始化本英雄的天赋列表界面数据
                InitShowDataInfo(EntityUtil.getMainHeroHeroID());
            }
            break;

            case WndMsgID.WND_ID_HEROTALENTVIEW_ACTIVEDTALENTLISTUPDATE:
            {
                // 断线重连情况下,该消息比BATTLESTATE_ENTER消息先来
                if (m_wndView == null)
                {
                    LoadView();
                    SetVisible(true);
                }

                // 已激活的主动学习天赋列表更新
                if (m_wndView != null)
                {
                    // 每次成功激活一个天赋后执行
                    UIMsgCmdData uiTalent  = (UIMsgCmdData)msgData;
                    int          nTalentId = uiTalent.nParam;
                    if (nTalentId > 0)
                    {
                        m_wndView.onActivedTalent(nTalentId);
                    }
                    else
                    {
                        // 断线重连后收到天赋列表
                        cmd_war_active_talent_list talentList = new cmd_war_active_talent_list();
                        if (LogicDataCenter.heroTalentDataManager.getActiveTalentList((ulong)EntityUtil.getMainHeroPdbid(), out talentList))
                        {
                            foreach (int item in talentList.nTalentList)
                            {
                                m_wndView.onActivedTalent(item);
                            }
                        }
                    }

                    m_wndView.ShowMainTalent(false);
                }
            }
            break;

                #region 新手引导
            case WndMsgID.WND_ID_HEROTALENTVIEW_ADDGUIDEWIDGET:
            {
                if (m_wndView != null && msgData != null)
                {
                    UGuideWidgetMsgData uiTalent = (UGuideWidgetMsgData)msgData;
                    m_bIsGuiding = true;
                    m_wndView.AddGuideWidget(uiTalent);
                }
            }
            break;

            case WndMsgID.WND_ID_HEROTALENTVIEW_REMOVEGUIDEWIDGET:
            {
                if (m_wndView != null && msgData != null)
                {
                    UGuideWidgetMsgData uiTalent = (UGuideWidgetMsgData)msgData;
                    m_bIsGuiding = false;
                    m_wndView.RemoveGuideWidget(uiTalent);
                }
            }
            break;

                #endregion
            default:
                break;
            }
        }