/// <summary> /// 刷新坐骑皮肤属性 /// </summary> private void RefreshSkinAttr() { var tb = Table.GetMount(DataModel.SelectMount.MountId); if (tb == null) { return; } DataModel.SkinAttrList.Clear(); for (int i = 0; i < tb.Attr.Length && i < tb.Value.Length; i++) { if (tb.Attr[i] > 0) { var att = new AttributeChangeDataModel(); att.Type = tb.Attr[i]; att.Value = tb.Value[i]; DataModel.SkinAttrList.Add(att); } } }
//刷新部位属性 public void RefresPartAttribute() { var index = DataModel.PartData.PartIndex; DataModel.PartData.PartAttributes.Clear(); var attrs = new ObservableCollection <AttributeChangeDataModel>(); var dicAttr = new Dictionary <int, int>(); var tbWingTrain = Table.GetWingTrain(DataModel.PartData.TrainId); var tbWingTrainAddPropIDLength1 = tbWingTrain.AddPropID.Length; for (var i = 0; i < tbWingTrainAddPropIDLength1; i++) { var nAttrId = tbWingTrain.AddPropID[i]; var nValue = tbWingTrain.AddPropValue[i]; if (nAttrId < 0 || nValue <= 0) { break; } if (nValue > 0 && nAttrId != -1) { dicAttr.modifyValue(nAttrId, nValue); } } var dicAttrNext = new Dictionary <int, int>(); if (tbWingTrain.UpStarID != -1) { var tbWingTrainNext = Table.GetWingTrain(tbWingTrain.UpStarID); var tbWingTrainNextAddPropIDLength2 = tbWingTrainNext.AddPropID.Length; for (var i = 0; i < tbWingTrainNextAddPropIDLength2; i++) { var nAttrId = tbWingTrainNext.AddPropID[i]; var nValue = tbWingTrainNext.AddPropValue[i]; if (nAttrId < 0 || nValue <= 0) { break; } if (nValue > 0 && nAttrId != -1) { dicAttrNext.modifyValue(nAttrId, nValue); } } } { // foreach(var i in dicAttr) var __enumerator2 = (dicAttr).GetEnumerator(); while (__enumerator2.MoveNext()) { var i = __enumerator2.Current; { var attr = new AttributeChangeDataModel(); attr.Type = i.Key; attr.Value = i.Value; var nextValue = 0; if (dicAttrNext.TryGetValue(attr.Type, out nextValue)) { attr.Change = nextValue - i.Value; attr.Change = FixAttributeValue(i.Key, attr.Change); } attr.Value = FixAttributeValue(i.Key, attr.Value); attrs.Add(attr); } } } { // foreach(var i in dicAttrNext) var __enumerator3 = (dicAttrNext).GetEnumerator(); while (__enumerator3.MoveNext()) { var i = __enumerator3.Current; { var type = i.Key; var value = 0; if (!dicAttr.TryGetValue(type, out value)) { var attr = new AttributeChangeDataModel(); attr.Type = type; attr.Value = value; attr.Change = i.Value - value; attr.Change = FixAttributeValue(i.Key, attr.Change); attr.Value = FixAttributeValue(i.Key, attr.Value); attrs.Add(attr); } } } } DataModel.PartData.PartAttributes = attrs; }
//刷新翅膀升阶人物属性 public void RefresWingQualityAttribute(int wingId) { var tbWing = Table.GetWingQuality(wingId); if (tbWing == null) { return; } if (tbWing.Segment > GameUtils.WingQualityMax) { GameUtils.ShowHintTip(200012); return; } { // foreach(var data in DataModel.QualityDatas) var __enumerator5 = (DataModel.QualityDatas).GetEnumerator(); while (__enumerator5.MoveNext()) { var data = __enumerator5.Current; { data.IsSelect = data.ItemId == wingId ? 1 : 0; //var tbQuality = Table.GetWingQuality(data.WingId); if (data.IsSelect == 1) { var tbWingQuality = Table.GetWingQuality(data.WingId); DataModel.SelectQuality = tbWingQuality.Segment; var tbItem = Table.GetItemBase(data.ItemId); if (tbItem != null) { DataModel.SelectName = tbItem.Name; } else { DataModel.SelectName = ""; } } } } } DataModel.QualityId = wingId; DataModel.QualityAttributes.Clear(); var attrs = new ObservableCollection <AttributeChangeDataModel>(); var dicAttr = new Dictionary <int, int>(); var dicAttrNext = new Dictionary <int, int>(); var dicAttrNextMax = new Dictionary <int, int>(); if (wingId == DataModel.ItemData.WingQuailty) { // 当前阶段 PlayerAttr.FillWingAdvanceAttr(dicAttr, DataModel.ItemData); if (DataModel.IsAdvanceFull) { PlayerAttr.FillWingBreakAttr(dicAttrNext, wingId + 1); // dicAttrNext = dicAttrNext - dicAttr; var tempAttrDict = new Dictionary <int, int>(); var enumorator1 = dicAttrNext.GetEnumerator(); while (enumorator1.MoveNext()) { int attr; if (dicAttr.TryGetValue(enumorator1.Current.Key, out attr)) { tempAttrDict[enumorator1.Current.Key] = enumorator1.Current.Value - attr; } } dicAttrNext = tempAttrDict; } else { // 成长属性 for (var i = 0; i < tbWing.GrowPropID.Length; ++i) { var nAttrId = tbWing.GrowPropID[i]; if (nAttrId < 0) { break; } var valueMin = tbWing.GrowMinProp[i]; var valueMax = tbWing.GrowMaxProp[i]; if (valueMin > 0 && valueMax >= valueMin) { dicAttrNext.modifyValue(nAttrId, valueMin); if (valueMax != valueMin) { dicAttrNextMax.modifyValue(nAttrId, valueMax); } } } } } else if (wingId > DataModel.ItemData.WingQuailty) { // 其它阶段 PlayerAttr.FillWingAdvanceAttr(dicAttr, DataModel.ItemData); PlayerAttr.FillWingBreakAttr(dicAttrNext, wingId); // dicAttrNext = dicAttrNext - dicAttr; var tempAttrDict = new Dictionary <int, int>(); var enumorator1 = dicAttrNext.GetEnumerator(); while (enumorator1.MoveNext()) { int attr; if (dicAttr.TryGetValue(enumorator1.Current.Key, out attr)) { tempAttrDict[enumorator1.Current.Key] = enumorator1.Current.Value - attr; } } dicAttrNext = tempAttrDict; dicAttr.Clear(); PlayerAttr.FillWingBreakAttr(dicAttr, wingId); } else { PlayerAttr.FillWingBreakAttr(dicAttr, wingId); } var __enumerator7 = (dicAttr).GetEnumerator(); while (__enumerator7.MoveNext()) { var i = __enumerator7.Current; { var attr = new AttributeChangeDataModel(); attr.Type = i.Key; attr.Value = i.Value; int nextValue; if (dicAttrNext.TryGetValue(attr.Type, out nextValue)) { attr.Change = nextValue; attr.Change = FixAttributeValue(i.Key, attr.Change); int nextValueMax; if (dicAttrNextMax.TryGetValue(attr.Type, out nextValueMax)) { attr.ChangeEx = nextValueMax; } } attr.Value = FixAttributeValue(i.Key, attr.Value); attrs.Add(attr); } } DataModel.QualityAttributes = attrs; }
private void UpdateMountInfo(bool bSendModel = false) { bool bChangeSelect = DataModel.Step != PlayerDataManager.Instance.mMountData.Step; DataModel.Step = PlayerDataManager.Instance.mMountData.Step; DataModel.Exp = PlayerDataManager.Instance.mMountData.Exp; DataModel.Level = PlayerDataManager.Instance.mMountData.Level; DataModel.RideId = PlayerDataManager.Instance.mMountData.Ride; int selectIndex = 0; int topStep = 0; int topLevel = 0; for (int i = 0; i < DataModel.MountBag.Count; i++) { var m = DataModel.MountBag[i]; m.IsGrey = PlayerDataManager.Instance.mMountData.Step >= m.Step ? 0 : 1; if (bChangeSelect == true) { m.IsSelect = false; } if (m.IsGrey == 0 && bChangeSelect) { if (m.MountId == DataModel.RideId) { selectIndex = i; topStep = 100; } else if (topStep * 100 + topLevel < m.Step * 100 + m.Level) { selectIndex = i; topStep = m.Step; topLevel = m.Level; } } } if (bChangeSelect) { DataModel.MountBag[selectIndex].IsSelect = true; DataModel.SelectMount.CopyFrom(DataModel.MountBag[selectIndex]); } DataModel.NeedItem = new ItemIdDataModel(); var tb = Table.GetMount(PlayerDataManager.Instance.mMountData.Id); if (tb == null) { return; } DataModel.MaxExp = tb.NeedExp; {//属性浮动 DataModel.AttrList.Clear(); Dictionary <int, int> dicAttr = new Dictionary <int, int>(); for (int i = 0; i < tb.Attr.Length && i < tb.Value.Length; i++) { if (tb.Attr[i] > 0) { var att = new AttributeChangeDataModel(); att.Type = tb.Attr[i]; att.Value = tb.Value[i]; DataModel.AttrList.Add(att); dicAttr.modifyValue(att.Type, att.Value); } } DataModel.FightPoint = PlayerDataManager.Instance.GetElfAttrFightPoint(dicAttr); var tbNext = Table.GetMount(tb.NextId); if (tbNext != null && tbNext.IsOpen == 1) { dicAttr.Clear(); for (int i = 0; i < tbNext.Attr.Length && i < tbNext.Value.Length; i++) { if (tbNext.Attr[i] > 0 && tbNext.Value[i] > 0) { dicAttr.modifyValue(tbNext.Attr[i], tbNext.Value[i]); } } foreach (var attr in DataModel.AttrList) { IControllerBase control = UIManager.GetInstance().GetController(UIConfig.WingUI); if (dicAttr.ContainsKey(attr.Type)) { attr.Change = dicAttr[attr.Type] - attr.Value; attr.Change = (int)control.CallFromOtherClass("AmendPropertiesValue", new[] { (object)attr.Type, (object)attr.Change }); } attr.Value = (int)control.CallFromOtherClass("AmendPropertiesValue", new[] { (object)attr.Type, (object)attr.Change }); } } } if (tb.NeedItem > 0) { needItem = tb.NeedItem; needCount = (int)Math.Ceiling((double)(tb.NeedExp - DataModel.Exp) / (double)tb.GetExp); CheckRedNotic(); } DataModel.NeedItem.ItemId = tb.NeedItem; DataModel.NeedItem.Count = PlayerDataManager.Instance.GetItemCount(tb.NeedItem); if (bSendModel) { SendModel(); EventDispatcher.Instance.DispatchEvent(new MountEffect_Event(0)); } {//init next string int maxLv = 0; int maxStep = 0; Table.ForeachMount(tbMount => { if (tbMount.Step > maxStep && tbMount.IsOpen == 1 && tbMount.Special == 0) { maxStep = tbMount.Step; } if (tbMount.Step != DataModel.Step) { return(true); } if (tbMount.Level > maxLv) { maxLv = tbMount.Level; } return(true); }); if (maxStep > DataModel.Step) {//还可以进阶 int dis = maxLv - DataModel.Level + 1; DataModel.strNextStep = string.Format(GameUtils.GetDictionaryText(274001), dis); } else {//以达到最大阶 DataModel.strNextStep = GameUtils.GetDictionaryText(274002); DataModel.IsMaxLevel = maxLv == DataModel.Level ? 1 : 0; } } }