少年修仙传客户端代码仓库
client_linchunjie
2018-11-07 1353fa6afbfbf1f01a745253fa380ffbdb05df3b
4398 【1.2】聊天气泡框前端去掉Vip礼包的支持
4个文件已修改
59 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/ChatBubbleBoxConfig.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/ChatBubbleBoxConfig.cs.meta 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatBubbleModel.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatBubbleSelectBehaviour.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/ChatBubbleBoxConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:            第二世界
//    [  Date ]:           Tuesday, November 06, 2018
//    [  Date ]:           Wednesday, November 07, 2018
//--------------------------------------------------------
using UnityEngine;
@@ -14,7 +14,6 @@
        public int ID { get ; private set ; }
        public string Name { get ; private set; } 
        public int NeedLV { get ; private set ; }
        public int NeedVIPLVGift { get ; private set ; }
        public string leftBubbleIcon { get ; private set; } 
        public string rightBubbleIcon { get ; private set; } 
        public int[] leftOffset;
@@ -39,40 +38,38 @@
            
                NeedLV=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; 
            
                NeedVIPLVGift=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0;
                leftBubbleIcon = rawContents[3].Trim();
            
                leftBubbleIcon = rawContents[4].Trim();
                rightBubbleIcon = rawContents[4].Trim();
            
                rightBubbleIcon = rawContents[5].Trim();
                string[] leftOffsetStringArray = rawContents[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                string[] leftOffsetStringArray = rawContents[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                leftOffset = new int[leftOffsetStringArray.Length];
                for (int i=0;i<leftOffsetStringArray.Length;i++)
                {
                     int.TryParse(leftOffsetStringArray[i],out leftOffset[i]);
                }
            
                string[] rightOffsetStringArray = rawContents[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                string[] rightOffsetStringArray = rawContents[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                rightOffset = new int[rightOffsetStringArray.Length];
                for (int i=0;i<rightOffsetStringArray.Length;i++)
                {
                     int.TryParse(rightOffsetStringArray[i],out rightOffset[i]);
                }
            
                Icon = rawContents[8].Trim();
                Icon = rawContents[7].Trim();
            
                Jump=IsNumeric(rawContents[9]) ? int.Parse(rawContents[9]):0;
                Jump=IsNumeric(rawContents[8]) ? int.Parse(rawContents[8]):0;
            
                GainTip = rawContents[10].Trim();
                GainTip = rawContents[9].Trim();
            
                string[] colorStringArray = rawContents[11].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                string[] colorStringArray = rawContents[10].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                color = new int[colorStringArray.Length];
                for (int i=0;i<colorStringArray.Length;i++)
                {
                     int.TryParse(colorStringArray[i],out color[i]);
                }
            
                top=IsNumeric(rawContents[12]) ? int.Parse(rawContents[12]):0;
                top=IsNumeric(rawContents[11]) ? int.Parse(rawContents[11]):0;
            }
            catch (Exception ex)
            {
Core/GameEngine/Model/Config/ChatBubbleBoxConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: d3368c32387593943aae6e197d7cb78f
timeCreated: 1541471355
timeCreated: 1541554853
licenseType: Pro
MonoImporter:
  serializedVersion: 2
System/Chat/ChatBubbleModel.cs
@@ -68,33 +68,26 @@
            return chatBubbles.TryGetValue(id, out bubble);
        }
        public bool IsBubbleGot(int id, out int reason)
        public bool IsBubbleGot(int id)
        {
            ChatBubble bubble;
            reason = 0;
            if (TryGetBubble(id, out bubble))
            {
                var config = Config.Instance.Get<ChatBubbleBoxConfig>(id);
                if (config.NeedLV != 0)
                {
                    reason = 1;
                    return PlayerDatas.Instance.baseData.LV >= config.NeedLV;
                }
                if (config.NeedVIPLVGift != 0)
                {
                    reason = 2;
                    var gift = vipModel.GetVipGift(config.NeedVIPLVGift);
                    return gift != null && gift.hasBuy;
                }
                bool got = false;
                try
                {
                    reason = 3;
                    return MathUtility.GetBitValue(bubbleState, (ushort)id);
                    got = MathUtility.GetBitValue(bubbleState, (ushort)id);
                }
                catch (ArgumentOutOfRangeException)
                {
                    DebugEx.LogError("目前不支持id超过31的聊天框:" + id);
                }
                if (!got && config.NeedLV != 0)
                {
                    return PlayerDatas.Instance.baseData.LV >= config.NeedLV;
                }
                return got;
            }
            return false;
        }
@@ -112,8 +105,7 @@
        public void SendUseBubble(int id)
        {
            var reason = 0;
            if (!IsBubbleGot(id, out reason))
            if (!IsBubbleGot(id))
            {
                return;
            }
System/Chat/ChatBubbleSelectBehaviour.cs
@@ -86,9 +86,8 @@
            ChatBubbleModel.ChatBubble bubble;
            if (model.TryGetBubble(bubbleId, out bubble))
            {
                var reason = 0;
                var got = model.IsBubbleGot(bubbleId, out reason);
                m_ContainerUnGet.gameObject.SetActive(reason != 0 && !got);
                var got = model.IsBubbleGot(bubbleId);
                m_ContainerUnGet.gameObject.SetActive(!got);
                var config = Config.Instance.Get<ChatBubbleBoxConfig>(bubbleId);
                if (!got)
                {
@@ -99,8 +98,7 @@
        private void OnFunc()
        {
            var reason = 0;
            if (model.IsBubbleGot(bubbleId, out reason))
            if (model.IsBubbleGot(bubbleId))
            {
                model.SendUseBubble(bubbleId);
            }