少年修仙传客户端代码仓库
client_linchunjie
2018-08-21 8089f61b173cf879da93835de2b6bca08644a6f8
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
6个文件已修改
4个文件已添加
344 ■■■■■ 已修改文件
System/Dogz/DogzActiveWin.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzModel.cs 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzPackWin.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzWin.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/SelectCell.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/SelectCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/SelectDogzItemWin.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/SelectDogzItemWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/EquipTip.cs 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzActiveWin.cs
@@ -60,7 +60,6 @@
        protected override void OnPreOpen()
        {
            SelectDecide();
            GenerateDogz();
            UpdateSelectDogzEvent();
            UpdateDogzAssistCnt();
@@ -86,12 +85,6 @@
        {
        }
        #endregion
        void SelectDecide()
        {
            var configs = ConfigManager.Instance.GetAllValues<DogzConfig>();
            model.presentSelectDogz = configs[0].ID;
        }
        void GenerateDogz()
        {
@@ -155,6 +148,7 @@
        {
            if (dogzId != model.presentSelectDogz) return;
            UpdateDogzEquip();
            UpdateDogzProperty();
        }
        private void UpdateDogzEquip()
@@ -177,6 +171,11 @@
        private void UpdateDogzProperty()
        {
            var _dogzCfg = ConfigManager.Instance.GetTemplate<DogzConfig>(model.presentSelectDogz);
            bool isAddAttr = model.GetDogzEquips(model.presentSelectDogz) != null && model.GetDogzEquips(model.presentSelectDogz).Count == 5 ? true : false;
            if(isAddAttr)
            {
                model.GetDogzEquipAddAttr(model.presentSelectDogz);
            }
            for (int i = 0; i < m_PropertyTypes.Count; i++)
            {
                m_PropertyTypes[i].gameObject.SetActive(i < _dogzCfg.BaseAttrTypes.Length);
@@ -185,8 +184,31 @@
                {
                    var _propertyCfg = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(_dogzCfg.BaseAttrTypes[i]);
                    m_PropertyTypes[i].text = _propertyCfg.Name;
                    m_PropertyValues[i].text = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
                        , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
                    int attrValue = _dogzCfg.BaseAttrValues[i];
                    if (isAddAttr && model.m_DogzEquipAttrDict[_propertyCfg.ID] > 0)
                    {
                        m_PropertyValues[i].text = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
                      , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty,"+",UIHelper.ReplacePercentage(model.m_DogzEquipAttrDict[_propertyCfg.ID], _propertyCfg.ISPercentage)
                      , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
                    }
                    else
                    {
                        m_PropertyValues[i].text = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
                      , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
                    }
                }
                if(model.TryGetAssistDogzState(model.presentSelectDogz))
                {
                    m_PropertyTypes[i].material = MaterialUtility.GetUIDefaultGraphicMaterial();
                    m_PropertyValues[i].material = MaterialUtility.GetUIDefaultGraphicMaterial();
                }
                else
                {
                    m_PropertyTypes[i].material = MaterialUtility.GetDefaultSpriteGrayMaterial();
                    m_PropertyValues[i].material = MaterialUtility.GetDefaultSpriteGrayMaterial();
                }
            }
        }
@@ -212,7 +234,7 @@
        }
        private void TakeOffEquip()
        {
            model.SendPutOffEquip(0);
            model.CheckPutOff(0);
        }
        private void OpenEquipPack()
        {
System/Dogz/DogzModel.cs
@@ -21,7 +21,9 @@
            SelectDogzItemQuality = 0;
            SelectDogzItemStart = 0;
            dogzItemList = new List<ItemModel>();
            selectEquipPlacelist = new List<ItemModel>();
            dogzAssistStateDict = new Dictionary<int, int>();
            m_DogzEquipAttrDict = new Dictionary<int, int>();
        }
        public void OnAfterPlayerDataInitialize()
@@ -58,7 +60,7 @@
                var _dict = new Dictionary<int, int>();
                for(int j = 0; j < _dogzCfgs[i].EquipPlaceColorList.Length; j++)
                {
                    _dict.Add(j+1, _dogzCfgs[i].EquipPlaceColorList[j]);
                    _dict.Add(j, _dogzCfgs[i].EquipPlaceColorList[j]);
                }
                m_DogzEquipLimit.Add(_dogzCfgs[i].ID, _dict);
            }
@@ -138,7 +140,7 @@
        public int GetAssistItemCnt()
        {
            return AddAssistItemCnt[0];
            return AddAssistItemCnt[addAssistCnt];
        }
        public int presentSelectDogz { get; set; } //当前选中的神兽id
@@ -189,7 +191,7 @@
            int assistCnt = 0;
            foreach(var key in dogzAssistStateDict.Keys)
            {
                if(key == 1)
                if(dogzAssistStateDict[key] == 1)
                {
                    assistCnt += 1;
                }
@@ -297,6 +299,53 @@
            return _list;
        }
        /// <summary>
        /// 获得助战属性加成
        /// </summary>
        public Dictionary<int,int> m_DogzEquipAttrDict { get; private set; }
        public Dictionary<int,int> GetDogzEquipAddAttr(int dogzId)
        {
            m_DogzEquipAttrDict.Clear();
            DogzConfig dogzConfig = ConfigManager.Instance.GetTemplate<DogzConfig>(dogzId);
            int[] baseAttrIds = dogzConfig.BaseAttrTypes;
            for(int i = 0; i < baseAttrIds.Length; i++)
            {
                int attrValue = 0;
                List<ItemModel> itemModels = GetDogzEquips(dogzId);
                if(itemModels != null)
                {
                    for(int j = 0; j < itemModels.Count; j++)
                    {
                        ItemConfig itemConfig = ConfigManager.Instance.GetTemplate<ItemConfig>(itemModels[j].itemId);
                        if(itemConfig.Effect1 == baseAttrIds[i])
                        {
                            attrValue += itemConfig.EffectValueA1;
                        }
                        if (itemConfig.Effect2 == baseAttrIds[i])
                        {
                            attrValue += itemConfig.EffectValueA2;
                        }
                        if (itemConfig.Effect3 == baseAttrIds[i])
                        {
                            attrValue += itemConfig.EffectValueA3;
                        }
                        if (itemConfig.Effect4 == baseAttrIds[i])
                        {
                            attrValue += itemConfig.EffectValueA4;
                        }
                        if (itemConfig.Effect5 == baseAttrIds[i])
                        {
                            attrValue += itemConfig.EffectValueA5;
                        }
                    }
                }
                m_DogzEquipAttrDict.Add(baseAttrIds[i], attrValue);
            }
            return m_DogzEquipAttrDict;
        }
        public int GetDogzEquipPlaceByIndex(int index)
        {
            return (index % 5) + 101;
@@ -335,6 +384,26 @@
            return false;
        }
        public void CheckPutOff(int equipPlace)
        {
            if (TryGetAssistDogzState(presentSelectDogz))
            {
                ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),"当前神兽助战中,卸下装备无法保持助战状态,确定继续?",
                    (bool isOk)=>
                    {
                        if(isOk)
                        {
                            SendPutOffEquip(equipPlace);
                        }
                        return;
                    });
            }
            else
            {
                SendPutOffEquip(equipPlace);
            }
        }
        public void SendPutOnEquip(int index)
        {
            CA5C0_tagCMDogzEquipItem dogzPutOn = new CA5C0_tagCMDogzEquipItem();
@@ -343,7 +412,7 @@
            GameNetSystem.Instance.SendInfo(dogzPutOn);
        }
        public void SendPutOffEquip(int equipPlace)
        private void SendPutOffEquip(int equipPlace)
        {
            CA5C1_tagCMDogzUnEquipItem dogzPutOff = new CA5C1_tagCMDogzUnEquipItem();
            dogzPutOff.DogzID = (byte)presentSelectDogz;
@@ -419,6 +488,43 @@
            return false;
        }
        public List<ItemModel> selectEquipPlacelist { get; private set; }
        public List<ItemModel> GetDogzItemListByIndex(int index)
        {
            SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptDogzItem);
            selectEquipPlacelist.Clear();
            if (singlePack == null) return selectEquipPlacelist;
            var _itemColor = GetDogzEquipLimitByIndex(presentSelectDogz, index);
            var _equipPlace = GetDogzEquipPlaceByIndex(index);
            Dictionary<int, ItemModel> pairs = singlePack.GetPackModelIndexDict();
            foreach (var value in pairs.Values)
            {
                if(value.chinItemModel.EquipPlace == _equipPlace
                    && value.chinItemModel.ItemColor >= _itemColor)
                {
                    selectEquipPlacelist.Add(value);
                }
            }
            selectEquipPlacelist.Sort(CompareByDogzItem);
            return selectEquipPlacelist;
        }
        private int CompareByDogzItem(ItemModel start,ItemModel end)
        {
            int x = start.chinItemModel.ItemColor;
            int y = end.chinItemModel.ItemColor;
            if (x.CompareTo(y) != 0) return -x.CompareTo(y);
            x = start.chinItemModel.StarLevel;
            y = end.chinItemModel.StarLevel;
            if (x.CompareTo(y) != 0) return -x.CompareTo(y);
            x = start.equipScore;
            y = end.equipScore;
            if (x.CompareTo(y) != 0) return -x.CompareTo(y);
            return 0;
        }
        #endregion
        #region 装备详细信息
@@ -441,6 +547,24 @@
            return 0;
        }
        #endregion
        #region 默认选择逻辑处理
        public void SetDefaultSelectDogz()
        {
            var configs = ConfigManager.Instance.GetAllValues<DogzConfig>();
            presentSelectDogz = configs[0].ID;
            foreach (var key in dogzAssistStateDict.Keys)
            {
                if(dogzAssistStateDict[key] == 1)
                {
                    if(presentSelectDogz < key)
                    {
                        presentSelectDogz = key;
                    }
                }
            }
        }
        #endregion
    }
}
System/Dogz/DogzPackWin.cs
@@ -8,6 +8,7 @@
using System.Collections.Generic;
using TableConfig;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace Snxxz.UI {
@@ -103,6 +104,7 @@
            for (int i = 0; i < m_DogzEquips.Count; i++)
            {
                ItemModel _data;
                int index = i;
                bool _equiped = dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, i, out _data);
                m_DogzUnEquipBtns[i].gameObject.SetActive(!_equiped);
                m_DogzEquips[i].gameObject.SetActive(_equiped);
@@ -116,10 +118,31 @@
                    m_DogzUnEquipContents[i].text = StringUtility.Contact(DogzModel.GetItemColorName(_itemColor),
                        DogzModel.GetDogzPartNameByIndex(i));
                    m_DogzUnEquipContents[i].color = UIHelper.GetUIColor(_itemColor);
                    m_DogzUnEquipBtns[i].RemoveAllListeners();
                    m_DogzUnEquipBtns[i].AddListener(() => { ClickEquipIndex(index); });
                }
            }
        }
        private void ClickEquipIndex(int index)
        {
            dogzModel.GetDogzItemListByIndex(index);
            if(dogzModel.selectEquipPlacelist.Count > 0)
            {
                WindowCenter.Instance.Open<SelectDogzItemWin>();
            }
            else
            {
                ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),"背包中没有该部位可穿戴的装备",(bool isOk)=>
                {
                    if(isOk)
                    {
                    }
                    return;
                });
            }
        }
        private void RefreshDogzSelectEvent(int type)
        {
System/Dogz/DogzWin.cs
@@ -21,6 +21,7 @@
        [SerializeField] FunctionButton functionButtonStrengthen;
        [SerializeField] FunctionButtonGroup funcBtnGroup;
        DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } }
        protected override void BindController()
        {
        }
@@ -54,6 +55,7 @@
        protected override void OnPreOpen()
        {
            dogzModel.SetDefaultSelectDogz();
        }
        protected override void OnActived()
System/Dogz/SelectCell.cs
New file
@@ -0,0 +1,30 @@
using EnhancedUI.EnhancedScroller;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class SelectCell : ScrollerUI
    {
        [SerializeField] Text nameTex;
        [SerializeField] CommonItemBaisc itemBaisc;
        [SerializeField] Button selectBtn;
        DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } }
        public override void Refresh(CellView cell)
        {
            if (cell.index >= dogzModel.selectEquipPlacelist.Count) return;
            ItemModel model = dogzModel.selectEquipPlacelist[cell.index];
            nameTex.text = model.chinItemModel.ItemName;
            nameTex.color = UIHelper.GetUIColor(model.chinItemModel.ItemColor);
            itemBaisc.Init(model);
            selectBtn.RemoveAllListeners();
            selectBtn.AddListener(()=>
            {
                dogzModel.SendPutOnEquip(model.itemInfo.ItemPlace);
                WindowCenter.Instance.CloseImmediately<SelectDogzItemWin>();
            });
        }
    }
}
System/Dogz/SelectCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fdd7aaa6f855054448570bc63608ceb8
timeCreated: 1534834007
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Dogz/SelectDogzItemWin.cs
New file
@@ -0,0 +1,53 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class SelectDogzItemWin : Window
    {
        [SerializeField] ScrollerController ctrl;
        [SerializeField] Button closeBtn;
        DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } }
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
            closeBtn.AddListener(CloseClick);
        }
        protected override void OnPreOpen()
        {
            CreateSelectItem();
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
        }
        protected override void OnAfterClose()
        {
        }
        private void CreateSelectItem()
        {
            ctrl.Refresh();
            for(int i = 0; i < dogzModel.selectEquipPlacelist.Count; i++)
            {
                ctrl.AddCell(ScrollerDataType.Header,i);
            }
            ctrl.Restart();
        }
    }
}
System/Dogz/SelectDogzItemWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 82cf9b82cfbdeed478bac6785c72367e
timeCreated: 1534833403
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/KnapSack/Logic/EquipTip.cs
@@ -105,6 +105,7 @@
        EquipSource equipSourceDes;
        [SerializeField]
        Text equipSourceText;
        [SerializeField] Text dogzEquipDesText;
        #endregion
        [SerializeField]
@@ -562,7 +563,9 @@
        private void SetGemAttrUI()
        {   
            if (itemAttrData.itemConfig.LV < itemTipsModel.gemOpenLvs[0])
            if (itemAttrData.itemConfig.LV < itemTipsModel.gemOpenLvs[0]
                || itemAttrData.packType == PackType.rptDogzEquip
                || itemAttrData.packType == PackType.rptDogzItem)
            {
                gemAttr.SetActive(false);
                return;
@@ -822,21 +825,34 @@
        private void SetBottomUI()
        {
            if (itemAttrData.itemConfig.Description == "" || string.IsNullOrEmpty(itemAttrData.itemConfig.Description))
            if(itemAttrData.packType != PackType.rptDogzItem && itemAttrData.packType != PackType.rptDogzEquip)
            {
                equipSourceNormal.gameObject.SetActive(true);
                equipSourceDes.gameObject.SetActive(false);
                equipSourceText.gameObject.SetActive(false);
                SetBottomText(equipSourceNormal);
                dogzEquipDesText.gameObject.SetActive(false);
                if (itemAttrData.itemConfig.Description == "" || string.IsNullOrEmpty(itemAttrData.itemConfig.Description))
                {
                    equipSourceNormal.gameObject.SetActive(true);
                    equipSourceDes.gameObject.SetActive(false);
                    equipSourceText.gameObject.SetActive(false);
                    SetBottomText(equipSourceNormal);
                }
                else
                {
                    equipSourceNormal.gameObject.SetActive(false);
                    equipSourceDes.gameObject.SetActive(true);
                    equipSourceText.gameObject.SetActive(true);
                    SetBottomText(equipSourceDes);
                    equipSourceText.text = itemAttrData.itemConfig.Description;
                }
            }
            else
            {
                equipSourceNormal.gameObject.SetActive(false);
                equipSourceDes.gameObject.SetActive(true);
                equipSourceText.gameObject.SetActive(true);
                SetBottomText(equipSourceDes);
                equipSourceText.text = itemAttrData.itemConfig.Description;
                equipSourceDes.gameObject.SetActive(false);
                equipSourceText.gameObject.SetActive(false);
                dogzEquipDesText.gameObject.SetActive(true);
                dogzEquipDesText.text = itemAttrData.itemConfig.Description;
            }
        }
        private void SetBottomText(EquipSource source)
System/KnapSack/Logic/ItemTipsModel.cs
@@ -708,7 +708,7 @@
            if (attrData == null) return;
            attrData.SetTipsFuncBtn(ItemWinBtnType.putOff, (ItemWinBtnType, ItemAttrData) => {
               dogzModel.SendPutOffEquip(dogzModel.GetDogzEquipPlaceByIndex(attrData.index));
               dogzModel.CheckPutOff(dogzModel.GetDogzEquipPlaceByIndex(attrData.index));
            });
            attrData.SetTipsFuncBtn(ItemWinBtnType.strength, (ItemWinBtnType, ItemAttrData) => {