少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-04 57f21b5ec74d8164ddbcca3538aecb73e2a3706f
3555 新版装备功能开发
9个文件已修改
8个文件已添加
401 ■■■■ 已修改文件
Core/GameEngine/DataToCtl/PackageRegedit.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialEquipPlaceMapConfig.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialEquipPlaceMapConfig.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C5_tagCMEquipPartStarUp.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C5_tagCMEquipPartStarUp.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B1_tagMCEquipPartStarInfo.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B1_tagMCEquipPartStarInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA3_Function/HA3B1_tagMCEquipPartStarInfo.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA3_Function/HA3B1_tagMCEquipPartStarInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipLevelSelectBehaviour.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipModel.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipSet.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/EquipSuitPropertyWidget.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Equip/RealmEquipWin.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStar.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarModel.cs 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarWin.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -29,6 +29,7 @@
    public static void Init()
    {
        // 登记相应的数据体及对应的数据转逻辑类
        Register(typeof(HA3B1_tagMCEquipPartStarInfo), typeof(DTCA3B1_tagMCEquipPartStarInfo));
        Register(typeof(HA816_tagMCMysticalShopInfo), typeof(DTCA816_tagMCMysticalShopInfo));
        Register(typeof(HAC11_tagGCFeastRedPacketInfo), typeof(DTCAC11_tagGCFeastRedPacketInfo));
        Register(typeof(HAB25_tagMCFeastRedPackInfo), typeof(DTCAB25_tagMCFeastRedPackInfo));
Core/GameEngine/Model/TelPartialConfig/PartialEquipPlaceMapConfig.cs
New file
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public partial class EquipPlaceMapConfig : IConfigPostProcess
{
    static Dictionary<int, int> clientPlaceToServerPlace = new Dictionary<int, int>();
    public void OnConfigParseCompleted()
    {
        clientPlaceToServerPlace[LV * 100 + EquipPlace] = PackIndex;
    }
    public static int GetServerPlace(int level, int equipPlace)
    {
        var key = level * 100 + equipPlace;
        if (clientPlaceToServerPlace.ContainsKey(key))
        {
            return clientPlaceToServerPlace[key];
        }
        else
        {
            return 0;
        }
    }
}
Core/GameEngine/Model/TelPartialConfig/PartialEquipPlaceMapConfig.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5575604ea3a7ff34d97988215afd52dd
timeCreated: 1551686215
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C5_tagCMEquipPartStarUp.cs
New file
@@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
// A5 C5 装备部位升星 #tagCMEquipPartStarUp
public class CA5C5_tagCMEquipPartStarUp : GameNetPackBasic
{
    public ushort EquipPackIndex;    // 部位格子索引
    public byte CostEquipCnt;    // 装备个数
    public ushort[] CostEquipIndex;    // 装备索引
    public uint[] CostEquipID;    // 装备物品ID
    public CA5C5_tagCMEquipPartStarUp()
    {
        combineCmd = (ushort)0x03FE;
        _cmd = (ushort)0xA5C5;
    }
    public override void WriteToBytes()
    {
        WriteBytes(EquipPackIndex, NetDataType.WORD);
        WriteBytes(CostEquipCnt, NetDataType.BYTE);
        WriteBytes(CostEquipIndex, NetDataType.WORD, CostEquipCnt);
        WriteBytes(CostEquipID, NetDataType.DWORD, CostEquipCnt);
    }
}
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C5_tagCMEquipPartStarUp.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0e0e73c681efe2a439a71954e7dab705
timeCreated: 1551685504
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B1_tagMCEquipPartStarInfo.cs
New file
@@ -0,0 +1,13 @@
using UnityEngine;
using System.Collections;
using Snxxz.UI;
// A3 B1 装备部位星数信息 #tagMCEquipPartStarInfo
public class DTCA3B1_tagMCEquipPartStarInfo : DtcBasic
{     EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
    public override void Done(GameNetPackBasic vNetPack)
    {         base.Done(vNetPack);
        var vNetData = vNetPack as HA3B1_tagMCEquipPartStarInfo;         model.UpdateStarLevels(vNetData);
    }
}
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B1_tagMCEquipPartStarInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 718480869f00d38488b3c37ffc53c5bc
timeCreated: 1551687370
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ServerPack/HA3_Function/HA3B1_tagMCEquipPartStarInfo.cs
New file
@@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
// A3 B1 装备部位星数信息 #tagMCEquipPartStarInfo
public class HA3B1_tagMCEquipPartStarInfo : GameNetPackBasic {
    public byte Count;    // 信息个数
    public  tagMCEquipPartStar[] InfoList = null;    // 信息列表
    public HA3B1_tagMCEquipPartStarInfo () {
        _cmd = (ushort)0xA3B1;
    }
    public override void ReadFromBytes (byte[] vBytes) {
        TransBytes (out Count, vBytes, NetDataType.BYTE);
        InfoList = new tagMCEquipPartStar[Count];
        for (int i = 0; i < Count; i ++) {
            InfoList[i] = new tagMCEquipPartStar();
            TransBytes (out InfoList[i].EquipPackIndex, vBytes, NetDataType.WORD);
            TransBytes (out InfoList[i].Star, vBytes, NetDataType.BYTE);
        }
    }
    public struct tagMCEquipPartStar {
        public ushort EquipPackIndex;
        public byte Star;
    }
}
Core/NetworkPackage/ServerPack/HA3_Function/HA3B1_tagMCEquipPartStarInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0169900e0e4c9a0428ac35731c220f82
timeCreated: 1551687369
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Equip/EquipLevelSelectBehaviour.cs
@@ -9,29 +9,23 @@
namespace Snxxz.UI
{
    public class EquipLevelSelectBehaviour : ScrollItem
    public class EquipLevelSelectBehaviour : MonoBehaviour
    {
        [SerializeField] RectTransform m_AppearanceSign;
        [SerializeField] RedpointBehaviour m_Redpoint;
        [SerializeField] RectTransform m_SelectedSign;
        [SerializeField] Button m_Select;
        [SerializeField] Image m_Icon;
        [SerializeField] Text m_LevelName;
        [SerializeField] RectTransform m_LockContainer;
        [SerializeField] Text m_UnLockCondition;
        [SerializeField] Material m_MaterialNormal;
        [SerializeField] Material m_MaterialLocked;
        [SerializeField] FontColorSizeConfig m_FontColor;
        [SerializeField] FontColorSizeConfig m_FontConfig;
        EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        int level = 0;
        EquipSet equipSet;
        public override void Display(object data)
        public void Display(int level)
        {
            base.Display(data);
            this.level = (int)data;
            this.level = level;
            this.equipSet = model.GetEquipSet(level);
            this.m_Select.SetListener(() => { model.SelectSet(this.level, 0); });
@@ -39,9 +33,8 @@
            UpdateDynamicInfo(true);
        }
        public override void Dispose()
        public void Dispose()
        {
            base.Dispose();
        }
        private void LateUpdate()
@@ -56,14 +49,7 @@
            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_LockContainer.gameObject.SetActive(!unLocked);
            m_Redpoint.redpointId = this.equipSet.redpoint.id;
        }
@@ -76,7 +62,9 @@
            if (force || equipSet.selected.dirty)
            {
                m_SelectedSign.gameObject.SetActive(equipSet.selected.Fetch());
                var selected = equipSet.selected.Fetch();
                m_Icon.SetSprite(equipSet.selected.Fetch() ? "Title_Clicked" : "Title_Normal");
                m_LevelName.color = m_FontConfig.GetColorSize(selected ? "Selected" : "Normal").color;
            }
        }
System/Equip/EquipModel.cs
@@ -131,6 +131,30 @@
            return new List<int>(equipSets.Keys);
        }
        public List<int> GetViewableEquipSets()
        {
            var sets = new List<int>();
            var enumerator = equipSets.GetEnumerator();
            while (enumerator.MoveNext())
            {
                if (enumerator.Current.Value.unLocked)
                {
                    sets.Add(enumerator.Current.Value.level);
                }
                else
                {
                    break;
                }
            }
            if (enumerator.Current.Value != null)
            {
                sets.Add(enumerator.Current.Value.level);
            }
            return sets;
        }
        public EquipSet GetEquipSet(int level)
        {
            if (!equipSets.ContainsKey(level))
System/Equip/EquipSet.cs
@@ -238,6 +238,11 @@
            }
        }
        public static int ClientPlaceToServerPlace(int level, int place)
        {
            return EquipPlaceMapConfig.GetServerPlace(level, place);
        }
    }
    public struct EquipAppearance
