少年修仙传客户端代码仓库
client_linchunjie
2018-12-14 ec434e1cba24208c5d8b63df3ba4e7a42cfa468b
【1.4】聚魂功能
5个文件已修改
2个文件已添加
328 ■■■■■ 已修改文件
System/GatheringSoul/GatherSoulComposeWin.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulHoleBehaviour.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulItemBehaviour.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulWin.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatheringSoulModel.cs 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/SystemMoneyRemindWin.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/SystemMoneyRemindWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulComposeWin.cs
@@ -201,7 +201,8 @@
            var error = 0;
            if (!TestCompose(out error))
            {
                DisplayErrorTip(error);
                return;
            }
        }
@@ -214,12 +215,48 @@
                error = 1;
                return false;
            }
            if (PlayerDatas.Instance.baseData.LV < compose.requireLevel)
            {
                error = 2;
                return false;
            }
            if (UIHelper.GetMoneyCnt(GatheringSoulModel.SOULSPLINTERS_MONEYTYPE) < (ulong)compose.requireSoulSplinters)
            {
                error = 3;
                return false;
            }
            if (UIHelper.GetMoneyCnt(GatheringSoulModel.SOULCORE_MONEYTYPE) < (ulong)compose.requireSoulCore)
            {
                error = 4;
                return false;
            }
            for (int i = 0; i < compose.requireItems.Count; i++)
            {
                GatherSoulItem item;
                if (!soulModel.TryGetHighestLevelItem(compose.requireItems[i], out item))
                {
                    error = 5;
                    return false;
                }
            }
            return true;
        }
        void DisplayErrorTip(int error)
        {
            //sw
            switch (error)
            {
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    break;
            }
        }
    }
System/GatheringSoul/GatherSoulHoleBehaviour.cs
@@ -69,7 +69,7 @@
            GatherSoulHoleCondition condition;
            if (model.TryGetHoleCondition(hole, out condition))
            {
                m_Condition.text = Language.Get("", condition.level);
                m_Condition.text = Language.Get("GatherSoulHoleOpenCondition", condition.level);
            }
        }
@@ -80,7 +80,7 @@
                GatherSoulHoleCondition condition;
                if (model.TryGetHoleCondition(hole, out condition))
                {
                    SysNotifyMgr.Instance.ShowTip("", condition.level);
                    SysNotifyMgr.Instance.ShowTip("GatherSoulHoleOpenCondition", condition.level);
                }
            }
            else
@@ -107,7 +107,7 @@
                {
                    if (!model.ContainsEquipSoul(hole))
                    {
                        SysNotifyMgr.Instance.ShowTip("");
                        SysNotifyMgr.Instance.ShowTip("NoneSoulSatisfyEquip");
                    }
                    else
                    {
System/GatheringSoul/GatherSoulItemBehaviour.cs
@@ -125,12 +125,12 @@
        void OnFunc()
        {
            var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>();
            if (diplayItem.packType == PackType.rptGatherSoul)
            {
                GatherSoulItem item;
                if (model.TryGetItem(diplayItem.packType, diplayItem.index, out item))
                {
                    var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>();
                    var data = new ItemAttrData(item.id);
                    data.SetGatherSoul(item.level, -1);
                    bool requireCompose = composeModel.ExistInComposeMat(item.id);
@@ -160,7 +160,9 @@
            }
            else
            {
                var data = new ItemAttrData(diplayItem.itemId);
                data.SetGatherSoul(diplayItem.level, -1);
                itemTipsModel.SetItemTipsModel(data);
            }
        }
System/GatheringSoul/GatherSoulWin.cs
@@ -25,6 +25,10 @@
        [SerializeField] Button m_GotoCompose;
        [SerializeField] Button m_Resolve;
        [SerializeField] Button m_ViewProperty;
        [SerializeField] Image m_DustIcon;
        [SerializeField] Image m_SplintersIcon;
        [SerializeField] Image m_CoreIcon;
        VirtualPackModel virtualPack
        {
@@ -46,6 +50,18 @@
            m_GotoCompose.onClick.AddListener(GotoCompose);
            m_Resolve.onClick.AddListener(Resolve);
            m_ViewProperty.onClick.AddListener(ViewProperty);
            UIEventTrigger.Get(m_DustIcon.gameObject).OnDown = (GameObject go) =>
              {
                  ViewMoneyType(GatheringSoulModel.SOULDUST_MONEYTYPE, m_DustIcon.transform as RectTransform);
              };
            UIEventTrigger.Get(m_SplintersIcon.gameObject).OnDown = (GameObject go) =>
            {
                ViewMoneyType(GatheringSoulModel.SOULSPLINTERS_MONEYTYPE, m_SplintersIcon.transform as RectTransform);
            };
            UIEventTrigger.Get(m_CoreIcon.gameObject).OnDown = (GameObject go) =>
            {
                ViewMoneyType(GatheringSoulModel.SOULCORE_MONEYTYPE, m_CoreIcon.transform as RectTransform);
            };
            m_ScrollerControl.OnRefreshCell += OnRefreshCell;
        }
@@ -151,6 +167,14 @@
        {
            WindowCenter.Instance.Open<GatherSoulResolveWin>();
        }
        void ViewMoneyType(int moneyType, RectTransform rect)
        {
            SystemMoneyRemindWin.moneyType = moneyType;
            var position = rect.TransformPoint(Vector3.zero);
            SystemMoneyRemindWin.position = position;
            WindowCenter.Instance.Open<SystemMoneyRemindWin>(true);
        }
    }
}
System/GatheringSoul/GatheringSoulModel.cs
@@ -31,6 +31,8 @@
            get; set;
        }
        public int coreHole { get; private set; }
        public int autoResolveRemainCount { get; private set; }
        public event Action<int> gatherSoulHoleRefresh;
@@ -44,6 +46,16 @@
        public const int SOULSPLINTERS_MONEYTYPE = 29;
        public const int SOULCORE_MONEYTYPE = 30;
        const int GATHERSOUL_REDPOINT_BASE = 10102;
        const int GATHERSOUL_REDPOINT_DEEP = 1010200;
        static int redpointIndex = 0;
        readonly Redpoint redpoint = new Redpoint(101, GATHERSOUL_REDPOINT_BASE);
        readonly Redpoint equipRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, GATHERSOUL_REDPOINT_DEEP + redpointIndex++);
        readonly Redpoint replaceRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, GATHERSOUL_REDPOINT_DEEP + redpointIndex++);
        readonly Redpoint resolveRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, GATHERSOUL_REDPOINT_DEEP + redpointIndex++);
        readonly Redpoint levelUpRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, GATHERSOUL_REDPOINT_DEEP + redpointIndex++);
        static readonly IComparer<int> soulPackSort = new GatherSoulPackSort();
        static readonly IEqualityComparer<int> holeItemTypeDistinct = new HoleItemTypeDistinct();
@@ -56,6 +68,7 @@
            resolveItems = new List<GatherSoulItem>();
            virtualPack.virtualPackRefresh += VirtualPackRefresh;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
        }
        public void OnBeforePlayerDataInitialize()
@@ -67,11 +80,21 @@
        public void OnPlayerLoginOk()
        {
            CheckAutoResolve();
            UpdateRedpoint();
        }
        public override void UnInit()
        {
            virtualPack.virtualPackRefresh -= VirtualPackRefresh;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent;
        }
        private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType)
        {
            if (refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulDust)
            {
                UpdateRedpoint();
            }
        }
        void ParseConfig()
@@ -88,6 +111,13 @@
                    });
                }
                holeItemTypeDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical2);
                foreach (var hole in holeItemTypeDict.Keys)
                {
                    if (holeItemTypeDict[hole] == GATHERSOUL_CORE_TYPE)
                    {
                        coreHole = hole;
                    }
                }
            }
            funcConfig = Config.Instance.Get<FuncConfigConfig>("");
@@ -149,6 +179,7 @@
            {
                RefreshGatherSoulPack();
                CheckAutoResolve();
                UpdateRedpoint();
            }
        }
