示例#1
0
    /// <summary>
    /// 获取宝石类型名称
    /// </summary>
    /// <param name="gType"></param>
    /// <returns></returns>
    public string GetGemNameByType(GameCmd.GemType gType)
    {
        LocalTextType key = LocalTextType.LocalText_None;

        switch (gType)
        {
        case GameCmd.GemType.GemType_MagicAttact:
            key = LocalTextType.Local_TXT_Mattack;
            break;

        case GameCmd.GemType.GemType_MagicDefent:
            key = LocalTextType.Local_TXT_Mdefend;
            break;

        case GameCmd.GemType.GemType_PhysicalAttact:
            key = LocalTextType.Local_TXT_Pattack;
            break;

        case GameCmd.GemType.GemType_PhysicalDefent:
            key = LocalTextType.Local_TXT_Pdefend;
            break;

        case GameCmd.GemType.GemType_UpgradeLife:
            key = LocalTextType.Local_TXT_HpPromote;
            break;

        case GameCmd.GemType.GemType_Exp:
            key = LocalTextType.Local_TXT_ExpAdd;
            break;
        }
        return(GetLocalText(key));
    }
示例#2
0
    /// <summary>
    /// 生成宝石数据UI
    /// </summary>
    private void BuildGemDataUI()
    {
        m_emActiveGemType = GameCmd.GemType.GemType_None;
        if (null != mSecondsTabCreator)
        {
            //1、获取补一个不为空宝石类型
            GameCmd.GemType nextActiveGemType          = GameCmd.GemType.GemType_None;
            List <int>      secondTabDatas             = new List <int>();
            UISecondTabCreatorBase.SecondsTabData data = null;
            GemInlayUpdateData updateData = null;
            for (int i = 0; i < mlstCanInlayGemType.Count; i++)
            {
                updateData = GetGemInlayUpdateData(mlstCanInlayGemType[i]);
                if (null == updateData)
                {
                    continue;
                }

                secondTabDatas.Add(updateData.Count);
                if (updateData.Count != 0 &&
                    nextActiveGemType == GameCmd.GemType.GemType_None)
                {
                    nextActiveGemType = mlstCanInlayGemType[i];
                }
            }
            mSecondsTabCreator.CreateGrids(secondTabDatas);

            //2、展开当前活跃宝石列表,并生成UI
            SetActiveGemType(nextActiveGemType);
        }
    }
示例#3
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);
                }
            }
        }
    }
示例#4
0
 /// <summary>
 /// 宝石二级页签数据刷新
 /// </summary>
 /// <param name="gridBase"></param>
 /// <param name="id"></param>
 /// <param name="index"></param>
 private void OnUpdateSecondGemGrid(UIGridBase gridBase, object id, int index)
 {
     if (gridBase is UIGemGrid && id is GameCmd.GemType)
     {
         GameCmd.GemType    gemType = (GameCmd.GemType)id;
         GemInlayUpdateData data    = GetGemInlayUpdateData(gemType);
         uint gembaseId             = 0;
         if (null != data && data.TryGetBaseIdByIndex(index, out gembaseId))
         {
             UIGemGrid gemGrid = gridBase as UIGemGrid;
             gemGrid.SetGridData(gembaseId);
             bool show = DataManager.Manager <ForgingManager>().HaveGemCanImprove(m_emSelectInlayPos, gemType) &&
                         (gembaseId == data.PrefectGemID && data.PrefectGemID != 0);
             gemGrid.SetRedPointStatus(show);
         }
     }
 }
示例#5
0
 /// <summary>
 /// 设置展开的宝石类型
 /// </summary>
 /// <param name="gType">目标宝石类型</param>
 /// <param name="instant">是否直接展开不需要过度</param>
 private void SetActiveGemType(GameCmd.GemType gType, bool instant = false)
 {
     if (gType == GameCmd.GemType.GemType_None)
     {
         return;
     }
     if (null != mSecondsTabCreator)
     {
         UICtrTypeGrid      ctgGrid           = mSecondsTabCreator.GetGrid <UICtrTypeGrid>(mlstCanInlayGemType.IndexOf(m_emActiveGemType));
         GemInlayUpdateData gemCurUpdateData  = GetGemInlayUpdateData();
         GemInlayUpdateData gemNextUpdateData = GetGemInlayUpdateData(gType);
         if (m_emActiveGemType == gType)
         {
             if (!mSecondsTabCreator.IsOpen(mlstCanInlayGemType.IndexOf(m_emActiveGemType)) ||
                 gemCurUpdateData.Count == 0)
             {
                 mSecondsTabCreator.Close(mlstCanInlayGemType.IndexOf(m_emActiveGemType), true);
                 m_emActiveGemType = GameCmd.GemType.GemType_None;
                 TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Gemstone_Commond_2);
             }
             else
             {
                 TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Gemstone_Commond_1);
             }
             return;
         }
         if (null != gemCurUpdateData && (gemCurUpdateData.Count == 0 || gemNextUpdateData.Count != 0))
         {
             mSecondsTabCreator.Close(mlstCanInlayGemType.IndexOf(m_emActiveGemType), true);
         }
         if (null != gemNextUpdateData)
         {
             if (gemNextUpdateData.Count != 0)
             {
                 m_emActiveGemType = gType;
                 mSecondsTabCreator.Open(mlstCanInlayGemType.IndexOf(m_emActiveGemType), instant);
             }
             else
             {
                 TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Gemstone_Commond_2);
             }
         }
     }
 }
示例#6
0
 /// <summary>
 /// 获取的宝石控制格子
 /// </summary>
 /// <param name="gemType"></param>
 /// <returns></returns>
 private GemInlayUpdateData GetGemInlayUpdateData(GameCmd.GemType gemType)
 {
     return(mdicCanInlayDatas.ContainsKey(gemType) ? mdicCanInlayDatas[gemType] : null);
 }