System/Equip/EquipSuitPropertyWidget.cs
@@ -13,6 +13,7 @@
    public class EquipSuitPropertyWidget : MonoBehaviour
    {
        [SerializeField] Text m_SuitName;
        [SerializeField] StarToggle[] m_StarToggles;
        [SerializeField] Text[] m_SuitEquipNames;
        [SerializeField] EquipSuitPropertyBar m_TwoSuit;
@@ -69,6 +70,45 @@
            return string.Join("\n", lines.ToArray());
        }
        public class StarToggle
        {
            public int star;
            public Text title;
            public Toggle toggle;
            public void Display()
            {
                title.gameObject.SetActive(true);
            }
            public void Hide()
            {
            }
            private void OnValueChange(bool value)
            {
                if (value)
                {
                    switch (star)
                    {
                        case 0:
                            break;
                        case 3:
                            break;
                        case 6:
                            break;
                        case 9:
                            break;
                        default:
                            break;
                    }
                }
            }
        }
    }
}
System/Equip/RealmEquipWin.cs
@@ -14,6 +14,7 @@
    public class RealmEquipWin : Window
    {
        [SerializeField] RectTransform m_LevelsContainer;
        [SerializeField] EquipSlots m_EquipSlots;
        [SerializeField] Text m_FightPoint;
        [SerializeField] RawImage m_Role;
@@ -21,6 +22,9 @@
        [SerializeField] EquipSuitPropertyWidget m_SuitPropertyWidget;
        [SerializeField] CandidateEquipWidget m_CandidateEquipWidget;
        List<EquipLevelSelectBehaviour> levelSelectBehaviours = new List<EquipLevelSelectBehaviour>();
        List<GameObject> emptyFillers = new List<GameObject>();
        EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
@@ -53,9 +57,8 @@
        protected override void OnActived()
        {
            base.OnActived();
            DisplayLevels();
            DisplayDynamicInfo(true);
            ShowCandidateEquips();
        }
        protected override void LateUpdate()
@@ -85,6 +88,7 @@
            if (force || model.selectedLevel.dirty)
            {
                var level = model.selectedLevel.Fetch();
                DisplayEquips(level);
                DisplayAppearance(level);
                DisplayFightPoint(level);
@@ -98,6 +102,49 @@
            }
        }
        private void DisplayLevels()
        {
            var sets = model.GetViewableEquipSets();
            var behaviourCount = sets.Count;
            var emptyCount = behaviourCount >= 5 ? 0 : 5 - behaviourCount;
            var behaviourGap = behaviourCount - levelSelectBehaviours.Count;
            for (var i = 0; i < behaviourGap; i++)
            {
                var instance = UIUtility.CreateWidget("EquipLevelSelectBehaviour", "EquipLevelSelectBehaviour");
                instance.transform.SetParentEx(m_LevelsContainer, Vector3.zero, Quaternion.identity, Vector3.one);
                instance.transform.SetAsFirstSibling();
                levelSelectBehaviours.Insert(0, instance.GetComponent<EquipLevelSelectBehaviour>());
            }
            var emptyGap = emptyCount - emptyFillers.Count;
            for (var i = 0; i < emptyCount; i++)
            {
                var instance = UIUtility.CreateWidget("EquipLevelSelectEmptyBehaviour", "EquipLevelSelectEmptyBehaviour");
                instance.transform.SetParentEx(m_LevelsContainer, Vector3.zero, Quaternion.identity, Vector3.one);
                instance.transform.SetAsLastSibling();
                emptyFillers.Add(instance);
            }
            for (var i = 0; i < levelSelectBehaviours.Count; i++)
            {
                var behaviour = levelSelectBehaviours[i];
                if (i < behaviourCount)
                {
                    behaviour.gameObject.SetActive(true);
                    behaviour.Display(sets[i]);
                }
                else
                {
                    behaviour.gameObject.SetActive(false);
                }
            }
            for (var i = 0; i < emptyFillers.Count; i++)
            {
                emptyFillers[i].SetActive(i < emptyCount);
            }
        }
        private void DisplayEquips(int level)
        {
            for (var i = 1; i <= 12; i++)
System/EquipStar/EquipStar.cs
@@ -9,7 +9,6 @@
    {
        public readonly int level = 0;
        Dictionary<int, int> equipStars = new Dictionary<int, int>();
        Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>();
        public EquipSetStar(int level)
        {
@@ -25,6 +24,11 @@
            }
            return totalLevel;
        }
        public void UpdateEquipStarLevel(int place, int level)
        {
            equipStars[place] = level;
        }
        public int GetEquipStarLevel(int place)
@@ -43,14 +47,34 @@
            return count;
        }
        public void UpdateSuitLevel(EquipSuitType type, int level)
        {
            suitLevels[type] = level;
        }
        public int GetSuitLevel(EquipSuitType type)
        {
            return suitLevels[type];
            var targetCount = 2;
            switch (type)
            {
                case EquipSuitType.TwoSuit:
                    targetCount = 2;
                    break;
                case EquipSuitType.FiveSuit:
                    targetCount = 5;
                    break;
                case EquipSuitType.EightSuit:
                    targetCount = 8;
                    break;
                default:
                    break;
            }
            var maxLevel = GetTotalStarLevel() / targetCount;
            for (var i = maxLevel; i >= 0; i--)
            {
                if (GetEquipCountWhichStarLevelLq(i) >= targetCount)
                {
                    return i;
                }
            }
            return 0;
        }
    }
