Lua/Gen/SnxxzUIEquipTrainModelWrap.cs
@@ -37,7 +37,6 @@ Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetTotalLevel", _m_GetTotalLevel); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetMaterialNeed", _m_GetMaterialNeed); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetMaxTrainLevel", _m_GetMaxTrainLevel); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetCandidatePlaces", _m_GetCandidatePlaces); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetEquipPlaceTrainState", _m_GetEquipPlaceTrainState); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetUnSavedProperties", _m_GetUnSavedProperties); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetTrainedProperties", _m_GetTrainedProperties); @@ -507,34 +506,6 @@ } return LuaAPI.luaL_error(L, "invalid arguments to Snxxz.UI.EquipTrainModel.GetMaxTrainLevel!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetCandidatePlaces(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.EquipTrainModel gen_to_be_invoked = (Snxxz.UI.EquipTrainModel)translator.FastGetCSObj(L, 1); { System.Collections.Generic.List<Snxxz.UI.EquipTrainCandidate> gen_ret = gen_to_be_invoked.GetCandidatePlaces( ); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } System/DailyQuest/DayRemind.cs
@@ -48,6 +48,8 @@ public const string FAIRYGRABBOSS_NOTICE_REDPOINT = "FairyGrabBossRedpoint"; public const string TEAM_TICKET_FAIRYLAND = "TeamTicketFairyLand"; public const string FESTIVALREDPACKREMIND = "FestivalRedpackRemind"; public const string EQUIPTRAIN_COSTDIAMOND = "EquipTrain_CostDiamond"; public Dictionary<string, int[]> dayRemindDic = new Dictionary<string, int[]>(); public bool GetDayRemind(string _remindKey) System/Equip/CandidateEquipBehaviour.cs
@@ -11,6 +11,7 @@ public class CandidateEquipBehaviour : ScrollItem { [SerializeField] Image m_UnLockLabel; [SerializeField] ItemCell m_ItemCell; [SerializeField] Text m_EquipName; [SerializeField] Text m_EquipSorce; @@ -46,6 +47,7 @@ { var equip = packModel.GetItemByGuid(this.candidateEquip.guid); m_ItemCell.Init(equip, true); m_UnLockLabel.gameObject.SetActive(!model.IsLevelUnLocked(equip.config.LV)); m_EquipName.text = equip.config.ItemName; m_EquipName.color = UIHelper.GetUIColor(equip.config.ItemColor, true); m_EquipSorce.text = string.Format("评分:{0}", equip.score); System/Equip/EquipModel.cs
@@ -77,6 +77,16 @@ } } public bool IsLevelUnLocked(int level) { if (!equipSets.ContainsKey(level)) { return false; } return equipSets[level].unLocked; } public int GetLastestUnLockEquipSet() { for (int i = sortedLevels.Count - 1; i >= 0; i--) @@ -194,7 +204,6 @@ candidateEquips.Clear(); var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams() { levels = level == 0 ? null : new List<int>() { level }, equipTypes = realmEquipTypes, job = PlayerDatas.Instance.baseData.Job, }); System/EquipTrain/EquipTrain.cs
@@ -24,6 +24,14 @@ } } public void Reset() { foreach (var equipTrain in equipTrains.Values) { equipTrain.Reset(); } } public void UpdateEquipTrainLevel(int place, int trainLevel) { if (equipTrains.ContainsKey(place)) @@ -93,6 +101,13 @@ this.trainLevel = 1; } public void Reset() { this.trainLevel = 1; this.unSavedProperties = Int3.zero; this.trainedProperties = Int3.zero; } } System/EquipTrain/EquipTrainCandidate.cs
@@ -12,6 +12,8 @@ public class EquipTrainCandidate { public readonly Int2 equipPosition; public readonly LogicString equipGuid = new LogicString(); public readonly LogicInt trainLevel = new LogicInt(); public readonly LogicBool selected = new LogicBool(); public EquipTrainCandidate(Int2 equipPosition) System/EquipTrain/EquipTrainCandidateBehaviour.cs
@@ -64,8 +64,7 @@ m_ItemCell.Init(item); m_Description1.text = item.config.ItemName; m_Description1.color = UIHelper.GetUIColor(item.config.ItemColor, true); var trainLevel = model.GetTrainLevel(candidate.equipPosition); m_Description2.text = string.Format("洗练等级:{0}级", trainLevel); m_Description2.text = string.Format("洗练等级:{0}级", this.candidate.trainLevel.Fetch()); m_Description2.color = UIHelper.GetUIColor(TextColType.Black, true); } } @@ -77,6 +76,11 @@ var selected = this.candidate.selected.Fetch(); m_BackGround.SetSprite(selected ? "Title_RightWindow" : "Title_PopupWindow"); } if (force || this.candidate.trainLevel.dirty) { m_Description2.text = string.Format("洗练等级:{0}级", this.candidate.trainLevel.Fetch()); } } } System/EquipTrain/EquipTrainLevelBehaviour.cs
@@ -45,7 +45,7 @@ public void Display() { var siblingIndex = this.transform.GetSiblingIndex(); var candidates = this.model.GetCandidatePlaces(); var candidates = this.model.candidatePlaces.Fetch(); for (var i = candidates.Count - 1; i >= 0; i--) { var behaviour = EquipTrainCandidateBehaviourPool.Get(); System/EquipTrain/EquipTrainModel.cs
@@ -5,7 +5,7 @@ namespace Snxxz.UI { [XLua.LuaCallCSharp] public class EquipTrainModel : Model public class EquipTrainModel : Model, IBeforePlayerDataInitialize { public readonly LogicInt selectedLevel = new LogicInt(); public readonly LogicInt selectedPlace = new LogicInt(); @@ -37,6 +37,14 @@ public override void UnInit() { } public void OnBeforePlayerDataInitialize() { foreach (var train in equipTrains.Values) { train.Reset(); } } public void ResetOperateParams() @@ -99,6 +107,13 @@ InitTrainableProperties(equipPosition, operateType.value); } if (candidatePlaces.Count > 0) { for (int i = 0; i < candidatePlaces.Count; i++) { candidatePlaces[i].trainLevel.value = GetTrainLevel(candidatePlaces[i].equipPosition); } } } public void Train(Int2 equipPosition, bool[] inevitables) @@ -135,6 +150,24 @@ var moneyNeed = config != null ? config.mustCosts[inevitableCount - 1] : 0; var moneyOwn = PlayerDatas.Instance.baseData.diamond; if (!DayRemind.Instance.GetDayRemind(DayRemind.EQUIPTRAIN_COSTDIAMOND)) { ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("TodayDungeonComplete"), Language.Get("TodayNoNotify"), (bool isOk, bool isToggle) => { if (isToggle) { DayRemind.Instance.SetDayRemind(DayRemind.EQUIPTRAIN_COSTDIAMOND, true); } if (!isOk) { return; } }); } if (moneyNeed > moneyOwn) { WindowCenter.Instance.Open<RechargeTipWin>(); @@ -164,6 +197,14 @@ GameNetSystem.Instance.SendInfo(result); } public void UpdateLevel(Int2 equipPosition) { var result = new CA326_tagCMEquipXLAttrChangeOK(); result.EquipPlace = (byte)EquipSet.ClientPlaceToServerPlace(equipPosition); result.IsSave = 2; GameNetSystem.Instance.SendInfo(result); } public void SelectLevel(int level) { selectedLevel.value = level; @@ -180,12 +221,52 @@ { var place = places[i]; var equipPosition = new Int2(level, place); candidatePlaces.Add(new EquipTrainCandidate(equipPosition)); if (i == 0) { SelectPlace(equipPosition); } var trainCandidate = new EquipTrainCandidate(equipPosition); trainCandidate.trainLevel.value = GetTrainLevel(equipPosition); trainCandidate.equipGuid.value = equipModel.GetEquip(equipPosition); candidatePlaces.Add(trainCandidate); } candidatePlaces.Sort((EquipTrainCandidate x, EquipTrainCandidate y) => { var stateX = GetEquipPlaceTrainState(x.equipPosition); var stateY = GetEquipPlaceTrainState(y.equipPosition); if (stateX == TrainState.Allowable && stateY != TrainState.Allowable) { return -1; } else if (stateX != TrainState.Allowable && stateY == TrainState.Allowable) { return 1; } else if (stateX == TrainState.Allowable && stateY == TrainState.Allowable) { return x.trainLevel.value.CompareTo(y.trainLevel.value); } else if (stateX == TrainState.StarLimit && stateY != TrainState.StarLimit) { return -1; } else if (stateX != TrainState.StarLimit && stateY == TrainState.StarLimit) { return 1; } else if (stateX == TrainState.Empty && stateY != TrainState.Empty) { return -1; } else if (stateX != TrainState.Empty && stateY == TrainState.Empty) { return 1; } else { return 0; } }); SelectPlace(candidatePlaces[0].equipPosition); } } @@ -211,10 +292,17 @@ public void SetInevitable(int index, bool invevitable) { var equipPosition = new Int2(selectedLevel.value, selectedPlace.value); var equipGuid = equipModel.GetEquip(equipPosition); if (string.IsNullOrEmpty(equipGuid)) var state = GetEquipPlaceTrainState(equipPosition); if (state == TrainState.Empty) { SysNotifyMgr.Instance.ShowTip("Wash_NoEquip1"); return; } if (state == TrainState.StarLimit) { SysNotifyMgr.Instance.ShowTip("WashStarRequirement"); return; } @@ -227,13 +315,13 @@ var isPerfect = false; switch (index) { case 1: case 0: isPerfect = properties[index] >= data.config.attMax1; break; case 2: case 1: isPerfect = properties[index] >= data.config.attMax2; break; case 3: case 2: isPerfect = properties[index] >= data.config.attMax3; break; } @@ -303,11 +391,6 @@ } } public List<EquipTrainCandidate> GetCandidatePlaces() { return candidatePlaces.Fetch(); } public TrainState GetEquipPlaceTrainState(Int2 equipPosition) { var equipGuid = equipModel.GetEquip(equipPosition); @@ -331,6 +414,12 @@ return TrainState.Empty; } var relativeMax = GetMaxTrainLevel(new Int2(equip.config.LV, equip.config.EquipPlace)); if (relativeMax == 0 || currentStarLevel >= relativeMax) { return TrainState.StarLimit; } var properties = GetTrainedProperties(equipPosition); var isFull = properties.x >= data.config.attMax1 && properties.y >= data.config.attMax2 @@ -340,12 +429,6 @@ if (currentStarLevel >= absoluteMax) { return TrainState.MaxLevel; } var relativeMax = GetMaxTrainLevel(new Int2(equip.config.LV, equip.config.EquipPlace)); if (currentStarLevel >= relativeMax) { return TrainState.StarLimit; } } @@ -468,21 +551,37 @@ private TrainOperateType CalculateTrainOperateType(Int2 equipPosition) { var trainState = GetEquipPlaceTrainState(equipPosition); if (trainState == TrainState.StarLimit || trainState == TrainState.MaxLevel) { return TrainOperateType.Max; } var properties = GetTrainedProperties(equipPosition); var equip = packModel.GetItemByGuid(equipModel.GetEquip(equipPosition)); if (equip == null) { return TrainOperateType.None; } var type = GetTrainType(equip.config.EquipPlace); var trainLevel = GetTrainLevel(equipPosition); var data = EquipWashConfig.Get(type, trainLevel); if (properties.x >= data.config.attMax1 && properties.y >= data.config.attMax2 && properties.z >= data.config.attMax3) { return TrainOperateType.LevelUp; } var unSavedProperties = GetUnSavedProperties(equipPosition); if (unSavedProperties != Int3.zero) { return TrainOperateType.Save; } var trainState = GetEquipPlaceTrainState(equipPosition); if (trainState == TrainState.Allowable) { return TrainOperateType.Train; } if (trainState == TrainState.StarLimit || trainState == TrainState.MaxLevel) { return TrainOperateType.Max; } return TrainOperateType.None; @@ -505,7 +604,8 @@ Train = 1, Forbid = 2, Save = 3, Max = 4, LevelUp = 4, Max = 5, } public enum TrainState System/EquipTrain/EquipTrainPropertyBarBehaviour.cs
@@ -54,7 +54,7 @@ m_Progress.value = 1; m_Value.text = string.Format("{0}/{1}", propertyBar.propertyValue, propertyBar.upperLimit); m_DeltaValue.gameObject.SetActive(true); m_Inevitable.gameObject.SetActive(false); m_Inevitable.gameObject.SetActive(true); break; case EquipTrainModel.TrainState.MaxLevel: m_Progress.value = 1; @@ -101,7 +101,7 @@ m_DeltaValue.text = inevitable ? "必增" : ""; m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true); } else else if (operateType == EquipTrainModel.TrainOperateType.Save) { if (deltaValue > 0) { @@ -119,8 +119,11 @@ m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true); } } else { m_DeltaValue.text = ""; } } } @@ -134,6 +137,7 @@ SysNotifyMgr.Instance.ShowTip("Wash_NoEquip1"); break; case EquipTrainModel.TrainState.StarLimit: SysNotifyMgr.Instance.ShowTip("WashStarRequirement"); break; case EquipTrainModel.TrainState.Allowable: model.SetInevitable(m_Index - 1, !propertyBar.inevitable.value); System/EquipTrain/EquipTrainWin.cs
@@ -32,6 +32,7 @@ [SerializeField] Button m_Train; [SerializeField] Button m_Save; [SerializeField] Button m_GiveUp; [SerializeField] Button m_UpdateLevel; List<EquipTrainLevelBehaviour> levelBehaviours = new List<EquipTrainLevelBehaviour>(); @@ -51,6 +52,7 @@ m_Train.SetListener(Train); m_Save.SetListener(Save); m_GiveUp.SetListener(GiveUp); m_UpdateLevel.SetListener(UpdateLevel); } protected override void OnPreOpen() @@ -244,32 +246,10 @@ private void DisplayOperateButton(EquipTrainModel.TrainOperateType opreateType) { switch (opreateType) { case EquipTrainModel.TrainOperateType.None: m_Train.gameObject.SetActive(false); m_Save.gameObject.SetActive(false); m_GiveUp.gameObject.SetActive(false); break; case EquipTrainModel.TrainOperateType.Train: m_Train.gameObject.SetActive(true); m_Save.gameObject.SetActive(false); m_GiveUp.gameObject.SetActive(false); break; case EquipTrainModel.TrainOperateType.Forbid: break; case EquipTrainModel.TrainOperateType.Save: m_Save.gameObject.SetActive(true); m_Train.gameObject.SetActive(false); m_GiveUp.gameObject.SetActive(false); break; case EquipTrainModel.TrainOperateType.Max: m_Train.gameObject.SetActive(false); m_Save.gameObject.SetActive(false); m_GiveUp.gameObject.SetActive(false); break; } m_Train.gameObject.SetActive(opreateType== EquipTrainModel.TrainOperateType.Train); m_Save.gameObject.SetActive(opreateType == EquipTrainModel.TrainOperateType.Save); m_GiveUp.gameObject.SetActive(opreateType == EquipTrainModel.TrainOperateType.Save); m_UpdateLevel.gameObject.SetActive(opreateType == EquipTrainModel.TrainOperateType.LevelUp); } private void Train() @@ -295,6 +275,12 @@ model.GiveUp(equipPosition); } private void UpdateLevel() { var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value); model.UpdateLevel(equipPosition); } private void CreateLevelBehaviours() { var levels = equipModel.GetUnLockedEquipSets(); System/KnapSack/Logic/ItemLogicUtility.cs
@@ -647,7 +647,11 @@ return false; } var itemModels = singlePack.GetItemsByType((int)ItemType.Equip_Wing); var itemModels = playerPack.GetItems(PackType.Item, new SinglePack.FilterParams() { itemTypes = new List<int>() { (int)ItemType.Equip_Wing } }); if (itemModels != null) { for (int i = 0; i < itemModels.Count; i++) System/KnapSack/Logic/PackModel.cs
@@ -378,7 +378,11 @@ if (itemConfig.CDType != 0) { float configCdTime = (float)Math.Round((double)itemConfig.CDTime / 1000, 1); var items = GetSinglePack(PackType.Item).GetItemsByType((int)ItemType.Buff); var items = GetItems(PackType.Item, new SinglePack.FilterParams() { itemTypes = new List<int>() { (int)ItemType.Buff } }); for (int i = 0; i < items.Count; i++) { if (items[i].itemId == 901 System/KnapSack/Logic/SinglePack.cs
@@ -85,20 +85,6 @@ return count; } public List<ItemModel> GetItemsByType(int type) { var list = new List<ItemModel>(); foreach (var item in items.Values) { if (item.config.Type == type) { list.Add(item); } } return list; } public List<ItemModel> GetItems(FilterParams filterParams) { var list = new List<ItemModel>();