Beispiel #1
0
 /// <summary>
 /// 是否为合成最高级
 /// </summary>
 /// <param name="composeId"></param>
 /// <returns></returns>
 public bool IsHighestComposeId(uint composeId)
 {
     table.ComposeDataBase curDB
         = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(composeId);
     if (null != curDB)
     {
         return((curDB.nextId == 0) ? true : false);
     }
     return(true);
 }
Beispiel #2
0
    /// <summary>
    /// 根据当前id获取下一级合成id
    /// </summary>
    /// <param name="curComposeId"></param>
    /// <returns></returns>
    public uint GetNextComposeId(uint curComposeId)
    {
        uint nextId = 0;

        table.ComposeDataBase curDB
            = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(curComposeId);
        if (null != curDB)
        {
            nextId = curDB.nextId;
        }
        return(nextId);
    }
Beispiel #3
0
 /// <summary>
 /// shi
 /// </summary>
 /// <param name="composeId"></param>
 public void FocusComposeData(uint composeId)
 {
     table.ComposeDataBase curDB
         = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(composeId);
     if (null != curDB)
     {
         CategoryTypeData ctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First, curDB.fType);
         if (null != mSecondTabCreator && null != ctd)
         {
             uint secondType = m_mgr.BuildComposeSecondsKey(curDB.fType, curDB.sType);
             SetSelectFirstType(curDB.fType, true);
             SetSelectSecondType(secondType, true);
             mSecondTabCreator.FocusData(mlstFirstTabIds.IndexOf(curDB.fType), ctd.IndexOf(secondType));
         }
         SetSelectId(composeId);
     }
 }
Beispiel #4
0
    /// <summary>
    /// 刷新
    /// </summary>
    private void UpdateComposeUI()
    {
        BaseItem composeItem = (m_uint_composeId != 0)
            ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(m_uint_composeId) : null;

        table.ComposeDataBase composeDb
            = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(m_uint_composeId);

        //更新材料
        uint     composeNum = 0;
        BaseItem costItem   = null;
        uint     holdNum    = 0;

        if (null != m_costNeedGrid1)
        {
            costItem = (null != composeDb && composeDb.costItem1 != 0 && composeDb.costNum1 != 0)
                ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(composeDb.costItem1) : null;
            if (null != costItem)
            {
                holdNum    = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(costItem.BaseId);
                composeNum = holdNum / composeDb.costNum1;
                m_costNeedGrid1.SetGridViewData(false, true, composeDb.costItem1, composeDb.costNum1);
            }
            else
            {
                m_costNeedGrid1.SetGridViewData(true);
            }
        }
        if (null != m_costNeedGrid2)
        {
            costItem = (null != composeDb && composeDb.costItem2 != 0 && composeDb.costNum2 != 0)
                ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(composeDb.costItem2) : null;
            if (null != costItem)
            {
                holdNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(costItem.BaseId);
                uint tempNum = holdNum / composeDb.costNum2;
                if (composeNum > tempNum)
                {
                    composeNum = tempNum;
                }
                m_costNeedGrid2.SetGridViewData(false, true, composeDb.costItem2, composeDb.costNum2);
            }
            else
            {
                m_costNeedGrid2.SetGridViewData(true);
            }
        }
        if (null != m_costNeedGrid3)
        {
            costItem = (null != composeDb && composeDb.costItem3 != 0 && composeDb.costNum3 != 0)
                ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(composeDb.costItem3) : null;
            if (null != costItem)
            {
                holdNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(costItem.BaseId);
                uint tempNum = holdNum / composeDb.costNum3;
                if (composeNum > tempNum)
                {
                    composeNum = tempNum;
                }
                m_costNeedGrid3.SetGridViewData(false, true, composeDb.costItem3, composeDb.costNum3);
            }
            else
            {
                m_costNeedGrid3.SetGridViewData(true);
            }
        }
        if (null != m_costNeedGrid4)
        {
            costItem = (null != composeDb && composeDb.costItem4 != 0 && composeDb.costNum4 != 0)
                   ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(composeDb.costItem4) : null;
            if (null != costItem)
            {
                holdNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(costItem.BaseId);
                uint tempNum = holdNum / composeDb.costNum4;
                if (composeNum > tempNum)
                {
                    composeNum = tempNum;
                }
                m_costNeedGrid4.SetGridViewData(false, true, composeDb.costItem4, composeDb.costNum4);
            }
            else
            {
                m_costNeedGrid4.SetGridViewData(true);
            }
        }
        if (null != m_costNeedGrid5)
        {
            costItem = (null != composeDb && composeDb.costItem5 != 0 && composeDb.costNum5 != 0)
                ? DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(composeDb.costItem5) : null;
            if (null != costItem)
            {
                holdNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(costItem.BaseId);
                uint tempNum = holdNum / composeDb.costNum5;
                if (composeNum > tempNum)
                {
                    composeNum = tempNum;
                }
                m_costNeedGrid5.SetGridViewData(false, true, composeDb.costItem5, composeDb.costNum5);
            }
            else
            {
                m_costNeedGrid5.SetGridViewData(true);
            }
        }

        if (null != m_targetNeedGrid)
        {
            if (null != composeItem)
            {
                m_targetNeedGrid.SetGridViewData(false, false, composeItem.BaseId, composeNum);
            }
            else
            {
                m_targetNeedGrid.SetGridViewData(true);
            }
        }

        uint costType    = (null != composeDb) ? composeDb.moneyType : (uint)GameCmd.MoneyType.MoneyType_Gold;
        uint composeCost = (null != composeDb) ? composeDb.costMoney : 0;

        //更新按钮
        UpdateCompseoBtnStatus(composeNum, costType, composeCost);
    }
