少年修仙传客户端代码仓库
hch
2020-02-05 93407b821556759302e8e30a0be71ccede71ae37
0312 vip界面改列表显示
4个文件已修改
4个文件已添加
235 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/VipPrivilegeInfoConfig.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/VipPrivilegeInfoConfig.cs.meta 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialVipPrivilegeInfoConfig.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Vip/VipListHeaderCell.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Vip/VipListHeaderCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Vip/VipListNormalCell.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Vip/VipListNormalCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Vip/VipWin.cs 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/VipPrivilegeInfoConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:           Fish
//    [  Date ]:           Monday, June 10, 2019
//    [  Date ]:           Sunday, February 02, 2020
//--------------------------------------------------------
using System.Collections.Generic;
@@ -20,6 +20,7 @@
    public readonly int dataType;
    public readonly int privilegeId;
    public readonly int[] datas;
    public readonly int important;
    public VipPrivilegeInfoConfig()
    {
@@ -43,12 +44,14 @@
            int.TryParse(tables[5],out privilegeId); 
            string[] datasStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
            datas = new int[datasStringArray.Length];
            for (int i=0;i<datasStringArray.Length;i++)
            {
                 int.TryParse(datasStringArray[i],out datas[i]);
            string[] datasStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
            datas = new int[datasStringArray.Length];
            for (int i=0;i<datasStringArray.Length;i++)
            {
                 int.TryParse(datasStringArray[i],out datas[i]);
            }
            int.TryParse(tables[7],out important);
        }
        catch (Exception ex)
        {
Core/GameEngine/Model/Config/VipPrivilegeInfoConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 53554b87ef95b1240a6528d2b10fba27
timeCreated: 1560132767
timeCreated: 1580652541
licenseType: Pro
MonoImporter:
  serializedVersion: 2
Core/GameEngine/Model/TelPartialConfig/PartialVipPrivilegeInfoConfig.cs
@@ -28,6 +28,16 @@
        return 0;
    }
    public static int GetPrivilegeDataEx(int id, int level)
    {
        var config = Get(id);
        if (config != null)
        {
            return VipPrivilegeConfig.GetVipPrivilegeData(config.privilegeId, level);
        }
        return 0;
    }
    public static string GetPrivilegeLabel(int id, int level)
    {
        var config = Get(id);
System/Vip/VipListHeaderCell.cs
New file
@@ -0,0 +1,39 @@
using Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class VipListHeaderCell : CellView
    {
        [SerializeField] Text m_PrivilegeText;
        public void ShowUI(int import)
        {
            m_PrivilegeText.text = import == 0 ? "核心特权":"其他特权";
        }
    }
    //public class VipListNormalCell : CellView
    //{
    //    [SerializeField] Text m_PrivilegeText;
    //    private VipModel m_Model;
    //    private VipModel model
    //    {
    //        get
    //        {
    //            return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<VipModel>());
    //        }
    //    }
    //    public void ShowUI(string content)
    //    {
    //        m_PrivilegeText.text = content;
    //    }
    //}
}
System/Vip/VipListHeaderCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c95425bc73022a347b2df2024ed67909
timeCreated: 1580649815
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Vip/VipListNormalCell.cs
New file
@@ -0,0 +1,28 @@
using Snxxz.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class VipListNormalCell : CellView
    {
        [SerializeField] Text m_PrivilegeText;
        private VipModel m_Model;
        private VipModel model
        {
            get
            {
                return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<VipModel>());
            }
        }
        public void ShowUI(string content)
        {
            m_PrivilegeText.text = content;
        }
    }
}
System/Vip/VipListNormalCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2a8bab5993806684d8feb8e53ae43b87
timeCreated: 1580650547
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Vip/VipWin.cs
@@ -38,6 +38,7 @@
        [SerializeField] Button m_ViewPrivilege;
        [SerializeField] Text m_AddFightPower;
        [SerializeField] Text m_SelectVipLevel;
        [SerializeField] ScrollerController m_SelectVipList;
        [SerializeField] Image m_GainTitle;
        [SerializeField] Image m_LeftPrivilegeIcon;
        [SerializeField] Image m_RightPrivilegeIcon;
