少年修仙传客户端代码仓库
client_Lhy
2019-06-11 32d55c7070393b55679f453dd9ea00456e3bde1a
7139 仙盟新增兑换活跃令功能
16个文件已添加
2个文件已修改
599 ■■■■■ 已修改文件
Core/GameEngine/DataToCtl/PackageRegedit.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA606_tagCMFamilyActivityExchange.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA606_tagCMFamilyActivityExchange.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA5_Family/DTCA502_tagMCFamilyActivityExchangeResult.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA5_Family/DTCA502_tagMCFamilyActivityExchangeResult.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA5_Family/HA502_tagMCFamilyActivityExchangeResult.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA5_Family/HA502_tagMCFamilyActivityExchangeResult.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/EquipCellLine.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/EquipCellLine.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveSuccessWin.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveSuccessWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveTokenModel.cs 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveTokenModel.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveTokenWin.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeActiveTokenWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeEquipCell.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/ExchangeEquipCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/FairyAu/FairyBasicFunctionWin.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -476,6 +476,7 @@
        Register(typeof(HB510_tagGCBiddingItemInfo), typeof(DTCB510_tagGCBiddingItemInfo));
        #endregion
        Register(typeof(HA3B3_tagMCEquipPartPlusInfo), typeof(DTCA3B3_tagMCEquipPartPlusInfo));//装备强化
        Register(typeof(HA502_tagMCFamilyActivityExchangeResult), typeof(DTCA502_tagMCFamilyActivityExchangeResult));//装备换活跃度
    }
    private static void Register(Type _pack, Type _business)
Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA606_tagCMFamilyActivityExchange.cs
New file
@@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
// A6 06 家族兑换活跃令 #tagCMFamilyActivityExchange
public class CA606_tagCMFamilyActivityExchange : GameNetPackBasic {
    public byte Count;    //材料所在背包索引的数量
    public  ushort[] IndexList;    //材料所在背包索引列表
    public  uint[] ItemIDList;    //材料所在背包物品ID列表
    public CA606_tagCMFamilyActivityExchange () {
        combineCmd = (ushort)0x03FE;
        _cmd = (ushort)0xA606;
    }
    public override void WriteToBytes () {
        WriteBytes (Count, NetDataType.BYTE);
        WriteBytes (IndexList, NetDataType.WORD, Count);
        WriteBytes (ItemIDList, NetDataType.DWORD, Count);
    }
}
Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA606_tagCMFamilyActivityExchange.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1ada5429f23a310409413aab69463435
timeCreated: 1560135823
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/DTCFile/ServerPack/HA5_Family/DTCA502_tagMCFamilyActivityExchangeResult.cs
New file
@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;
using Snxxz.UI;
// A5 02 家族活跃令兑换结果 #tagMCFamilyActivityExchangeResult
public class DTCA502_tagMCFamilyActivityExchangeResult : DtcBasic
{
    private ExchangeActiveTokenModel m_ExchangeModel { get { return ModelCenter.Instance.GetModel<ExchangeActiveTokenModel>(); } }
    public override void Done(GameNetPackBasic vNetPack) {
        base.Done(vNetPack);
        HA502_tagMCFamilyActivityExchangeResult vNetData = vNetPack as HA502_tagMCFamilyActivityExchangeResult;
        m_ExchangeModel.ReciveExchangeResult(vNetData);
    }
}
Core/NetworkPackage/DTCFile/ServerPack/HA5_Family/DTCA502_tagMCFamilyActivityExchangeResult.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ecd85f072841839448d8748a71c9edce
timeCreated: 1560135957
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ServerPack/HA5_Family/HA502_tagMCFamilyActivityExchangeResult.cs
New file
@@ -0,0 +1,17 @@
using UnityEngine;
using System.Collections;
// A5 02 家族活跃令兑换结果 #tagMCFamilyActivityExchangeResult
public class HA502_tagMCFamilyActivityExchangeResult : GameNetPackBasic {
    public uint Point;    // 活跃令
    public HA502_tagMCFamilyActivityExchangeResult () {
        _cmd = (ushort)0xA502;
    }
    public override void ReadFromBytes (byte[] vBytes) {
        TransBytes (out Point, vBytes, NetDataType.DWORD);
    }
}
Core/NetworkPackage/ServerPack/HA5_Family/HA502_tagMCFamilyActivityExchangeResult.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5f57f5aebd2fc664dbed44c5fa334584
timeCreated: 1560136026
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/EquipCellLine.cs
New file
@@ -0,0 +1,19 @@
using Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EquipCellLine : ScrollItem
{
    [SerializeField] ExchangeEquipCell[] m_EquipCells;
    public override void Display(object _data)
    {
        base.Display(_data);
        var data = (ItemModel[])_data;
        for (int i = 0; i < data.Length; i++)
        {
            m_EquipCells[i].SetSelf(data[i]);
        }
    }
}
System/FairyAu/EquipCellLine.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5f95b96c2fff6fb41917e377d1c6aca8
timeCreated: 1560151090
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/ExchangeActiveSuccessWin.cs
New file
@@ -0,0 +1,46 @@
using Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
public class ExchangeActiveSuccessWin : Window
{
    [SerializeField] Button m_UseBtn;
    [SerializeField] Text m_ActiveCount;
    private ExchangeActiveTokenModel m_Model { get { return ModelCenter.Instance.GetModel<ExchangeActiveTokenModel>(); } }
    protected override void AddListeners()
    {
        m_UseBtn.AddListener(() => Close());
    }
    protected override void BindController()
    {
    }
    protected override void OnAfterClose()
    {
    }
    protected override void OnAfterOpen()
    {
    }
    protected override void OnPreClose()
    {
    }
    protected override void OnPreOpen()
    {
        m_ActiveCount.text = m_Model.NewActivePoint.ToString();
    }
}
System/FairyAu/ExchangeActiveSuccessWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 94015ec0376ce5a41826a3992dc7768c
timeCreated: 1560232461
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/ExchangeActiveTokenModel.cs
New file
@@ -0,0 +1,241 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Snxxz.UI;
using System;
using System.Text.RegularExpressions;
public class ExchangeActiveTokenModel : Model
{
    private PackModel m_PackModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
    private EquipStarModel m_EquipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
    private EquipModel m_EquipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
    public HashSet<ItemModel> ChoseEquips { get; private set; }
    public int NewActivePoint { get; private set; }
    public int SuitEquipActiveCount { get; private set; }
    public int NormalEquipActiveCount { get; private set; }
    public event Action RefreshActiveCanGetEvent;
    public event Action ExchangetSuccessEvent;
    public override void Init()
    {
        ChoseEquips = new HashSet<ItemModel>();
        ParseConfig();
    }
    public override void UnInit()
    {
    }
    public void ReciveExchangeResult(HA502_tagMCFamilyActivityExchangeResult info)
    {
        NewActivePoint = (int)info.Point;
        WindowCenter.Instance.Open<ExchangeActiveSuccessWin>();
        if (ExchangetSuccessEvent != null)
        {
            ExchangetSuccessEvent();
        }
    }
    private bool IsBetterThanBodyEquip(ItemModel item)
    {
        if(item.config.JobLimit != PlayerDatas.Instance.baseData.Job)
        {
            return false;
        }
        var equipGUID = m_EquipModel.GetEquip(new Int2(1, item.config.Type - 100));
        var equip = m_PackModel.GetItemByGuid(equipGUID);
        if(equip == null)
        {
            return true;
        }
        if(equip.config.LV < item.config.LV)
        {
            return true;
        }
        if(equip.score < item.score)
        {
            return true;
        }
        return false;
    }
    public void EquipCellClick(ItemModel item ,Action CellAct)
    {
        if(ChoseEquips.Contains(item))
        {
            ChoseEquips.Remove(item);
        }
        else
        {
            ChoseEquips.Add(item);
        }
        CellAct();
        if (RefreshActiveCanGetEvent != null)
        {
            RefreshActiveCanGetEvent();
        }
    }
    public int GetTotalActiveCount()
    {
        int totalCount = 0;
        foreach (var equip in ChoseEquips)
        {
            if(equip.config.SuiteiD == 0)
            {
                totalCount += NormalEquipActiveCount;
            }
            else
            {
                totalCount += SuitEquipActiveCount;
            }
        }
        return totalCount;
    }
    public void ParseConfig()
    {
        Regex r = new Regex(@"\[(\d+),(\d+)\]");
        var res = r.Match(FuncConfigConfig.Get("FamilyDonate").Numerical1);
        NormalEquipActiveCount = int.Parse(res.Groups[1].Value);
        SuitEquipActiveCount = int.Parse(res.Groups[2].Value);
    }
    public void SendExchangeRequest()
    {
        Action SendInfo = () =>
        {
            var info = new CA606_tagCMFamilyActivityExchange();
            info.Count = (byte)ChoseEquips.Count;
            info.IndexList = new ushort[info.Count];
            info.ItemIDList = new uint[info.Count];
            int i = 0;
            foreach (var equip in ChoseEquips)
            {
                info.IndexList[i] = (ushort)equip.gridIndex;
                info.ItemIDList[i] = (uint)equip.itemId;
                i++;
            }
            GameNetSystem.Instance.SendInfo(info);
        };
        bool bIsHasBetterEquip = false;
        foreach (var equip in ChoseEquips)
        {
            if(IsBetterThanBodyEquip(equip))
            {
                bIsHasBetterEquip = true;
                break;
            }
        }
        if(bIsHasBetterEquip)
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
            Language.Get("ExchangeActiveTokenWin_Tip_4"),
            (bIsExchange) =>
            {
                if (bIsExchange)
                {
                    SendInfo();
                }
            });
        }
        else
        {
            SendInfo();
        }
    }
    public List<ItemModel> GetShowEquips()
    {
        ChoseEquips.Clear();
        SinglePack.FilterParams par = new SinglePack.FilterParams();
        par.qualitys = new List<int>() { 4 };
        par.itemTypes = new List<int>() { 101, 102, 103, 104, 105, 106, 107, 108 };
        var suitEquips = m_PackModel.GetItems(PackType.Item, par);
        Int2 equPos = new Int2(1, 1);
        bool bIsAllEquMaxStar = true;
        for (int i = 1; i < 9; ++i)
        {
            equPos.y = i;
            int posStarLevel = m_EquipStarModel.GetStarLevel(equPos);
            int equMaxStarLevel = m_EquipStarModel.GetEquipPositionMaxStarLevel(equPos);
            if(equMaxStarLevel > posStarLevel || equMaxStarLevel == 0)
            {
                bIsAllEquMaxStar = false;
                break;
            }
        }
        Debug.LogFormat("<color=#00ff00ff>{0}</color>", bIsAllEquMaxStar);
        var playerJob = PlayerDatas.Instance.baseData.Job;
        //物品排序
        for (int i = 0; i < suitEquips.Count; i++)
        {
            var iEqu = suitEquips[i];
            if (bIsAllEquMaxStar)
            {
                if(!IsBetterThanBodyEquip(iEqu))
                {
                    ChoseEquips.Add(iEqu);
                }
            }
            for (int j = i - 1; j >= 0; j--)
            {
                var jEqu = suitEquips[j];
                bool bHasIEqu = ChoseEquips.Contains(iEqu);
                bool bHasJEqu = ChoseEquips.Contains(jEqu);
                if (!bHasIEqu && bHasJEqu)
                {
                    break;
                }
                if(bHasIEqu && !bHasJEqu)
                {
                    goto Swap;
                }
                if(iEqu.config.LV > jEqu.config.LV)
                {
                    break;
                }
                if(iEqu.config.LV < jEqu.config.LV)
                {
                    goto Swap;
                }
                if(iEqu.config.JobLimit > jEqu.config.JobLimit)
                {
                    break;
                }
                if (iEqu.config.JobLimit < jEqu.config.JobLimit)
                {
                    goto Swap;
                }
                if (iEqu.config.Type > jEqu.config.Type)
                {
                    break;
                }
                if (iEqu.config.Type < jEqu.config.Type)
                {
                    goto Swap;
                }
                if (iEqu.score >= jEqu.score)
                {
                    break;
                }
                Swap:
                suitEquips[j + 1] = jEqu;
                suitEquips[j] = iEqu;
            }
        }
        return suitEquips;
    }
}
System/FairyAu/ExchangeActiveTokenModel.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 826676fe2901c4b4c80dc4324266c3dc
timeCreated: 1559801992
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/ExchangeActiveTokenWin.cs
New file
@@ -0,0 +1,102 @@
using Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
public class ExchangeActiveTokenWin : Window
{
    [SerializeField] CyclicScroll m_EquipsScroll;
    [SerializeField] Button m_CloseBtn;
    [SerializeField] Button m_ConvertBtn;
    [SerializeField] Text m_ActiveCanGetText;
    [SerializeField] Text m_ActiveCountText;
    private ExchangeActiveTokenModel m_Model { get { return ModelCenter.Instance.GetModel<ExchangeActiveTokenModel>(); } }
    private const int MINLINECOUNT = 5;
    protected override void AddListeners()
    {
        m_CloseBtn.AddListener(() => Close());
        m_ConvertBtn.AddListener(OnConvertBtnDown);
    }
    protected override void BindController()
    {
    }
    protected override void OnAfterClose()
    {
        m_EquipsScroll.Dispose();
        m_Model.RefreshActiveCanGetEvent -= RefreshActiveCanGet;
        m_Model.ExchangetSuccessEvent -= ExchangeSuccess;
    }
    protected override void OnAfterOpen()
    {
    }
    protected override void OnPreClose()
    {
    }
    protected override void OnPreOpen()
    {
        RefreshEquipsScroll();
        RefreshActiveCanGet();
        RefreshActiveCount();
        m_Model.RefreshActiveCanGetEvent += RefreshActiveCanGet;
        m_Model.ExchangetSuccessEvent += ExchangeSuccess;
    }
    private void ExchangeSuccess()
    {
        Close();
    }
    private void RefreshActiveCanGet()
    {
        m_ActiveCanGetText.text = m_Model.GetTotalActiveCount().ToString();
    }
    private void RefreshActiveCount()
    {
        m_ActiveCountText.text = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(15));
    }
    private void OnConvertBtnDown()
    {
        m_Model.SendExchangeRequest();
    }
    private void RefreshEquipsScroll()
    {
        var itemModelList = m_Model.GetShowEquips();
        int count = itemModelList.Count / 5 + (itemModelList.Count % 5 == 0 ? 0 : 1);
        count = Mathf.Max(MINLINECOUNT, count);
        List<ItemModel[]> itemModelAryList = new List<ItemModel[]>();
        for (int i = 0; i < count; i++)
        {
            ItemModel[] itemModelAry = new ItemModel[5];
            for (int j = 0; j < 5; j++)
            {
                int id = 5 * i + j;
                if (id >= itemModelList.Count)
                {
                    break;
                }
                itemModelAry[j] = itemModelList[id];
            }
            itemModelAryList.Add(itemModelAry);
        }
        m_EquipsScroll.Init(itemModelAryList);
    }
}
System/FairyAu/ExchangeActiveTokenWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9f12ccd457dc4034f980f8c5a286523b
timeCreated: 1559802030
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/ExchangeEquipCell.cs
New file
@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Snxxz.UI;
using UnityEngine.UI;
public class ExchangeEquipCell : MonoBehaviour
{
    [SerializeField] ItemCell m_ItemCell;
    [SerializeField] Image m_ChoseImg;
    private ItemModel m_ItemModel;
    private ExchangeActiveTokenModel m_Model { get { return ModelCenter.Instance.GetModel<ExchangeActiveTokenModel>(); } }
    public void SetSelf(ItemModel item)
    {
        m_ItemModel = item;
        if(m_ItemModel == null)
        {
            m_ItemCell.gameObject.SetActive(false);
            m_ChoseImg.gameObject.SetActive(false);
            return;
        }
        m_ItemCell.gameObject.SetActive(true);
        bool bIsChose = m_Model.ChoseEquips.Contains(m_ItemModel);
        m_ChoseImg.gameObject.SetActive(bIsChose);
        m_ItemCell.Init(item, true);
        m_ItemCell.button.RemoveAllListeners();
        m_ItemCell.button.AddListener(() =>
        {
            m_Model.EquipCellClick(m_ItemModel,
                ()=>
                {
                    m_ChoseImg.gameObject.SetActive(m_Model.ChoseEquips.Contains(m_ItemModel));
                });
        });
    }
}
System/FairyAu/ExchangeEquipCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 411b050b83331844d975f91460e2e6ff
timeCreated: 1560150075
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/FairyAu/FairyBasicFunctionWin.cs
@@ -23,6 +23,7 @@
        [SerializeField] Text textFairyName;
        [SerializeField] Text textFairyLv;
        [SerializeField] Text m_FairyRankTxt;
        [SerializeField] Button m_ExchangeBtn;
        StoreModel _storeModel;
        StoreModel m_storeModel
@@ -54,6 +55,7 @@
            SkillBtn.onClick.AddListener(SkillBtna);
            HallBtn.onClick.AddListener(HallButton);
            FairyAuBtn.AddListener(FairyAuButton);
            m_ExchangeBtn.AddListener(() => WindowCenter.Instance.Open<ExchangeActiveTokenWin>());
        }
        protected override void OnPreOpen()