Beispiel #5
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);
        if (null != data && data is uint)
        {
            m_uint_id = (uint)data;
        }
        else
        {
            m_uint_id = 0;
        }
        bool     empty    = false;
        BaseItem baseItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(m_uint_id);

        empty = !baseItem.IsBaseReady;
        ResetInfoGrid(!empty);
        if (!empty)
        {
            m_uint_id = (uint)data;
            if (null != m_lab_name)
            {
                m_lab_name.text = baseItem.Name;
            }

            SetIcon(true, baseItem.Icon);
            SetBorder(true, baseItem.BorderIcon);
            SetBindMask(baseItem.IsBind);
            int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(baseItem.BaseId);
            //if (num >= 1)
            {
                SetNum(true, num.ToString());
            }
            if (baseItem.IsMuhon)
            {
                SetMuhonMask(true, Muhon.GetMuhonStarLevel(baseItem.BaseId));
                SetMuhonLv(true, Muhon.GetMuhonLv(baseItem));
            }
            else if (baseItem.IsRuneStone)
            {
                SetRuneStoneMask(true, (uint)baseItem.Grade);
            }
            else if (baseItem.IsChips)
            {
                SetChips(true);
            }

            ItemManager img = DataManager.Manager <ItemManager>();
            if (null != m_lab_des)
            {
                int composeNum = 0;
                table.ComposeDataBase
                    db = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(m_uint_id);
                if (null == db)
                {
                    Engine.Utility.Log.Error("UIComposeGrid error,get ComposeDataBase exception id = {0}", m_uint_id);
                }
                else
                {
                    int tempComposeNum = 0;
                    //材料1
                    if (db.costItem1 != 0 && db.costNum1 > 0)
                    {
                        tempComposeNum = (int)(img.GetItemNumByBaseId(db.costItem1) / db.costNum1);
                        composeNum     = tempComposeNum;
                    }
                    //材料2
                    if (db.costItem2 != 0 && db.costNum2 > 0)
                    {
                        tempComposeNum = (int)(img.GetItemNumByBaseId(db.costItem2) / db.costNum2);
                        if (tempComposeNum < composeNum)
                        {
                            composeNum = tempComposeNum;
                        }
                    }
                    //材料3
                    if (db.costItem3 != 0 && db.costNum3 > 0)
                    {
                        tempComposeNum = (int)(img.GetItemNumByBaseId(db.costItem3) / db.costNum3);
                        if (tempComposeNum < composeNum)
                        {
                            composeNum = tempComposeNum;
                        }
                    }
                    //材料4
                    if (db.costItem4 != 0 && db.costNum4 > 0)
                    {
                        tempComposeNum = (int)(img.GetItemNumByBaseId(db.costItem4) / db.costNum4);
                        if (tempComposeNum < composeNum)
                        {
                            composeNum = tempComposeNum;
                        }
                    }
                    //材料5
                    if (db.costItem5 != 0 && db.costNum5 > 0)
                    {
                        tempComposeNum = (int)(img.GetItemNumByBaseId(db.costItem1) / db.costNum1);
                        if (tempComposeNum < composeNum)
                        {
                            composeNum = tempComposeNum;
                        }
                    }
                }
                m_lab_des.text = string.Format("可合成:{0}", composeNum);
            }
        }
    }