@@ -272,9 +303,28 @@
            return false;
        }
        public bool ExistEmptyHole()
        {
            var count = holeCount;
            for (int i = 0; i < count; i++)
            {
                if (!IsHoleUnlock(i))
                {
                    continue;
                }
                GatherSoulItem item;
                if (!TryGetItem(i, out item))
                {
                    return true;
                }
            }
            return false;
        }
        public void OnReceiveServerPack()
        {
            RefreshGatherSoulPack();
            UpdateRedpoint();
            if (gatherSoulHoleRefresh != null)
            {
                gatherSoulHoleRefresh(0);
@@ -370,6 +420,20 @@
                        hole = i;
                        return true;
                    }
                }
            }
            return false;
        }
        public bool SatisfyReplace(int hole, GatherSoulItem item)
        {
            GatherSoulItem holeItem;
            if (TryGetItem(hole, out holeItem))
            {
                if (item.itemType == holeItem.itemType
                    && item.ExistSameProperty(holeItem.id))
                {
                    return true;
                }
            }
            return false;
@@ -584,6 +648,21 @@
                }
            }
            return item != null;
        }
        public bool TryGetSinglePropertyItems(int property, out int itemId)
        {
            itemId = 0;
            foreach (var key in gatherSoulPropertys.Keys)
            {
                if (gatherSoulPropertys[key].Count == 1
                    && gatherSoulPropertys[key][0] == property)
                {
                    itemId = key;
                    return true;
                }
            }
            return false;
        }
        public int CommonSort(GatherSoulItem lhs, GatherSoulItem rhs)
@@ -924,7 +1003,86 @@
        #endregion
        #region 红点
        public int levelUpRedpointHole = 0;
        void UpdateRedpoint()
        {
            equipRedpoint.state = RedPointState.None;
            replaceRedpoint.state = RedPointState.None;
            resolveRedpoint.state = RedPointState.None;
            levelUpRedpoint.state = RedPointState.None;
            if (!FuncOpen.Instance.IsFuncOpen(1))
            {
                return;
            }
            var error = 0;
            List<int> holes;
            if (ExistEmptyHole(out holes) && packIndexs.Count > 0)
            {
                GatherSoulItem item;
                if (virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[0], out item))
                {
                    for (int i = 0; i < holes.Count; i++)
                    {
                        if (SatisfyEquipSoul(item, holes[i], out error))
                        {
                            equipRedpoint.state = RedPointState.Simple;
                            return;
                        }
                    }
                }
            }
            var count = holeCount;
            if (packIndexs.Count > 0)
            {
                GatherSoulItem item;
                virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[0], out item);
                for (int i = 0; i < count; i++)
                {
                    GatherSoulItem holeItem;
                    if (TryGetItem(i, out holeItem))
                    {
                        if (SatisfyReplace(i, item) && item.Compare(holeItem) == 1)
                        {
                            replaceRedpoint.state = RedPointState.Simple;
                            return;
                        }
                    }
                }
            }
            List<GatherSoulItem> list = new List<GatherSoulItem>();
            GetResolveSouls(int.MaxValue, list);
            if (list.Count > 0)
            {
                resolveRedpoint.state = RedPointState.Simple;
                list = null;
                return;
            }
            GatherSoulItem coreItem;
            if (TryGetItem(coreHole, out coreItem))
            {
                if (SatisfyLevelUp(coreItem, out error))
                {
                    levelUpRedpointHole = coreHole;
                    levelUpRedpoint.state = RedPointState.Simple;
                }
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    GatherSoulItem holeItem;
                    if (TryGetItem(i, out holeItem))
                    {
                        if (SatisfyLevelUp(holeItem, out error))
                        {
                            levelUpRedpointHole = i;
                            levelUpRedpoint.state = RedPointState.Simple;
                            return;
                        }
                    }
                }
            }
        }
        #endregion
        public class HoleItemTypeDistinct : IEqualityComparer<int>
System/GatheringSoul/SystemMoneyRemindWin.cs
New file
@@ -0,0 +1,79 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, December 14, 2018
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class SystemMoneyRemindWin : Window
    {
        [SerializeField] RectTransform m_Container;
        [SerializeField] Text m_Remind;
        public static int moneyType = 0;
        public static Vector2 position = Vector3.zero;
        #region Built-in
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
        }
        protected override void OnPreOpen()
        {
            Display();
        }
        protected override void OnActived()
        {
            base.OnActived();
            var localpos = transform.InverseTransformPoint(position);
            m_Container.localPosition = localpos;
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
        }
        protected override void OnAfterClose()
        {
        }
        #endregion
        protected override void LateUpdate()
        {
            base.LateUpdate();
            if (!Input.GetMouseButton(0))
            {
                if (WindowCenter.Instance.IsOpen<SystemMoneyRemindWin>())
                {
                    CloseImmediately();
                }
            }
        }
        void Display()
        {
            m_Remind.text = Language.Get(StringUtility.Contact("MoneyTypeUseRemind_", moneyType));
        }
    }
}
System/GatheringSoul/SystemMoneyRemindWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 77ec946bfa3aa1f429baca2680aae3b8
timeCreated: 1544772268
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: