예제 #1
0
    /// <summary>
    /// 卸下
    /// </summary>
    /// <param name="index"></param>
    private void DoUnload(EquipManager.EquipGridIndexType index)
    {
        uint inlayBaseId = 0;

        if (!emgr.IsUnlockEquipGridIndex(index))
        {
            TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Gemstone_Commond_3, emgr.GetEquipGridUnlockLevel(index));
        }
        else if (emgr.TryGetEquipGridInlayGem(m_emSelectInlayPos, index, out inlayBaseId))
        {
            //卸下
            emgr.GemUnload(m_emSelectInlayPos, index);
        }
        else
        {
            GemInlayUpdateData data = GetGemInlayUpdateData();
            uint canInlayBaseId     = 0;
            if (null != data && data.TryGetCanInlayGem(out canInlayBaseId))
            {
                DoInlay(canInlayBaseId, index);
            }
            else
            {
                TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Gemstone_Commond_4);
            }
        }
    }
예제 #2
0
    public bool JudgeEquipPosCanInlay(GameCmd.EquipPos pos, EquipManager.EquipGridIndexType index, GameCmd.GemType gemType)
    {
        uint inlayBaseId = 0;
        int  matchNum    = 0;

        if (!emgr.IsUnlockEquipGridIndex(index))
        {
            return(false);
        }
        else if (emgr.TryGetEquipGridInlayGem(pos, index, out inlayBaseId))
        {
            Gem InlayItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <Gem>(inlayBaseId, ItemDefine.ItemDataType.Gem);
            //镶嵌的宝石小与背包的宝石?
            StructGemInlayDatas(pos);
            GemInlayUpdateData updateData = GetGemInlayUpdateData(gemType);
            if (null != updateData)
            {
                updateData.HaveGemCanInlay = false;
                uint canInlayBaseId = 0;
                if (null != updateData && updateData.TryGetCanInlayGem(out canInlayBaseId))
                {
                    Gem canInlayItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <Gem>(canInlayBaseId, ItemDefine.ItemDataType.Gem);
                    if (InlayItem != null && canInlayItem != null)
                    {
                        bool higher = canInlayItem.FightPowerNum > InlayItem.FightPowerNum;
                        if (higher)
                        {
                            matchNum++;
                            updateData.HaveGemCanInlay = true;
                        }
                    }
                }
            }
        }
        else
        {
            StructGemInlayDatas(pos);
            GemInlayUpdateData updateData = GetGemInlayUpdateData(gemType);
            if (null != updateData)
            {
                updateData.HaveGemCanInlay = false;
                uint canInlayBaseId = 0;
                if (null != updateData && updateData.TryGetCanInlayGem(out canInlayBaseId))
                {
                    matchNum++;
                    updateData.HaveGemCanInlay = true;
                }
            }
        }
        return(matchNum > 0);
    }