Beispiel #6
0
 /// <summary>
 /// 物品是否满足合成条件
 /// </summary>
 /// <param name="itemId">合成物品</param>
 /// <param name="needReduceCost">是否有需要减少的合成材料</param>
 /// <param name="reduceItemBaseId">需要减少的合成材料id</param>
 /// <param name="reduceItemNum">需要减少合成材料数量</param>
 /// <returns></returns>
 public bool IsItemCanCompose(uint itemId, bool needReduceCost = false, uint reduceItemBaseId = 0, uint reduceItemNum = 0)
 {
     table.ComposeDataBase db = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(itemId);
     if (null != db)
     {
         int         currencyHoldNum = DataManager.Instance.GetCurrencyNumByType((GameCmd.MoneyType)db.moneyType);
         int         composeNum      = 0;
         int         tempComposeNum  = 0;
         ItemManager img             = DataManager.Manager <ItemManager>();
         uint        holdNum         = 0;
         //材料1
         if (db.costItem1 != 0 && db.costNum1 > 0)
         {
             holdNum = (uint)img.GetItemNumByBaseId(db.costItem1);
             if (needReduceCost && (reduceItemBaseId == db.costItem1))
             {
                 holdNum += reduceItemNum;
             }
             tempComposeNum = (int)(holdNum / db.costNum1);
             composeNum     = tempComposeNum;
         }
         //材料2
         if (db.costItem2 != 0 && db.costNum2 > 0)
         {
             holdNum = (uint)img.GetItemNumByBaseId(db.costItem2);
             if (needReduceCost && (reduceItemBaseId == db.costItem2))
             {
                 holdNum += reduceItemNum;
             }
             tempComposeNum = (int)(holdNum / db.costNum2);
             if (tempComposeNum < composeNum)
             {
                 composeNum = tempComposeNum;
             }
         }
         //材料3
         if (db.costItem3 != 0 && db.costNum3 > 0)
         {
             holdNum = (uint)img.GetItemNumByBaseId(db.costItem3);
             if (needReduceCost && (reduceItemBaseId == db.costItem3))
             {
                 holdNum += reduceItemNum;
             }
             tempComposeNum = (int)(holdNum / db.costNum3);
             if (tempComposeNum < composeNum)
             {
                 composeNum = tempComposeNum;
             }
         }
         //材料4
         if (db.costItem4 != 0 && db.costNum4 > 0)
         {
             holdNum = (uint)img.GetItemNumByBaseId(db.costItem4);
             if (needReduceCost && (reduceItemBaseId == db.costItem4))
             {
                 holdNum += reduceItemNum;
             }
             tempComposeNum = (int)(holdNum / db.costNum4);
             if (tempComposeNum < composeNum)
             {
                 composeNum = tempComposeNum;
             }
         }
         //材料5
         if (db.costItem5 != 0 && db.costNum5 > 0)
         {
             holdNum = (uint)img.GetItemNumByBaseId(db.costItem5);
             if (needReduceCost && (reduceItemBaseId == db.costItem5))
             {
                 holdNum += reduceItemNum;
             }
             tempComposeNum = (int)(holdNum / db.costNum5);
             if (tempComposeNum < composeNum)
             {
                 composeNum = tempComposeNum;
             }
         }
         if (composeNum > 0 &&
             currencyHoldNum >= db.costMoney)
         {
             return(true);
         }
     }
     return(false);
 }