@@ -60,13 +84,6 @@
        TwoSuit = 2,
        FiveSuit = 5,
        EightSuit = 8,
    }
    public struct EquipStar
    {
        public int level;
        public int place;
        public int starLevel;
    }
}
System/EquipStar/EquipStarModel.cs
@@ -29,13 +29,53 @@
        }
        public void DoStarUpgrade(int level, int place)
        public void DoStarUpgrade(int level, int place, int starLevel)
        {
            if (!equipStars.ContainsKey(level))
            {
                return;
            }
            var maxLevel = GetMaxStarLevel(level);
            if (starLevel > maxLevel)
            {
                //已经是最大星级,无法升星
                return;
            }
            var config = EquipStarConfig.Get(level, place, starLevel);
            var specialMaterial = packModel.GetItemByGuid(materials[6].value);
            if (config.CostItemDict.x > 0 && (specialMaterial == null || specialMaterial.config.ID != config.CostItemDict.x))
            {
                //请放入正确的特殊材料
                return;
            }
            var materialIndexs = new List<ushort>();
            var materialItemIds = new List<uint>();
            foreach (var material in materials.Values)
            {
                if (!string.IsNullOrEmpty(material.value))
                {
                    var item = packModel.GetItemByGuid(material.value);
                    materialIndexs.Add((ushort)item.itemPlace);
                    materialItemIds.Add((uint)item.itemId);
                }
            }
            if (materialIndexs.Count < (config.CostEquipCnt + config.CostItemDict.x > 0 ? 1 : 0))
            {
                //材料不足
                return;
            }
            var info = new CA5C5_tagCMEquipPartStarUp();
            info.EquipPackIndex = (ushort)EquipSet.ClientPlaceToServerPlace(level, place);
            info.CostEquipIndex = materialIndexs.ToArray();
            info.CostEquipID = materialItemIds.ToArray();
            info.CostEquipCnt = (byte)materialIndexs.Count;
            GameNetSystem.Instance.SendInfo(info);
        }
        public void FiltrateCandidateEquips(int level)
