少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-19 6ea752f7f7a4ed47de871f896f6892f14faed044
3335 itemcell 制作成prefab
4个文件已添加
12个文件已修改
356 ■■■■■ 已修改文件
System/Compose/New/ComposeWingsWin.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzEquip.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/DogzItemCell.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dogz/SelectCell.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/BagItemCell.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/BagItemCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/BagWin.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/ButtonExtend.cs 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/CommonItemBaisc.cs 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/DepotWin.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/GridCell.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/ItemCell.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Strengthening/GodBeastChildNodes.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Strengthening/WingsRefined.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UIPrefabLoader.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UIPrefabLoader.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Compose/New/ComposeWingsWin.cs
@@ -418,7 +418,7 @@
            {
                case SelectItemType.unfixed:
                    matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, "", 0, itemIndex);
                    IsComposeBind = ChangeFixedMatUI();
                    IsComposeBind = false;
                    break;
                case SelectItemType.addons:
                    matCell.SetDisplay(compoundModel, NeedMatType.addItem, false, "", 0, itemIndex);
@@ -438,7 +438,7 @@
                case NeedMatType.unfixedItem:
                    matCell.SetDisplay(compoundModel, matType, false, 
                        UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_1")));
                    IsComposeBind = ChangeFixedMatUI();
                    IsComposeBind = false;
                    break;
                case NeedMatType.addItem:
                    matCell.SetDisplay(compoundModel, matType, false, 
@@ -474,57 +474,6 @@
            UpdateComposeMat();
            composeItemSelectObj.SetActive(compoundModel.secondType < 4);
        }
        private bool ChangeFixedMatUI()
        {
            if (compoundModel == null) return false;
            var packType = composeWinModel.GetPackTypeByMakerId(compoundModel.makeID);
            SinglePack singlePack = playerPack.GetSinglePack(packType);
            if (singlePack == null) return false;
            bool isBind = false;
            Dictionary<int,ItemModel> unfixedMatDict = selectModel.GetHaveUnfixedSelectItem();
            //foreach(var model in unfixedMatDict.Values)
            //{
            //    if(model.isBind == 1)
            //    {
            //        isBind = true;
            //        break;
            //    }
            //}
            int[] fixedIds = compoundModel.itemID;
            int[] fixedCounts = compoundModel.itemCount;
            int[] fixedDisplays = compoundModel.itemDisplay;
            for (int i = 0; i < fixedDisplays.Length; i++)
            {
                var fixedDisplay = fixedDisplays[i];
                if (fixedDisplay != 0)
                {
                    var matCell = fixedAndUnfixeds[fixedDisplay - 1];
                    int fixedId = fixedIds[i];
                    var bindIcon = matCell.itemCell.auctionIcon;
                    bindIcon.gameObject.SetActive(false);
                    //if (isBind)
                    //{
                    //    var list= singlePack.GetItemsById(fixedId);
                    //    if (list != null)
                    //    {
                    //        for (int j = 0; j < list.Count; j++)
                    //        {
                    //            if (list[j].isBind == 1)
                    //            {
                    //                bindIcon.gameObject.SetActive(true);
                    //                break;
                    //            }
                    //        }
                    //    }
                    //}
                }
            }
            return isBind;
        }
        public int RefreshComposeSuccessRate(int initRate)
System/Dogz/DogzEquip.cs
@@ -15,7 +15,6 @@
        public void Display(ItemModel model)
        {
            itemBaisc.Init(model);
            itemBaisc.auctionIcon.gameObject.SetActive(false);
            int strenLv = 0;
            if(model.GetUseData((int)ItemUseDataKey.dogzEquipPlus) != null)
            {
System/Dogz/DogzItemCell.cs
@@ -50,7 +50,6 @@
                itemBaisc.stateIcon.gameObject.SetActive(false);
            }
            itemBaisc.auctionIcon.gameObject.SetActive(false);
            itemBaisc.button.RemoveAllListeners();
            itemBaisc.button.AddListener(()=>
            {
System/Dogz/SelectCell.cs
@@ -22,7 +22,6 @@
            nameTex.text = model.config.ItemName;
            nameTex.color = UIHelper.GetUIColor(model.config.ItemColor,true);
            itemBaisc.Init(model);
            itemBaisc.auctionIcon.gameObject.SetActive(false);
            int strenLv = 0;
            if (model.GetUseData((int)ItemUseDataKey.dogzEquipPlus) != null)
            {
System/KnapSack/New/BagItemCell.cs
New file
@@ -0,0 +1,52 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, March 19, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class BagItemCell : CommonItemBaisc
    {
        Image m_AuctionIcon;
        public Image auctionIcon {
            get {
                if (m_AuctionIcon == null)
                {
                    m_AuctionIcon = this.transform.GetComponent<Image>("Img_Auction");
                }
                return m_AuctionIcon;
            }
        }
        /// <summary>
        /// 初始化数据 bool值用来判断是否需要展示评分高低或者职业限制
        /// </summary>
        /// <param name="model"></param>
        /// <param name="isCompare"></param>
        public override void Init(ItemModel model, bool isCompare = false)
        {
            base.Init(model, isCompare);
            auctionIcon.gameObject.SetActive(model.isAuction);
        }
        /// <summary>
        ///  初始化数据(预览)
        /// </summary>
        /// <param name="model"></param>
        public override void Init(ItemCellModel model)
        {
            base.Init(model);
            auctionIcon.gameObject.SetActive(false);
        }
    }
}
System/KnapSack/New/BagItemCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3271fd9e5f6ed824dabe85aa9aa004e5
timeCreated: 1552982226
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/KnapSack/New/BagWin.cs
@@ -24,20 +24,9 @@
        #endregion
        private SinglePack packModel;
        private ItemModel _clickItemModel;
        private bool isDoubleClick = false;
        ItemTipsModel _itemTipsModel;
        ItemTipsModel itemTipsModel {
            get {
                return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
            }
        }
        PackModel _playerPack;
        PackModel playerPack {
            get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
        }
        ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
        PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        private GridCell _lookEquipCell = null;
@@ -112,10 +101,10 @@
        {
            if (AchievementGoto.guideAchievementId != 0)
            {
                SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId);
                var successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId);
                if (successConfig != null)
                {
                    JumpUIType jump = (JumpUIType)successConfig.Jump;
                    var jump = (JumpUIType)successConfig.Jump;
                    switch (successConfig.Type)
                    {
                        case 94:
@@ -257,11 +246,11 @@
                {
                    gridCell.itemCell.gameObject.SetActive(true);
                    gridCell.itemCell.Init(itemModel, true);
                    gridCell.itemCellBtn.OnOneParaClick = null;
                    gridCell.itemCellBtn.m_OnDbClick = null;
                    gridCell.itemCellBtn.onceClick = null;
                    gridCell.itemCellBtn.doubleClick = null;
                    if (KnapSackWin.titleType == KnapsackFuncTitle.depot)
                    {
                        gridCell.itemCellBtn.OnOneParaClick = (int info) =>
                        gridCell.itemCellBtn.onceClick = (int info) =>
                        {
                            itemTipsModel.SetItemTipsModel(PackType.Item, itemModel.guid, false, true);
@@ -269,7 +258,7 @@
                            itemTipsModel.ShowUICtrl();
                        };
                        gridCell.itemCellBtn.m_OnDbClick = () =>
                        gridCell.itemCellBtn.doubleClick = () =>
                          {
                              ItemOperateUtility.Instance.PutInWareHouse(itemModel.guid);
                          };
@@ -277,7 +266,7 @@
                    }
                    else if (KnapSackWin.titleType == KnapsackFuncTitle.bag)
                    {
                        gridCell.itemCellBtn.OnOneParaClick = (int info) =>
                        gridCell.itemCellBtn.onceClick = (int info) =>
                        {
                            itemTipsModel.SetItemTipsModel(PackType.Item, itemModel.guid, false, true);
                            itemTipsModel.SetBagTipsBtn(itemTipsModel.curAttrData);
System/KnapSack/New/ButtonExtend.cs
@@ -1,62 +1,65 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ButtonExtend : ButtonEx
{
    public int intInfo = 0;
    //public bool OnListen { get; set; }
    public Action<int> OnOneParaClick;
    public Action<int> onceClick;
    public override void OnPointerClick(PointerEventData eventData)
    {
        base.OnPointerClick(eventData);
        if (OnCheckDbClick())
        if (IsDoubleClick())
        {
            return;
        }
        if (OnOneParaClick != null) OnOneParaClick(intInfo);
        if (onceClick != null) onceClick(intInfo);
    }
    #region 双击
    private float dbInterval = 0.3f;
    private bool m_IsOnDb = false;
    private float doubleClickInterval = 0.3f;
    private bool m_IsOnDoubleClick = false;
    private bool m_FreezeDbClick = false;
    public Action m_OnDbClick;
    private bool OnCheckDbClick()
    public Action doubleClick;
    private bool IsDoubleClick()
    {
        if (m_OnDbClick == null)
        if (doubleClick == null)
        {
            return false;
        }
        if (m_IsOnDb)
        if (m_IsOnDoubleClick)
        {
            if (!m_FreezeDbClick)
            {
                m_OnDbClick();
                m_IsOnDb = false;
                doubleClick();
                m_IsOnDoubleClick = false;
                m_FreezeDbClick = true;
            }
        }
        else
        {
            m_FreezeDbClick = false;
            m_IsOnDb = true;
            m_IsOnDoubleClick = true;
        }
        TimeMgr.Instance.Register(this, OnDbCallback, dbInterval);
        TimeMgr.Instance.Register(this, OnDoubleClickCallback, doubleClickInterval);
        return true;
    }
    private void OnDbCallback(Component comp)
    private void OnDoubleClickCallback(Component comp)
    {
        if (!m_FreezeDbClick)
        {
            if (OnOneParaClick != null) OnOneParaClick(intInfo);
            if (onceClick != null) onceClick(intInfo);
        }
        m_FreezeDbClick = false;
        m_IsOnDb = false;
        m_IsOnDoubleClick = false;
    }
    #endregion
System/KnapSack/New/CommonItemBaisc.cs
@@ -4,14 +4,27 @@
namespace Snxxz.UI
{
    public enum ItemCellformat
    {
        Format_84x84,
        Format_80x80,
        Format_70x70,
        Format_64x64,
        None,
    }
    public class CommonItemBaisc : MonoBehaviour
    {
        [SerializeField] ItemCellformat m_Format;
        public ItemCellformat format { get { return m_Format; } set { m_Format = value; } }
        Image m_BgIcon;
        public Image bgIcon {
            get {
                if (m_BgIcon == null)
                {
                    m_BgIcon = this.transform.GetComponent<Image>("EquipBG");
                    LoadPrefab();
                    m_BgIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_BackGround");
                }
                return m_BgIcon;
            }
@@ -22,29 +35,21 @@
            get {
                if (m_ItemIcon == null)
                {
                    m_ItemIcon = this.transform.GetComponent<Image>("ItemIcon");
                    LoadPrefab();
                    m_ItemIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Icon");
                }
                return m_ItemIcon;
            }
        }
        Image m_AuctionIcon;
        public Image auctionIcon {
            get {
                if (m_AuctionIcon == null)
                {
                    m_AuctionIcon = this.transform.GetComponent<Image>("Img_Auction");
                }
                return m_AuctionIcon;
            }
        }
        Image m_StateIcon;
        public Image stateIcon {
            get {
                if (m_StateIcon == null)
                {
                    m_StateIcon = this.transform.GetComponent<Image>("stateIcon");
                    LoadPrefab();
                    m_StateIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_State");
                }
                return m_StateIcon;
            }
@@ -55,7 +60,8 @@
            get {
                if (m_CountText == null)
                {
                    m_CountText = this.transform.GetComponent<Text>("CountText");
                    LoadPrefab();
                    m_CountText = this.transform.GetComponent<Text>("Container_ItemCell/Txt_Count");
                }
                return m_CountText;
            }
@@ -66,14 +72,43 @@
            get {
                if (m_Button == null)
                {
                    m_Button = this.GetComponent<Button>();
                    LoadPrefab();
                    m_Button = this.GetComponent<Button>("Container_ItemCell");
                }
                return m_Button;
            }
        }
        public int itemId { get; private set; }
        GameObject cellContainer;
        protected void LoadPrefab()
        {
            if (cellContainer == null)
            {
                switch (format)
                {
                    case ItemCellformat.Format_64x64:
                        cellContainer = UIUtility.CreateWidget("ItemCell_64", "Container_ItemCell");
                        break;
                    case ItemCellformat.Format_70x70:
                        cellContainer = UIUtility.CreateWidget("ItemCell_70", "Container_ItemCell");
                        break;
                    case ItemCellformat.Format_80x80:
                        cellContainer = UIUtility.CreateWidget("ItemCell_80", "Container_ItemCell");
                        break;
                    case ItemCellformat.Format_84x84:
                        cellContainer = UIUtility.CreateWidget("ItemCell_84", "Container_ItemCell");
                        break;
                }
                if (cellContainer != null)
                {
                    cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
                    cellContainer.transform.SetAsFirstSibling();
                }
            }
        }
        public int itemId { get; private set; }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
@@ -107,8 +142,6 @@
            bgIcon.gameObject.SetActive(true);
            itemIcon.SetSprite(config.IconKey);
            bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic));
            auctionIcon.gameObject.SetActive(isAuction);
            countText.gameObject.SetActive(count > 1);
            if (count > 1)
System/KnapSack/New/DepotWin.cs
@@ -181,15 +181,15 @@
                    gridCell.itemCell.gameObject.SetActive(true);
                    //pdr ToDo
                    gridCell.itemCell.Init(itemModel, true);
                    gridCell.itemCellBtn.OnOneParaClick = null;
                    gridCell.itemCellBtn.m_OnDbClick = null;
                    gridCell.itemCellBtn.OnOneParaClick=(int info)=>
                    gridCell.itemCellBtn.onceClick = null;
                    gridCell.itemCellBtn.doubleClick = null;
                    gridCell.itemCellBtn.onceClick=(int info)=>
                    {
                        itemTipsModel.SetItemTipsModel(PackType.Warehouse,itemModel.guid,false,true);
                        itemTipsModel.SetDepotTipsBtn(itemTipsModel.curAttrData);
                        itemTipsModel.ShowUICtrl();
                    };
                    gridCell.itemCellBtn.m_OnDbClick = () =>
                    gridCell.itemCellBtn.doubleClick = () =>
                    {
                        ItemOperateUtility.Instance.TakeOutFromWarehouse(ItemOperateType.putOut, itemModel.guid);
                    };
System/KnapSack/New/GridCell.cs
@@ -9,12 +9,12 @@
{
    public class GridCell : MonoBehaviour
    {
        private ItemCell _itemCell;
        public ItemCell itemCell {
        private BagItemCell _itemCell;
        public BagItemCell itemCell {
            get
            {
                if(_itemCell == null)
                    _itemCell = transform.Find("ItemCell").GetComponent<ItemCell>();
                    _itemCell = transform.Find("ItemCell").GetComponent<BagItemCell>();
                return _itemCell;
            }
        }
@@ -28,7 +28,7 @@
        public Image cdImag {get { return _cdImage ?? (_cdImage = transform.Find("CDImag").GetComponent<Image>()); }}
        private ButtonExtend _itemCellBtn;
        public ButtonExtend itemCellBtn { get { return _itemCellBtn ?? (_itemCellBtn = transform.Find("ItemCell").GetComponent<ButtonExtend>()); } }
        public ButtonExtend itemCellBtn { get { return _itemCellBtn ?? (_itemCellBtn = transform.Find("ItemCell/Container_ItemCell").GetComponent<ButtonExtend>()); } }
        private Button _lockBtn;
        public Button lockBtn { get { return _lockBtn ?? (_lockBtn = transform.Find("GridLock").GetComponent<Button>()); } }
@@ -40,10 +40,7 @@
        }
        private ItemModel itemModel = null;
        PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        public void SetModel(ItemModel itemModel)
        {
System/KnapSack/New/ItemCell.cs
@@ -6,6 +6,7 @@
namespace Snxxz.UI
{
    public class ItemCell : CommonItemBaisc
    {
        private Button m_Reducebtn;
@@ -13,7 +14,8 @@
            get {
                if (m_Reducebtn == null)
                {
                    m_Reducebtn = this.transform.GetComponent<Button>("Reducebtn");
                    LoadPrefab();
                    m_Reducebtn = this.transform.GetComponent<Button>("Container_ItemCell/Btn_Reduce");
                }
                return m_Reducebtn;
            }
System/Strengthening/GodBeastChildNodes.cs
@@ -47,7 +47,6 @@
            ItemModel itemModel = playerPack.GetItemByIndex(PackType.DogzItem, Index);
            m_ItemCell.Init(itemModel);
            m_ItemCell.countText.gameObject.SetActive(false);
            m_ItemCell.auctionIcon.gameObject.SetActive(false);
            var IudetDogzEquipPlus = itemModel.GetUseData((int)ItemUseDataKey.dogzEquipPlus);// 神兽装备强化信息列表 [强化等级, 强化熟练度]
            TextNumber.gameObject.SetActive(false);
            if (IudetDogzEquipPlus != null)
System/Strengthening/WingsRefined.cs
@@ -166,14 +166,14 @@
                _ChildNodes._ItemIcon.SetActive(true);
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, intPetAbsorbTyp[cellCount - 1]);
                _ChildNodes._ItemIcon.GetComponent<ItemCell>().Init(model);
                _ChildNodes._ItemButton.OnOneParaClick = null;
                _ChildNodes._ItemButton.onceClick = null;
                if (_DevourDIc.ContainsKey(intPetAbsorbTyp[cellCount - 1]))
                {
                    _ChildNodes._Elect.SetActive(true);
                }
                _ChildNodes._ItemButton.OnOneParaClick = (int info) =>
                _ChildNodes._ItemButton.onceClick = (int info) =>
                {
                    if (_ChildNodes._Elect.activeSelf)
                    {
UI/Common/UIPrefabLoader.cs
New file
@@ -0,0 +1,53 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, March 19, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
namespace Snxxz.UI
{
    [ExecuteInEditMode]
    [RequireComponent(typeof(RectTransform))]
    public class UIPrefabLoader : MonoBehaviour
    {
        [SerializeField] string m_PrefabName;
        public string prefabName { get { return m_PrefabName; } }
        GameObject instance;
        [ExecuteInEditMode]
        private void Awake()
        {
            Create();
        }
        [ContextMenu("Create")]
        public void Create()
        {
            if (instance != null)
            {
                return;
            }
            if (string.IsNullOrEmpty(m_PrefabName))
            {
                return;
            }
            var find = this.transform.Find(m_PrefabName);
            if (find)
            {
                return;
            }
            instance = UIUtility.CreateWidget(m_PrefabName, m_PrefabName);
            instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
        }
    }
}
UI/Common/UIPrefabLoader.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dabca296a3c10864b8107dca62b132e4
timeCreated: 1552974474
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: