少年修仙传客户端代码仓库
client_linchunjie
2018-12-13 2daf00182988cee4cd44a2b4b755a960b3da71c7
【1.4】聚魂功能
3个文件已修改
6个文件已添加
312 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs.meta 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeCategoryCell.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeCategoryCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeModel.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeSelectCell.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeSelectCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeWin.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:            第二世界
//    [  Date ]:           Wednesday, December 12, 2018
//    [  Date ]:           Thursday, December 13, 2018
//--------------------------------------------------------
using UnityEngine;
@@ -15,7 +15,8 @@
        public int NeedLV { get ; private set ; }
        public int[] NeedItem;
        public int NeedSoulSplinters { get ; private set ; }
        public int NeedSoulCore { get ; private set ; }
        public int NeedSoulCore { get ; private set ; }
        public int category { get ; private set ; }
        public override string getKey()
        {
@@ -38,7 +39,9 @@
            
                NeedSoulSplinters=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; 
            
                NeedSoulCore=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0;
                NeedSoulCore=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0;
                category=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0;
            }
            catch (Exception ex)
            {
Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 0ea390c2d6d6e9140a961520fdc1f652
timeCreated: 1544580391
timeCreated: 1544702516
licenseType: Pro
MonoImporter:
  serializedVersion: 2
System/GatheringSoul/GatherSoulComposeCategoryCell.cs
New file
@@ -0,0 +1,64 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class GatherSoulComposeCategoryCell : CellView
    {
        [SerializeField] Image m_Bottom;
        [SerializeField] Text m_CategoryName;
        [SerializeField] Image m_Arrow;
        [SerializeField] RedpointBehaviour m_Redpoint;
        [SerializeField] Button m_Func;
        GatherSoulComposeModel model
        {
            get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); }
        }
        GatherSoulComposeModel.ComposeCategory category;
        private void Awake()
        {
            m_Func.AddListener(OnFunc);
        }
        private void OnFunc()
        {
            model.selectCategory = category;
        }
        public void Display(GatherSoulComposeModel.ComposeCategory category)
        {
            this.category = category;
            bool isSelect = model.selectCategory.Equals(category);
            m_Arrow.transform.localEulerAngles = isSelect ? new Vector3(0, 0, -90) : Vector3.zero;
            m_Bottom.SetSprite(isSelect ? "ComposeFirstClassChoosebtn" : "ComposeFirstClassNormalbtn");
            var qualityNameKey = StringUtility.Contact("QualityName_", category.quality);
            var propertyCountNameKey = StringUtility.Contact("SoulPropertyCountName_", category.propertyCount);
            switch (category.category)
            {
                case 1:
                    m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey),
                        Language.Get(propertyCountNameKey), Language.Get("SoulCategoryProperty"));
                    break;
                case 2:
                    m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey),
                        Language.Get("ComposeSoulCore"));
                    break;
                case 3:
                    m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey),
                        Language.Get("ComposeSoulPromotion"));
                    break;
                case 4:
                    m_CategoryName.text = StringUtility.Contact(Language.Get(propertyCountNameKey),
                       Language.Get("SoulCategoryProperty"), Language.Get("ComposeHolySoul"));
                    break;
            }
        }
    }
}
System/GatheringSoul/GatherSoulComposeCategoryCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8e427e45690c5eb47b2fe3a3094e3ae8
timeCreated: 1544704726
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/GatheringSoul/GatherSoulComposeModel.cs
@@ -4,9 +4,23 @@
using UnityEngine;
namespace Snxxz.UI
{
    [XLua.Hotfix]
    [XLua.LuaCallCSharp]
    public class GatherSoulComposeModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        Dictionary<int, Compose> composeDict = new Dictionary<int, Compose>();
        public List<ComposeCategory> composeCategories { get; private set; }
        public Dictionary<ComposeCategory, List<int>> categoryDict { get; private set; }
        public ComposeCategory selectCategory { get; set; }
        public int selectItemId { get; set; }
        GatheringSoulModel soulModel
        {
            get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); }
        }
        public override void Init()
        {
            ParseConfig();
@@ -26,10 +40,38 @@
        void ParseConfig()
        {
            categoryDict = new Dictionary<ComposeCategory, List<int>>();
            composeCategories = new List<ComposeCategory>();
            var configs = Config.Instance.GetAllValues<GatherSoulComposeConfig>();
            for (int i = 0; i < configs.Count; i++)
            {
                composeDict.Add(configs[i].TagItemID, new Compose(configs[i]));
                var itemConfig = Config.Instance.Get<ItemConfig>(configs[i].TagItemID);
                var propertyCount = soulModel.gatherSoulPropertys[configs[i].TagItemID].Count;
                if (itemConfig.Type == GatheringSoulModel.GATHERSOUL_CORE_TYPE)
                {
                    propertyCount = 0;
                }
                var quality = itemConfig.ItemColor;
                var category = new ComposeCategory()
                {
                    category = configs[i].category,
                    propertyCount = propertyCount,
                    quality = quality,
                };
                if (!composeCategories.Contains(category))
                {
                    composeCategories.Add(category);
                }
                List<int> list;
                if (!categoryDict.TryGetValue(category, out list))
                {
                    list = new List<int>();
                    categoryDict.Add(category, list);
                }
                list.Add(configs[i].TagItemID);
            }
        }
@@ -45,6 +87,11 @@
            return false;
        }
        public bool TryGetCompose(int itemId, out Compose compose)
        {
            return composeDict.TryGetValue(itemId, out compose);
        }
        public class Compose
        {
            public int itemId;
@@ -52,6 +99,7 @@
            public int requireLevel;
            public int requireSoulSplinters;
            public int requireSoulCore;
            public int category;
            public Compose(GatherSoulComposeConfig config)
            {
@@ -60,6 +108,26 @@
                requireLevel = config.NeedLV;
                requireSoulSplinters = config.NeedSoulSplinters;
                requireSoulCore = config.NeedSoulCore;
                category = config.category;
            }
        }
        public struct ComposeCategory
        {
            public int category;
            public int quality;
            public int propertyCount;
            public override bool Equals(object obj)
            {
                var compare = (ComposeCategory)obj;
                return this.category == compare.category && this.quality == compare.quality
                    && this.propertyCount == compare.propertyCount;
            }
            public override int GetHashCode()
            {
                return (category * 100 + quality * 10 + propertyCount).GetHashCode();
            }
        }
    }
System/GatheringSoul/GatherSoulComposeSelectCell.cs
New file
@@ -0,0 +1,49 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TableConfig;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class GatherSoulComposeSelectCell : CellView
    {
        [SerializeField] Image m_Bottom;
        [SerializeField] Text m_ItemName;
        [SerializeField] RedpointBehaviour m_Redpoint;
        [SerializeField] Button m_Func;
        int itemId;
        GatherSoulComposeModel model
        {
            get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); }
        }
        private void Awake()
        {
            m_Func.AddListener(OnFunc);
        }
        private void OnFunc()
        {
            if (itemId != 0)
            {
                model.selectItemId = itemId;
            }
        }
        public void Display(int itemId)
        {
            this.itemId = itemId;
            var config = Config.Instance.Get<ItemConfig>(itemId);
            m_ItemName.text = config.ItemName;
            m_ItemName.color = UIHelper.GetUIColor(config.ItemColor);
            m_Bottom.SetSprite(model.selectItemId == itemId ? "ChildListBtn_Select" : "ChildListBtn_UnSelect");
        }
    }
}
System/GatheringSoul/GatherSoulComposeSelectCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 88b84b54f5cc83242a4a2ad5606d8ed0
timeCreated: 1544706615
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/GatheringSoul/GatherSoulComposeWin.cs
New file
@@ -0,0 +1,84 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, December 13, 2018
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class GatherSoulComposeWin : Window
    {
        [SerializeField] ScrollerController m_ScrollerControl;
        GatherSoulComposeModel model
        {
            get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); }
        }
        #region Built-in
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
        }
        protected override void OnPreOpen()
        {
            Display();
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
        }
        protected override void OnAfterClose()
        {
        }
        #endregion
        void Display()
        {
            DisplaySelect();
        }
        void DisplaySelect()
        {
            if (m_ScrollerControl.GetNumberOfCells(m_ScrollerControl.m_Scorller) == 0)
            {
                m_ScrollerControl.Refresh();
                for (int i = 0; i < model.composeCategories.Count; i++)
                {
                    var category = model.composeCategories[i];
                    var list = model.categoryDict[category];
                    m_ScrollerControl.AddCell(ScrollerDataType.Header, i);
                    for (int k = 0; k < list.Count; k++)
                    {
                        m_ScrollerControl.AddCell(ScrollerDataType.Normal, k);
                    }
                }
                m_ScrollerControl.Restart();
            }
            else
            {
                m_ScrollerControl.m_Scorller.RefreshActiveCellViews();
            }
        }
    }
}
System/GatheringSoul/GatherSoulComposeWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d61183202e081ad488e471cf8db5a36d
timeCreated: 1544704498
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: