少年修仙传客户端代码仓库
client_linchunjie
2019-04-24 c43b601f9beb9903ea1f8c983ad55636b50ca1d3
3335 聚魂Tips逻辑修改
5个文件已修改
306 ■■■■■ 已修改文件
System/GatheringSoul/GatherSoulHoleBehaviour.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulItemBehaviour.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulTipWin.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/ItemTip/ItemTipUtility.cs 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GatheringSoul/GatherSoulHoleBehaviour.cs
@@ -97,29 +97,7 @@
                GatherSoulItem item;
                if (model.TryGetItem(hole, out item))
                {
                    var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>();
                    var data = new ItemAttrData(item.id, true);
                    data.SetGatherSoul(item.level, hole);
                    GatherSoulComposeModel.Compose compose;
                    bool requireCompose = composeModel.ExistInComposeMat(item.id, out compose);
                    data.SetTipsFuncBtn(ItemOperateType.putOff, OnTipFunc);
                    if (requireCompose)
                    {
                        data.SetTipsFuncBtn(ItemOperateType.compose, OnTipFunc);
                    }
                    if (!model.IsGatherSoulMaxLevel(item.id, item.level))
                    {
                        data.SetTipsFuncBtn(ItemOperateType.LevelUp, OnTipFunc);
                    }
                    List<GatherSoulItem> list = new List<GatherSoulItem>();
                    model.TryGetSatisfyReplaceSouls(hole, ref list);
                    if (list.Count > 0)
                    {
                        data.SetTipsFuncBtn(ItemOperateType.Replace, OnTipFunc);
                        list = null;
                    }
                    itemTipsModel.SetItemTipsModel(data);
                    ItemTipUtility.ShowGatherSoul(PackType.InterimPack, hole);
                }
                else
                {
System/GatheringSoul/GatherSoulItemBehaviour.cs
@@ -208,62 +208,19 @@
        void OnFunc()
        {
            var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>();
            if (displayItem.packType == PackType.GatherSoul)
            {
                GatherSoulItem item;
                if (model.TryGetItem(displayItem.packType, displayItem.index, out item))
                {
                    var data = new ItemAttrData(item.id, true);
                    data.SetGatherSoul(item.level, -1, PackType.GatherSoul, displayItem.index);
                    if (item.itemType != GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE)
                    {
                        GatherSoulComposeModel.Compose compose;
                        if (composeModel.TryGetCompose(item.id, out compose)
                            && compose.requireItems.Count > 0)
                        {
                            data.SetTipsFuncBtn(ItemOperateType.dismantle, OnTipFunc);
                        }
                        else
                        {
                            data.SetTipsFuncBtn(ItemOperateType.Resolve, OnTipFunc);
                        }
                        GatherSoulComposeModel.Compose outCompose;
                        bool requireCompose = composeModel.ExistInComposeMat(item.id, out outCompose);
                        if (requireCompose)
                        {
                            data.SetTipsFuncBtn(ItemOperateType.compose, OnTipFunc);
                        }
                        bool existSamePropertyHole = soulModel.IsSamePropertyCompareHoles(-1, item as GatherSoulItem) != -1;
                        bool existCoreHoleItem = false;
                        GatherSoulItem holeItem;
                        if (soulModel.TryGetItem(soulModel.coreHole, out holeItem))
                        {
                            existCoreHoleItem = true;
                        }
                        if (item.itemType == GatheringSoulModel.GATHERSOUL_CORE_TYPE)
                        {
                            data.SetTipsFuncBtn(existCoreHoleItem ? ItemOperateType.Replace : ItemOperateType.Wear, OnTipFunc);
                        }
                        else
                        {
                            data.SetTipsFuncBtn(existSamePropertyHole ? ItemOperateType.Replace : ItemOperateType.Wear, OnTipFunc);
                        }
                    }
                    else
                    {
                        data.SetTipsFuncBtn(ItemOperateType.Resolve, OnTipFunc);
                    }
                    itemTipsModel.SetItemTipsModel(data);
                    ItemTipUtility.ShowGatherSoul(displayItem.packType, displayItem.index);
                }
            }
            else
            {
                if (displayItem.itemId != 0)
                {
                    var data = new ItemAttrData(displayItem.itemId, true);
                    data.SetGatherSoul(displayItem.level, -1);
                    itemTipsModel.SetItemTipsModel(data);
                    ItemTipUtility.ShowGatherSoul(displayItem.itemId, displayItem.level);
                }
            }
        }
System/GatheringSoul/GatherSoulTipWin.cs
@@ -32,14 +32,14 @@
        [SerializeField] Vector2 m_ScrollerHeight = new Vector2(180, 260);
        ItemTipsModel itemTipsModel
        {
            get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); }
        }
        GatheringSoulModel model
        {
            get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); }
        }
        ItemTipUtility.TipData tipData
        {
            get { return ItemTipUtility.mainTipData; }
        }
        #region Built-in
