少年修仙传客户端代码仓库
client_Zxw
2018-09-28 a7fcf0f74ad4bf5ec704a4f886db4caba39e41b5
2614 【前端】神兽——强化功能
3个文件已修改
185 ■■■■ 已修改文件
System/Strengthening/GodBeastEntry.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Strengthening/GodBeastModel.cs 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Strengthening/GodBeastReinforcementWin.cs 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Strengthening/GodBeastEntry.cs
@@ -17,7 +17,7 @@
        [SerializeField] GameObject m_Selectedbar_Image;
        [SerializeField] Text m_Item_Text;
        [SerializeField] Button m_GodBeastButton;
        [SerializeField] RedpointBehaviour m_RedPoint;
        public Button GodBeastButton
        {
            get { return m_GodBeastButton; }
@@ -25,7 +25,8 @@
        }
        DogzModel Dogz_model;
        DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
        DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
        GodBeastModel godBeastModel { get { return ModelCenter.Instance.GetModel<GodBeastModel>(); } }
        public void GetGodBeastLocationMarker(int locationMarker, int currentlySelected)
        {
            int godBeastNumber = locationMarker % 100;//神兽编号
@@ -38,6 +39,10 @@
                    if (itemModel[i].EquipPlace == godBeastPart)
                    {
                        ItemCellModel ItemModel = new ItemCellModel(itemModel[i].itemId, true, 0, 0);//不显示绑定
                        if (godBeastModel.GodBeastRedPointDic.ContainsKey(itemModel[i].itemInfo.ItemPlace))
                        {
                            m_RedPoint.redpointId = godBeastModel.GodBeastRedPointDic[(itemModel[i].itemInfo.ItemPlace)].id;
                        }
                        m_itemCell.Init(ItemModel);
                        var itemConfig = Config.Instance.Get<ItemConfig>(itemModel[i].itemId);
                        var IudetDogzEquipPlus = itemModel[i].GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);// 神兽装备强化信息列表 [强化等级, 强化熟练度]
System/Strengthening/GodBeastModel.cs
@@ -23,6 +23,8 @@
    DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
    PlayerPackModel _playerPack;
    PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
    public Dictionary<int, Redpoint> GodBeastRedPointDic = new Dictionary<int, Redpoint>();//key装备位置下标(红点)
    private List<int> RedPointLIst = new List<int>();
    private const int Redpoint_key1 = 11202;//神兽强化红点
    public Redpoint redPointStre1 = new Redpoint(112, Redpoint_key1);
    public override void Init()
@@ -49,6 +51,7 @@
        playerPack.ItemCntReduceAct += ItemCntReduceAct;//物品数量减少
        dogz_model.UpdateAssistDogzEvent += UpdateAssistDogzEvent;
        FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
        SetRedPointID();
        GodBeastRedPoint();
    }
@@ -62,6 +65,7 @@
    private void UpdateAssistDogzEvent()
    {
        SetRedPointID();
        GodBeastRedPoint();
    }
@@ -200,7 +204,7 @@
                    if (_IudetDogzEquipPlus != null)
                    {
                        SingleProficiency += _IudetDogzEquipPlus[1];
                        DoubleProficiency += item_Model.chinItemModel.EffectValueA1+ _IudetDogzEquipPlus[1];
                        DoubleProficiency += item_Model.chinItemModel.EffectValueA1 + _IudetDogzEquipPlus[1];
                    }
                    else
                    {
@@ -233,12 +237,93 @@
        }
    }
    private void SetRedPointID()//设置红点ID
    {
        GodBeastRedPointDic.Clear();
        RedPointLIst.Clear();
        var DogzEquipDict = dogz_model.dogzAssistStateDict;
        foreach (var key in DogzEquipDict.Keys)
        {
            if (DogzEquipDict[key] == 1)
            {
                List<ItemModel> itemModel = dogz_model.GetDogzEquips(key);
                for (int i = 0; i < itemModel.Count; i++)
                {
                    int IndexId = itemModel[i].itemInfo.ItemPlace;
                    int RedPoint = Redpoint_key1 * 1000 + IndexId;
                    Redpoint redPointStare = new Redpoint(Redpoint_key1, RedPoint);
                    if (!GodBeastRedPointDic.ContainsKey(IndexId))
                    {
                        GodBeastRedPointDic.Add(IndexId, redPointStare);
                        RedPointLIst.Add(IndexId);
                    }
                }
            }
        }
        RedPointLIst.Sort(Compare);
    }
    int Compare(int x, int y)
    {
        ItemModel IindexitemModelx = playerPack.GetItemModelByIndex(PackType.rptDogzEquip, x);
        ItemModel IindexitemModely = playerPack.GetItemModelByIndex(PackType.rptDogzEquip, y);
        if (IindexitemModelx.chinItemModel.ItemColor.CompareTo(IindexitemModely.chinItemModel.ItemColor) != 0)//品质
        {
            return -IindexitemModelx.chinItemModel.ItemColor.CompareTo(IindexitemModely.chinItemModel.ItemColor);
        }
        if (IindexitemModelx.chinItemModel.StarLevel.CompareTo(IindexitemModely.chinItemModel.StarLevel) != 0)//星级
        {
            return -IindexitemModelx.chinItemModel.StarLevel.CompareTo(IindexitemModely.chinItemModel.StarLevel);
        }
        if (IindexitemModelx.chinItemModel.EquipPlace.CompareTo(IindexitemModely.chinItemModel.EquipPlace) != 0)//装备位
        {
            return IindexitemModelx.chinItemModel.EquipPlace.CompareTo(IindexitemModely.chinItemModel.EquipPlace);
        }
        if (GetLV(IindexitemModelx).CompareTo(GetLV(IindexitemModely)) != 0)//强化等级
        {
            return -GetLV(IindexitemModelx).CompareTo(GetLV(IindexitemModely));
        }
        if (GetProficiency(IindexitemModelx).CompareTo(GetProficiency(IindexitemModely)) != 0)//熟练度
        {
            return -GetProficiency(IindexitemModelx).CompareTo(GetProficiency(IindexitemModely));
        }
        if (IindexitemModelx.equipScore.CompareTo(IindexitemModely.equipScore) != 0)//装备评分
        {
            return -IindexitemModelx.equipScore.CompareTo(IindexitemModely.equipScore);
        }
        return 1;
    }
    private int GetLV(ItemModel _ItemModel)
    {
        var IudetDogzEquipPlus = _ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
        if (IudetDogzEquipPlus != null)
        {
            return IudetDogzEquipPlus[0];
        }
        return 0;
    }
    private int GetProficiency(ItemModel _ItemModel)
    {
        var IudetDogzEquipPlus = _ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
        if (IudetDogzEquipPlus != null)
        {
            return IudetDogzEquipPlus[1];
        }
        return 0;
    }
    public int IndexId = 0;
    private void GodBeastRedPoint()//神兽强化红点
    {
        bool Istrue = false;
        bool IsRedPoint = false;
        int ItemColor = 10;
        var DogzEquipDict = dogz_model.dogzAssistStateDict;
        redPointStre1.state = RedPointState.None;
        IndexId = 0;
        foreach (var key in GodBeastRedPointDic.Keys)
        {
            GodBeastRedPointDic[key].state = RedPointState.None;
        }
        int Type = 0;
        foreach (var key in DogzEquipDict.Keys)
        {
@@ -278,25 +363,53 @@
                        var itemModelBack = BackpackDic[keyBack];
                        if (itemModelBack.chinItemModel.Type == 70)//有神兽水晶时的红点
                        {
                            redPointStre1.state = RedPointState.Simple;
                            return;
                            IsRedPoint = true;
                        }
                        if (itemModelBack.chinItemModel.ItemColor < _ItemColor)
                        {
                            _ItemColor = itemModelBack.chinItemModel.ItemColor;
                        }
                    }
                    if (Type >= dogz_model.curSumAssistNum && ItemColor> _ItemColor)//出战神兽已满,且神兽背包有品质低于已助战神兽品质颜色时
                    if (Type >= dogz_model.curSumAssistNum && ItemColor > _ItemColor)//出战神兽已满,且神兽背包有品质低于已助战神兽品质颜色时
                    {
                        redPointStre1.state = RedPointState.Simple;
                        return;
                        IsRedPoint = true;
                    }
                }
            }
        }
        if (IsRedPoint)
        {
            int Lv = 100;
            for (int i = 0; i < RedPointLIst.Count; i++)
            {
                ItemModel _itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzEquip, RedPointLIst[i]);
                var _IudetDogzEquipPlus = _itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
                if (_IudetDogzEquipPlus != null)
                {
                    if (_IudetDogzEquipPlus[0] < Lv)
                    {
                        IndexId = RedPointLIst[i];
                    }
                }
                else
                {
                    if (0 < Lv)
                    {
                        Lv = 0;
                        IndexId = RedPointLIst[i];
                    }
                }
            }
            if (GodBeastRedPointDic.ContainsKey(IndexId))
            {
                GodBeastRedPointDic[IndexId].state = RedPointState.Simple;
            }
        }
    }
    public bool  IsNeedEquipment()//是否有极品装备需要弹框
    public bool IsNeedEquipment()//是否有极品装备需要弹框
    {
        bool IsBool = false;
        foreach (var key in Absorption_Dic.Keys)
@@ -309,7 +422,7 @@
                    IsBool = true;
                }
            }
        }
        return IsBool;
    }
System/Strengthening/GodBeastReinforcementWin.cs
@@ -3,6 +3,7 @@
//    [  Date ]:           Thursday, August 16, 2018
//--------------------------------------------------------
using EnhancedUI.EnhancedScroller;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -40,22 +41,24 @@
        private List<GodBeastClass> GodBeastList = new List<GodBeastClass>();
        private int CurrentlySelected = 0;
        private int JumpIndex = 0;
        public int Offset = 0;//偏移量
        #region Built-in
        protected override void BindController()
        {
        {
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
        }
        protected override void AddListeners()
        {
        {
        }
        protected override void OnPreOpen()
        {
            CurrentlySelected = 0;
            GetGodBeast();//获取神兽强化装备信息
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
            if (godBeastModel.ItemPlace != -1)
            if (godBeastModel.ItemPlace != -1)//装备强化跳转选中
            {
                for (int i = 0; i < GodBeastList.Count; i++)
                {
@@ -74,23 +77,44 @@
            }
            else
            {
                if (GodBeastList.Count > 0)
                if (godBeastModel.redPointStre1.state == RedPointState.Simple)//强化红点选中
                {
                    CurrentlySelected = GodBeastList[0].LocationMarker;
                    GetDogZBagIndex();
                    JumpIndex = 0;
                    for (int i = 0; i < GodBeastList.Count; i++)
                    {
                        if (GodBeastList[i].ItemPlace == godBeastModel.IndexId)
                        {
                            JumpIndex = i;
                            CurrentlySelected = GodBeastList[i].LocationMarker;
                        }
                    }
                }
                else
                {
                    if (GodBeastList.Count > 0)//默认选中个
                    {
                        CurrentlySelected = GodBeastList[0].LocationMarker;
                        GetDogZBagIndex();
                        JumpIndex = 0;
                    }
                }
            }
            OnCreateGridLineCell(m_ScrollerController);
            m_GodBeastSlidingList.Init();
            m_GodBeastAttributes.Init();
            m_GodBeastAttributes.GetGodBeastLocationMarker(CurrentlySelected);
            m_ScrollerController.JumpIndex(JumpIndex);
        }
        protected override void OnActived()
        {
            var offset = 0f;
            m_ScrollerController.JumpIndex(JumpIndex,ref offset);
            m_ScrollerController.JumpIndex(Offset + offset, 0, EnhancedScroller.TweenType.immediate);
        }
        protected override void OnAfterOpen()
        {
            playerPack.RefreshItemCountAct += RefreshItemCountAct;
@@ -102,7 +126,6 @@
            JumpIndex = 0;
            godBeastModel.ItemPlace = -1;
            playerPack.RefreshItemCountAct -= RefreshItemCountAct;
            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
            DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent -= MakeItemAnswerEvent;
        }