少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-01 44aade95a2a13d0126c532c6a3fc2f1263988f49
3555 新版装备系统开发。
4个文件已修改
104 ■■■■■ 已修改文件
System/Equip/EquipLevelSelectBehaviour.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipModel.cs 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipSet.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipSlotBehaviour.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipLevelSelectBehaviour.cs
@@ -55,6 +55,15 @@
            m_Icon.SetSprite(icon);
            m_LevelName.text = string.Empty;
            var unLocked = equipSet.unLocked;
            m_UnLockCondition.gameObject.SetActive(unLocked);
            m_Icon.material = unLocked ? m_MaterialNormal : m_MaterialLocked;
            m_LevelName.color = m_FontColor.GetColorSize(unLocked ? "" : "").color;
            if (!unLocked)
            {
                m_UnLockCondition.text = string.Empty;
            }
            m_Redpoint.redpointId = this.equipSet.redpoint.id;
        }
@@ -69,19 +78,6 @@
            {
                m_SelectedSign.gameObject.SetActive(equipSet.selected.Fetch());
            }
            if (force || equipSet.unLocked.dirty)
            {
                var unLocked = equipSet.unLocked.Fetch();
                m_UnLockCondition.gameObject.SetActive(unLocked);
                m_Icon.material = unLocked ? m_MaterialNormal : m_MaterialLocked;
                m_LevelName.color = m_FontColor.GetColorSize(unLocked ? "" : "").color;
                if (!unLocked)
                {
                    m_UnLockCondition.text = string.Empty;
                }
            }
        }
    }
System/Equip/EquipModel.cs
@@ -7,6 +7,16 @@
{
    public class EquipModel : Model
    {
        public int showedUnLockLevel {
            get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), 1); }
            set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), value); }
        }
        public int showedUnLockSlot {
            get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSlotUnLockHasShowed"), 1); }
            set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSlotUnLockHasShowed"), value); }
        }
        public readonly LogicInt selectedLevel = new LogicInt();
        public readonly LogicInt selectedPlace = new LogicInt();
        public readonly LogicString selectedEquip = new LogicString();
@@ -21,11 +31,7 @@
        public override void Init()
        {
            for (var i = 0; i < 20; i++)
            {
                equipSets[i + 1] = new EquipSet(i + 1);
            }
            ParseConfig();
            packModel.refrechPackEvent += OnItemPackRefresh;
            packModel.refreshItemCountEvent += OnItemCountRefresh;
            PlayerDatas.Instance.PlayerDataRefreshEvent += OnPlayerDataRefresh;
@@ -179,7 +185,7 @@
                return false;
            }
            return equipSets[level].unLocked.value;
            return equipSets[level].unLocked;
        }
        public void PutOn(string equipGuid)
@@ -197,7 +203,7 @@
            }
            var set = equipSets[level];
            if (!set.unLocked.value)
            if (!set.unLocked)
            {
                return;
            }
@@ -224,7 +230,7 @@
            }
            var set = equipSets[level];
            if (set.unLocked.value)
            if (set.unLocked)
            {
                return;
            }
@@ -292,10 +298,13 @@
        private void UpdateRedpoints()
        {
            var equips = new List<ItemModel>();
            for (var i = 101; i < 110; i++)
            for (var i = 1; i <= 12; i++)
            {
                var type = i;
                var items = packModel.GetItemsByType(PackType.Item, type);
                var items = packModel.GetItems(new SinglePack.FilterParams()
                {
                    equipType = i,
                });
                if (items != null)
                {
                    equips.AddRange(items);
@@ -305,7 +314,7 @@
            var hints = new Dictionary<int, bool>();
            foreach (var item in equipSets)
            {
                if (item.Value.unLocked.value)
                if (item.Value.unLocked)
                {
                    hints[item.Key] = false;
                }
@@ -332,10 +341,14 @@
        private void UpdateRedpoint(int level)
        {
            var equips = new List<ItemModel>();
            for (var i = 101; i < 110; i++)
            for (var i = 1; i <= 12; i++)
            {
                var type = i;
                var items = packModel.GetItemsByType(PackType.Item, type);
                var items = packModel.GetItems(new SinglePack.FilterParams()
                {
                    level = level,
                    equipType = i,
                });
                if (items != null)
                {
                    equips.AddRange(items);
@@ -359,6 +372,25 @@
        }
        private void ParseConfig()
        {
            var configs = EquipControlConfig.GetValues();
            var setLevelToRealms = new Dictionary<int, int>();
            foreach (var item in configs)
            {
                var level = item.level;
                var currentRealm = setLevelToRealms.ContainsKey(level) ? 9999 : setLevelToRealms[level];
                if (item.realm < currentRealm)
                {
                    setLevelToRealms[level] = item.realm;
                }
            }
            foreach (var item in setLevelToRealms)
            {
                equipSets[item.Key] = new EquipSet(item.Key, item.Value);
            }
        }
    }
    public struct EquipSuitPropertyEntry
System/Equip/EquipSet.cs
@@ -8,7 +8,8 @@
    public class EquipSet
    {
        public readonly int level;
        public readonly LogicBool unLocked = new LogicBool(false);
        public readonly int realm;
        public bool unLocked { get { return PlayerDatas.Instance.baseData.realmLevel >= realm; } }
        public readonly LogicBool selected = new LogicBool();
        public readonly Redpoint redpoint = new Redpoint(1);
@@ -16,13 +17,13 @@
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        public EquipSet(int level)
        public EquipSet(int level, int realm)
        {
            this.level = level;
            for (var i = 0; i < 12; i++)
            this.realm = realm;
            for (var i = 1; i <= 12; i++)
            {
                equipSlots[i + 1] = new EquipSlot(this.level, i + 1);
                equipSlots[i] = new EquipSlot(this.level, i);
            }
        }
System/Equip/EquipSlotBehaviour.cs
@@ -12,15 +12,12 @@
    public class EquipSlotBehaviour : MonoBehaviour
    {
        [SerializeField] Button m_Select;
        [SerializeField] RectTransform m_UnLockOperateContainer;
        [SerializeField] Button m_UnLock;
        [SerializeField] Text m_SlotName;
        [SerializeField] Image m_Icon;
        [SerializeField] Image m_IconFrame;
        [SerializeField] RectTransform m_LockContainer;
        [SerializeField] Text m_UnLockCondition;
        [SerializeField] Text m_UnLockHint;
        EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
@@ -75,12 +72,10 @@
                    if (realmLevel >= needRealm)
                    {
                        m_UnLockCondition.gameObject.SetActive(false);
                        m_UnLockHint.gameObject.SetActive(true);
                    }
                    else
                    {
                        m_UnLockCondition.gameObject.SetActive(true);
                        m_UnLockHint.gameObject.SetActive(false);
                        m_UnLockCondition.text = string.Format("境界{0}解锁", needRealm);
                    }
                }
@@ -114,10 +109,6 @@
            if (slot.unLocked.value)
            {
                model.SelectSet(this.level, slot.place);
            }
            else
            {
                m_UnLockOperateContainer.gameObject.SetActive(true);
            }
        }