少年修仙传客户端代码仓库
client_linchunjie
2018-12-26 8c97b2829b8c13e823560bdc5d06db9afa717548
5504 【前端】【1.4】法宝标签页新增一个系列(王者法宝),王者法宝的功能开发
6个文件已修改
4个文件已添加
393 ■■■■■ 已修改文件
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51D_tagCMWearMagicWeapon.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51D_tagCMWearMagicWeapon.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/FunctionUnlockFlyObject.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/KingThreeDimensionsBehaviour.cs 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/KingTreasureModel.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/KingTreasureWin.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/TreasureInteractProcessor.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/TreasureNewGotWin.cs 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/TreasureUIEvent.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/TreasureUIEvent.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51D_tagCMWearMagicWeapon.cs
New file
@@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;
// A5 1D 法宝佩戴 #tagCMWearMagicWeapon
public class CA51D_tagCMWearMagicWeapon : GameNetPackBasic {
    public uint MWID;    //法宝ID
    public byte State;    //0-卸下 1-佩戴
    public CA51D_tagCMWearMagicWeapon () {
        combineCmd = (ushort)0x03FE;
        _cmd = (ushort)0xA51D;
    }
    public override void WriteToBytes () {
        WriteBytes (MWID, NetDataType.DWORD);
        WriteBytes (State, NetDataType.BYTE);
    }
}
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51D_tagCMWearMagicWeapon.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c0cb54d8f83ee704390655a70712d24b
timeCreated: 1545809562
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Treasure/FunctionUnlockFlyObject.cs
@@ -127,6 +127,9 @@
                    onReached();
                    onReached = null;
                }
                StopTreasureShow();
                GameObject.Destroy(this.gameObject);
                return;
            }
@@ -189,27 +192,29 @@
                        functionUnLockShowEndEvent(m_UnLockType);
                    }
                    switch (m_UnLockType)
                    {
                        case FunctionUnlockType.Treasure:
                        case FunctionUnlockType.TreasureSkill:
                        case FunctionUnlockType.TreasureFunc:
                            UI3DTreasureExhibition.Instance.StopShow();
                            break;
                        case FunctionUnlockType.Normal:
                            break;
                    }
                    StopTreasureShow();
                    GameObject.Destroy(this.gameObject);
                }
                catch (Exception ex)
                {
                    DebugEx.Log(ex.Message);
                }
            }
        }
        void StopTreasureShow()
        {
            switch (m_UnLockType)
            {
                case FunctionUnlockType.Treasure:
                case FunctionUnlockType.TreasureSkill:
                case FunctionUnlockType.TreasureFunc:
                    UI3DTreasureExhibition.Instance.StopShow();
                    break;
            }
        }
    }
}
System/Treasure/KingThreeDimensionsBehaviour.cs
@@ -2,34 +2,113 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TableConfig;
using System;
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class KingThreeDimensionsBehaviour : MonoBehaviour
    {
        [SerializeField] RectTransform m_ContainerSeasonNotStart;
        [SerializeField] RectTransform m_ContainerSeasonStartOrEnd;
        [SerializeField] Text m_Season;
        [SerializeField] Image m_State;
        [SerializeField] Image m_EndState;
        [SerializeField] Image m_OnGoingState;
        [SerializeField] Text m_Division;
        [SerializeField] Text m_Score;
        [SerializeField] TreasureUIEvent m_Wear;
        KingTreasureModel model
        {
            get { return ModelCenter.Instance.GetModel<KingTreasureModel>(); }
        }
        TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
        CrossServerOneVsOneModel oneVsOneModel
        {
            get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); }
        }
        int displayTreasureId = 0;
        private void Awake()
        {
            m_Wear.onClick += OnWear;
        }
        public void Display(int treasureId)
        {
            displayTreasureId = treasureId;
            var season = 0;
            if (model.TryGetSeason(treasureId, out season))
            {
                m_Season.text = season.ToString();
                var seasonNotStart = season > CrossServerOneVsOnePKSeason.Instance.SeasonID;
                m_ContainerSeasonNotStart.gameObject.SetActive(seasonNotStart);
                m_ContainerSeasonStartOrEnd.gameObject.SetActive(!seasonNotStart);
                bool seasonEnd = season < CrossServerOneVsOnePKSeason.Instance.SeasonID;
                if (!seasonNotStart)
                {
                    m_EndState.gameObject.SetActive(seasonEnd);
                    m_OnGoingState.gameObject.SetActive(!seasonEnd);
                    m_Season.text = season.ToString();
                    m_Division.gameObject.SetActive(seasonEnd);
                    CrossServerOneVsOneModel.CrossServerOneVsOneHistory history;
                    if (oneVsOneModel.TryGetOneVsOneHistory(season, out history))
                    {
                        var divisionConfig = Config.Instance.Get<CrossServerArenaConfig>(history.division);
                        m_Division.gameObject.SetActive(divisionConfig != null);
                        if (divisionConfig != null)
                        {
                            m_Division.text = divisionConfig.Name;
                        }
                        m_Score.gameObject.SetActive(true);
                        m_Score.text = Language.Get("KingTreasureScore", model.GetSeasonScore(treasureId));
                    }
                    else
                    {
                        m_Division.gameObject.SetActive(false);
                        m_Score.gameObject.SetActive(false);
                    }
                }
            }
            Treasure treasure;
            if(treasureModel.TryGetTreasure(treasureId, out treasure))
            {
                m_Wear.gameObject.SetActive(treasure.state == TreasureState.Collected);
            }
            else
            {
                m_Wear.gameObject.SetActive(false);
            }
            model.treasureWearRefresh -= TreasureWearRefresh;
            model.treasureWearRefresh += TreasureWearRefresh;
        }
        public void OnWear()
        {
            if (displayTreasureId != 0)
            {
                model.TryWearTreasure(displayTreasureId);
            }
        }
        private void TreasureWearRefresh(int id)
        {
            if (id == displayTreasureId)
            {
            }
        }
        public void Dispose()
        {
            model.treasureWearRefresh -= TreasureWearRefresh;
        }
    }
}
System/Treasure/KingTreasureModel.cs
@@ -14,10 +14,16 @@
        public event Action<int> treasureWearRefresh;
        public int wearCountLimit { get; private set; }
        public string scoreFormula { get; private set; }
        TreasureModel treasureModel
        {
            get { return ModelCenter.Instance.GetModel<TreasureModel>(); }
        }
        CrossServerOneVsOneModel oneVsOneModel
        {
            get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); }
        }
        public override void Init()
