少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-29 7dcbca7f53bcfa8df7811fd51097598469aaab9c
System/Compose/New/ComposeWinModel.cs
@@ -73,7 +73,6 @@
    {
        SetComposeTypeRed();
        RefreshComposeRed();
        funcType = ComposeFuncType.Wings;
        playerPack.RefreshItemCountAct -= OnItemCntRefresh;
        playerPack.RefreshItemCountAct += OnItemCntRefresh;
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerLvUpdate;
@@ -109,24 +108,33 @@
        }
        return false;
    }
    public Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> GetFirstTypeModel()
    public Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> GetFirstTypeModel(int firstType)
    {
        firstTypeDict = null;
        firstTypeDict = ItemCompoundConfig.GetFirstComposeTypeDict((int)funcType);
        firstTypeDict = ItemCompoundConfig.GetFirstComposeTypeDict((int)firstType);
        return firstTypeDict;
    }
    public Dictionary<int, List<ItemCompoundConfig>> GetSecondTypeModel(int secondType)
    public Dictionary<int, List<ItemCompoundConfig>> GetSecondTypeModel(int firstType,int secondType)
    {
        GetFirstTypeModel(firstType);
        secondTypeDict = null;
        firstTypeDict.TryGetValue(secondType, out secondTypeDict);
        if (firstTypeDict != null)
        {
            firstTypeDict.TryGetValue(secondType, out secondTypeDict);
        }
        return secondTypeDict;
    }
    public List<ItemCompoundConfig> GetThirdTypeModellist(int thirdType)
    public List<ItemCompoundConfig> GetThirdTypeModellist(int firstType,int secondType,int thirdType)
    {
        List<ItemCompoundConfig> modellist = null;
        secondTypeDict.TryGetValue(thirdType, out modellist);
        GetSecondTypeModel(firstType, secondType);
        if(secondTypeDict != null)
        {
            secondTypeDict.TryGetValue(thirdType, out modellist);
        }
        return modellist;
    }
@@ -148,24 +156,10 @@
        return itemId;
    }
    public int[] makeIDs { get; private set; }
    public int[] unfixedItemIDs { get; private set; }
    public int[] costfixedItemIDs { get; private set; }
    public int[] costfixedItemCounts { get; private set; }
    public int[] unfixedItemDisplay { get; private set; }
    public int[] fixedItemDisplay { get; private set; }
    public ItemCompoundConfig CurComposeModel { get; private set; }
    public void SetCurComposeModel(ItemCompoundConfig compoundModel)
    {
        CurComposeModel = compoundModel;
        makeIDs = ConfigParse.GetMultipleStr<int>(compoundModel.makeID);
        unfixedItemIDs = ConfigParse.GetMultipleStr<int>(compoundModel.unfixedItemID);
        costfixedItemIDs = ConfigParse.GetMultipleStr<int>(compoundModel.itemID);
        costfixedItemCounts = ConfigParse.GetMultipleStr<int>(compoundModel.itemCount);
        unfixedItemDisplay = ConfigParse.GetMultipleStr<int>(compoundModel.unfixedItemDisplay);
        fixedItemDisplay = ConfigParse.GetMultipleStr<int>(compoundModel.itemDisplay);
    }
    public bool IsEnoughUnfixedMat(ItemCompoundConfig compoundModel)
@@ -177,12 +171,15 @@
        return true;
    }
    public bool IsEnoughFixedMat()
    public bool IsEnoughFixedMat(ItemCompoundConfig config)
    {
        for ( int i = 0; i < costfixedItemCounts.Length; i++)
        if (config == null) return false;
        int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(config.id,DisplayItemArray.FixedIds);
        int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(config.id, DisplayItemArray.FixedCounts);
        for ( int i = 0; i < fixedCounts.Length; i++)
        {
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem, costfixedItemIDs[i]);
            if (haveCount < costfixedItemCounts[i])
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem,fixedIds[i]);
            if (haveCount < fixedCounts[i])
            {
                return false;
            }
