少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-01 d57686accebc3f3bbc81078e29bb0250c46ba105
3555 新版装备系统开发。
2个文件已修改
2个文件已添加
235 ■■■■■ 已修改文件
Core/GameEngine/Model/TelPartialConfig/PartialEquipStarConfig.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialEquipStarConfig.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarModel.cs 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarWin.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialEquipStarConfig.cs
New file
@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public partial class EquipStarConfig : IConfigPostProcess
{
    static Dictionary<int, EquipStarConfig> equipStarConfigs = new Dictionary<int, EquipStarConfig>();
    public void OnConfigParseCompleted()
    {
        var key = Level * 10000 + EquipPlace * 100 + Star;
        equipStarConfigs[key] = this;
    }
    public static EquipStarConfig Get(int level, int equipPlace, int star)
    {
        var key = Level * 10000 + EquipPlace * 100 + Star;
        if (equipStarConfigs.ContainsKey(key))
        {
            return equipStarConfigs[key];
        }
        else
        {
            return null;
        }
    }
}
Core/GameEngine/Model/TelPartialConfig/PartialEquipStarConfig.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f4e9844d40f5cda48bdfd22a4ec8ab42
timeCreated: 1551447991
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/EquipStar/EquipStarModel.cs
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
namespace Snxxz.UI
{
@@ -8,12 +9,7 @@
    {
        public readonly LogicString selectedEquip = new LogicString();
        public readonly LogicInt equipStarLevel = new LogicInt();
        public readonly LogicString material_1 = new LogicString();
        public readonly LogicString material_2 = new LogicString();
        public readonly LogicString material_3 = new LogicString();
        public readonly LogicString material_4 = new LogicString();
        public readonly LogicString material_5 = new LogicString();
        public readonly LogicString material_6 = new LogicString();
        public readonly Dictionary<int, LogicString> materials = new Dictionary<int, LogicString>();
        public readonly LogicInt starUpgradeProbability = new LogicInt();
        Dictionary<int, EquipSetStar> equipStars = new Dictionary<int, EquipSetStar>();
@@ -131,6 +127,18 @@
            }
        }
        public int GetMaxStarLevel(int level)
        {
            if (maxStarLevels.ContainsKey(level))
            {
                return maxStarLevels[level];
            }
            else
            {
                return 0;
            }
        }
        public int GetTotalStarLevel(int level)
        {
            if (!equipStars.ContainsKey(level))
@@ -161,8 +169,14 @@
            return equipStars[level].GetEquipCountWhichStarLevelLq(standard);
        }
        public List<ItemModel> GetMaterials(int level, int place)
        public List<ItemModel> GetMaterials(int level, int place, int starLevel)
        {
            var config = EquipStarConfig.Get(level, place, starLevel);
            if (config == null)
            {
                return null;
            }
            var equipGuid = equipModel.GetEquipSet(level).GetEquip(place);
            var equip = packModel.GetItemByGuid(equipGuid);
            if (equip == null)
@@ -178,60 +192,21 @@
                itemType = 0
            });
            switch (equip.config.EquipPlace)
            for (var i = expcetMaterials.Count - 1; i >= 0; i--)
            {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                case 8:
                    for (var i = expcetMaterials.Count - 1; i >= 0; i--)
                    {
                        var item = expcetMaterials[i];
                        if (item.config.RealmLimit != equip.config.RealmLimit)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                        else if (item.config.EquipPlace < 1 || item.config.EquipPlace > 8)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                        else if (item.config.ItemColor != 4)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                    }
                    break;
                case 9:
                case 10:
                case 11:
                case 12:
                    for (var i = expcetMaterials.Count - 1; i >= 0; i--)
                    {
                        var item = expcetMaterials[i];
                        if (item.config.RealmLimit != equip.config.RealmLimit)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                        else if (item.config.EquipPlace < 9 || item.config.EquipPlace > 12)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                        else if (item.config.ItemColor != 4)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                        else if (item.config.EquipPlace != equip.config.EquipPlace)
                        {
                            expcetMaterials.RemoveAt(i);
                        }
                    }
                    break;
                default:
                    break;
                var item = expcetMaterials[i];
                if (item.config.RealmLimit != equip.config.RealmLimit)
                {
                    expcetMaterials.RemoveAt(i);
                }
                else if (!config.CostEquipPlace.Contains(item.config.EquipPlace))
                {
                    expcetMaterials.RemoveAt(i);
                }
                else if (!config.CostEquipColor.Contains(item.config.ItemColor))
                {
                    expcetMaterials.RemoveAt(i);
                }
            }
            for (var i = 1; i <= 6; i++)
