| | |
| | |
|
| | | public class ComposeWinModel : Model, IBeforePlayerDataInitialize,IPlayerLoginOk
|
| | | {
|
| | | private Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstTypeDict = null;
|
| | | private Dictionary<int, List<ItemCompoundConfig>> secondTypeDict = null;
|
| | | |
| | |
|
| | | public event Action ResetModelEvent;
|
| | | SelectEquipModel _selectModel;
|
| | | SelectEquipModel selectModel
|
| | |
| | | {
|
| | | ParseFuncConfig();
|
| | | ParseItemComoundConfig();
|
| | | SetComposeTypeRed();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | firstTypeDict = null;
|
| | | secondTypeDict = null;
|
| | | secondType = 0;
|
| | | thirdType = 0;
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | SetComposeTypeRed();
|
| | | RefreshComposeRed();
|
| | | playerPack.RefreshItemCountAct -= OnItemCntRefresh;
|
| | | playerPack.RefreshItemCountAct += OnItemCntRefresh;
|
| | |
| | | if (type != PlayerDataRefresh.LV) return;
|
| | |
|
| | | UpdateComposeDataByLevel();
|
| | | SetComposeTypeRed();
|
| | | RefreshComposeRed();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetItemCompoundByMakeId(int _ticketId, out ItemCompoundConfig itemCompound)
|
| | | {
|
| | | itemCompound = null;
|
| | | foreach (var first in composeOpenDataDict.Keys)
|
| | | {
|
| | | var secondTypeDic = composeOpenDataDict[first].secondTypeDict;
|
| | | foreach(var second in secondTypeDic.Keys)
|
| | | {
|
| | | var thirdTypeDic = secondTypeDic[second].thirdTypeDict;
|
| | | foreach(var third in thirdTypeDic.Keys)
|
| | | {
|
| | | var thirdTypeDatas = thirdTypeDic[third];
|
| | | for(int i = 0; i < thirdTypeDatas.Count; i++)
|
| | | {
|
| | | var compound = thirdTypeDatas[i].itemCompound;
|
| | | if (compound.makeID.Contains(_ticketId))
|
| | | {
|
| | | itemCompound = compound;
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | return false;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | public bool IsComposeJobLimit(int composeId)
|
| | |
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> GetFirstTypeModel(int firstType)
|
| | | {
|
| | | firstTypeDict = null;
|
| | | firstTypeDict = ItemCompoundConfig.GetFirstComposeTypeDict((int)firstType);
|
| | | return firstTypeDict;
|
| | | }
|
| | |
|
| | | public Dictionary<int, List<ItemCompoundConfig>> GetSecondTypeModel(int firstType,int secondType)
|
| | | {
|
| | | GetFirstTypeModel(firstType);
|
| | | secondTypeDict = null;
|
| | | if (firstTypeDict != null)
|
| | | {
|
| | | firstTypeDict.TryGetValue(secondType, out secondTypeDict);
|
| | | }
|
| | | return secondTypeDict;
|
| | | }
|
| | |
|
| | | public List<ItemCompoundConfig> GetThirdTypeModellist(int firstType,int secondType,int thirdType)
|
| | | {
|
| | | List<ItemCompoundConfig> modellist = null;
|
| | | GetSecondTypeModel(firstType, secondType);
|
| | | if(secondTypeDict != null)
|
| | | {
|
| | | secondTypeDict.TryGetValue(thirdType, out modellist);
|
| | | }
|
| | | return modellist;
|
| | | }
|
| | |
|
| | | public bool IsTrailerByLevel(ItemCompoundConfig itemCompound)
|
| | |
| | |
|
| | | public int GetTicketId(int firstType, int secondType, int thirdType)
|
| | | {
|
| | | var itemId = 0;
|
| | | var dict = ItemCompoundConfig.GetFirstComposeTypeDict(firstType);
|
| | | Dictionary<int, List<ItemCompoundConfig>> _secondTypeDict = null;
|
| | | dict.TryGetValue(secondType, out _secondTypeDict);
|
| | | if (_secondTypeDict != null)
|
| | | ComposeThirdTypeData thirdTypeData = null;
|
| | | TryGetThirdTypeData(firstType,secondType,thirdType,out thirdTypeData);
|
| | | if(thirdTypeData != null)
|
| | | {
|
| | | List<ItemCompoundConfig> modellist = null;
|
| | | _secondTypeDict.TryGetValue(thirdType, out modellist);
|
| | | if (modellist != null && modellist.Count > 0)
|
| | | {
|
| | | itemId = modellist[0].makeID[0];
|
| | | }
|
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | return itemCompound.makeID[0];
|
| | | }
|
| | | return itemId;
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public bool IsEnoughUnfixedMat(ItemCompoundConfig compoundModel)
|
| | |
| | | public bool IsEnoughFixedMat(ItemCompoundConfig config)
|
| | | {
|
| | | if (config == null) return false;
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(config.id,DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(config.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedIds = config.itemID;
|
| | | int[] fixedCounts = config.itemCount;
|
| | | for ( int i = 0; i < fixedCounts.Length; i++)
|
| | | {
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem,fixedIds[i]);
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedCounts = compoundModel.itemCount;
|
| | | for (i = 0; i < fixedCounts.Length; i++)
|
| | | {
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem,fixedIds[i]);
|
| | |
| | | private string GetComposeInfoStr(int bindCnt,int noBindCnt)
|
| | | {
|
| | | if (CurComposeModel == null) return string.Empty;
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(CurComposeModel.id,DisplayItemArray.MakeIds);
|
| | | int[] makeIds = CurComposeModel.makeID;
|
| | | ItemConfig config = Config.Instance.Get<ItemConfig>(makeIds[0]);
|
| | | StringBuilder stringBuilder = new StringBuilder();
|
| | | if (bindCnt > 0)
|
| | |
| | |
|
| | | Dictionary<int, int> bindCntDic = new Dictionary<int, int>();
|
| | | Dictionary<int, int> noBindCntDic = new Dictionary<int, int>();
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(CurComposeModel.id,DisplayItemArray.FixedIds);
|
| | | int[] fixedIds = CurComposeModel.itemID;
|
| | | for (int i = 0; i < fixedIds.Length;i++)
|
| | | {
|
| | | List<ItemModel> list = null;
|
| | |
| | | /// 判断是否可以合成门票
|
| | | /// </summary>
|
| | | /// <param name="composeItemID"></param>
|
| | | /// <returns></returns>
|
| | | /// <returns></returns
|
| | | public bool IsComposeTicketByType(int secondType)
|
| | | {
|
| | | bool isEnough = true;
|
| | | Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> getFirstModel = ItemCompoundConfig.GetFirstComposeTypeDict((int)ComposeFuncType.Ticket);
|
| | | if (getFirstModel.ContainsKey(secondType))
|
| | | ComposeThirdTypeData thirdTypeData = null;
|
| | | TryGetThirdTypeData((int)ComposeFuncType.Ticket,secondType,0,out thirdTypeData);
|
| | | if(thirdTypeData != null)
|
| | | {
|
| | | if (getFirstModel[secondType].ContainsKey(0))
|
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | int[] fixedIDs = itemCompound.itemID;
|
| | | int[] fixedCnt = itemCompound.itemCount;
|
| | | for (int i = 0; i < fixedIDs.Length; i++)
|
| | | {
|
| | | ItemCompoundConfig compoundConfig = getFirstModel[secondType][0][0];
|
| | | int[] fixedIDs = compoundConfig.itemID;
|
| | | int[] fixedCnt = compoundConfig.itemCount;
|
| | | for (int i = 0; i < fixedIDs.Length; i++)
|
| | | int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, fixedIDs[i]);
|
| | | if (fixedCnt[i] > haveCnt)
|
| | | {
|
| | | int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, fixedIDs[i]);
|
| | | if (fixedCnt[i] > haveCnt)
|
| | | {
|
| | | isEnough = false;
|
| | | break;
|
| | | }
|
| | | isEnough = false;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | isEnough = false;
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | |
|
| | | int[] composeCondi = itemConfig.JumpComposeCondi;
|
| | | if (composeCondi.Length < 3) return false;
|
| | | ItemCompoundConfig itemCompound = ItemCompoundConfig.GetItemCompoundByType(composeCondi[0], composeCondi[1], composeCondi[2]);
|
| | | if(itemCompound != null)
|
| | |
|
| | | int first = composeCondi[0];
|
| | | int second = composeCondi[1];
|
| | | int third = composeCondi[2];
|
| | | ComposeThirdTypeData thirdTypeData = null;
|
| | | TryGetThirdTypeData(first,second,third,out thirdTypeData);
|
| | | if(thirdTypeData != null)
|
| | | {
|
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV)
|
| | | {
|
| | | switch (itemCompound.firstType)
|
| | |
| | | break;
|
| | | }
|
| | | this.secondType = itemCompound.secondType;
|
| | |
|
| | | if (itemCompound.firstType == 5 && itemCompound.secondType == 3)
|
| | | {
|
| | | this.thirdType = PlayerDatas.Instance.baseData.Job;
|
| | |
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool CheckIsComposeByType(int firstType,int secondType,int thirdType)
|
| | | {
|
| | | ItemCompoundConfig itemCompound = ItemCompoundConfig.GetItemCompoundByType(firstType, secondType, thirdType);
|
| | | if (itemCompound == null) return false;
|
| | |
|
| | | ComposeThirdTypeData thirdTypeData = null;
|
| | | TryGetThirdTypeData(firstType,secondType,thirdType,out thirdTypeData);
|
| | | if (thirdTypeData == null) return false;
|
| | | |
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV)
|
| | | {
|
| | | return true;
|
| | |
| | | {
|
| | | this.secondType = secondType;
|
| | | this.thirdType = thirdType;
|
| | | GetFirstTypeModel((int)type);
|
| | | Dictionary<int, List<ItemCompoundConfig>> dict = GetSecondTypeModel((int)type,secondType);
|
| | | if(dict == null)
|
| | | ComposeThirdTypeData thirdTypeData = null;
|
| | | TryGetThirdTypeData((int)type,secondType,thirdType,out thirdTypeData);
|
| | | if(thirdTypeData == null)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("FuncLimit_Level");
|
| | | ResetJumpToModel();
|
| | |
| | | {
|
| | | secondTypeRedDict.Clear();
|
| | | thirdTypeRedDict.Clear();
|
| | | Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstDict = ItemCompoundConfig.GetFirstComposeTypeDict((int)ComposeFuncType.Item);
|
| | | if (firstDict == null) return;
|
| | |
|
| | | foreach(var secondType in firstDict.Keys)
|
| | | if (composeDataDict.ContainsKey((int)ComposeFuncType.Item))
|
| | | {
|
| | | int secondRedKey = COMPOSETOOL_REDKEY * 100 + secondType;
|
| | | Redpoint secondRed = new Redpoint(COMPOSETOOL_REDKEY, secondRedKey);
|
| | | secondTypeRedDict.Add(secondType, secondRed);
|
| | | foreach(var thirdType in firstDict[secondType].Keys)
|
| | | var firstTypeData = composeDataDict[(int)ComposeFuncType.Item];
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | foreach (var second in secondTypeDict.Keys)
|
| | | {
|
| | | int thirdRedKey = secondRedKey*100 + thirdType;
|
| | | Redpoint thirdRed = new Redpoint(secondRedKey,thirdRedKey);
|
| | | string key = StringUtility.Contact(secondType,10,thirdType);
|
| | | thirdTypeRedDict.Add(key,thirdRed);
|
| | | var thirdTypeDict = secondTypeDict[second].thirdTypeDict;
|
| | | int secondRedKey = COMPOSETOOL_REDKEY * 100 + second;
|
| | | Redpoint secondRed = new Redpoint(COMPOSETOOL_REDKEY, secondRedKey);
|
| | | secondTypeRedDict.Add(second, secondRed);
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | int thirdRedKey = secondRedKey * 100 + third;
|
| | | Redpoint thirdRed = new Redpoint(secondRedKey, thirdRedKey);
|
| | | string key = StringUtility.Contact(second, 10, third);
|
| | | thirdTypeRedDict.Add(key, thirdRed);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public void RefreshComposeRed()
|
| | | {
|
| | | Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstDict = ItemCompoundConfig.GetFirstComposeTypeDict((int)ComposeFuncType.Item);
|
| | | if (firstDict == null || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Compose)) return;
|
| | | ComposeFirstTypeData firstTypeData = null;
|
| | | TryGetFirstTypeData((int)ComposeFuncType.Item, out firstTypeData);
|
| | | if (firstTypeData == null
|
| | | || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Compose)) return;
|
| | |
|
| | | if (firstDict.ContainsKey(3))
|
| | | ComposeSecondTypeData secondTypeData = null;
|
| | | TryGetSecondTypeData((int)ComposeFuncType.Item, 3, out secondTypeData);
|
| | | if(secondTypeData != null)
|
| | | {
|
| | | foreach(var thirdType in firstDict[3].Keys)
|
| | | var thirdTypeDict = secondTypeData.thirdTypeDict;
|
| | | foreach(var third in thirdTypeDict.Keys)
|
| | | {
|
| | | List<ItemCompoundConfig> compoundlist = firstDict[3][thirdType];
|
| | | for(int i = 0; i < compoundlist.Count; i++)
|
| | | List<ComposeThirdTypeData> thirdTypeDatas = thirdTypeDict[third];
|
| | | for (int i = 0; i < thirdTypeDatas.Count; i++)
|
| | | {
|
| | | int makeID = compoundlist[i].makeID[i];
|
| | | string key = StringUtility.Contact(3, 10, thirdType);
|
| | | if (IsComposeJobLimit(makeID) && IsEnoughFixedMat(compoundlist[i]))
|
| | | var itemCompound = thirdTypeDatas[i].itemCompound;
|
| | | int makeID = itemCompound.makeID[0];
|
| | | string key = StringUtility.Contact(3, 10, third);
|
| | | if (IsComposeJobLimit(makeID) && IsEnoughFixedMat(itemCompound))
|
| | | {
|
| | | if (thirdTypeRedDict[key].state != RedPointState.Simple)
|
| | | {
|
| | | thirdTypeRedDict[key].state = RedPointState.Simple;
|
| | | } |
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | | }
|