@@ -225,12 +222,14 @@
            return;
        }
        for (i = 0; i < costfixedItemCounts.Length; i++)
        int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
        int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
        for (i = 0; i < fixedCounts.Length; i++)
        {
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem, costfixedItemIDs[i]);
            if (haveCount < costfixedItemCounts[i])
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem,fixedIds[i]);
            if (haveCount < fixedCounts[i])
            {
                ItemConfig fixedConfig = Config.Instance.Get<ItemConfig>(costfixedItemIDs[i]);
                ItemConfig fixedConfig = Config.Instance.Get<ItemConfig>(fixedIds[i]);
                if (fixedConfig.GetWay.Length < 1)
                {
                    ItemAttrData attrData = new ItemAttrData(fixedConfig.ID);
@@ -460,10 +459,10 @@
                    noBindCnt = fixedMatIsBindDict[idlist[0]][0];
                }
               
                int remainBind = bindCnt % costfixedItemCounts[0];
                int remainNOBind = noBindCnt % costfixedItemCounts[0];
                bindCnt = bindCnt / costfixedItemCounts[0];
                noBindCnt = noBindCnt / costfixedItemCounts[0];
                int remainBind = bindCnt % fixedCounts[0];
                int remainNOBind = noBindCnt % fixedCounts[0];
                bindCnt = bindCnt / fixedCounts[0];
                noBindCnt = noBindCnt / fixedCounts[0];
                if (bindCnt + noBindCnt < composeCount)
                {
                    bindCnt = composeCount - noBindCnt;
@@ -618,7 +617,9 @@
    private string GetComposeInfoStr(int bindCnt,int noBindCnt)
    {
        ItemConfig config = Config.Instance.Get<ItemConfig>(makeIDs[0]);
        if (CurComposeModel == null) return string.Empty;
        int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(CurComposeModel.id,DisplayItemArray.MakeIds);
        ItemConfig config = Config.Instance.Get<ItemConfig>(makeIds[0]);
        StringBuilder stringBuilder = new StringBuilder();
        if (bindCnt > 0)
        {
@@ -675,15 +676,15 @@
    {
        minBindCnt = 0;
        minNoBindCnt = 0;
        if (costfixedItemIDs == null) return;
        if (CurComposeModel == null) return;
        Dictionary<int, int> bindCntDic = new Dictionary<int, int>();
        Dictionary<int, int> noBindCntDic = new Dictionary<int, int>();
        for (int i = 0; i < costfixedItemIDs.Length;i++)
        int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(CurComposeModel.id,DisplayItemArray.FixedIds);
        for (int i = 0; i < fixedIds.Length;i++)
        {
            List<ItemModel> list = null;
            playerPack.GetSinglePackModel(PackType.rptItem).GetItemCountByID(costfixedItemIDs[i],out list);
            playerPack.GetSinglePackModel(PackType.rptItem).GetItemCountByID(fixedIds[i],out list);
            if(list != null)
            {
                int bindCnt = 0;
@@ -700,8 +701,8 @@
                        noBindCnt += list[j].itemInfo.ItemCount;
                    }
                }
                bindCntDic.Add(costfixedItemIDs[i], bindCnt);
                noBindCntDic.Add(costfixedItemIDs[i], noBindCnt);
                bindCntDic.Add(fixedIds[i], bindCnt);
                noBindCntDic.Add(fixedIds[i], noBindCnt);
            }
        }
@@ -855,8 +856,8 @@
        this.secondType = secondType;
        this.thirdType = thirdType;
        funcType = type;
        GetFirstTypeModel();
        Dictionary<int, List<ItemCompoundConfig>> dict = GetSecondTypeModel(secondType);
        GetFirstTypeModel((int)type);
        Dictionary<int, List<ItemCompoundConfig>> dict = GetSecondTypeModel((int)type,secondType);
        if(dict == null)
        {
            SysNotifyMgr.Instance.ShowTip("FuncLimit_Level");
@@ -926,10 +927,9 @@
                List<ItemCompoundConfig> compoundlist = firstDict[3][thirdType];
                for(int i = 0; i < compoundlist.Count; i++)
                {
                    SetCurComposeModel(compoundlist[i]);
                    int makeID = ConfigParse.GetMultipleStr<int>(compoundlist[i].makeID)[i];
                    string key = StringUtility.Contact(3, 10, thirdType);
                    if (IsComposeJobLimit(makeID) && IsEnoughFixedMat())
                    if (IsComposeJobLimit(makeID) && IsEnoughFixedMat(compoundlist[i]))
                    {
                        if (thirdTypeRedDict[key].state != RedPointState.Simple)
                        {
@@ -971,3 +971,13 @@
    addItem,
}
public enum DisplayItemArray
{
    MakeIds,
    UnfixedIds,
    FixedIds,
    FixedCounts,
    UnfixedDisplay,
    FixedDisplay,
}