@@ -54,14 +94,17 @@
            }
        }
        public void UpdateSuitLevel(int level, EquipSuitType type, int starLevel)
        public void UpdateStarLevels(HA3B1_tagMCEquipPartStarInfo info)
        {
            if (!equipStars.ContainsKey(level))
            for (var i = 0; i < info.InfoList.Length; i++)
            {
                return;
                var clientInfo = EquipSet.ServerPlaceToClientPlace(info.InfoList[i].EquipPackIndex);
                var level = clientInfo.x;
                if (equipStars.ContainsKey(level))
                {
                    equipStars[level].UpdateEquipStarLevel(clientInfo.y, info.InfoList[i].Star);
            }
            equipStars[level].UpdateSuitLevel(type, starLevel);
            }
        }
        public int GetSuitLevel(int level, EquipSuitType type)
System/EquipStar/EquipStarWin.cs
@@ -173,11 +173,13 @@
            }
        }
        private void StarUpgrade()
        {
            var equip = packModel.GetItemByGuid(model.selectedEquip.value);
            model.DoStarUpgrade(equip.config.LV, equip.config.EquipPlace);
            var level = equip.config.LV;
            var place = equip.config.EquipPlace;
            var currentStarLevel = model.GetEquipStarLevel(level, place);
            model.DoStarUpgrade(level, place, currentStarLevel);
        }
        [System.Serializable]