@@ -75,6 +76,7 @@
        protected override void BindController()
        {
            m_SelectVipList.lockType = EnhanceLockType.KeepVertical;
        }
        protected override void OnAfterClose()
@@ -93,10 +95,12 @@
            model.OnVipTimeEvent -= OnVipTimeEvent;
            model.giftRedpointStateEvent -= OnVipGiftRedpointChange;
            WindowCenter.Instance.windowBeforeOpenEvent -= WindowBeforeOpenEvent;
            m_SelectVipList.OnRefreshCell -= OnRefreshCell;
        }
        protected override void OnPreOpen()
        {
            m_SelectVipList.OnRefreshCell += OnRefreshCell;
            PlayerDatas.Instance.playerDataRefreshEvent += RefreshInfo;
            model.OnVipExpEvent += OnVipExpEvent;
            model.OnVipGiftEvent += OnVipGiftEvent;
@@ -353,9 +357,122 @@
            }
        }
        private bool GetPrivilegeText(int id, out string privilegeStr)
        {
            var config = VipPrivilegeInfoConfig.Get(id);
            var value = VipPrivilegeInfoConfig.GetPrivilegeDataEx(id, model.presentSelectVip);
            if (value == 0)
            {
                privilegeStr = string.Empty;
                return false;
            }
            var label = VipPrivilegeInfoConfig.GetPrivilegeLabel(id, model.presentSelectVip);
            string valueStr = string.Empty;
            switch (config.displayType)
            {
                case 1:
                    break;
                case 2:
                case 5:
                    if (!string.IsNullOrEmpty(label))
                    {
                        valueStr = string.Format(label, value);
                    }
                    else
                    {
                        valueStr = value.ToString();
                    }
                    break;
                case 3:
                    if (!string.IsNullOrEmpty(label))
                    {
                        valueStr = string.Format(label, value / 100);
                    }
                    else
                    {
                        valueStr = (value / 100).ToString();
                    }
                    break;
                case 4:
                    valueStr = label;
                    break;
                case 6:
                    var isEmptyLabel = label.Equals("Null");
                    if (!isEmptyLabel)
                    {
                        valueStr = label;
                    }
                    break;
                default:
                    break;
            }
            privilegeStr = config.name + valueStr;
            return true;
        }
        private void RefreshVipList()
        {
            m_SelectVipList.Refresh();
            m_SelectVipList.AddCell(ScrollerDataType.Header, 0);
            List<int> tmpIDList = new List<int>();
            tmpIDList.Clear();
            //筛选出核心特权
            foreach (string idstr in VipPrivilegeInfoConfig.GetKeys())
            {
                int id = int.Parse(idstr);
                var value = VipPrivilegeInfoConfig.GetPrivilegeDataEx(id, model.presentSelectVip);
                if (value == 0)
                {
                    continue;
                }
                var config = VipPrivilegeInfoConfig.Get(id);
                if (config.important == 1)
                {
                    m_SelectVipList.AddCell(ScrollerDataType.Normal, id);
                }
                else
                {
                    tmpIDList.Add(id);
                }
            }
            //其他特权
            m_SelectVipList.AddCell(ScrollerDataType.Header, 1);
            foreach (var id in tmpIDList)
            {
                m_SelectVipList.AddCell(ScrollerDataType.Normal, id);
            }
            m_SelectVipList.Restart();
            m_SelectVipList.m_Scorller.RefreshActiveCellViews();
        }
        private void OnRefreshCell(ScrollerDataType type, CellView cell)
        {
            if (type == ScrollerDataType.Header)
            {
                VipListHeaderCell headerCell = cell as VipListHeaderCell;
                headerCell.ShowUI(headerCell.index);
            }
            else if (type == ScrollerDataType.Normal)
            {
                VipListNormalCell normalCell = cell as VipListNormalCell;
                string vipStr;
                bool result = GetPrivilegeText(normalCell.index, out vipStr);
                if (result)
                    normalCell.ShowUI(vipStr);
            }
        }
        private void InitVipData()
        {
            m_SelectVipLevel.text = model.presentSelectVip.ToString();
            RefreshVipList();
            VipGiftData data = model.GetVipGift(model.presentSelectVip);
            int index = 0;
            if (data != null)