@@ -271,23 +246,7 @@
        public LogicString GetMaterialLogicStringByIndex(int index)
        {
            switch (index)
            {
                case 1:
                    return material_1;
                case 2:
                    return material_2;
                case 3:
                    return material_3;
                case 4:
                    return material_4;
                case 5:
                    return material_5;
                case 6:
                    return material_6;
                default:
                    return null;
            }
            return materials.ContainsKey(index - 1) ? materials[index - 1] : null;
        }
        private void ParseConfig()
System/EquipStar/EquipStarWin.cs
@@ -23,8 +23,6 @@
        [SerializeField] Button m_StarUpgrade;
        EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        #region Built-in
@@ -39,6 +37,8 @@
        protected override void OnPreOpen()
        {
            DisplayBaseInfo();
            DisplayDynamicInfo(true);
        }
        protected override void OnAfterOpen()
@@ -52,16 +52,81 @@
        protected override void OnAfterClose()
        {
        }
        protected override void LateUpdate()
        {
            base.LateUpdate();
            DisplayDynamicInfo(false);
        }
        #endregion
        private void DisplayBaseInfo()
        {
            var equip = packModel.GetItemByGuid(model.selectedEquip.Fetch());
            var currentStarLevel = model.GetEquipStarLevel(equip.config.LV, equip.config.EquipPlace);
            var starConfig = EquipStarConfig.Get(equip.config.LV, equip.config.EquipPlace, currentStarLevel);
            for (var i = 1; i <= 5; i++)
            {
                m_Materials[i].Display(i >= starConfig.CostEquipCnt);
            }
            m_Materials[6].Display(starConfig.CostItemDict.x == 0);
        }
        private void DisplayDynamicInfo(bool force)
        {
            if (force || model.selectedEquip.dirty)
            {
                var equip = packModel.GetItemByGuid(model.selectedEquip.Fetch());
                m_TargetEquip.Init(equip);
                var currentStarLevel = model.GetEquipStarLevel(equip.config.LV, equip.config.EquipPlace);
                var maxStarLevel = model.GetMaxStarLevel(equip.config.LV);
                for (var i = 0; i < m_Stars.Length; i++)
                {
                    m_Stars[i].gameObject.SetActive(i < maxStarLevel);
                    if (i < maxStarLevel)
                    {
                        m_Stars[i].SetSprite(i < currentStarLevel ? "" : "");
                    }
                }
                var starConfig = EquipStarConfig.Get(equip.config.LV, equip.config.EquipPlace, currentStarLevel);
                var equalCount = Mathf.Min(starConfig.BaseAttrInfo.Length, starConfig.StarAttrInfo.Length);
                for (var i = 0; i < m_PropertyPreviews.Length; i++)
                {
                    var behaviour = m_PropertyPreviews[i];
                    if (i < equalCount)
                    {
                        behaviour.Display(starConfig.BaseAttrInfo[i].x, starConfig.BaseAttrInfo[i].y, starConfig.StarAttrInfo[i].y);
                    }
                    else
                    {
                        behaviour.Hide();
                    }
                }
                var newCount = starConfig.StarAttrInfo.Length - starConfig.BaseAttrInfo.Length;
                if (newCount > 0)
                {
                    var property = starConfig.StarAttrInfo[starConfig.StarAttrInfo.Length - 1];
                    var propertyConfig = PlayerPropertyConfig.Get(property.x);
                    var valueDescription = propertyConfig.ISPercentage == 1
                        ? StringUtility.Contact(Mathf.RoundToInt(property.y * 0.01f), "%") : property.y.ToString();
                    m_NewProperty.text = StringUtility.Contact(propertyConfig.Name, " +", valueDescription);
                    m_NewProperty.gameObject.SetActive(true);
                }
                else
                {
                    m_NewProperty.gameObject.SetActive(false);
                }
            }
            if (force || model.starUpgradeProbability.dirty)
            {
                m_SuccessRate.text = string.Format("成功率 {0}", model.starUpgradeProbability.Fetch());
            }
        }
        private void StarUpgrade()
@@ -80,8 +145,10 @@
            public EquipStarUpgradeMaterialBehaviour m_Material5;
            public EquipStarUpgradeMaterialBehaviour m_MaterialSpecial;
            public EquipStarUpgradeMaterialBehaviour this[int index] {
                get {
            public EquipStarUpgradeMaterialBehaviour this[int index]
            {
                get
                {
                    switch (index)
                    {
                        case 1:
@@ -107,12 +174,14 @@
        [System.Serializable]
        public class PropertyPreview
        {
            public RectTransform container;
            public Text propertyName;
            public Text current;
            public Text next;
            public void Display(int propertyId, int currentValue, int nextValue)
            {
                container.gameObject.SetActive(true);
                var config = PlayerPropertyConfig.Get(propertyId);
                if (config != null)
                {
@@ -125,6 +194,10 @@
                }
            }
            public void Hide()
            {
                container.gameObject.SetActive(false);
            }
        }