Пример #1
0
 /// <summary>
 /// 格子UI点击响应事件
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="data"></param>
 /// <param name="param"></param>
 private void OnUIGridEventDlg(UIEventType eventType, object data, object param)
 {
     if (eventType == UIEventType.Click)
     {
         if (data is UIClanTaskGrid)
         {
             UIClanTaskGrid taskGrid = data as UIClanTaskGrid;
         }
         else if (data is UIClanApplyGrid)
         {
             UIClanApplyGrid aGrid = data as UIClanApplyGrid;
             if (null != param && param is bool)
             {
                 bool agree = (bool)param;
                 DealClanApplyInfo(aGrid.UserId, agree);
             }
             else
             {
                 GameCmd.stRequestListClanUserCmd_S.Data member = m_mgr.GetClanApplyUserInfo(aGrid.UserId);
                 DataManager.Instance.Sender.RequestPlayerInfoForOprate(aGrid.UserId, PlayerOpreatePanel.ViewType.Normal);
             }
         }
         else if (data is UIClanDonateGrid)
         {
         }
         else if (data is UIClanDeclareWarGrid)
         {
             UIClanDeclareWarGrid dwg = data as UIClanDeclareWarGrid;
             dwg.SetSelect(true);
             if (previousDeclareGrid == null)
             {
                 previousDeclareGrid = dwg;
             }
             else
             {
                 if (previousDeclareGrid.Id == dwg.Id)
                 {
                     return;
                 }
                 else
                 {
                     previousDeclareGrid.SetSelect(false);
                     previousDeclareGrid = dwg;
                 }
             }
         }
         else if (data is UIClanMemberGrid)
         {
             UIClanMemberGrid         mGrid  = data as UIClanMemberGrid;
             GameCmd.stClanMemberInfo member = (null != ClanInfo) ? ClanInfo.GetMemberInfo(mGrid.UserId) : null;
             if (null != member)
             {
                 if (member.id != DataManager.Instance.UserId)
                 {
                     SetSelectMemberId(member);
                     DataManager.Instance.Sender.RequestPlayerInfoForOprate(mGrid.UserId, PlayerOpreatePanel.ViewType.Clan);
                 }
             }
             else
             {
                 Engine.Utility.Log.Error("GetClanMemberInfo null userid={0}", mGrid.UserId);
             }
         }
         else if (data is UIClanSkillGrid)
         {
             UIClanSkillGrid skillGrid = data as UIClanSkillGrid;
             SetSelectSkillId(skillGrid.Id);
         }
         else if (data is UITabGrid)
         {
             UITabGrid tabGrid = data as UITabGrid;
             if (tabGrid.Data is ClanPanelMode)
             {
                 SetMode((ClanPanelMode)tabGrid.Data);
             }
         }
         else if (data is UIClanTabGrid)
         {
             UIClanTabGrid tab = data as UIClanTabGrid;
             SetInfoMode((ClanInfoMode)tab.Data + 1);
         }
     }
 }