@@ -101,13 +101,14 @@
        void DisplayEquipedSign()
        {
            m_EquipedSign.gameObject.SetActive(itemTipsModel.curAttrData.equipHole != -1);
            var packType = ItemTipUtility.mainTipData.gatherSoul.packType;
            m_EquipedSign.gameObject.SetActive(packType == PackType.InterimPack);
        }
        void Display()
        {
            var id = itemTipsModel.curAttrData.itemId;
            var level = itemTipsModel.curAttrData.level;
            var id = tipData.itemId;
            var level = tipData.gatherSoul.level;
            m_Base.Display(id, level);
            m_Property.Display(id, level);
            m_Resolve.Display(id, level);
@@ -115,7 +116,7 @@
        void DisplayGetWay()
        {
            var config = itemTipsModel.curAttrData.itemConfig;
            var config = ItemConfig.Get(tipData.itemId);
            m_ContainerGetWay.gameObject.SetActive(config != null && !string.IsNullOrEmpty(config.Description));
            if (config != null && !string.IsNullOrEmpty(config.Description))
            {
@@ -125,9 +126,9 @@
        void DisplayFuncs()
        {
            var dict = itemTipsModel.curAttrData.tipsFuncBtnDic;
            var list = tipData.operates;
            var index = 0;
            foreach (var type in dict.Keys)
            foreach (var type in list)
            {
                var callBackType = type;
                if (index < m_Funcs.Length)
@@ -136,13 +137,11 @@
                    m_Funcs[index].RemoveAllListeners();
                    m_Funcs[index].AddListener(() =>
                    {
                        if (dict != null && dict.ContainsKey(callBackType))
                        {
                            if (dict[callBackType] != null)
                            {
                                dict[callBackType](callBackType, string.Empty);
                            }
                        }
                        ItemTipUtility.GatherSoulOperate(callBackType);
                        //if (list[callBackType] != null)
                        //{
                        //    list[callBackType](callBackType, string.Empty);
                        //}
                    });
                    m_FuncBtnDisplays[index].text = Language.Get(StringUtility.Contact("ItemHandle_", callBackType));
                    m_Redpoints[index].gameObject.SetActive(false);
@@ -150,12 +149,14 @@
                    if (callBackType == ItemOperateType.LevelUp)
                    {
                        m_Redpoints[index].gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple
                            && model.levelUpRedpointHole == itemTipsModel.curAttrData.equipHole);
                          && tipData.gatherSoul.packType == PackType.InterimPack
                          && model.levelUpRedpointHole == tipData.gatherSoul.index);
                    }
                    else if (callBackType == ItemOperateType.Replace)
                    {
                        m_Redpoints[index].gameObject.SetActive(model.replaceRedpoint.state == RedPointState.Simple
                            && itemTipsModel.curAttrData.index == model.replaceRedpointIndex);
                            && tipData.gatherSoul.packType == PackType.GatherSoul
                            && tipData.gatherSoul.index == model.replaceRedpointIndex);
                    }
                }
                index++;
System/ItemTip/ItemTipUtility.cs
@@ -32,6 +32,7 @@
            public List<ItemOperateType> operates;
            public WingRefineMaterials refineMaterials;
            public GetWay getWay;
            public GatherSoulInfo gatherSoul;
        }
        public struct BaseInfo