@@ -47,6 +53,12 @@
            {
                treasureSeasonDict = ConfigParse.GetDic<int, int>(config.Numerical1);
                wearCountLimit = int.Parse(config.Numerical2);
            }
            config = Config.Instance.Get<FuncConfigConfig>("KingTreasureScore");
            if (config != null)
            {
                scoreFormula = config.Numerical1;
            }
            var configs = Config.Instance.GetAllValues<KingTreasureConfig>();
@@ -107,6 +119,96 @@
            return displays;
        }
        public void TryWearTreasure(int treasureId)
        {
            var config = Config.Instance.Get<TreasureConfig>(treasureId);
            if (config == null || (TreasureCategory)config.Category != TreasureCategory.King)
            {
                return;
            }
            Treasure treasure;
            if (treasureModel.TryGetTreasure(treasureId, out treasure))
            {
                if (treasure.state == TreasureState.Collected)
                {
                    if (IsWear(treasureId))
                    {
                        CA51D_tagCMWearMagicWeapon pak = new CA51D_tagCMWearMagicWeapon();
                        pak.MWID = (uint)treasureId;
                        pak.State = 0;
                        GameNetSystem.Instance.SendInfo(pak);
                    }
                    else
                    {
                        if (GetWearTreasureCount() >= wearCountLimit)
                        {
                            var countDisplay = string.Empty;
                            if (wearCountLimit == 2)
                            {
                                countDisplay = Language.Get("Num_CHS_Two");
                            }
                            else
                            {
                                countDisplay = Language.Get(StringUtility.Contact("Num_CHS_", wearCountLimit));
                            }
                            SysNotifyMgr.Instance.ShowTip("KingTreasureWearLimit", countDisplay);
                            return;
                        }
                        CA51D_tagCMWearMagicWeapon pak = new CA51D_tagCMWearMagicWeapon();
                        pak.MWID = (uint)treasureId;
                        pak.State = 1;
                        GameNetSystem.Instance.SendInfo(pak);
                    }
                }
            }
        }
        public int GetWearTreasureCount()
        {
            var count = 0;
            var list = treasureModel.GetTreasureCategory(TreasureCategory.King);
            for (int i = 0; i < list.Count; i++)
            {
                if (IsWear(list[i]))
                {
                    count++;
                }
            }
            return count;
        }
        public int GetSeasonScore(int treasureId)
        {
            var score = 0;
            if (scoreFormula != null)
            {
                var season = 0;
                if (TryGetSeason(treasureId, out season))
                {
                    CrossServerOneVsOneModel.CrossServerOneVsOneHistory history;
                    if (oneVsOneModel.TryGetOneVsOneHistory(season, out history))
                    {
                        Division division;
                        if (TryGetDivision(treasureId, history.rewardLevel, out division)
                            && division.propertys != null)
                        {
                            Equation.Instance.Clear();
                            foreach (var key in division.propertys.Keys)
                            {
                                var config = Config.Instance.Get<PlayerPropertyConfig>(key);
                                if (config != null)
                                {
                                    Equation.Instance.AddKeyValue(config.Parameter, division.propertys[key]);
                                }
                            }
                            score = Equation.Instance.Eval<int>(scoreFormula);
                        }
                    }
                }
            }
            return score;
        }
        public void OnReceivePackage(HA352_tagMCMagicWeaponLVInfo package)
        {
System/Treasure/KingTreasureWin.cs
@@ -156,7 +156,7 @@
                    m_Division.text = divisionConfig.Name;
                }
                KingTreasureModel.Division division;
                if (kingTreasureModel.TryGetDivision(model.selectedTreasure, history.division, out division))
                if (kingTreasureModel.TryGetDivision(model.selectedTreasure, history.rewardLevel, out division))
                {
                    if (division.propertys != null)
                    {
System/Treasure/TreasureInteractProcessor.cs
@@ -22,6 +22,20 @@
        public void OnPointerClick(PointerEventData eventData)
        {
            List<RaycastResult> results = new List<RaycastResult>();
            EventSystem.current.RaycastAll(eventData, results);
            if (results != null)
            {
                var index = results.FindIndex((x) =>
                {
                    return x.gameObject.GetComponent<TreasureUIEvent>() != null;
                });
                if (index != -1)
                {
                    DebugEx.Log("法宝UI事件拦截");
                    return;
                }
            }
            UI3DTreasureSelectStage.Instance.OnPointDownTreasure(treasureId);
        }
System/Treasure/TreasureNewGotWin.cs
@@ -45,12 +45,20 @@
        [SerializeField] UIAlphaTween m_FadeInStory;
        [SerializeField] Text m_Story;
        [SerializeField] RectTransform m_ContainerProperty;
        [SerializeField] Slider m_PropertySlider;
        [SerializeField] UIAlphaTween m_FadeInProperty;
        [SerializeField] PropertyBehaviour[] m_BasePropertys;
        [SerializeField] PropertyBehaviour[] m_SpecialPropertys;
        [SerializeField] RectTransform m_ContainerFightPower;
        [SerializeField] Text m_FightPower;
        TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
        PlayerTaskDatas taskmodel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } }
        SkillModel skillModel { get { return ModelCenter.Instance.GetModel<SkillModel>(); } }
        KingTreasureModel kingTreasureModel { get { return ModelCenter.Instance.GetModel<KingTreasureModel>(); } }
        CrossServerOneVsOneModel oneVsOneModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } }
        FunctionUnlockFlyObject flyObject;
        FunctionUnlockFlyObject unlockFlyObject1;
