少年修仙传客户端代码仓库
client_linchunjie
2019-01-08 b4fd56564f5b74dc9a1d4ea145aba42148d8489c
5729 【前端】【1.5】时装功能开发
6个文件已添加
4个文件已修改
219 ■■■■■ 已修改文件
Core/GameEngine/DataToCtl/PackageRegedit.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FashionDress/FashionDressCell.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FashionDress/FashionDressModel.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FashionDress/FashionDressWin.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -31,6 +31,7 @@
    public static void Init()
    {
        // 登记相应的数据体及对应的数据转逻辑类
        Register(typeof(HB102_tagMCClothesCoatSkinState), typeof(DTCB102_tagMCClothesCoatSkinState));
        Register(typeof(HC103_tagMCCrossRealmPKPlayerHisSeasonInfo), typeof(DTCC103_tagMCCrossRealmPKPlayerHisSeasonInfo));
        Register(typeof(HA31E_tagMCGatherSoulHoleInfo), typeof(DTCA31E_tagMCGatherSoulHoleInfo));
        Register(typeof(HAA1D_tagMCActTotalRechargeInfo), typeof(DTCAA1D_tagMCActTotalRechargeInfo));
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs
New file
@@ -0,0 +1,18 @@
using UnityEngine;
using System.Collections;
// A5 0B 玩家时装升级 #tagCMCoatUp
public class CA50B_tagCMCoatUp : GameNetPackBasic {
    public uint CoatIndex;    // 时装索引
    public CA50B_tagCMCoatUp () {
        combineCmd = (ushort)0x03FE;
        _cmd = (ushort)0xA50B;
    }
    public override void WriteToBytes () {
        WriteBytes (CoatIndex, NetDataType.DWORD);
    }
}
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 17ad6502064d0014b9ca6f5ba5e95a2c
timeCreated: 1546938032
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs
New file
@@ -0,0 +1,23 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, January 08, 2019
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
public class DTCB102_tagMCClothesCoatSkinState : DtcBasic {
    public override void Done(GameNetPackBasic vNetPack)
    {
        base.Done(vNetPack);
        var package = vNetPack as HB102_tagMCClothesCoatSkinState;
    }
}
Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 492fb693405473b41acea24913462db6
timeCreated: 1546938241
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs
New file
@@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
// B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState
public class HB102_tagMCClothesCoatSkinState : GameNetPackBasic {
    public uint CoatChestLV;    //时装柜等级
    public uint CoatChestExp;    //时装柜经验
    public ushort CoatNum;    //时装个数
    public  tagMCClothesCoatLVInfo[] CoatInfoList;    // 时装数据列表
    public HB102_tagMCClothesCoatSkinState () {
        _cmd = (ushort)0xB102;
    }
    public override void ReadFromBytes (byte[] vBytes) {
        TransBytes (out CoatChestLV, vBytes, NetDataType.DWORD);
        TransBytes (out CoatChestExp, vBytes, NetDataType.DWORD);
        TransBytes (out CoatNum, vBytes, NetDataType.WORD);
        CoatInfoList = new tagMCClothesCoatLVInfo[CoatNum];
        for (int i = 0; i < CoatNum; i ++) {
            CoatInfoList[i] = new tagMCClothesCoatLVInfo();
            TransBytes (out CoatInfoList[i].CoatIndex, vBytes, NetDataType.DWORD);
            TransBytes (out CoatInfoList[i].CoatLV, vBytes, NetDataType.BYTE);
        }
    }
    public struct tagMCClothesCoatLVInfo {
        public uint CoatIndex;        //时装索引
        public byte CoatLV;        //时装等级
    }
}
Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 311be06de3a564b48951786c28d5bb27
timeCreated: 1546938210
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FashionDress/FashionDressCell.cs
@@ -108,7 +108,16 @@
            FashionDress fashionDress;
            if (model.TryGetFashionDress(fashionDressId, out fashionDress))
            {
                model.SetPreviewFashionDress(fashionDress.fashionDressType, fashionDressId);
                var dict = model.fashionDressSelectDict;
                if (dict.ContainsKey(fashionDress.fashionDressType)
                    && dict[fashionDress.fashionDressType] == fashionDressId)
                {
                    model.SetPreviewFashionDress(fashionDress.fashionDressType, 0);
                }
                else
                {
                    model.SetPreviewFashionDress(fashionDress.fashionDressType, fashionDressId);
                }
            }
        }
@@ -120,6 +129,7 @@
                model.DisplayLevelUpError(error);
                return;
            }
            model.SendLevelUp(fashionDressId);
        }
    }
}
System/FashionDress/FashionDressModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TableConfig;
using UnityEngine;
namespace Snxxz.UI
@@ -26,6 +27,7 @@
        public Dictionary<int, int> fashionDressSelectDict { get; private set; }
        public List<int> fashionDressLevelUpItems { get; private set; }
        public List<int> fashionDressTypes { get; private set; }
        int m_SelectType = 1;
        public int selectType