@@ -123,6 +124,13 @@
        }
        public struct GatherSoulInfo
        {
            public PackType packType;
            public int index;
            public int level;
        }
        static PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        static EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        static EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
@@ -133,6 +141,9 @@
        static PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
        static ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
        static StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
        static GatheringSoulModel gatherSoulModel { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } }
        static VirtualPackModel virtualPackModel { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } }
        static GatherSoulComposeModel gatherSoulComposeModel { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } }
        public static TipData mainTipData { get; private set; }
        public static TipData secondaryData { get; private set; }
@@ -168,6 +179,7 @@
                    case 61:
                    case 62:
                    case 63:
                        ShowGatherSoul(itemId, 0);
                        break;
                    case 53:
                        var kingTreasureShow = ModelCenter.Instance.GetModel<KingTreasureShowModel>();
@@ -189,6 +201,30 @@
                        break;
                }
            }
        }
        public static void ShowGatherSoul(PackType packType, int index)
        {
            if (packType == PackType.GatherSoul || packType == PackType.InterimPack)
            {
                mainTipData = CreateGatherSoulData(packType, index);
            }
            WindowCenter.Instance.Open<GatherSoulTipWin>();
        }
        public static void ShowGatherSoul(int itemId,int level)
        {
            mainTipData = new TipData()
            {
                itemId = itemId,
                gatherSoul = new GatherSoulInfo()
                {
                    index = -1,
                    level = level,
                    packType = PackType.Deleted,
                },
            };
            WindowCenter.Instance.Open<GatherSoulTipWin>();
        }
        public static void Show(string guid)
