Core/GameEngine/Model/Config/WashLevelMaxConfig.cs
New file @@ -0,0 +1,208 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: Monday, March 11, 2019 //-------------------------------------------------------- using System.Collections.Generic; using System.IO; using System.Threading; using System; using UnityEngine; [XLua.LuaCallCSharp] public partial class WashLevelMaxConfig { public readonly int id; public readonly int equipType; public readonly int equipStar; public readonly int levelMax; public WashLevelMaxConfig() { } public WashLevelMaxConfig(string input) { try { var tables = input.Split('\t'); int.TryParse(tables[0],out id); int.TryParse(tables[1],out equipType); int.TryParse(tables[2],out equipStar); int.TryParse(tables[3],out levelMax); } catch (Exception ex) { DebugEx.Log(ex); } } static Dictionary<string, WashLevelMaxConfig> configs = new Dictionary<string, WashLevelMaxConfig>(); public static WashLevelMaxConfig Get(string id) { if (!inited) { Debug.Log("WashLevelMaxConfig 还未完成初始化。"); return null; } if (configs.ContainsKey(id)) { return configs[id]; } WashLevelMaxConfig config = null; if (rawDatas.ContainsKey(id)) { config = configs[id] = new WashLevelMaxConfig(rawDatas[id]); rawDatas.Remove(id); } return config; } public static WashLevelMaxConfig Get(int id) { return Get(id.ToString()); } public static List<string> GetKeys() { var keys = new List<string>(); keys.AddRange(configs.Keys); keys.AddRange(rawDatas.Keys); return keys; } public static List<WashLevelMaxConfig> GetValues() { var values = new List<WashLevelMaxConfig>(); values.AddRange(configs.Values); var keys = new List<string>(rawDatas.Keys); foreach (var key in keys) { values.Add(Get(key)); } return values; } public static bool Has(string id) { return configs.ContainsKey(id) || rawDatas.ContainsKey(id); } public static bool Has(int id) { return Has(id.ToString()); } public static bool inited { get; private set; } protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); public static void Init(bool sync=false) { inited = false; var path = string.Empty; if (AssetSource.refdataFromEditor) { path = ResourcesPath.CONFIG_FODLER +"/WashLevelMax.txt"; } else { path = AssetVersionUtility.GetAssetFilePath("config/WashLevelMax.txt"); } var tempConfig = new WashLevelMaxConfig(); var preParse = tempConfig is IConfigPostProcess; if (sync) { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new WashLevelMaxConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; } else { ThreadPool.QueueUserWorkItem((object _object) => { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new WashLevelMaxConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; }); } } } Core/GameEngine/Model/Config/WashLevelMaxConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4f5f05a190827f847b600b3c9988650a timeCreated: 1552298504 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/Player/Market.meta
File was deleted Core/GameEngine/Model/TelPartialConfig/PartialWashLevelMaxConfig.cs
New file @@ -0,0 +1,35 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; public partial class WashLevelMaxConfig : IConfigPostProcess { static Dictionary<int, WashLevelMaxConfig> washLevelMaxConfigs = new Dictionary<int, WashLevelMaxConfig>(); public void OnConfigParseCompleted() { var key = equipType * 100 + equipStar; washLevelMaxConfigs[key] = this; } public static WashLevelMaxConfig Get(int type, int star) { var key = type * 100 + star; return washLevelMaxConfigs.ContainsKey(key) ? washLevelMaxConfigs[key] : null; } public static int GetMaxLevel( int type) { var max = 0; foreach ( var config in washLevelMaxConfigs.Values) { if ( config .equipType==type && config .levelMax >max) { max = config.levelMax; } } return max; } } Core/GameEngine/Model/TelPartialConfig/PartialWashLevelMaxConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4d25380bc3cd23d479aa010336985565 timeCreated: 1552298532 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HAD_SaleActivity.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/DTCFile/ServerPack/HAD_SaleActivity.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: 3e05761d690b75440a6be79207d0fb01 folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/DTCFile/ServerPack/HAE_Truck.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/DTCFile/ServerPack/HAE_Truck.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: 1d70ccd06161e0443b7a802ad94292f8 folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/DTCFile/ServerPack/HAF_Merge.meta
File was renamed from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: 71e878ac60c49ad4f964dd2dbc725739 folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/DTCFile/ServerPack/HB0_Event.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/DTCFile/ServerPack/HB0_Event.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: eed34091b0568664b9fb42f0634496c1 folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/ServerPack/HAD_SaleActivity.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/ServerPack/HAD_SaleActivity.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: 32ceb8b7faf99f84a8b73ce53c5e3e4d folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/ServerPack/HAE_Truck.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/ServerPack/HAE_Truck.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: 77f69c2b862d1704299a32d0d8eeb71e folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/ServerPack/HAF_Merge.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/ServerPack/HAF_Merge.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: fa14960fa44b0d1439bab471a764e34f folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: Core/NetworkPackage/ServerPack/HB0_Event.metacopy from Core/NetworkPackage/DTCFile/ClientPack.meta copy to Core/NetworkPackage/ServerPack/HB0_Event.meta
File was copied from Core/NetworkPackage/DTCFile/ClientPack.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 722e5e3d30096674e811f5bd191246a0 guid: d914565b65f8e8145988734c4d915834 folderAsset: yes timeCreated: 1539228128 timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: System/Equip/EquipFrameWin.cs
@@ -107,6 +107,8 @@ private void OpenTrainWin() { CloseSubWindows(); WindowCenter.Instance.Open<EquipTrainWin>(); functionOrder = m_Train.order; } private void CloseEquipFrameWin() System/EquipStar/EquipStarWin.cs
@@ -36,15 +36,18 @@ #region Built-in protected override void BindController() { m_StarUpgrade.SetListener(StarUpgrade); } protected override void AddListeners() { m_StarUpgrade.SetListener(StarUpgrade); } protected override void OnPreOpen() { model.SelectLevel(equipModel.GetLastestUnLockEquipSet()); DisplayBaseInfo(); DisplayDynamicInfo(true); } System/EquipTrain/EquipTrainCandidateBehaviour.cs
@@ -6,10 +6,11 @@ using System.Collections; using UnityEngine.UI; namespace Snxxz.UI { namespace Snxxz.UI { public class EquipTrainCandidateBehaviour : MonoBehaviour { public class EquipTrainCandidateBehaviour : MonoBehaviour { [SerializeField] Image m_BackGround; [SerializeField] Image m_EmptyItem; [SerializeField] ItemCell m_ItemCell; @@ -17,17 +18,15 @@ [SerializeField] Text m_Description2; [SerializeField] Button m_Select; EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } EquipTrainModel model { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } int place; EquipStarUpgradeCandidate candidate; EquipTrainCandidate candidate; public void Display(int place) public void Display(EquipTrainCandidate candidate) { this.place = place; this.candidate = model.GetCandidatePlace(this.place); this.candidate = candidate; DisplayBaseInfo(); DisplayDynamicInfo(true); @@ -63,7 +62,8 @@ m_ItemCell.Init(item); m_Description1.text = item.config.ItemName; m_Description1.color = UIHelper.GetUIColor(item.config.ItemColor); m_Description2.text = string.Empty; var trainLevel = model.GetTrainLevel(candidate.level, candidate.place); m_Description2.text = string.Format("洗练等级:{0}级", trainLevel); } } @@ -77,7 +77,6 @@ } } public class EquipTrainCandidateBehaviourPool { System/EquipTrain/EquipTrainLevelBehaviour.cs
@@ -18,7 +18,7 @@ readonly List<EquipTrainCandidateBehaviour> slotBehaviours = new List<EquipTrainCandidateBehaviour>(); EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } EquipTrainModel model { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } public int level { get; private set; } System/EquipTrain/EquipTrainModel.cs
@@ -6,7 +6,6 @@ { public class EquipTrainModel : Model { public readonly LogicInt selectedLevel = new LogicInt(); public readonly LogicInt selectedPlace = new LogicInt(); public readonly LogicInt equipTrainLevel = new LogicInt(); @@ -14,12 +13,11 @@ public readonly LogicInt material = new LogicInt(); public readonly LogicInt inevitableMaterialCount = new LogicInt(); public readonly LogicEnum<TrainOperateType> operateType = new LogicEnum<TrainOperateType>(TrainOperateType.None); public readonly List<EquipTrainCandidate> candidatePlaces = new List<EquipTrainCandidate>(); public readonly List<EquipTrainPropertyBar> propertyBars = new List<EquipTrainPropertyBar>(); Dictionary<int, EquipTrainSet> equipTrains = new Dictionary<int, EquipTrainSet>(); public readonly LogicList<EquipTrainCandidate> candidatePlaces = new LogicList<EquipTrainCandidate>(); public readonly LogicList<EquipTrainPropertyBar> propertyBars = new LogicList<EquipTrainPropertyBar>(); static Dictionary<int, int> trainTypes = new Dictionary<int, int>(); Dictionary<int, EquipTrainSet> equipTrains = new Dictionary<int, EquipTrainSet>(); EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } @@ -128,7 +126,7 @@ for (var i = 0; i < places.Count; i++) { var place = places[i]; candidatePlaces[place] = new EquipTrainCandidate(level, place); candidatePlaces.Add(new EquipTrainCandidate(level, place)); if (i == 0) { SelectPlace(level, place); @@ -141,13 +139,14 @@ { selectedPlace.value = place; selectedPlace.dirty = true; foreach (var candidate in candidatePlaces) for (int i = 0; i < candidatePlaces.Count; i++) { var candidate = candidatePlaces[i]; candidate.selected.value = candidate.level == level && candidate.place == place; } equipTrainLevel.value = GetTrainLevel(level, place); equipTrainMaxLevel.value = GetMaxTrainLevel(level); equipTrainMaxLevel.value = GetMaxTrainLevel(level, place); material.value = GetTrainMaterial(level, place); InitTrainableProperties(level, place); @@ -184,15 +183,39 @@ return equipTrains[level].GetTotalLevel(); } public int GetMaxTrainLevel(int level) public int GetMaterialNeed(int level, int place) { var star = starModel.GetEquipStarLevel(level, place); var type = GetTrainType(place); var data = EquipWashConfig.Get(type, star + 1); return 5; return data.config.costCount; } public int GetMaxTrainLevel(int place) { var type = GetTrainType(place); return WashLevelMaxConfig.GetMaxLevel(type); } public int GetMaxTrainLevel(int level, int place) { return 5; var star = starModel.GetEquipStarLevel(level, place); var type = GetTrainType(place); var config = WashLevelMaxConfig.Get(type, star); if (config == null) { return 0; } else { return config.levelMax; } } public List<EquipTrainCandidate> GetCandidatePlaces() { return candidatePlaces.Fetch(); } public bool IsEquipPlaceTrainable(string equipGuid) @@ -208,7 +231,7 @@ return false; } var maxStarLevel = GetMaxTrainLevel(equip.config.ItemColor, equip.config.LV); var maxStarLevel = GetMaxTrainLevel(equip.config.LV, equip.config.EquipPlace); var currentStarLevel = GetTrainLevel(equip.config.LV, equip.config.EquipPlace); return currentStarLevel < maxStarLevel; } @@ -258,7 +281,7 @@ var unSavedProperties = GetUnSavedProperties(level, place); var trainedProperties = GetTrainedProperties(level, place); var trainLevel = GetTrainLevel(level, place); var data = EquipWashConfig.Get(GetTrainType(place), trainLevel); var data = EquipWashConfig.Get(GetTrainType(place), trainLevel + 1); var propertyBar = new EquipTrainPropertyBar(data.config.attType1, data.config.attMax1); propertyBar.propertyValue.value = trainedProperties.x; @@ -282,23 +305,25 @@ private int GetTrainMaterial(int level, int place) { var equipGuid = equipModel.GetEquip(level, place); var equip = packModel.GetItemByGuid(equipGuid); if (equip == null) if (IsEquipPlaceTrainable(equipGuid)) { return 0; var star = starModel.GetEquipStarLevel(level, place); var type = GetTrainType(place); var data = EquipWashConfig.Get(type, star + 1); return data.config.costItem; } else { return 1; return 0; } } private int CalculateInevitableMaterialCount() { var count = 0; foreach (var bar in propertyBars) for (int i = 0; i < propertyBars.Count; i++) { count += bar.inevitable.value ? 1 : 0; count += propertyBars[i].inevitable.value ? 1 : 0; } return count; @@ -308,7 +333,7 @@ { var currentLevel = GetTrainLevel(level, place); var maxLevel = GetMaxTrainLevel(level, place); if (currentLevel >= maxLevel) if (maxLevel > 0 && currentLevel >= maxLevel) { return TrainOperateType.Max; } System/EquipTrain/EquipTrainPropertyBarBehaviour.cs
@@ -11,8 +11,92 @@ public class EquipTrainPropertyBarBehaviour : MonoBehaviour { [SerializeField] int m_Index; [SerializeField] Text m_PropertyName; [SerializeField] Text m_Value; [SerializeField] Slider m_Progress; [SerializeField] Text m_DeltaValue; [SerializeField] ToggleButton m_Inevitable; EquipTrainModel model { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } EquipTrainPropertyBar propertyBar; public void Display(EquipTrainPropertyBar propertyBar) { this.propertyBar = propertyBar; DisplayBaseInfo(); DisplayDynamicInfo(true); m_Inevitable.SetListener(SwitchInevitable); } private void LateUpdate() { DisplayDynamicInfo(false); } private void DisplayBaseInfo() { var config = PlayerPropertyConfig.Get(propertyBar.propertyId); m_PropertyName.text = config.Name; } private void DisplayDynamicInfo(bool force) { if (force || propertyBar.inevitable.dirty) { m_Inevitable.isOn = propertyBar.inevitable.Fetch(); } if (force || propertyBar.propertyValue.dirty) { var value = propertyBar.propertyValue.Fetch(); var maxValue = propertyBar.upperLimit; m_Value.text = string.Format("{0}/{1}", value, maxValue); m_Progress.value = Mathf.Clamp01((float)value / maxValue); m_Inevitable.gameObject.SetActive(value < maxValue); } if (force || propertyBar.deltaValue.dirty) { var deltaValue = propertyBar.deltaValue.Fetch(); var isPerfect = propertyBar.propertyValue.value >= propertyBar.upperLimit; if (isPerfect) { m_DeltaValue.text = "完美"; m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true); } else { if (deltaValue > 0) { m_DeltaValue.text = string.Format("+{0}", deltaValue); m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true); } else if (deltaValue < 0) { m_DeltaValue.text = string.Format("-{0}", deltaValue); m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Red, true); } else { m_DeltaValue.text = string.Format("+{0}", deltaValue); m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true); } } } } private void SwitchInevitable() { model.SetInevitable(m_Index - 1, !propertyBar.inevitable.value); } } System/EquipTrain/EquipTrainWin.cs
@@ -9,22 +9,52 @@ using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { namespace Snxxz.UI { public class EquipTrainWin : Window { [SerializeField] RectTransform m_LevelContainer; [SerializeField] Text m_MaxTrainLevel; [SerializeField] ItemCell m_TargetEquip; [SerializeField] MaterialCell m_MaterialCell; [SerializeField] InevitableMaterialCell m_InevitableMaterial; [SerializeField] RectTransform m_UnTrainableContainer; [SerializeField] RectTransform m_TrainableContainer; [SerializeField] Text m_TrainLevel; [SerializeField] EquipTrainPropertyBarBehaviour[] m_PropertyBarBehaviours; [SerializeField] RectTransform m_MaxLevelContainer; [SerializeField] Button m_Train; [SerializeField] Button m_Save; [SerializeField] Button m_GiveUp; List<EquipTrainLevelBehaviour> levelBehaviours = new List<EquipTrainLevelBehaviour>(); EquipTrainModel model { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Train.SetListener(Train); m_Save.SetListener(Save); m_GiveUp.SetListener(GiveUp); } protected override void OnPreOpen() { } protected override void OnAfterOpen() @@ -33,13 +63,342 @@ protected override void OnPreClose() { } protected override void OnAfterClose() { model.ResetOperateParams(); } protected override void OnActived() { base.OnActived(); model.SelectLevel(equipModel.GetLastestUnLockEquipSet()); DisplayBaseInfo(); DisplayDynamicInfo(true); } protected override void LateUpdate() { base.LateUpdate(); DisplayDynamicInfo(false); } #endregion private void DisplayBaseInfo() { CreateLevelBehaviours(); } private void DisplayDynamicInfo(bool force) { if (force || model.selectedLevel.dirty) { var level = model.selectedLevel.Fetch(); for (var i = 0; i < levelBehaviours.Count; i++) { var behaviour = levelBehaviours[i]; if (behaviour.level != level) { behaviour.Dispose(); } } for (var i = 0; i < levelBehaviours.Count; i++) { var behaviour = levelBehaviours[i]; if (behaviour.level == level) { behaviour.Display(); } } } if (force || model.selectedPlace.dirty) { var level = model.selectedLevel.value; var place = model.selectedPlace.Fetch(); var equipGuid = equipModel.GetEquip(level, place); var equip = packModel.GetItemByGuid(equipGuid); if (equip != null) { m_TargetEquip.gameObject.SetActive(true); m_TargetEquip.Init(equip); } else { m_TargetEquip.gameObject.SetActive(false); } } if (force || model.equipTrainLevel.dirty) { var trainLevel = model.equipTrainLevel.Fetch(); m_TrainLevel.text = string.Format("{0}级洗练", trainLevel); m_MaxLevelContainer.gameObject.SetActive(model.equipTrainLevel.value >= model.equipTrainMaxLevel.value); } if (force || model.equipTrainMaxLevel.dirty) { var level = model.selectedLevel.value; var place = model.selectedPlace.value; var maxTrain = model.equipTrainMaxLevel.Fetch(); if (maxTrain > 0) { var star = starModel.GetEquipStarLevel(level, place); m_MaxTrainLevel.text = string.Format("{0}星装备最高可洗练至{1}级", star, maxTrain); } else { m_MaxTrainLevel.text = "提升装备星级可洗练"; } } if (force || model.material.dirty) { var level = model.selectedLevel.value; var place = model.selectedPlace.value; DisplayMaterial(level, place, model.material.Fetch()); } if (force || model.inevitableMaterialCount.dirty) { var level = model.selectedLevel.value; var place = model.selectedPlace.value; DisplayInevitableMaterial(level, place, model.inevitableMaterialCount.Fetch()); } if (force || model.operateType.dirty) { DisplayOperateButton(model.operateType.Fetch()); } if (force || model.propertyBars.dirty) { DisplayProperty(model.propertyBars.Fetch()); } } private void DisplayMaterial(int level, int place, int itemId) { var own = 0; var need = 0; if (itemId > 0) { need = model.GetMaterialNeed(level, place); own = packModel.GetItemCountByID(PackType.Item, itemId); } m_MaterialCell.Display(itemId, need, own); } private void DisplayInevitableMaterial(int level, int place, int need) { var equipGuid = equipModel.GetEquip(level, place); var trainable = model.IsEquipPlaceTrainable(equipGuid); if (trainable) { var own = packModel.GetItemCountByID(PackType.Item, GeneralDefine.equipTrainMustItemId); var type = EquipTrainModel.GetTrainType(place); var trainLevel = model.GetTrainLevel(level, place); var config = EquipWashConfig.Get(type, trainLevel + 1); m_InevitableMaterial.Display(false, own, need, config.mustCosts[need - 1]); } else { m_InevitableMaterial.Display(true, 0, 0, 0); } } private void DisplayProperty(List<EquipTrainPropertyBar> propertyBars) { var isTrainable = !propertyBars.IsNullOrEmpty(); if (isTrainable) { m_UnTrainableContainer.gameObject.SetActive(false); m_TrainableContainer.gameObject.SetActive(true); for (int i = 0; i < m_PropertyBarBehaviours.Length; i++) { var behaviour = m_PropertyBarBehaviours[i]; if (i < propertyBars.Count) { behaviour.gameObject.SetActive(true); behaviour.Display(propertyBars[i]); } else { behaviour.gameObject.SetActive(false); } } } else { m_UnTrainableContainer.gameObject.SetActive(true); m_TrainableContainer.gameObject.SetActive(false); } } 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; } } private void Train() { var level = model.selectedLevel.value; var place = model.selectedPlace.value; var inevitables = new bool[3]; for (int i = 0; i < 3; i++) { inevitables[i] = model.propertyBars[i].inevitable.value; } model.Train(level, place, inevitables); } private void Save() { var level = model.selectedLevel.value; var place = model.selectedPlace.value; model.Save(level, place); } private void GiveUp() { var level = model.selectedLevel.value; var place = model.selectedPlace.value; model.GiveUp(level, place); } private void CreateLevelBehaviours() { var levels = equipModel.GetUnLockedEquipSets(); var gap = levels.Count - levelBehaviours.Count; for (var i = 0; i < gap; i++) { var instance = UIUtility.CreateWidget("EquipTrainLevelBehaviour", "EquipTrainLevelBehaviour"); var behaviour = instance.GetComponent<EquipTrainLevelBehaviour>(); behaviour.transform.SetParentEx(m_LevelContainer, Vector3.zero, Quaternion.identity, Vector3.one); levelBehaviours.Add(behaviour); } for (var i = 0; i < levelBehaviours.Count; i++) { var behaviour = levelBehaviours[i]; if (i < levels.Count) { behaviour.gameObject.SetActive(true); behaviour.UnInit(); behaviour.Init(levels[i]); } else { behaviour.UnInit(); behaviour.gameObject.SetActive(false); } } } [Serializable] public class MaterialCell { public RectTransform m_LockContainer; public ItemBehaviour m_Material; public Text m_MaterialCount; public void Display(int itemId, int need, int own) { if (itemId > 0) { m_LockContainer.gameObject.SetActive(false); m_Material.gameObject.SetActive(true); m_MaterialCount.gameObject.SetActive(true); m_Material.SetItem(itemId, 1); var enough = own >= need; m_MaterialCount.text = string.Format("{0}/{1}", UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); } else { m_LockContainer.gameObject.SetActive(true); m_Material.gameObject.SetActive(false); m_MaterialCount.gameObject.SetActive(false); } } } [Serializable] public class InevitableMaterialCell { public RectTransform m_LockContainer; public ItemBehaviour m_InevitableMaterial; public Text m_InevitableMaterialCount; public RectTransform m_DiamondContainer; public Text m_DiamondCount; public void Display(bool locked, int need, int own, int diamond) { if (locked) { m_LockContainer.gameObject.SetActive(true); m_InevitableMaterial.gameObject.SetActive(false); m_InevitableMaterialCount.gameObject.SetActive(false); m_DiamondContainer.gameObject.SetActive(false); } else { m_LockContainer.gameObject.SetActive(false); m_InevitableMaterial.gameObject.SetActive(true); m_InevitableMaterialCount.gameObject.SetActive(true); m_InevitableMaterial.SetItem(GeneralDefine.equipTrainMustItemId, 1); var enough = own >= need; m_InevitableMaterialCount.text = string.Format("{0}/{1}", UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); if (diamond > 0) { m_DiamondContainer.gameObject.SetActive(true); m_DiamondCount.text = diamond.ToString(); } else { m_DiamondContainer.gameObject.SetActive(false); } } } } } } System/MainInterfacePanel/LowSettingTip.cs
@@ -118,9 +118,6 @@ void Strengthen1Button() { WindowCenter.Instance.Close<MainInterfaceWin>(); var starModel = ModelCenter.Instance.GetModel<EquipStarModel>(); var equipModel = ModelCenter.Instance.GetModel<EquipModel>(); starModel.SelectLevel(equipModel.GetLastestUnLockEquipSet()); WindowCenter.Instance.Open<EquipFrameWin>(false, 0); } System/Market.meta
File was deleted UI/Core/ToggleButton.cs
@@ -78,6 +78,14 @@ } } public void SetListener(UnityAction action ) { if (button != null) { button.SetListener(action); } } public void AddListener(UnityAction _action) { if (button != null) Utility/ConfigInitiator.cs
@@ -283,6 +283,7 @@ normalTasks.Add(new ConfigInitTask("EquipControlConfig", () => { EquipControlConfig.Init(); }, () => { return EquipControlConfig.inited; })); normalTasks.Add(new ConfigInitTask("EquipSuitConfig", () => { EquipSuitConfig.Init(); }, () => { return EquipSuitConfig.inited; })); normalTasks.Add(new ConfigInitTask("EquipStarConfig", () => { EquipStarConfig.Init(); }, () => { return EquipStarConfig.inited; })); normalTasks.Add(new ConfigInitTask("WashLevelMaxConfig", () => { WashLevelMaxConfig.Init(); }, () => { return WashLevelMaxConfig.inited; })); } static List<ConfigInitTask> doingTasks = new List<ConfigInitTask>();