Пример #2
0
    /// <summary>
    /// 格子刷新回调
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    private void OnUpdateUIGrid(UIGridBase grid, int index)
    {
        if (grid is UIClanTaskGrid)
        {
            if (null != m_list_taskInfos && m_list_taskInfos.Count > index)
            {
                uint           id           = m_list_taskInfos[index];
                UIClanTaskGrid clanTaskGrid = grid as UIClanTaskGrid;
                clanTaskGrid.SetGridData(m_mgr.GetClanQuestInfo(id));
            }
            else
            {
                Engine.Utility.Log.Error("ClanTask OnUpdateUIGrid error");
            }
        }
        else if (grid is UIClanApplyGrid)
        {
            UIClanApplyGrid caGrid = grid as UIClanApplyGrid;
            if (null != caGrid && null != m_list_applyUserIds && m_list_applyUserIds.Count > index)
            {
                caGrid.SetGridData(m_mgr.GetClanApplyUserInfo(m_list_applyUserIds[index]));
            }
        }
        else if (grid is UIClanDonateGrid)
        {
            UIClanDonateGrid cdGrid = grid as UIClanDonateGrid;
            if (null != cdGrid && null != m_list_donateDatas && m_list_donateDatas.Count > index)
            {
                ClanDefine.LocalClanDonateDB cdDB
                    = m_mgr.GetLocalDonateDB(m_list_donateDatas[index]);
                cdGrid.RegisterDonateAction(DoDonate);
                if (null != cdDB)
                {
                    cdGrid.SetGridData(cdDB);
                }
            }
        }
        else if (grid is UIClanMemberGrid)
        {
            UIClanMemberGrid cmGrid = grid as UIClanMemberGrid;
            //ClanDefine.LocalClanInfo clanInfo = ClanInfo;
            if (null != cmGrid && index < m_list_memberdatas.Count)
            {
                cmGrid.SetGridData(m_list_memberdatas[index]);
                cmGrid.SetHightLight((m_uint_selectmemberid == m_list_memberdatas[index]) ? true : false);
                cmGrid.SetBackGround(index);
            }
        }
        else if (grid is UIClanSkillGrid)
        {
            UIClanSkillGrid csGrid = grid as UIClanSkillGrid;
            if (null != csGrid && null != m_list_clanSkillIds && m_list_clanSkillIds.Count > index)
            {
                uint skillId = m_list_clanSkillIds[index];
                csGrid.SetGridData(m_list_clanSkillIds[index]);
                table.SkillDatabase skillDB = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillId, 1);
                if (null != skillDB)
                {
                    bool select = (m_uint_SelectSkillId == skillId) ? true : false;

                    uint lv1    = 0;
                    uint lv2    = 0;
                    bool isLock = false;
                    if (IsSkillMode(ClanSkillMode.Learn))
                    {
                        lv1    = m_mgr.GetClanSkillLearnLv(skillId);
                        lv2    = m_mgr.GetClanSkillDevLv(skillId);
                        isLock = (lv1 >= lv2);
                    }
                    else if (IsSkillMode(ClanSkillMode.Dev))
                    {
                        lv1 = m_mgr.GetClanSkillDevLv(skillId);
                        lv2 = skillDB.dwMaxLevel;
                    }

                    csGrid.SetInfo(skillDB.strName
                                   , string.Format("{0}/{1}", lv1, lv2)
                                   , skillDB.iconPath
                                   , select, isLock);
                }
            }
        }
        else if (grid is UIClanHonorGrid)
        {
            UIClanHonorGrid cdGrid = grid as UIClanHonorGrid;
            if (null != cdGrid && null != m_list_honorInfos && m_list_honorInfos.Count > index)
            {
                cdGrid.SetGridData(m_list_honorInfos[index]);
            }
        }
        else if (grid is UIClanDecareWaRivalryGrid)
        {
            UIClanDecareWaRivalryGrid dwg = grid as UIClanDecareWaRivalryGrid;
            if (null != m_lst_Rivalry && m_lst_Rivalry.Count > index)
            {
                dwg.SetGridData(m_mgr.GetClanRivalryInfo(m_lst_Rivalry[index]));
            }
        }
        else if (grid is UIClanDeclareWarGrid)
        {
            UIClanDeclareWarGrid dwg = grid as UIClanDeclareWarGrid;
            if (null != m_lst_Rivalry && m_lst_Rivalry.Count > index)
            {
                dwg.SetGridData(m_mgr.GetClanRivalryInfo(m_lst_Rivalry[index]));
                dwg.SetIndex(index);
            }
        }
        else if (grid is UIClanTabGrid)
        {
            UIClanTabGrid tab = grid as UIClanTabGrid;
            tab.SetGridData(index);
            tab.SetName(m_list_tabContents[index]);
            if (index == 0 && previous == null)
            {
                previous = tab;
                tab.SetHightLight(true);
            }
        }
    }