@@ -443,6 +479,30 @@
            };
        }
        static TipData CreateGatherSoulData(PackType packType, int index)
        {
            GatherSoulItem soulItem;
            if (packType == PackType.GatherSoul)
            {
                virtualPackModel.TryGetItem(PackType.GatherSoul, index, out soulItem);
            }
            else
            {
                gatherSoulModel.TryGetItem(index, out soulItem);
            }
            return new TipData()
            {
                itemId = soulItem.id,
                gatherSoul = new GatherSoulInfo()
                {
                    packType = packType,
                    level = soulItem.level,
                    index = soulItem.index,
                },
                operates = GetGatherSoulOperates(packType, index),
            };
        }
        public static void Operate(ItemOperateType type, string guid)
        {
            switch (type)
@@ -499,6 +559,58 @@
        {
            var config = StoreConfig.Get(goodId);
            storeModel.SendBuyShopItem(config, count);
        }
        public static void GatherSoulOperate(ItemOperateType type)
        {
            if (mainTipData == null)
            {
                WindowCenter.Instance.Close<GatherSoulTipWin>();
                return;
            }
            if (mainTipData.gatherSoul.packType == PackType.GatherSoul)
            {
                GatherSoulItem item;
                if (!virtualPackModel.TryGetItem(mainTipData.gatherSoul.packType,
                    mainTipData.gatherSoul.index, out item))
                {
                    WindowCenter.Instance.Close<GatherSoulTipWin>();
                    return;
                }
                gatherSoulModel.HandleSoulTipFunc(type, item);
            }
            else if (mainTipData.gatherSoul.packType == PackType.InterimPack)
            {
                GatherSoulItem item;
                if (!gatherSoulModel.TryGetItem(mainTipData.gatherSoul.index, out item))
                {
                    return;
                }
                switch (type)
                {
                    case ItemOperateType.compose:
                        {
                            gatherSoulModel.HandleSoulTipFunc(type, item);
                        }
                        break;
                    case ItemOperateType.putOff:
                        {
                            WindowCenter.Instance.Close<GatherSoulTipWin>();
                            gatherSoulModel.ExecutePutOffSoul(item);
                        }
                        break;
                    case ItemOperateType.LevelUp:
                        WindowCenter.Instance.Close<GatherSoulTipWin>();
                        GatherSoulLevelUpWin.selectHole = item.index;
                        WindowCenter.Instance.Open<GatherSoulLevelUpWin>();
                        break;
                    case ItemOperateType.Replace:
                        WindowCenter.Instance.Close<GatherSoulTipWin>();
                        GatherSoulEquipListWin.selectHole = item.index;
                        WindowCenter.Instance.Open<GatherSoulEquipListWin>();
                        break;
                }
            }
        }
        private static BaseInfo GetBaseInfo(int itemId)
@@ -1219,6 +1331,79 @@
            return operates;
        }
        public static List<ItemOperateType> GetGatherSoulOperates(PackType packType, int index)
        {
            var operates = new List<ItemOperateType>();
            GatherSoulItem item;
            if (packType == PackType.InterimPack)
            {
                gatherSoulModel.TryGetItem(index, out item);
                operates.Add(ItemOperateType.putOff);
                GatherSoulComposeModel.Compose compose;
                bool requireCompose = gatherSoulComposeModel.ExistInComposeMat(item.id, out compose);
                if (requireCompose)
                {
                    operates.Add(ItemOperateType.compose);
                }
                if (!gatherSoulModel.IsGatherSoulMaxLevel(item.id, item.level))
                {
                    operates.Add(ItemOperateType.LevelUp);
                }
                List<GatherSoulItem> list = new List<GatherSoulItem>();
                gatherSoulModel.TryGetSatisfyReplaceSouls(item.index, ref list);
                if (list.Count > 0)
                {
                    operates.Add(ItemOperateType.Replace);
                }
            }
            else if (packType == PackType.GatherSoul)
            {
                virtualPackModel.TryGetItem(PackType.GatherSoul, index, out item);
                if (item.itemType != GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE)
                {
                    GatherSoulComposeModel.Compose compose;
                    if (gatherSoulComposeModel.TryGetCompose(item.id, out compose)
                        && compose.requireItems.Count > 0)
                    {
                        operates.Add(ItemOperateType.dismantle);
                    }
                    else
                    {
                        operates.Add(ItemOperateType.Resolve);
                    }
                    GatherSoulComposeModel.Compose outCompose;
                    bool requireCompose = gatherSoulComposeModel.ExistInComposeMat(item.id, out outCompose);
                    if (requireCompose)
                    {
                        operates.Add(ItemOperateType.compose);
                    }
                    bool existSamePropertyHole = gatherSoulModel.IsSamePropertyCompareHoles(-1, item as GatherSoulItem) != -1;
                    bool existCoreHoleItem = false;
                    GatherSoulItem holeItem;
                    if (gatherSoulModel.TryGetItem(gatherSoulModel.coreHole, out holeItem))
                    {
                        existCoreHoleItem = true;
                    }
                    if (item.itemType == GatheringSoulModel.GATHERSOUL_CORE_TYPE)
                    {
                        operates.Add(existCoreHoleItem ? ItemOperateType.Replace : ItemOperateType.Wear);
                    }
                    else
                    {
                        operates.Add(existSamePropertyHole ? ItemOperateType.Replace : ItemOperateType.Wear);
                    }
                }
                else
                {
                    operates.Add(ItemOperateType.Resolve);
                }
            }
            return operates;
        }
        private static List<ItemOperateType> GetGoodOperates(int goodId)
        {
            var operates = new List<ItemOperateType>();
System/KnapSack/Logic/ItemTipsModel.cs
@@ -933,15 +933,6 @@
        {
            tipsFuncBtnDic.Add(type, func);
        }
        public void SetGatherSoul(int level, int equipHole, PackType packType = PackType.Deleted, int index = -1)
        {
            this.level = level;
            this.equipHole = equipHole;
            this.packType = packType;
            this.index = index;
        }
    }
}