@@ -93,6 +101,9 @@
                        case ShowStep.ShowStory:
                            OnEnterShowStory();
                            break;
                        case ShowStep.ShowProperty:
                            OnEnterShowProperty();
                            break;
                        case ShowStep.ShowComplete:
                            OnEnterShowComplete();
                            break;
@@ -133,6 +144,7 @@
            m_UnlockTip.gameObject.SetActive(false);
            m_ContainerFinishShow.gameObject.SetActive(false);
            m_ContainerFightPower.gameObject.SetActive(false);
            m_ContainerProperty.gameObject.SetActive(false);
            for (int i = 0; i < m_TreasureNewGots.Length; i++)
            {
@@ -234,6 +246,7 @@
                    break;
                case ShowStep.ShowNameAndSliderUnlock:
                    m_FuncUnLockSlider.value = 0;
                    m_PropertySlider.value = 0;
                    if (timer > 0.7f)
                    {
                        timer = 0f;
@@ -256,6 +269,14 @@
                    }
                    break;
                case ShowStep.ShowStory:
                    if (timer > 0.7f)
                    {
                        timer = 0f;
                        showStep = ShowStep.ShowComplete;
                    }
                    break;
                case ShowStep.ShowProperty:
                    m_PropertySlider.value = timer / 0.7f;
                    if (timer > 0.7f)
                    {
                        timer = 0f;
@@ -395,6 +416,69 @@
                }
                flyObject = unlockFlyObject1;
            }
            if ((TreasureCategory)config.Category == TreasureCategory.King)
            {
                Dictionary<int, int> basePropertys = new Dictionary<int, int>();
                Dictionary<int, int> specialPropertys = new Dictionary<int, int>();
                var season = 0;
                if (kingTreasureModel.TryGetSeason(config.ID, out season))
                {
                    CrossServerOneVsOneModel.CrossServerOneVsOneHistory history;
                    if (oneVsOneModel.TryGetOneVsOneHistory(season, out history))
                    {
                        KingTreasureModel.Division division;
                        if (kingTreasureModel.TryGetDivision(config.ID, history.rewardLevel, out division)
                            && division.propertys != null)
                        {
                            foreach (var key in division.propertys.Keys)
                            {
                                var propertyConfig = Config.Instance.Get<PlayerPropertyConfig>(key);
                                if (propertyConfig == null)
                                {
                                    continue;
                                }
                                if (propertyConfig.type == 2)
                                {
                                    specialPropertys.Add(key, division.propertys[key]);
                                }
                                else
                                {
                                    basePropertys.Add(key, division.propertys[key]);
                                }
                            }
                        }
                    }
                }
                var propertyIndex = 0;
                foreach (var key in basePropertys.Keys)
                {
                    if (propertyIndex < m_BasePropertys.Length)
                    {
                        m_BasePropertys[propertyIndex].gameObject.SetActive(true);
                        m_BasePropertys[propertyIndex].DisplayUpper(key, basePropertys[key]);
                    }
                    propertyIndex++;
                }
                for (int i = propertyIndex; i < m_BasePropertys.Length; i++)
                {
                    m_BasePropertys[i].gameObject.SetActive(false);
                }
                propertyIndex = 0;
                foreach (var key in specialPropertys.Keys)
                {
                    if (propertyIndex < m_SpecialPropertys.Length)
                    {
                        m_SpecialPropertys[propertyIndex].gameObject.SetActive(true);
                        m_SpecialPropertys[propertyIndex].DisplayUpper(key, specialPropertys[key]);
                    }
                    propertyIndex++;
                }
                for (int i = propertyIndex; i < m_SpecialPropertys.Length; i++)
                {
                    m_SpecialPropertys[i].gameObject.SetActive(false);
                }
            }
        }
        private void FinishShow()
