Exemplo n.º 1
0
 /// <summary>
 /// 镶嵌格子数据UI事件回调
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="data"></param>
 /// <param name="param"></param>
 private void OnInlayGridUIEventDlg(UIEventType eventType, object data, object param)
 {
     switch (eventType)
     {
     case UIEventType.Click:
     {
         if (data is UICtrTypeGrid)
         {
             UICtrTypeGrid ctg = data as UICtrTypeGrid;
             SetActiveGemType((GameCmd.GemType)ctg.ID);
         }
         else if (data is UIGemGrid)
         {
             UIGemGrid gGRid = data as UIGemGrid;
             //镶嵌
             DoInlay(gGRid.Data);
         }
         else if (data is UIEquipPosStatusGrid)
         {
             UIEquipPosStatusGrid epsGrid = data as UIEquipPosStatusGrid;
             SetSelectPart(epsGrid.Data);
         }
         else if (data is UIGemInLayGrid)
         {
             UIGemInLayGrid gInlayGrid = data as UIGemInLayGrid;
             DoUnload(gInlayGrid.Data);
         }
     }
     break;
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 镶嵌格子数据刷新回调
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    private void OnUpdateInlayGrid(UIGridBase grid, int index)
    {
        if (grid is UICtrTypeGrid)
        {
            UICtrTypeGrid ctg = grid as UICtrTypeGrid;
            if (mlstCanInlayGemType.Count > index)
            {
                GameCmd.GemType gemType = mlstCanInlayGemType[index];

                GemInlayUpdateData updateData = GetGemInlayUpdateData(gemType);
                int num = (null != updateData) ? updateData.Count : 0;
                ctg.SetData(gemType, DataManager.Manager <TextManager>().GetGemNameByType(gemType), num);
                ctg.SetRedPointStatus(DataManager.Manager <ForgingManager>().HaveGemCanImprove(m_emSelectInlayPos, gemType));
            }
        }
        else if (grid is UIEquipPosStatusGrid)
        {
            UIEquipPosStatusGrid posGrid = grid as UIEquipPosStatusGrid;
            GameCmd.EquipPos     pos     = GetEquipPosByIndex(index);
            bool isInlay = IsPanelMode(ForgingPanelMode.Inlay);
            posGrid.SetGridViewData(pos, isInlay);
            posGrid.SetHightLight(pos == m_emSelectInlayPos);
            if (isInlay)
            {
                Gem    gem              = null;
                uint   inLayGemBaseId   = 0;
                string inlayGemIconName = "";
                bool   inlay            = false;
                bool   unlock           = false;
                for (EquipManager.EquipGridIndexType i = EquipManager.EquipGridIndexType.First; i < EquipManager.EquipGridIndexType.Max; i++)
                {
                    inlayGemIconName = "";
                    inlay            = false;
                    unlock           = false;
                    if (i < 0)
                    {
                        continue;
                    }

                    if (emgr.TryGetEquipGridInlayGem(pos, i, out inLayGemBaseId))
                    {
                        gem = DataManager.Manager <ItemManager>()
                              .GetTempBaseItemByBaseID <Gem>(inLayGemBaseId, ItemDefine.ItemDataType.Gem);
                        inlayGemIconName = gem.Icon;
                        unlock           = true;
                        inlay            = true;
                    }
                    else if (emgr.IsUnlockEquipGridIndex(i))
                    {
                        unlock = true;
                    }
                    posGrid.SetInlayIcon(i, unlock, inlay, inlayGemIconName);
                }
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 设置选中装备部位
    /// </summary>
    /// <param name="ep"></param>
    /// <param name="force"></param>
    private void SetSelectPart(GameCmd.EquipPos ep, bool force = false, bool needFocus = false)
    {
        if (null == m_ctor_InlayScrollView || null == m_dicInlayParts || (ep == m_emSelectInlayPos && !force))
        {
            return;
        }
        List <GameCmd.EquipPos> eps = null;
        //刷新数据
        UIEquipPosStatusGrid grid = null;
        EquipPartMode        epm  = DataManager.Manager <ForgingManager>().GetEquipModeByEquipPos(m_emSelectInlayPos);

        if (m_dicInlayParts.TryGetValue(epm, out eps) && eps.Contains(m_emSelectInlayPos))
        {
            grid = m_ctor_InlayScrollView.GetGrid <UIEquipPosStatusGrid>(eps.IndexOf(m_emSelectInlayPos));
            if (null != grid)
            {
                grid.SetHightLight(false);
            }
        }
        epm = DataManager.Manager <ForgingManager>().GetEquipModeByEquipPos(ep);
        if (m_dicInlayParts.TryGetValue(epm, out eps) && eps.Contains(ep))
        {
            grid = m_ctor_InlayScrollView.GetGrid <UIEquipPosStatusGrid>(eps.IndexOf(ep));
            if (null != grid)
            {
                grid.SetHightLight(true);
            }
        }
        m_emSelectInlayPos = ep;
        if (needFocus && m_dicInlayParts.TryGetValue(epm, out eps))
        {
            m_ctor_InlayScrollView.FocusGrid(eps.IndexOf(ep));
        }
        if (IsPanelMode(ForgingPanelMode.Inlay))
        {
            //更新镶嵌数据
            UpdateInlayInfo();
            //构建宝石列表
            BuildGemList();
        }
        else if (IsPanelMode(ForgingPanelMode.Strengthen))
        {
            UpdateStrengthen();
        }

        RefreshBtnState();
    }