Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
8 文件已复制
3个文件已删除
1 文件已重命名
10个文件已修改
17个文件已添加
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: Fish |
| | | // [ Date ]: Wednesday, May 15, 2019 |
| | | // [ Date ]: Wednesday, July 17, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | |
| | | public readonly int IsJobLimit; |
| | | public readonly int[] CostEquipColor; |
| | | public readonly int CostEquipCnt; |
| | | public readonly int SuitTotalRate; |
| | | public readonly int UnSuitRate; |
| | | public readonly int SuitRate; |
| | | public readonly Int2 CostItemDict; |
| | | public readonly Int2[] StarAttrInfo; |
| | | public readonly Int2[] BaseAttrInfo; |
| | |
| | | |
| | | int.TryParse(tables[7],out CostEquipCnt); |
| | | |
| | | int.TryParse(tables[8],out SuitTotalRate); |
| | | int.TryParse(tables[8],out UnSuitRate); |
| | | |
| | | Int2.TryParse(tables[9],out CostItemDict); |
| | | int.TryParse(tables[9],out SuitRate); |
| | | |
| | | string[] StarAttrInfoStringArray = tables[10].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | Int2.TryParse(tables[10],out CostItemDict); |
| | | |
| | | string[] StarAttrInfoStringArray = tables[11].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | StarAttrInfo = new Int2[StarAttrInfoStringArray.Length]; |
| | | for (int i=0;i<StarAttrInfoStringArray.Length;i++) |
| | | { |
| | | Int2.TryParse(StarAttrInfoStringArray[i],out StarAttrInfo[i]); |
| | | } |
| | | |
| | | string[] BaseAttrInfoStringArray = tables[11].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | string[] BaseAttrInfoStringArray = tables[12].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | BaseAttrInfo = new Int2[BaseAttrInfoStringArray.Length]; |
| | | for (int i=0;i<BaseAttrInfoStringArray.Length;i++) |
| | | { |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1cb3a1eef8413e8449c98c1761d313d1 |
| | | timeCreated: 1557892665 |
| | | timeCreated: 1563348131 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3e05761d690b75440a6be79207d0fb01 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1d70ccd06161e0443b7a802ad94292f8 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 71e878ac60c49ad4f964dd2dbc725739 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: eed34091b0568664b9fb42f0634496c1 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 32ceb8b7faf99f84a8b73ce53c5e3e4d |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 77f69c2b862d1704299a32d0d8eeb71e |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fa14960fa44b0d1439bab471a764e34f |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d914565b65f8e8145988734c4d915834 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarEffectTipModel : Model |
| | | { |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } } |
| | | EquipTrainModel trainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } |
| | | |
| | | public Int2 equipPosition { get; private set; } |
| | | |
| | | public override void Init() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | } |
| | | |
| | | public void Preview(Int2 equipPosition) |
| | | { |
| | | this.equipPosition = equipPosition; |
| | | WindowCenter.Instance.Open<EquipStarEffectTipWin>(); |
| | | } |
| | | |
| | | public Dictionary<int, List<SuitEffectInfo>> GetSuitEffectInfos(Int2 equipPosition) |
| | | { |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | |
| | | if (equipPosition.y >= 1 && equipPosition.y <= 8) |
| | | { |
| | | var effectInfos = new Dictionary<int, List<SuitEffectInfo>>(); |
| | | var configs = EquipSuitConfig.GetConfigs(PlayerDatas.Instance.baseData.Job, equipPosition.x, EquipSuitType.EightSuit); |
| | | |
| | | for (int i = 0; i < 10; i += 3) |
| | | { |
| | | if (maxStarLevel >= i) |
| | | { |
| | | effectInfos[i] = new List<SuitEffectInfo>(); |
| | | var twoSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.TwoSuit); |
| | | var fiveSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.FiveSuit); |
| | | var eightSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.EightSuit); |
| | | |
| | | effectInfos[i].Add(new SuitEffectInfo() |
| | | { |
| | | suitType = EquipSuitType.TwoSuit, |
| | | star = i, |
| | | actived = twoSuit.actived, |
| | | properties = twoSuit.properties |
| | | }); |
| | | |
| | | effectInfos[i].Add(new SuitEffectInfo() |
| | | { |
| | | suitType = EquipSuitType.FiveSuit, |
| | | star = i, |
| | | actived = fiveSuit.actived, |
| | | properties = fiveSuit.properties |
| | | }); |
| | | |
| | | var skillId = 0; |
| | | var skillDescription = string.Empty; |
| | | foreach (var config in configs) |
| | | { |
| | | if (config.star == i) |
| | | { |
| | | skillId = config.skillID; |
| | | skillDescription = config.description; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | effectInfos[i].Add(new SuitEffectInfo() |
| | | { |
| | | suitType = EquipSuitType.EightSuit, |
| | | star = i, |
| | | actived = eightSuit.actived, |
| | | properties = eightSuit.properties, |
| | | skillId = skillId, |
| | | skillDescription = skillDescription, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public List<StarProperty> GetStarProperties(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<StarProperty>(); |
| | | |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetEquipStarLevel(equipPosition); |
| | | var configs = EquipStarConfig.GetConfigs(equipPosition.x, equipPosition.y); |
| | | var lastStarAttrCount = 0; |
| | | for (var i = 0; i < configs.Count; i++) |
| | | { |
| | | var config = configs[i]; |
| | | if (config.Star <= maxStarLevel && (lastStarAttrCount != config.StarAttrInfo.Length)) |
| | | { |
| | | effectInfos.Add(new StarProperty() |
| | | { |
| | | star = config.Star, |
| | | actived = starLevel >= config.Star, |
| | | property = config.StarAttrInfo[config.StarAttrInfo.Length - 1] |
| | | }); |
| | | } |
| | | |
| | | lastStarAttrCount = config.StarAttrInfo.Length; |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<GemHoleInfo> GetGemHoleInfos(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<GemHoleInfo>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetEquipStarLevel(equipPosition); |
| | | if (maxStarLevel >= 0) |
| | | { |
| | | effectInfos.Add(new GemHoleInfo() { star = 0, actived = starLevel >= 0, index = 1 }); |
| | | } |
| | | |
| | | if (maxStarLevel >= 2) |
| | | { |
| | | effectInfos.Add(new GemHoleInfo() { star = 2, actived = starLevel >= 2, index = 2 }); |
| | | } |
| | | |
| | | if (maxStarLevel >= 5) |
| | | { |
| | | effectInfos.Add(new GemHoleInfo() { star = 5, actived = starLevel >= 5, index = 3 }); |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<StrengthLevelInfo> GetStrengthLevelInfos(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<StrengthLevelInfo>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetEquipStarLevel(equipPosition); |
| | | var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); |
| | | var lastStarStrengthLevel = 0; |
| | | for (int i = 0; i <= maxStarLevel; i++) |
| | | { |
| | | var levelLimit = strengthModel.GetEquipLevelMax(strengthType, i); |
| | | if (levelLimit != 0 && lastStarStrengthLevel != levelLimit) |
| | | { |
| | | effectInfos.Add(new StrengthLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
| | | } |
| | | |
| | | lastStarStrengthLevel = levelLimit; |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<TrainLevelInfo> GetTrainLevelInfos(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<TrainLevelInfo>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetEquipStarLevel(equipPosition); |
| | | var type = EquipTrainModel.GetTrainType(equipPosition.y); |
| | | var lastStarTrainLevel = 0; |
| | | for (int i = 0; i <= maxStarLevel; i++) |
| | | { |
| | | var config = WashLevelMaxConfig.Get(type, i); |
| | | var levelLimit = config.levelMax; |
| | | if (levelLimit != lastStarTrainLevel) |
| | | { |
| | | effectInfos.Add(new TrainLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
| | | } |
| | | |
| | | lastStarTrainLevel = levelLimit; |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<string> GetNextTwoSpecialEffect(Int2 equipPosition) |
| | | { |
| | | var specialEffects = new List<string>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetStarLevel(equipPosition); |
| | | |
| | | if (starLevel == maxStarLevel) |
| | | { |
| | | var suitLevel = starLevel - starLevel % 3; |
| | | specialEffects.Add(string.Format("【{0}星】{1}星套装效果(推荐)】", GetStarNumberCHS(starLevel), GetStarNumberCHS(suitLevel))); |
| | | |
| | | var equipStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); |
| | | var property = equipStarConfig.StarAttrInfo[equipStarConfig.StarAttrInfo.Length - 1]; |
| | | specialEffects.Add(string.Format("【{0}星】{1}", |
| | | GetStarNumberCHS(starLevel), |
| | | PlayerPropertyConfig.GetFullDescription(property.x, property.y) |
| | | )); |
| | | |
| | | return specialEffects; |
| | | } |
| | | |
| | | if (equipPosition.y >= 1 && equipPosition.y <= 8) |
| | | { |
| | | if (starLevel % 3 == 2) |
| | | { |
| | | var suitLevel = starLevel - starLevel % 3; |
| | | specialEffects.Add(string.Format("【{0}星】{1}星套装效果(推荐)】", GetStarNumberCHS(starLevel + 1), GetStarNumberCHS(suitLevel))); |
| | | } |
| | | } |
| | | |
| | | var nowStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); |
| | | var nextStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel + 1); |
| | | if (nowStarConfig == null || nowStarConfig.StarAttrInfo.Length != nextStarConfig.StarAttrInfo.Length) |
| | | { |
| | | var property = nextStarConfig.StarAttrInfo[nextStarConfig.StarAttrInfo.Length - 1]; |
| | | specialEffects.Add(string.Format("【{0}星】{1}", |
| | | GetStarNumberCHS(starLevel + 1), |
| | | PlayerPropertyConfig.GetFullDescription(property.x, property.y) |
| | | )); |
| | | } |
| | | |
| | | if (specialEffects.Count >= 2) |
| | | { |
| | | return specialEffects; |
| | | } |
| | | |
| | | var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); |
| | | var nowStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel); |
| | | var nextStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel + 1); |
| | | if (nowStrengthLevel != nextStrengthLevel) |
| | | { |
| | | specialEffects.Add(string.Format("【{0}星】{1}", |
| | | GetStarNumberCHS(starLevel + 1), |
| | | string.Format("强化等级提升至{0}", nextStrengthLevel) |
| | | )); |
| | | } |
| | | |
| | | if (specialEffects.Count >= 2) |
| | | { |
| | | return specialEffects; |
| | | } |
| | | |
| | | if (starLevel == 1 || starLevel == 4) |
| | | { |
| | | specialEffects.Add(string.Format("【{0}星】{1}", |
| | | GetStarNumberCHS(starLevel + 1), |
| | | string.Format("解锁宝石孔{0}", GetStarNumberCHS(starLevel == 1 ? 1 : 2)) |
| | | )); |
| | | } |
| | | |
| | | if (specialEffects.Count >= 2) |
| | | { |
| | | return specialEffects; |
| | | } |
| | | |
| | | var type = EquipTrainModel.GetTrainType(equipPosition.y); |
| | | var nowConfig = WashLevelMaxConfig.Get(type, starLevel); |
| | | var nowTrainLevel = nowConfig.levelMax; |
| | | var nextConfig = WashLevelMaxConfig.Get(type, starLevel + 1); |
| | | var nextTrainLevel = nextConfig.levelMax; |
| | | |
| | | if (nowTrainLevel != nextTrainLevel) |
| | | { |
| | | specialEffects.Add(string.Format("【{0}星】{1}", |
| | | GetStarNumberCHS(starLevel + 1), |
| | | string.Format("洗炼等级提升至{0}", nextTrainLevel) |
| | | )); |
| | | } |
| | | |
| | | return specialEffects; |
| | | } |
| | | |
| | | public static string GetStarNumberCHS(int star) |
| | | { |
| | | switch (star) |
| | | { |
| | | case 0: |
| | | return "零"; |
| | | case 1: |
| | | return "一"; |
| | | case 2: |
| | | return "二"; |
| | | case 3: |
| | | return "三"; |
| | | case 4: |
| | | return "四"; |
| | | case 5: |
| | | return "五"; |
| | | case 6: |
| | | return "六"; |
| | | case 7: |
| | | return "七"; |
| | | case 8: |
| | | return "八"; |
| | | case 9: |
| | | return "九"; |
| | | default: |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | public struct SuitEffectInfo |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public EquipSuitType suitType; |
| | | |
| | | public List<Int2> properties; |
| | | public int skillId; |
| | | public string skillDescription; |
| | | } |
| | | |
| | | public struct StarProperty |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public Int2 property; |
| | | } |
| | | |
| | | public struct GemHoleInfo |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public int index; |
| | | } |
| | | |
| | | public struct StrengthLevelInfo |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public int level; |
| | | } |
| | | |
| | | public struct TrainLevelInfo |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public int level; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarEffectTipModel.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: 566d7b29540388c4f9a08b4570084ae7 |
| | | timeCreated: 1563276990 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarEffectTipWin : Window |
| | | { |
| | | [SerializeField] ScrollRect m_ScrollRect; |
| | | |
| | | [SerializeField] RectTransform m_SuitContainer; |
| | | [SerializeField] SuitBehaviour[] m_SuitBehaviours; |
| | | |
| | | [SerializeField] Text m_StarProperty; |
| | | [SerializeField] Text m_GemHole; |
| | | [SerializeField] Text m_StengthLimit; |
| | | [SerializeField] Text m_TrainLimit; |
| | | |
| | | EquipStarEffectTipModel model { get { return ModelCenter.Instance.GetModel<EquipStarEffectTipModel>(); } } |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | |
| | | DisplaySuit(); |
| | | DisplayStarProperty(); |
| | | DisplayGemHole(); |
| | | DisplayStrengthLimit(); |
| | | DisplayTrainLimit(); |
| | | |
| | | m_ScrollRect.verticalNormalizedPosition = 1f; |
| | | } |
| | | #endregion |
| | | |
| | | private void DisplaySuit() |
| | | { |
| | | if (model.equipPosition.y >= 1 && model.equipPosition.y <= 8) |
| | | { |
| | | m_SuitContainer.gameObject.SetActive(true); |
| | | var effectInfos = model.GetSuitEffectInfos(model.equipPosition); |
| | | foreach (var item in m_SuitBehaviours) |
| | | { |
| | | item.Hide(); |
| | | } |
| | | |
| | | foreach (var item in effectInfos) |
| | | { |
| | | m_SuitBehaviours[item.Key / 3].Display(item.Key, item.Value); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_SuitContainer.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | private void DisplayStarProperty() |
| | | { |
| | | var effectInfos = model.GetStarProperties(model.equipPosition); |
| | | var descriptions = new string[effectInfos.Count]; |
| | | for (var i = 0; i < descriptions.Length; i++) |
| | | { |
| | | var info = effectInfos[i]; |
| | | var property = PlayerPropertyConfig.GetFullDescription(info.property.x, info.property.y); |
| | | descriptions[i] = string.Format("【{0}星】 {1}", |
| | | EquipStarEffectTipModel.GetStarNumberCHS(info.star), |
| | | property); |
| | | |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
| | | } |
| | | |
| | | m_StarProperty.text = string.Join("\n", descriptions); |
| | | } |
| | | |
| | | private void DisplayGemHole() |
| | | { |
| | | var effectInfos = model.GetGemHoleInfos(model.equipPosition); |
| | | var descriptions = new string[effectInfos.Count]; |
| | | for (var i = 0; i < descriptions.Length; i++) |
| | | { |
| | | var info = effectInfos[i]; |
| | | descriptions[i] = string.Format("【{0}星】 解锁宝石孔{1}", |
| | | EquipStarEffectTipModel.GetStarNumberCHS(info.star), |
| | | EquipStarEffectTipModel.GetStarNumberCHS(info.index)); |
| | | |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
| | | } |
| | | |
| | | m_GemHole.text = string.Join("\n", descriptions); |
| | | } |
| | | |
| | | private void DisplayStrengthLimit() |
| | | { |
| | | var effectInfos = model.GetStrengthLevelInfos(model.equipPosition); |
| | | var descriptions = new string[effectInfos.Count]; |
| | | for (var i = 0; i < descriptions.Length; i++) |
| | | { |
| | | var info = effectInfos[i]; |
| | | descriptions[i] = string.Format("【{0}星】 提升至{1}", |
| | | EquipStarEffectTipModel.GetStarNumberCHS(info.star), info.level); |
| | | |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
| | | } |
| | | |
| | | m_StengthLimit.text = string.Join("\n", descriptions); |
| | | } |
| | | |
| | | private void DisplayTrainLimit() |
| | | { |
| | | var effectInfos = model.GetTrainLevelInfos(model.equipPosition); |
| | | var descriptions = new string[effectInfos.Count]; |
| | | for (var i = 0; i < descriptions.Length; i++) |
| | | { |
| | | var info = effectInfos[i]; |
| | | descriptions[i] = string.Format("【{0}星】 提升至{1}", |
| | | EquipStarEffectTipModel.GetStarNumberCHS(info.star), info.level); |
| | | |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
| | | } |
| | | |
| | | m_TrainLimit.text = string.Join("\n", descriptions); |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class SuitBehaviour |
| | | { |
| | | public RectTransform container; |
| | | public Text title; |
| | | public Text content; |
| | | |
| | | public void Display(int star, List<EquipStarEffectTipModel.SuitEffectInfo> effectInfos) |
| | | { |
| | | container.gameObject.SetActive(true); |
| | | var actived = false; |
| | | var lines = new List<string>(); |
| | | foreach (var effectInfo in effectInfos) |
| | | { |
| | | switch (effectInfo.suitType) |
| | | { |
| | | case EquipSuitType.TwoSuit: |
| | | for (int i = 0; i < effectInfo.properties.Count; i++) |
| | | { |
| | | var property = effectInfo.properties[i]; |
| | | lines.Add(string.Format("(两件){0}", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
| | | lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
| | | : UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
| | | } |
| | | break; |
| | | case EquipSuitType.FiveSuit: |
| | | for (int i = 0; i < effectInfo.properties.Count; i++) |
| | | { |
| | | var property = effectInfo.properties[i]; |
| | | lines.Add(string.Format("(五件){0}", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
| | | lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
| | | : UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
| | | } |
| | | break; |
| | | case EquipSuitType.EightSuit: |
| | | for (int i = 0; i < effectInfo.properties.Count; i++) |
| | | { |
| | | var property = effectInfo.properties[i]; |
| | | lines.Add(string.Format("(八件){0}", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
| | | lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
| | | : UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
| | | } |
| | | |
| | | if (effectInfo.skillId > 0) |
| | | { |
| | | lines.Add(string.Format("(八件){0}", effectInfo.skillDescription)); |
| | | lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
| | | : UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (effectInfo.actived) |
| | | { |
| | | actived = true; |
| | | } |
| | | } |
| | | |
| | | content.text = string.Join("\n", lines.ToArray()); |
| | | |
| | | var titleDescription = string.Format("【{0}星】", EquipStarEffectTipModel.GetStarNumberCHS(star)); |
| | | title.text = actived ? UIHelper.AppendColor(TextColType.Green, titleDescription) |
| | | : UIHelper.AppendColor(TextColType.White, titleDescription, true); |
| | | } |
| | | |
| | | public void Hide() |
| | | { |
| | | container.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarEffectTipWin.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: 85e3c89a8aed4274d937db92d48a4a31 |
| | | timeCreated: 1563276953 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | |
| | | public class EquipStarMaterialCandidate : ScrollItem |
| | | { |
| | | [SerializeField] Image m_SelectedSign; |
| | | [SerializeField] Button m_Select; |
| | | [SerializeField] ItemBehaviour m_Item; |
| | | [SerializeField] Text m_ItemName; |
| | |
| | | string equip = string.Empty; |
| | | EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | EquipStarMaterialSelectModel selectModel { get { return ModelCenter.Instance.GetModel<EquipStarMaterialSelectModel>(); } } |
| | | |
| | | public override void Display(object _data) |
| | | { |
| | |
| | | m_Rate.text = string.Format("成功率 +{0}%", Mathf.RoundToInt(successRate * 100)); |
| | | m_Item.SetItem(item.config.ID, 1); |
| | | m_Select.SetListener(SelectMaterial); |
| | | |
| | | OnSelected(); |
| | | selectModel.materialSelectEvent -= OnSelected; |
| | | selectModel.materialSelectEvent += OnSelected; |
| | | } |
| | | |
| | | public override void Dispose() |
| | | { |
| | | base.Dispose(); |
| | | selectModel.materialSelectEvent -= OnSelected; |
| | | m_Select.RemoveAllListeners(); |
| | | } |
| | | |
| | | private void SelectMaterial() |
| | | { |
| | | var materialIndex = model.operateMaterialIndex.value; |
| | | model.AddMaterial(materialIndex, this.equip); |
| | | model.operateMaterialIndex.value = 0; |
| | | if (!selectModel.IsSelectedMaterial(equip)) |
| | | { |
| | | selectModel.AddMaterial(equip); |
| | | } |
| | | else |
| | | { |
| | | selectModel.RemoveMaterial(equip); |
| | | } |
| | | } |
| | | |
| | | private void OnSelected() |
| | | { |
| | | var selected = selectModel.IsSelectedMaterial(equip); |
| | | m_SelectedSign.gameObject.SetActive(selected); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarMaterialCandidateCouple : ScrollItem |
| | | { |
| | | [SerializeField] EquipStarMaterialCandidate[] m_Behaviours; |
| | | |
| | | public override void Display(object _data) |
| | | { |
| | | base.Display(_data); |
| | | |
| | | var materials = _data as string[]; |
| | | if (materials.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < m_Behaviours.Length; i++) |
| | | { |
| | | var behaviour = m_Behaviours[i]; |
| | | if (i < materials.Length && materials[i] != null) |
| | | { |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.Display(materials[i]); |
| | | } |
| | | else |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public override void Dispose() |
| | | { |
| | | for (int i = 0; i < m_Behaviours.Length; i++) |
| | | { |
| | | var behaviour = m_Behaviours[i]; |
| | | behaviour.Dispose(); |
| | | } |
| | | |
| | | base.Dispose(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarMaterialCandidateCouple.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: 871ef947bda453e459702610e2843e51 |
| | | timeCreated: 1563262055 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarMaterialSelectButton : MonoBehaviour |
| | | { |
| | | [SerializeField] Image m_Lock; |
| | | [SerializeField] Button m_SelectMaterial; |
| | | [SerializeField] Image m_Add; |
| | | [SerializeField] ItemBehaviour m_ItemBehaviour; |
| | | |
| | | EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | |
| | | public void Display(bool isLock, int itemId) |
| | | { |
| | | var state = 1; |
| | | if (isLock) |
| | | { |
| | | state = 1; |
| | | } |
| | | else |
| | | { |
| | | if (itemId == 0) |
| | | { |
| | | state = 2; |
| | | } |
| | | else |
| | | { |
| | | state = 3; |
| | | } |
| | | } |
| | | |
| | | switch (state) |
| | | { |
| | | case 1: |
| | | m_Lock.gameObject.SetActive(true); |
| | | m_Add.gameObject.SetActive(false); |
| | | m_ItemBehaviour.gameObject.SetActive(false); |
| | | m_SelectMaterial.RemoveAllListeners(); |
| | | break; |
| | | case 2: |
| | | m_Lock.gameObject.SetActive(false); |
| | | m_Add.gameObject.SetActive(true); |
| | | m_ItemBehaviour.gameObject.SetActive(false); |
| | | m_SelectMaterial.SetListener(OpenMaterialSelectWin); |
| | | break; |
| | | case 3: |
| | | m_Lock.gameObject.SetActive(false); |
| | | m_Add.gameObject.SetActive(false); |
| | | m_ItemBehaviour.gameObject.SetActive(true); |
| | | m_ItemBehaviour.SetItem(itemId, 0); |
| | | m_SelectMaterial.SetListener(OpenMaterialSelectWin); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | public void Dispose() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OpenMaterialSelectWin() |
| | | { |
| | | starModel.normalMaterials.Clear(); |
| | | var equipPosition = new Int2(starModel.selectedLevel.value, starModel.selectedPlace.value); |
| | | var starLevel = starModel.GetStarLevel(equipPosition); |
| | | starModel.CalculateStarUpgradeProbability(new Int2(starModel.selectedLevel.value, starModel.selectedPlace.value)); |
| | | |
| | | var materials = starModel.GetMaterials(equipPosition, starLevel + 1); |
| | | if (materials.IsNullOrEmpty()) |
| | | { |
| | | var getWays = starModel.GetMaterialGetWays(equipPosition, starLevel + 1); |
| | | var getWayModel = ModelCenter.Instance.GetModel<GetWayModel>(); |
| | | getWayModel.SetWays(getWays.ToArray()); |
| | | |
| | | WindowCenter.Instance.Open<GetWayWin>(); |
| | | } |
| | | else |
| | | { |
| | | WindowCenter.Instance.Open<EquipStarMaterialSelectWin>(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarMaterialSelectButton.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: d259d5b03b98ea04d82364336a2fc00e |
| | | timeCreated: 1563264270 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | public class EquipStarMaterialSelectModel : Model |
| | | { |
| | | public event Action materialSelectEvent; |
| | | |
| | | List<string> selectedMaterials = new List<string>(); |
| | | |
| | | EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | |
| | | public override void Init() |
| | | { |
| | | |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void InitMaterials(List<string> materials) |
| | | { |
| | | selectedMaterials.AddRange(materials); |
| | | } |
| | | |
| | | public void AddMaterial(string guid) |
| | | { |
| | | if (CalculateSuccessRate() > 0.999f) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUp6"); |
| | | return; |
| | | } |
| | | |
| | | if (!selectedMaterials.Contains(guid)) |
| | | { |
| | | selectedMaterials.Add(guid); |
| | | if (materialSelectEvent != null) |
| | | { |
| | | materialSelectEvent(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void RemoveMaterial(string guid) |
| | | { |
| | | if (selectedMaterials.Contains(guid)) |
| | | { |
| | | selectedMaterials.Remove(guid); |
| | | if (materialSelectEvent != null) |
| | | { |
| | | materialSelectEvent(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool IsSelectedMaterial(string guid) |
| | | { |
| | | return selectedMaterials.Contains(guid); |
| | | } |
| | | |
| | | public void ClearSelectedMaterials() |
| | | { |
| | | selectedMaterials.Clear(); |
| | | } |
| | | |
| | | public List<string> GetSelectedMaterials() |
| | | { |
| | | return selectedMaterials; |
| | | } |
| | | |
| | | public float CalculateSuccessRate() |
| | | { |
| | | var rate = 0f; |
| | | var equipPosition = new Int2(starModel.selectedLevel.value, starModel.selectedPlace.value); |
| | | foreach (var material in selectedMaterials) |
| | | { |
| | | rate += starModel.GetMaterialSuccessRate(equipPosition, material); |
| | | } |
| | | |
| | | return rate; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarMaterialSelectModel.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: da7fb5d2c47ea4a408810a69585ca676 |
| | | timeCreated: 1563272965 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, July 16, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarMaterialSelectWin : Window |
| | | { |
| | | [SerializeField] CyclicScroll m_MaterialScroll; |
| | | |
| | | [SerializeField] Text m_SuccessRate; |
| | | [SerializeField] Button m_OneKeySelect; |
| | | [SerializeField] Button m_Confirm; |
| | | [SerializeField] Button m_Close; |
| | | |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | EquipStarMaterialSelectModel model { get { return ModelCenter.Instance.GetModel<EquipStarMaterialSelectModel>(); } } |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | m_Confirm.SetListener(ConfirmSelectedMaterials); |
| | | m_OneKeySelect.SetListener(OneKeyAddMaterials); |
| | | |
| | | m_Close.SetListener(() => { WindowCenter.Instance.Close<EquipStarMaterialSelectWin>(); }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | model.materialSelectEvent += DisplaySuccessRate; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | model.materialSelectEvent -= DisplaySuccessRate; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | |
| | | model.ClearSelectedMaterials(); |
| | | model.InitMaterials(starModel.normalMaterials.Fetch()); |
| | | DisplayMaterials(); |
| | | DisplaySuccessRate(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | private void DisplayMaterials() |
| | | { |
| | | var equipPosition = new Int2(starModel.selectedLevel.value, starModel.selectedPlace.value); |
| | | var starLevel = starModel.GetStarLevel(equipPosition); |
| | | var materials = starModel.GetMaterials(equipPosition, starLevel + 1); |
| | | materials.Sort(MaterialSort); |
| | | if (!materials.IsNullOrEmpty()) |
| | | { |
| | | m_MaterialScroll.gameObject.SetActive(true); |
| | | m_MaterialScroll.Init(GetMaterialCouples(materials)); |
| | | } |
| | | else |
| | | { |
| | | m_MaterialScroll.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | private List<string[]> GetMaterialCouples(List<string> materials) |
| | | { |
| | | if (materials.IsNullOrEmpty()) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | var couples = new List<string[]>(); |
| | | for (int i = 0; i < materials.Count; i++, i++) |
| | | { |
| | | var couple = new string[2]; |
| | | couples.Add(couple); |
| | | couple[0] = materials[i]; |
| | | if (i + 1 < materials.Count) |
| | | { |
| | | couple[1] = materials[i + 1]; |
| | | } |
| | | } |
| | | |
| | | return couples; |
| | | } |
| | | |
| | | private void OneKeyAddMaterials() |
| | | { |
| | | var equipPosition = new Int2(starModel.selectedLevel.value, starModel.selectedPlace.value); |
| | | var starLevel = starModel.GetStarLevel(equipPosition); |
| | | var materials = starModel.GetMaterials(equipPosition, starLevel + 1); |
| | | materials.Sort(MaterialSort); |
| | | for (var i = 0; i < materials.Count; i++) |
| | | { |
| | | model.AddMaterial(materials[i]); |
| | | if (model.CalculateSuccessRate() >= 1.0f) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void ConfirmSelectedMaterials() |
| | | { |
| | | var materials = model.GetSelectedMaterials(); |
| | | foreach (var guid in materials) |
| | | { |
| | | starModel.AddMaterial(guid); |
| | | } |
| | | |
| | | WindowCenter.Instance.Close<EquipStarMaterialSelectWin>(); |
| | | } |
| | | |
| | | private void DisplaySuccessRate() |
| | | { |
| | | var successRate = Mathf.RoundToInt(model.CalculateSuccessRate() * 100); |
| | | m_SuccessRate.text = StringUtility.Contact("成功率:", successRate, "%"); |
| | | |
| | | if (successRate < 50) |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.Red, true); |
| | | } |
| | | else if (successRate < 80) |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.NavyBrown, true); |
| | | } |
| | | else |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.Green, true); |
| | | } |
| | | } |
| | | |
| | | private int MaterialSort(string materialA, string materialB) |
| | | { |
| | | var itemA = packModel.GetItemByGuid(materialA); |
| | | var itemB = packModel.GetItemByGuid(materialB); |
| | | |
| | | var isFightUpA = ItemLogicUtility.Instance.IsFightUp(itemA.itemId, itemA.score) == 1; |
| | | var isFightUpB = ItemLogicUtility.Instance.IsFightUp(itemB.itemId, itemB.score) == 1; |
| | | if (isFightUpA && !isFightUpB) |
| | | { |
| | | return -1; |
| | | } |
| | | |
| | | if (!isFightUpA && isFightUpB) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | var isSuitA = itemA.config.SuiteiD == 1; |
| | | var isSuitB = itemB.config.SuiteiD == 1; |
| | | if (isSuitA && !isSuitB) |
| | | { |
| | | return -1; |
| | | } |
| | | |
| | | if (!isSuitA && isSuitB) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | return itemA.itemId.CompareTo(itemB.itemId); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarMaterialSelectWin.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: ee0b98a184481194ba8cbb78d56d7e10 |
| | | timeCreated: 1563261047 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | public readonly LogicInt selectedPlace = new LogicInt(); |
| | | public readonly LogicInt equipStarLevel = new LogicInt(); |
| | | public readonly LogicInt equipMaxStarLevel = new LogicInt(); |
| | | public readonly LogicInt operateMaterialIndex = new LogicInt(); |
| | | public readonly LogicInt starUpgradeProbability = new LogicInt(); |
| | | public readonly LogicList<EquipStarUpgradeCandidate> candidatePlaces = new LogicList<EquipStarUpgradeCandidate>(); |
| | | public readonly Dictionary<int, LogicString> materials = new Dictionary<int, LogicString>() { |
| | | {1,new LogicString () }, |
| | | {2,new LogicString () }, |
| | | {3,new LogicString () }, |
| | | {4,new LogicString () }, |
| | | {5,new LogicString () }, |
| | | }; |
| | | |
| | | public readonly LogicList<Star> stars = new LogicList<Star>(); |
| | | |
| | | public readonly LogicList<string> normalMaterials = new LogicList<string>(); |
| | | public readonly LogicInt specialMaterial = new LogicInt(); |
| | | public readonly LogicInt starResultEffect = new LogicInt(); |
| | | |
| | |
| | | |
| | | if (info.Result == 1) |
| | | { |
| | | var successModel = ModelCenter.Instance.GetModel<EquipStarSuccessModel>(); |
| | | successModel.Show(equipPosition, GetStarLevel(equipPosition)); |
| | | starResultEffect.value = 1; |
| | | } |
| | | else |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUpFail"); |
| | | starResultEffect.value = -1; |
| | | } |
| | | } |
| | |
| | | |
| | | var materialIndexs = new List<ushort>(); |
| | | var materialItemIds = new List<uint>(); |
| | | foreach (var material in materials.Values) |
| | | for (var i = 0; i < normalMaterials.Count; i++) |
| | | { |
| | | if (!string.IsNullOrEmpty(material.value)) |
| | | var material = normalMaterials[i]; |
| | | if (!string.IsNullOrEmpty(material)) |
| | | { |
| | | var item = packModel.GetItemByGuid(material.value); |
| | | var item = packModel.GetItemByGuid(material); |
| | | materialIndexs.Add((ushort)item.gridIndex); |
| | | materialItemIds.Add((uint)item.itemId); |
| | | } |
| | | } |
| | | |
| | | if (materialIndexs.Count < config.CostEquipCnt) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("StarLevelUp3"); |
| | | return; |
| | | } |
| | | |
| | | Action sendInfo = () => |
| | |
| | | GameNetSystem.Instance.SendInfo(info); |
| | | }; |
| | | |
| | | if (starUpgradeProbability.value < 100) |
| | | if (starUpgradeProbability.value < 50) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm( |
| | | Language.Get("Mail101"), |
| | | Language.Get("EquipStarUpgradePossibility"), |
| | | (bool ok) => |
| | | { |
| | | if (ok) |
| | | { |
| | | sendInfo(); |
| | | } |
| | | }); |
| | | () => { } |
| | | ); |
| | | } |
| | | else |
| | | { |
| | |
| | | selectedPlace.value = 0; |
| | | equipStarLevel.value = 0; |
| | | equipMaxStarLevel.value = 0; |
| | | operateMaterialIndex.value = 0; |
| | | starUpgradeProbability.value = -1; |
| | | starResultEffect.value = 0; |
| | | foreach (var item in materials.Values) |
| | | { |
| | | item.value = string.Empty; |
| | | } |
| | | |
| | | normalMaterials.Clear(); |
| | | stars.Clear(); |
| | | } |
| | | |
| | |
| | | jobs = config.IsJobLimit == 1 ? new List<int>() { PlayerDatas.Instance.baseData.Job } : null, |
| | | }); |
| | | |
| | | for (var i = 1; i <= 5; i++) |
| | | { |
| | | var placedMaterialGuid = GetMaterialLogicStringByIndex(i).value; |
| | | var materialItem = packModel.GetItemByGuid(placedMaterialGuid); |
| | | if (materialItem != null) |
| | | { |
| | | expcetMaterials.Remove(materialItem); |
| | | } |
| | | } |
| | | |
| | | var materialGuids = new List<string>(); |
| | | foreach (var item in expcetMaterials) |
| | | { |
| | |
| | | return materialGuids; |
| | | } |
| | | |
| | | public void AddMaterial(int index, string itemGuid) |
| | | public void AddMaterial(string guid) |
| | | { |
| | | GetMaterialLogicStringByIndex(index).value = itemGuid; |
| | | CalculateStarUpgradeProbability(new Int2(selectedLevel.value, selectedPlace.value)); |
| | | if (!normalMaterials.Contains(guid)) |
| | | { |
| | | normalMaterials.Add(guid); |
| | | CalculateStarUpgradeProbability(new Int2(selectedLevel.value, selectedPlace.value)); |
| | | } |
| | | } |
| | | |
| | | public void RemoveMaterial(int index) |
| | | public void RemoveMaterial(string guid) |
| | | { |
| | | GetMaterialLogicStringByIndex(index).value = string.Empty; |
| | | CalculateStarUpgradeProbability(new Int2(selectedLevel.value, selectedPlace.value)); |
| | | if (normalMaterials.Contains(guid)) |
| | | { |
| | | normalMaterials.Remove(guid); |
| | | CalculateStarUpgradeProbability(new Int2(selectedLevel.value, selectedPlace.value)); |
| | | } |
| | | } |
| | | |
| | | private void AutoAddMaterials(Int2 equipPosition) |
| | |
| | | |
| | | if (upgradable) |
| | | { |
| | | normalMaterials.Clear(); |
| | | var config = EquipStarConfig.Get(equipPosition.x, equipPosition.y, GetEquipStarLevel(equipPosition) + 1); |
| | | if (config.CostEquipPlace.Length == 1 && config.CostEquipColor.Length == 1) |
| | | { |
| | | var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams() |
| | | { |
| | | levels = new List<int>() { equipPosition.x }, |
| | | qualitys = new List<int>() { config.CostEquipColor[0] }, |
| | | equipTypes = new List<int>() { config.CostEquipPlace[0] }, |
| | | jobs = config.IsJobLimit == 1 ? new List<int>() { PlayerDatas.Instance.baseData.Job } : null, |
| | | }); |
| | | |
| | | if (!items.IsNullOrEmpty()) |
| | | { |
| | | var minCount = Mathf.Min(config.CostEquipCnt, items.Count); |
| | | for (int i = 1; i <= 5; i++) |
| | | { |
| | | materials[i].value = i <= minCount ? items[i - 1].guid : string.Empty; |
| | | } |
| | | } |
| | | } |
| | | { |
| | | for (int i = 1; i <= 5; i++) |
| | | { |
| | | materials[i].value = string.Empty; |
| | | } |
| | | } |
| | | |
| | | if (config.CostItemDict.x > 0) |
| | | { |
| | | var itemId = config.CostItemDict.x; |
| | |
| | | } |
| | | else |
| | | { |
| | | foreach (var material in materials.Values) |
| | | { |
| | | material.value = string.Empty; |
| | | } |
| | | normalMaterials.Clear(); |
| | | } |
| | | |
| | | CalculateStarUpgradeProbability(new Int2(selectedLevel.value, selectedPlace.value)); |
| | | } |
| | | |
| | | private void CalculateStarUpgradeProbability(Int2 equipPosition) |
| | | public void CalculateStarUpgradeProbability(Int2 equipPosition) |
| | | { |
| | | var probability = 0f; |
| | | var equipGuid = equipModel.GetEquip(equipPosition); |
| | |
| | | } |
| | | else |
| | | { |
| | | for (var i = 1; i <= 5; i++) |
| | | for (int i = 0; i < normalMaterials.Count; i++) |
| | | { |
| | | var itemGuid = GetMaterialLogicStringByIndex(i).value; |
| | | probability += GetMaterialSuccessRate(equipPosition, itemGuid); |
| | | var material = normalMaterials[i]; |
| | | probability += GetMaterialSuccessRate(equipPosition, material); |
| | | } |
| | | } |
| | | |
| | |
| | | return 0f; |
| | | } |
| | | |
| | | var singleItemRate = (float)config.SuitTotalRate * 0.01f / config.CostEquipCnt; |
| | | return item.config.SuiteiD > 0 ? singleItemRate : singleItemRate * 0.5f; |
| | | } |
| | | |
| | | public LogicString GetMaterialLogicStringByIndex(int index) |
| | | { |
| | | return materials.ContainsKey(index) ? materials[index] : null; |
| | | return (item.config.SuiteiD > 0 ? config.SuitRate : config.UnSuitRate) * 0.01f; |
| | | } |
| | | |
| | | private void UpdateSelelctedEquipStars(int oldStarLevel, int newStarLevel, int maxStarLevel) |
| | |
| | | { |
| | | materials.RemoveAt(j); |
| | | } |
| | | } |
| | | |
| | | if (materials.Count < config.CostEquipCnt) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | minStarLevel = starLevel; |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, July 18, 2019 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarSuccessActiveItemBehaviour : MonoBehaviour |
| | | { |
| | | [SerializeField] Text m_Title; |
| | | [SerializeField] RectTransform m_ContainerContent; |
| | | [SerializeField] Text m_Content; |
| | | |
| | | public void DisplaySuitEffect(int star, EquipSuitType suitType, Int2[] properties) |
| | | { |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip1", EquipStarEffectTipModel.GetStarNumberCHS(star)); |
| | | var lines = new string[properties.Length]; |
| | | for (var i = 0; i < properties.Length; i++) |
| | | { |
| | | var property = properties[i]; |
| | | switch (suitType) |
| | | { |
| | | case EquipSuitType.TwoSuit: |
| | | lines[i] = string.Format("【{0}件】 {1}", EquipStarEffectTipModel.GetStarNumberCHS(2), |
| | | PlayerPropertyConfig.GetFullDescription(property.x, property.y)); |
| | | break; |
| | | case EquipSuitType.FiveSuit: |
| | | lines[i] = string.Format("【{0}件】 {1}", EquipStarEffectTipModel.GetStarNumberCHS(5), |
| | | PlayerPropertyConfig.GetFullDescription(property.x, property.y)); |
| | | break; |
| | | case EquipSuitType.EightSuit: |
| | | lines[i] = string.Format("【{0}件】 {1}", EquipStarEffectTipModel.GetStarNumberCHS(8), |
| | | PlayerPropertyConfig.GetFullDescription(property.x, property.y)); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | m_Content.text = string.Join("\n", lines); |
| | | } |
| | | |
| | | public void DisplaySuitEffect(int star, string skillDescription) |
| | | { |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip1", EquipStarEffectTipModel.GetStarNumberCHS(star)); |
| | | m_Content.text = string.Format("【{0}件】 {1}", EquipStarEffectTipModel.GetStarNumberCHS(8), skillDescription); |
| | | } |
| | | |
| | | public void DisplayStarProperty(int star, Int2 property) |
| | | { |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip2", EquipStarEffectTipModel.GetStarNumberCHS(star)); |
| | | m_Content.text = PlayerPropertyConfig.GetFullDescription(property.x, property.y); |
| | | } |
| | | |
| | | public void DisplayGemHole(int star) |
| | | { |
| | | switch (star) |
| | | { |
| | | case 2: |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip3", EquipStarEffectTipModel.GetStarNumberCHS(2)); |
| | | break; |
| | | case 5: |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip3", EquipStarEffectTipModel.GetStarNumberCHS(3)); |
| | | break; |
| | | } |
| | | |
| | | m_ContainerContent.gameObject.SetActive(false); |
| | | } |
| | | |
| | | public void DisplayTrainLevelLimit(int star, int trainLevel) |
| | | { |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip5", trainLevel); |
| | | m_ContainerContent.gameObject.SetActive(false); |
| | | } |
| | | |
| | | public void DisplayStrengthLevelLimit(int star, int strengthLevel) |
| | | { |
| | | m_Title.text = Language.Get("StarUpgradeSuccessTip4", strengthLevel); |
| | | m_ContainerContent.gameObject.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| File was renamed from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: fc1debd8d9dee52449495425775ee957 |
| | | timeCreated: 1563429342 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | public class EquipStarSuccessModel : Model |
| | | { |
| | | public Int2 equipPosition { get; private set; } |
| | | public int star { get; private set; } |
| | | |
| | | public override void Init() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | } |
| | | |
| | | public void Show(Int2 equipPosition, int star) |
| | | { |
| | | this.equipPosition = equipPosition; |
| | | this.star = star; |
| | | WindowCenter.Instance.Open<EquipStarSuccessWin>(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarSuccessModel.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: db076c07a1f8c294e9a9bf4f91dab5a4 |
| | | timeCreated: 1563433157 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, July 18, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipStarSuccessWin : Window |
| | | { |
| | | [SerializeField] ScrollRect m_ScrollRect; |
| | | [SerializeField] Star[] m_Stars; |
| | | [SerializeField] ItemCell m_ItemCell; |
| | | [SerializeField] Text m_EquipStar; |
| | | [SerializeField] BaseProperty[] m_BaseProperties; |
| | | |
| | | [SerializeField] RectTransform m_CloseTip; |
| | | [SerializeField] Button m_Close; |
| | | |
| | | List<EquipStarSuccessActiveItemBehaviour> activeItemBehaviours = new List<EquipStarSuccessActiveItemBehaviour>(); |
| | | |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | EquipStarSuccessModel model { get { return ModelCenter.Instance.GetModel<EquipStarSuccessModel>(); } } |
| | | EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } } |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | m_Close.SetListener(() => { WindowCenter.Instance.Close<EquipStarSuccessWin>(); }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_CloseTip.gameObject.SetActive(false); |
| | | m_Close.gameObject.SetActive(false); |
| | | foreach (var behaviour in activeItemBehaviours) |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | |
| | | Clock.AlarmAfter(3f, () => |
| | | { |
| | | m_Close.gameObject.SetActive(true); |
| | | m_CloseTip.gameObject.SetActive(true); |
| | | }); |
| | | |
| | | DisplayItem(); |
| | | DisplayStars(); |
| | | DisplayBaseProperty(); |
| | | DisplaySpecialEffects(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | private void DisplayItem() |
| | | { |
| | | var equip = equipModel.GetEquip(model.equipPosition); |
| | | m_ItemCell.gameObject.SetActive(true); |
| | | m_ItemCell.Init(packModel.GetItemByGuid(equip)); |
| | | |
| | | m_EquipStar.gameObject.SetActive(true); |
| | | m_EquipStar.text = string.Format("{0}星", model.star); |
| | | } |
| | | |
| | | private void DisplayStars() |
| | | { |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(model.equipPosition.x); |
| | | var currentStar = model.star; |
| | | |
| | | for (int i = 0; i < m_Stars.Length; i++) |
| | | { |
| | | var behaviour = m_Stars[i]; |
| | | if (i < maxStarLevel) |
| | | { |
| | | if (i < currentStar) |
| | | { |
| | | behaviour.Display(true); |
| | | if (i == currentStar - 1) |
| | | { |
| | | behaviour.Display(false); |
| | | Clock.AlarmAfter(1f, () => |
| | | { |
| | | behaviour.Display(true); |
| | | behaviour.PlayScaleAnimation(); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | behaviour.Display(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | behaviour.Hide(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void DisplayBaseProperty() |
| | | { |
| | | var configs = EquipStarConfig.GetConfigs(model.equipPosition.x, model.equipPosition.y); |
| | | EquipStarConfig beforeConfig = null; |
| | | EquipStarConfig nowConfig = null; |
| | | |
| | | for (int i = 0; i < configs.Count; i++) |
| | | { |
| | | var config = configs[i]; |
| | | if (config.Star == model.star - 1) |
| | | { |
| | | beforeConfig = config; |
| | | } |
| | | else if (config.Star == model.star) |
| | | { |
| | | nowConfig = config; |
| | | } |
| | | } |
| | | |
| | | var nowValues = nowConfig.BaseAttrInfo; |
| | | var beforeValues = new Int2[nowValues.Length]; |
| | | if (beforeConfig != null) |
| | | { |
| | | for (var i = 0; i < beforeConfig.BaseAttrInfo.Length; i++) |
| | | { |
| | | beforeValues[i] = beforeConfig.BaseAttrInfo[i]; |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < m_BaseProperties.Length; i++) |
| | | { |
| | | var behaviour = m_BaseProperties[i]; |
| | | if (i < nowValues.Length) |
| | | { |
| | | behaviour.Display(nowValues[i].x, beforeValues[i].y, nowValues[i].y); |
| | | } |
| | | else |
| | | { |
| | | behaviour.Hide(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void DisplaySpecialEffects() |
| | | { |
| | | m_ScrollRect.verticalNormalizedPosition = 0f; |
| | | DisplaySuitEffect(); |
| | | DisplayStarProperty(); |
| | | DisplayGemHole(); |
| | | DisplayStrengthLevel(); |
| | | DisplayTrainLevel(); |
| | | } |
| | | |
| | | private void DisplaySuitEffect() |
| | | { |
| | | if (model.star % 3 == 0) |
| | | { |
| | | var count = 0; |
| | | for (int i = 1; i <= 8; i++) |
| | | { |
| | | var star = starModel.GetStarLevel(new Int2(model.equipPosition.x, i)); |
| | | if (star >= model.star) |
| | | { |
| | | count++; |
| | | } |
| | | } |
| | | |
| | | var behaviour = GetStarSuccessActiveItemBehaviour(); |
| | | var job = PlayerDatas.Instance.baseData.Job; |
| | | switch (count) |
| | | { |
| | | case 2: |
| | | var twoConfigs = EquipSuitConfig.GetConfigs(job, model.equipPosition.x, EquipSuitType.TwoSuit); |
| | | var twoConfig = twoConfigs.Find(x => { return x.star == model.star; }); |
| | | behaviour.DisplaySuitEffect(model.star, EquipSuitType.TwoSuit, twoConfig.attr); |
| | | break; |
| | | case 5: |
| | | var fiveConfigs = EquipSuitConfig.GetConfigs(job, model.equipPosition.x, EquipSuitType.FiveSuit); |
| | | var fiveConfig = fiveConfigs.Find(x => { return x.star == model.star; }); |
| | | behaviour.DisplaySuitEffect(model.star, EquipSuitType.FiveSuit, fiveConfig.attr); |
| | | break; |
| | | case 8: |
| | | var eightConfigs = EquipSuitConfig.GetConfigs(job, model.equipPosition.x, EquipSuitType.EightSuit); |
| | | var eightConfig = eightConfigs.Find(x => { return x.star == model.star; }); |
| | | if (eightConfig.skillID > 0) |
| | | { |
| | | behaviour.DisplaySuitEffect(model.star, eightConfig.description); |
| | | } |
| | | else |
| | | { |
| | | behaviour.DisplaySuitEffect(model.star, EquipSuitType.EightSuit, eightConfig.attr); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void DisplayStarProperty() |
| | | { |
| | | var beforeConfig = EquipStarConfig.Get(model.equipPosition.x, model.equipPosition.y, model.star - 1); |
| | | var nowConfig = EquipStarConfig.Get(model.equipPosition.x, model.equipPosition.y, model.star); |
| | | |
| | | if (beforeConfig == null || beforeConfig.StarAttrInfo.Length != nowConfig.StarAttrInfo.Length) |
| | | { |
| | | var behaviour = GetStarSuccessActiveItemBehaviour(); |
| | | behaviour.DisplayStarProperty(model.star, nowConfig.StarAttrInfo[nowConfig.StarAttrInfo.Length - 1]); |
| | | } |
| | | } |
| | | |
| | | private void DisplayGemHole() |
| | | { |
| | | if (model.star == 2 || model.star == 5) |
| | | { |
| | | var behaviour = GetStarSuccessActiveItemBehaviour(); |
| | | behaviour.DisplayGemHole(model.star); |
| | | } |
| | | } |
| | | |
| | | private void DisplayStrengthLevel() |
| | | { |
| | | var type = EquipStrengthModel.GetEquipStrengthType(model.equipPosition.y); |
| | | var beforeLevel = strengthModel.GetEquipLevelMax(type, model.star - 1); |
| | | var nowLevel = strengthModel.GetEquipLevelMax(type, model.star); |
| | | if (beforeLevel != nowLevel) |
| | | { |
| | | var behaviour = GetStarSuccessActiveItemBehaviour(); |
| | | behaviour.DisplayStrengthLevelLimit(model.star, nowLevel); |
| | | } |
| | | } |
| | | |
| | | private void DisplayTrainLevel() |
| | | { |
| | | var type = EquipTrainModel.GetTrainType(model.equipPosition.y); |
| | | var beforeConfig = WashLevelMaxConfig.Get(type, model.star - 1); |
| | | var nowConfig = WashLevelMaxConfig.Get(type, model.star); |
| | | if (beforeConfig == null || beforeConfig.levelMax != nowConfig.levelMax) |
| | | { |
| | | var behaviour = GetStarSuccessActiveItemBehaviour(); |
| | | behaviour.DisplayTrainLevelLimit(model.star, nowConfig.levelMax); |
| | | } |
| | | } |
| | | |
| | | private EquipStarSuccessActiveItemBehaviour GetStarSuccessActiveItemBehaviour() |
| | | { |
| | | foreach (var item in activeItemBehaviours) |
| | | { |
| | | if (!item.gameObject.activeInHierarchy) |
| | | { |
| | | item.gameObject.SetActive(true); |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | var instance = UIUtility.CreateWidget("EquipStarSuccessActiveItemBehaviour", "EquipStarSuccessActiveItemBehaviour"); |
| | | instance.transform.SetParentEx(m_ScrollRect.content, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | var behaviour = instance.GetComponent<EquipStarSuccessActiveItemBehaviour>(); |
| | | activeItemBehaviours.Add(behaviour); |
| | | return behaviour; |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class Star |
| | | { |
| | | public RectTransform container; |
| | | public Image imageBase; |
| | | public Image imageStar; |
| | | |
| | | public void Display(bool active) |
| | | { |
| | | container.gameObject.SetActive(true); |
| | | imageStar.gameObject.SetActive(active); |
| | | imageStar.transform.localScale = Vector3.one; |
| | | } |
| | | |
| | | public void Hide() |
| | | { |
| | | container.gameObject.SetActive(false); |
| | | } |
| | | |
| | | public void PlayScaleAnimation() |
| | | { |
| | | imageStar.transform.localScale = Vector3.one * 5; |
| | | imageStar.transform.DOScale(Vector3.one, 0.5f); |
| | | } |
| | | |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class BaseProperty |
| | | { |
| | | public RectTransform container; |
| | | public Text title; |
| | | public Text before; |
| | | public Text now; |
| | | |
| | | public void Hide() |
| | | { |
| | | container.gameObject.SetActive(false); |
| | | } |
| | | |
| | | public void Display(int id, int beforeValue, int nowValue) |
| | | { |
| | | container.gameObject.SetActive(true); |
| | | |
| | | var config = PlayerPropertyConfig.Get(id); |
| | | title.text = string.Format("{0}:", config.Name); |
| | | |
| | | before.text = beforeValue.ToString(); |
| | | now.text = nowValue.ToString(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
copy from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta
copy to System/EquipStar/EquipStarSuccessWin.cs.meta
| File was copied from System/EquipStar/EquipStarUpgradeMaterialBehaviour.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3889beff9a11c30418e483e2eaf500be |
| | | timeCreated: 1551342836 |
| | | guid: 511570dc42e578d4a84cd0584f1dbdd3 |
| | | timeCreated: 1563420827 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | |
| | | public class EquipStarWin : Window |
| | | { |
| | | |
| | | [SerializeField] RectTransform m_LevelContainer; |
| | | [SerializeField] ScrollRect m_LevelScrollRect; |
| | | [SerializeField] RectTransform m_OperateContainer; |
| | |
| | | [SerializeField] Star[] m_Stars; |
| | | [SerializeField] ItemCell m_TargetEquip; |
| | | [SerializeField] Text m_EquipStar; |
| | | [SerializeField] Materials m_Materials; |
| | | [SerializeField] EquipStarMaterialSelectButton m_MaterialSelect; |
| | | [SerializeField] EquipStarUpgradeSpecialMaterialBehaviour m_SpecialMaterial; |
| | | |
| | | [SerializeField] Text m_SuccessRate; |
| | | [SerializeField] RectTransform m_EmptyHint; |
| | | [SerializeField] RectTransform m_PropertyDetails; |
| | |
| | | [SerializeField] Text[] m_LevelUpPropertys; |
| | | [SerializeField] Button m_StarUpgrade; |
| | | [SerializeField] RectTransform m_MaxStarLevelHint; |
| | | [SerializeField] EquipStarMaterialCandidateWidget m_MaterialCandidateWidget; |
| | | [SerializeField] Button m_Preview; |
| | | [SerializeField] UIEffect m_EffectStarFill; |
| | | [SerializeField] UIEffect m_EffectSuccess; |
| | | [SerializeField] UIEffect m_EffectFailed; |
| | |
| | | EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | EquipStarEffectTipModel starEffectTipModel { get { return ModelCenter.Instance.GetModel<EquipStarEffectTipModel>(); } } |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | |
| | | protected override void AddListeners() |
| | | { |
| | | m_StarUpgrade.SetListener(StarUpgrade); |
| | | m_Preview.SetListener(() => |
| | | { |
| | | var equipStarEffectTipModel = ModelCenter.Instance.GetModel<EquipStarEffectTipModel>(); |
| | | equipStarEffectTipModel.Preview(new Int2(model.selectedLevel.value, model.selectedPlace.value)); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | DisplaySuccessRate(model.starUpgradeProbability.Fetch()); |
| | | } |
| | | |
| | | if (force || model.operateMaterialIndex.dirty) |
| | | { |
| | | var index = model.operateMaterialIndex.Fetch(); |
| | | DisplayMaterialCandidates(index); |
| | | } |
| | | |
| | | if (force || model.starResultEffect.dirty) |
| | | { |
| | | var result = model.starResultEffect.Fetch(); |
| | | model.starResultEffect.value = 0; |
| | | PlayStarUpgradeEffect(result); |
| | | } |
| | | |
| | | if (force || model.normalMaterials.dirty) |
| | | { |
| | | var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value); |
| | | var currentStarLevel = model.GetEquipStarLevel(equipPosition); |
| | | model.normalMaterials.Fetch(); |
| | | DisplayMaterialSlots(equipPosition, currentStarLevel); |
| | | } |
| | | } |
| | | |
| | |
| | | var upgradable = maxStarLevel > 0; |
| | | var isMax = upgradable && currentStarLevel >= maxStarLevel; |
| | | |
| | | if (!upgradable || isMax) |
| | | if (!upgradable || isMax ) |
| | | { |
| | | for (var i = 1; i <= 5; i++) |
| | | { |
| | | m_Materials[i].Display(false); |
| | | } |
| | | |
| | | m_Materials.materialSpecial.Display(false, 0, 0); |
| | | m_MaterialSelect.Display(true, 0); |
| | | m_SpecialMaterial.Display(false, 0, 0); |
| | | } |
| | | else |
| | | { |
| | | var starConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, currentStarLevel + 1); |
| | | for (var i = 1; i <= 5; i++) |
| | | var needEquip = starConfig.CostEquipCnt > 0; |
| | | if (needEquip) |
| | | { |
| | | m_Materials[i].Display(starConfig != null && i <= starConfig.CostEquipCnt); |
| | | if (model.normalMaterials.Count > 0) |
| | | { |
| | | var item = packModel.GetItemByGuid(model.normalMaterials[0]); |
| | | m_MaterialSelect.Display(false, item != null ? item.itemId : 0); |
| | | } |
| | | else |
| | | { |
| | | m_MaterialSelect.Display(false, 0); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_MaterialSelect.Display(true, 0); |
| | | } |
| | | |
| | | if (starConfig != null) |
| | | { |
| | | m_Materials.materialSpecial.Display(starConfig.CostItemDict.x != 0, starConfig.CostItemDict.x, starConfig.CostItemDict.y); |
| | | } |
| | | m_SpecialMaterial.Display(starConfig.CostItemDict.x != 0, starConfig.CostItemDict.x, starConfig.CostItemDict.y); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private void DisplayLevelUpProperty(Int2 equipPosition, int currentStar, int nextStar) |
| | | { |
| | | var configs = EquipStarConfig.GetConfigs(equipPosition.x, equipPosition.y); |
| | | var levelUpProperties = new Dictionary<int, Int2>(); |
| | | var prePropertiesCount = 0; |
| | | foreach (var config in configs) |
| | | { |
| | | if (config.StarAttrInfo.Length > prePropertiesCount) |
| | | { |
| | | var length = config.StarAttrInfo.Length; |
| | | levelUpProperties[config.Star] = config.StarAttrInfo[length - 1]; |
| | | prePropertiesCount = config.StarAttrInfo.Length; |
| | | } |
| | | } |
| | | |
| | | var keys = new List<int>(levelUpProperties.Keys); |
| | | var descriptions = starEffectTipModel.GetNextTwoSpecialEffect(equipPosition); |
| | | for (var i = 0; i < m_LevelUpPropertys.Length; i++) |
| | | { |
| | | var behaviour = m_LevelUpPropertys[i]; |
| | | if (i < keys.Count) |
| | | if (i < descriptions.Count) |
| | | { |
| | | var star = keys[i]; |
| | | var property = levelUpProperties[star]; |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.text = string.Format("【{0}星】{1}", star, PlayerPropertyConfig.GetFullDescription(property)); |
| | | behaviour.color = UIHelper.GetUIColor(currentStar >= star ? TextColType.Green : TextColType.Gray); |
| | | behaviour.text = descriptions[i]; |
| | | } |
| | | else |
| | | { |
| | |
| | | if (successRate >= 0) |
| | | { |
| | | m_SuccessRate.text = string.Format("成功率 {0}%", successRate); |
| | | |
| | | if (successRate < 50) |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.Red, true); |
| | | } |
| | | else if (successRate < 80) |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.NavyBrown, true); |
| | | } |
| | | else |
| | | { |
| | | m_SuccessRate.color = UIHelper.GetUIColor(TextColType.Green, true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_SuccessRate.text = string.Empty; |
| | | } |
| | | } |
| | | |
| | | private void DisplayMaterialCandidates(int materialIndex) |
| | | { |
| | | if (materialIndex == 0) |
| | | { |
| | | m_MaterialCandidateWidget.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | m_MaterialCandidateWidget.gameObject.SetActive(true); |
| | | |
| | | var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value); |
| | | var starLevel = model.GetEquipStarLevel(equipPosition); |
| | | m_MaterialCandidateWidget.Display(equipPosition, starLevel + 1); |
| | | |
| | | var position = Vector3.zero; |
| | | m_MaterialCandidateWidget.transform.localPosition = position; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (result == 1 || result == -1) |
| | | { |
| | | StopCoroutine("Co_PlaySuccessEffect"); |
| | | StopCoroutine("Co_PlayFailedEffect"); |
| | | //StopCoroutine("Co_PlaySuccessEffect"); |
| | | // StopCoroutine("Co_PlayFailedEffect"); |
| | | } |
| | | |
| | | if (result == 1) |
| | | { |
| | | StartCoroutine("Co_PlaySuccessEffect"); |
| | | //StartCoroutine("Co_PlaySuccessEffect"); |
| | | } |
| | | else if (result == -1) |
| | | { |
| | | StartCoroutine("Co_PlayFailedEffect"); |
| | | //StartCoroutine("Co_PlayFailedEffect"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class Materials |
| | | { |
| | | public EquipStarUpgradeMaterialBehaviour m_Material1; |
| | | public EquipStarUpgradeMaterialBehaviour m_Material2; |
| | | public EquipStarUpgradeMaterialBehaviour m_Material3; |
| | | public EquipStarUpgradeMaterialBehaviour m_Material4; |
| | | public EquipStarUpgradeMaterialBehaviour m_Material5; |
| | | public EquipStarUpgradeSpecialMaterialBehaviour materialSpecial; |
| | | |
| | | public EquipStarUpgradeMaterialBehaviour this[int index] { |
| | | get { |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | return m_Material1; |
| | | case 2: |
| | | return m_Material2; |
| | | case 3: |
| | | return m_Material3; |
| | | case 4: |
| | | return m_Material4; |
| | | case 5: |
| | | return m_Material5; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class BaseProperty |
| | | { |
| | | public RectTransform container; |
| | | public Text current; |
| | | public Image arrow; |
| | | public RectTransform arrow; |
| | | public Text next; |
| | | |
| | | public void Display(int propertyId, int currentValue, int nextValue) |
| | |
| | | auctionTipWidget.gameObject.SetActive(data.baseInfo.isAuction); |
| | | if (data.baseInfo.isAuction) |
| | | { |
| | | var overdueTime = DateTime.Now.AddSeconds((double)data.baseInfo.auctionSurplusTime); |
| | | var overdueTime = TimeUtility.ServerNow.AddSeconds((double)data.baseInfo.auctionSurplusTime); |
| | | auctionTipWidget.Display(overdueTime); |
| | | } |
| | | |
| | |
| | | m_AuctionWidget.gameObject.SetActive(data.baseInfo.isAuction); |
| | | if (data.baseInfo.isAuction) |
| | | { |
| | | var overdueTime = DateTime.Now.AddSeconds((double)data.baseInfo.auctionSurplusTime); |
| | | var overdueTime = TimeUtility.ServerNow.AddSeconds((double)data.baseInfo.auctionSurplusTime); |
| | | m_AuctionWidget.Display(overdueTime); |
| | | } |
| | | } |
| | |
| | | m_AuctionWidget.gameObject.SetActive(baseInfo.isAuction); |
| | | if (baseInfo.isAuction) |
| | | { |
| | | var overdueTime = DateTime.Now.AddSeconds((double)baseInfo.auctionSurplusTime); |
| | | var overdueTime = TimeUtility.ServerNow.AddSeconds((double)baseInfo.auctionSurplusTime); |
| | | m_AuctionWidget.Display(overdueTime); |
| | | } |
| | | } |
| | |
| | | m_AuctionTipWidget.gameObject.SetActive(baseInfo.isAuction); |
| | | if (baseInfo.isAuction) |
| | | { |
| | | var overdueTime = DateTime.Now.AddSeconds((double)baseInfo.auctionSurplusTime); |
| | | var overdueTime = TimeUtility.ServerNow.AddSeconds((double)baseInfo.auctionSurplusTime); |
| | | m_AuctionTipWidget.Display(overdueTime); |
| | | } |
| | | } |
| | |
| | | this.dirty = true; |
| | | } |
| | | |
| | | public bool Contains(T element) |
| | | { |
| | | return collect.Contains(element); |
| | | } |
| | | |
| | | public void Clear() |
| | | { |
| | | collect.Clear(); |