@@ -62,8 +64,9 @@
        }
        public event Action selectTypeRefresh;
        public event Action cabinetRefresh;
        public event Action selectQualityRefresh;
        public event Action cabinetRefresh;
        public event Action<int> fashionDressRefresh;
        public event Action<int> previewRefresh;
        PlayerPackModel packModel
@@ -172,6 +175,7 @@
                {
                    fashionTypeMapPlaceDict = ConfigParse.GetDic<int, int>(config.Numerical1);
                }
                fashionDressTypes = fashionTypeMapPlaceDict.Keys.ToList();
            }
        }
@@ -211,6 +215,12 @@
                }
            }
            return 0;
        }
        public bool IsFashionDressUnlock(int id)
        {
            var level = GetFashionDressLevel(id);
            return level > 0;
        }
        public bool TryGetFashionDress(int id, out FashionDress fashionDress)
@@ -323,6 +333,66 @@
            }
        }
        public void ReceivePackage(HB102_tagMCClothesCoatSkinState package)
        {
            cabinetLevel = (int)package.CoatChestLV;
            cabinetExp = (int)package.CoatChestExp;
            if (cabinetRefresh != null)
            {
                cabinetRefresh();
            }
            for (int i = 0; i < package.CoatNum; i++)
            {
                var id = (int)package.CoatInfoList[i].CoatIndex;
                var level = (int)package.CoatInfoList[i].CoatLV;
                fashionDressLevelDict[id] = level;
                if (fashionDressRefresh != null)
                {
                    fashionDressRefresh(id);
                }
            }
            UpdateRedpoint();
        }
        public void SendLevelUp(int id)
        {
            CA50B_tagCMCoatUp pak = new CA50B_tagCMCoatUp();
            pak.CoatIndex = (uint)id;
            GameNetSystem.Instance.SendInfo(pak);
        }
        public void TryEquip()
        {
            foreach (var type in fashionDressSelectDict.Keys)
            {
                var equipId = GetFashionDressEquipId(type);
                var previewId = fashionDressSelectDict[type];
                var index = fashionTypeMapPlaceDict[type];
                if (previewId != 0)
                {
                    if (IsFashionDressUnlock(previewId)
                        && previewId != equipId)
                    {
                        SendEquipPackage((int)PackType.rptInterimPack, previewId, (int)PackType.rptEquip, index);
                    }
                }
                else
                {
                    SendEquipPackage((int)PackType.rptEquip, index, (int)PackType.rptInterimPack, 0);
                }
            }
        }
        void SendEquipPackage(int srcpackType, int scrIndex, int destpackType, int destIndex)
        {
            C073D_tagCPackItemExchange pak = new C073D_tagCPackItemExchange();
            pak.SrcBackpack = (byte)srcpackType;
            pak.SrcIndex = (ushort)scrIndex;
            pak.DesBackPack = (byte)destpackType;
            pak.DestIndex = (ushort)destIndex;
            GameNetSystem.Instance.SendInfo(pak);
        }
        #region 时装详情
        public int viewFashionDressId { get; private set; }
        public void ViewFashionDressDetails(int id)
System/FashionDress/FashionDressWin.cs
@@ -53,13 +53,13 @@
        protected override void OnPreOpen()
        {
            model.selectType = 1;
            model.selectQuality = 0;
            SetDefaultSelect();
            model.cabinetRefresh += FashionDressCabinetRefresh;
            model.selectTypeRefresh += SelectTypeRefresh;
            model.selectQualityRefresh += SelectQualityRefresh;
            model.previewRefresh += PreviewRefresh;
            model.fashionDressRefresh += FashionDressRefresh;
            packModel.RefreshItemCountAct += RefreshItemCountAct;
            for (int i = 0; i < m_FashionDressTypes.Length; i++)
@@ -84,6 +84,7 @@
            model.selectQualityRefresh -= SelectQualityRefresh;
            model.previewRefresh -= PreviewRefresh;
            packModel.RefreshItemCountAct -= RefreshItemCountAct;
            model.fashionDressRefresh -= FashionDressRefresh;
            for (int i = 0; i < m_FashionDressTypes.Length; i++)
            {
@@ -93,12 +94,26 @@
            {
                m_FashionDressQualitys[i].Dispose();
            }
            model.TryEquip();
        }
        protected override void OnAfterClose()
        {
        }
        #endregion
        void SetDefaultSelect()
        {
            model.selectType = model.fashionDressTypes[0];
            model.selectQuality = 0;
            foreach (var fashionDressType in model.fashionDressTypes)
            {
                var equipId = model.GetFashionDressEquipId(fashionDressType);
                model.SetPreviewFashionDress(fashionDressType, equipId);
            }
        }
        void Display()
        {
@@ -172,6 +187,11 @@
            }
        }
        private void FashionDressRefresh(int id)
        {
            m_ScrollerControl.RefreshSingleCellView(id);
        }
        private void OnRefreshCell(ScrollerDataType type, CellView cell)
        {
            var fashionDressCell = cell as FashionDressCell;