@@ -462,6 +546,12 @@
                showStep = ShowStep.ShowStory;
                return;
            }
            else if (config.Category == (int)TreasureCategory.King)
            {
                m_ContainerFuncUnLock.gameObject.SetActive(false);
                showStep = ShowStep.ShowProperty;
                return;
            }
            if (displayStageCount == 0)
            {
                showStep = ShowStep.ShowComplete;
@@ -482,6 +572,13 @@
            m_ContianerStory.gameObject.SetActive(true);
            m_FadeInStory.SetStartState();
            m_FadeInStory.Play();
        }
        private void OnEnterShowProperty()
        {
            m_ContainerProperty.gameObject.SetActive(true);
            m_FadeInProperty.SetStartState();
            m_FadeInProperty.Play();
        }
        private void OnEnterShowComplete()
@@ -519,6 +616,7 @@
            ShowNameAndSliderUnlock,
            ShowUnlock,
            ShowStory,
            ShowProperty,
            ShowComplete,
            FadeOut,
            FlyTo,
System/Treasure/TreasureUIEvent.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace Snxxz.UI
{
    public class TreasureUIEvent : MonoBehaviour, IPointerClickHandler
    {
        public event UnityAction onClick;
        public void OnPointerClick(PointerEventData eventData)
        {
            if (onClick != null)
            {
                onClick();
            }
        }
    }
}
System/Treasure/TreasureUIEvent.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1b7181922816fb34bb46a276c365e599
timeCreated: 1545807625
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: