5 文件已复制
3个文件已删除
1 文件已重命名
14个文件已添加
4个文件已修改
| 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) |
| | | { |
| | | effectInfos[i] = new List<SuitEffectInfo>(); |
| | | if (maxStarLevel >= i) |
| | | { |
| | | 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; |
| | | foreach (var config in configs) |
| | | { |
| | | if (config.star == i) |
| | | { |
| | | skillId = config.skillID; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | effectInfos[i].Add(new SuitEffectInfo() |
| | | { |
| | | suitType = EquipSuitType.EightSuit, |
| | | star = i, |
| | | actived = eightSuit.actived, |
| | | properties = eightSuit.properties, |
| | | skillId = skillId |
| | | }); |
| | | } |
| | | } |
| | | |
| | | 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.GetStarLevel(equipPosition); |
| | | var configs = EquipStarConfig.GetConfigs(equipPosition.x, equipPosition.y); |
| | | EquipStarConfig preConfig = null; |
| | | for (var i = 0; i < configs.Count; i++) |
| | | { |
| | | var config = configs[i]; |
| | | if (config.Star <= maxStarLevel && (preConfig == null || preConfig.StarAttrInfo.Length != config.StarAttrInfo.Length)) |
| | | { |
| | | effectInfos.Add(new StarProperty() |
| | | { |
| | | star = config.Star, |
| | | actived = starLevel >= config.Star, |
| | | property = config.StarAttrInfo[config.StarAttrInfo.Length - 1] |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<GemHoleInfo> GetGemHoleInfos(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<GemHoleInfo>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetStarLevel(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.GetStarLevel(equipPosition); |
| | | var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); |
| | | for (int i = 0; i <= maxStarLevel; i++) |
| | | { |
| | | var levelLimit = strengthModel.GetEquipLevelMax(strengthType, i); |
| | | if (levelLimit != 0) |
| | | { |
| | | effectInfos.Add(new StrengthLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
| | | } |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public List<TrainLevelInfo> GetTrainLevelInfos(Int2 equipPosition) |
| | | { |
| | | var effectInfos = new List<TrainLevelInfo>(); |
| | | var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
| | | var starLevel = starModel.GetStarLevel(equipPosition); |
| | | for (int i = 0; i <= maxStarLevel; i++) |
| | | { |
| | | var levelLimit = trainModel.GetMaxTrainLevel(equipPosition.y); |
| | | if (levelLimit != 0) |
| | | { |
| | | effectInfos.Add(new TrainLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
| | | } |
| | | } |
| | | |
| | | return effectInfos; |
| | | } |
| | | |
| | | public struct SuitEffectInfo |
| | | { |
| | | public int star; |
| | | public bool actived; |
| | | public EquipSuitType suitType; |
| | | |
| | | public List<Int2> properties; |
| | | public int skillId; |
| | | } |
| | | |
| | | 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 = 0f; |
| | | } |
| | | #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 effectInfos) |
| | | { |
| | | m_SuitBehaviours[item.Key / 3].Display(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] = StringUtility.Contact("【{0}星】 {1}", GetStarNumberCHS(info.star), property); |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i]); |
| | | } |
| | | |
| | | 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] = StringUtility.Contact("【{0}星】 解锁宝石孔{1}", GetStarNumberCHS(info.star), GetStarNumberCHS(info.index)); |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i]); |
| | | } |
| | | |
| | | m_StengthLimit.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] = StringUtility.Contact("【{0}星】 提升至{1}", GetStarNumberCHS(info.star), info.level); |
| | | descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
| | | : UIHelper.AppendColor(TextColType.White, descriptions[i]); |
| | | } |
| | | |
| | | m_GemHole.text = string.Join("\n", descriptions); |
| | | } |
| | | |
| | | private void DisplayTrainLimit() |
| | | { |
| | | |
| | | } |
| | | |
| | | |
| | | private 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 ""; |
| | | } |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class SuitBehaviour |
| | | { |
| | | public RectTransform container; |
| | | public Text title; |
| | | public Text content; |
| | | |
| | | public void Display(List<EquipStarEffectTipModel.SuitEffectInfo> effectInfos) |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
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); |
| | | |
| | | 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; |
| | | selectModel.AddMaterial(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) |
| | | { |
| | | 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(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| File was renamed 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; |
| | | |
| | | public void SetLock(bool isLock) |
| | | { |
| | | m_Lock.SetActive(isLock); |
| | | } |
| | | |
| | | public void Display(int itemId) |
| | | { |
| | | SetLock(false); |
| | | m_SelectMaterial.SetListener(OpenMaterialSelectWin); |
| | | m_Add.gameObject.SetActive(itemId == 0); |
| | | m_ItemBehaviour.gameObject.SetActive(itemId != 0); |
| | | if (itemId != 0) |
| | | { |
| | | m_ItemBehaviour.SetItem(itemId, 0); |
| | | } |
| | | } |
| | | |
| | | public void Dispose() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OpenMaterialSelectWin() |
| | | { |
| | | 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>(); |
| | | |
| | | public override void Init() |
| | | { |
| | | |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void AddMaterial(string guid) |
| | | { |
| | | 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; |
| | | foreach (var material in selectedMaterials) |
| | | { |
| | | rate += 0.1f; |
| | | } |
| | | |
| | | 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>(); } } |
| | | |
| | | #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(); |
| | | 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); |
| | | if (!materials.IsNullOrEmpty()) |
| | | { |
| | | m_MaterialScroll.Init(GetMaterialCouples(materials)); |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | private void DisplaySuccessRate() |
| | | { |
| | | m_SuccessRate.text = StringUtility.Contact(Mathf.RoundToInt(model.CalculateSuccessRate() * 100), "%"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
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(); |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void CalculateStarUpgradeProbability(Int2 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); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | private void UpdateSelelctedEquipStars(int oldStarLevel, int newStarLevel, int maxStarLevel) |
| | |
| | | |
| | | 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; |
| | |
| | | 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(); |
| | |
| | | |
| | | if (!upgradable || isMax) |
| | | { |
| | | for (var i = 1; i <= 5; i++) |
| | | { |
| | | m_Materials[i].Display(false); |
| | | } |
| | | |
| | | m_Materials.materialSpecial.Display(false, 0, 0); |
| | | m_MaterialSelect.SetLock(true); |
| | | m_SpecialMaterial.Display(false, 0, 0); |
| | | } |
| | | else |
| | | { |
| | | var starConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, currentStarLevel + 1); |
| | | for (var i = 1; i <= 5; i++) |
| | | if (model.normalMaterials.Count > 0) |
| | | { |
| | | m_Materials[i].Display(starConfig != null && i <= starConfig.CostEquipCnt); |
| | | var item = packModel.GetItemByGuid(model.normalMaterials[0]); |
| | | m_MaterialSelect.Display(item != null ? item.itemId : 0); |
| | | } |
| | | else |
| | | { |
| | | m_MaterialSelect.Display(0); |
| | | } |
| | | |
| | | if (starConfig != null) |
| | | { |
| | | m_Materials.materialSpecial.Display(starConfig.CostItemDict.x != 0, starConfig.CostItemDict.x, starConfig.CostItemDict.y); |
| | | } |
| | | var starConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, currentStarLevel + 1); |
| | | m_SpecialMaterial.Display(starConfig.CostItemDict.x != 0, starConfig.CostItemDict.x, starConfig.CostItemDict.y); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | private void DisplayStarUpgradeButton(Int2 equipPosition, int currentStarLevel) |
| | | { |
| | | if (equipPosition.y == 0) |
| | |
| | | { |
| | | 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"); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | newStarEffect.Play(); |
| | | } |
| | | } |
| | | |
| | | [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] |
| | |
| | | this.dirty = true; |
| | | } |
| | | |
| | | public bool Contains(T element) |
| | | { |
| | | return collect.Contains(element); |
| | | } |
| | | |
| | | public void Clear() |
| | | { |
| | | collect.Clear(); |