关于角色养成界面内衣架功能初版

main
Yuntao Hu 2024-06-20 14:58:48 +08:00
parent 8dbf1108de
commit 901011ca79
19 changed files with 1061 additions and 1231 deletions

View File

@ -23,6 +23,7 @@ public partial class UIManager
_WindowMeta(UINameConst.UI_Cultivate, UIWindowLayer.Normal, UIOpenType.FullScreen);
_WindowMeta(UINameConst.UI_Cultivate_ProAndInfo, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_Cultivate_Detail, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UI_SkinChange, UIWindowLayer.Normal, UIOpenType.FullScreen);
_WindowMeta(UINameConst.UIFightClock, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UIPause, UIWindowLayer.Normal);
_WindowMeta(UINameConst.UIDefeatGame, UIWindowLayer.Normal);
@ -126,6 +127,7 @@ public static class UINameConst
public static readonly string UI_Cultivate = "MainScene/ShowCharacter/UI_Cultivate";
public static readonly string UI_Cultivate_ProAndInfo = "MainScene/ShowCharacter/UI_Cultivate_ProAndInfo";
public static readonly string UI_Cultivate_Detail = "MainScene/ShowCharacter/UI_Cultivate_Detail";
public static readonly string UI_SkinChange = "MainScene/ShowCharacter/SkinChange";
public static readonly string UIAirView = "LevelSceneUI/UIAirView";
public static readonly string UIPoster = "MainScene/ShowCharacter/UIPoster";
public static readonly string UIClickSheild = "LevelSceneUI/UIClickSheild";

View File

@ -36,6 +36,8 @@ public class CategoryManager : Singlenton<CategoryManager>
List<int> itemIDLst = new List<int>();
Dictionary<int, DataItem> itemDataMap = new Dictionary<int, DataItem>();
Dictionary<int, List<DataItem>> characterSkinMap = new();
//********************************************************************************
//public enum SortingType
//{
@ -53,7 +55,31 @@ public class CategoryManager : Singlenton<CategoryManager>
//public readonly string[] ItemTypeStrs = { "Package_All_Item", "Package_SpecialCurrency", "Package_ConsumableItem", "Package_CultivateMaterial", "Package_CharacterFragment" };
//物品种类索引键值移动已到CategoryStorage配置表
public CategoryManager()
{
for (int i = 105001; i < 106000; i++)//用于角色皮肤ID物品索引
{
if (TableManager.Instance.Tables.Item.DataMap.TryGetValue(i, out var data))
{
DataItem skinData = GetItemData(i);
if (skinData != null)
{
int characterID = skinData.Param1;
if (characterSkinMap.ContainsKey(characterID))
{
characterSkinMap[characterID].Add(skinData);
}
else
{
characterSkinMap.Add(characterID, new());
characterSkinMap[characterID].Add(skinData);
}
}
}
}
}
/// <summary>
/// 物品数目变动时更新要显示的物品表
/// </summary>
@ -297,6 +323,23 @@ public class CategoryManager : Singlenton<CategoryManager>
}
return data.JumpToPos;
}
public bool TryGetSkinItemInfo(int characterID, int skinID, out DataItem info)
{
info = null;
if (characterSkinMap.ContainsKey(characterID))
{
for (int i = 0; i < characterSkinMap[characterID].Count; i++)
{
if (characterSkinMap[characterID][i].Param2 == skinID)
{
info = characterSkinMap[characterID][i];
return true;
}
}
}
return false;
}
#endregion
}

View File

@ -31,6 +31,4 @@ public class DragForUI : MonoBehaviour, IInitializePotentialDragHandler, IBeginD
public void OnInitializePotentialDrag(PointerEventData eventData)
{
}
}

View File

@ -0,0 +1,130 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public interface IPinchHandler
{
void OnPinchStart();
void OnPinchEnd();
void OnPinchZoom(float gapDelta);
}
public class PinchZoomModule : MonoBehaviour, IPointerUpHandler,IPointerDownHandler, IDragHandler
{
private int firstEnterFingerID = -1;
private int lastEnterFingerID = -1;
private int nowFingersCount = 0;
private Vector2 firstFingerPosition;
private Vector2 lastFingerPosition;
private float distance = 0.0f;
public float zoomSpeed = 0.5f;
public float minZoom = 0.5f;
public float maxZoom = 2.0f;
float scale = 1.0f;
public float zoomGap = 0.0f;
public float zoomGapDelta = 0.0f;
public float zoomGapDeltaSpeed = 0.1f;
private bool isPinchZooming = false;
public IPinchHandler pinchHandler;
void Awake()
{
if(GetComponent(typeof(IPinchHandler)) as IPinchHandler == null)
{
var add = gameObject.AddComponent<UIMultiScaleTool>();
add.minScale = minZoom;
add.maxScale = maxZoom;
add.enabled = false;
}
pinchHandler = GetComponent(typeof(IPinchHandler)) as IPinchHandler;
}
private void OnEnable()
{
GetComponent<UIMultiScaleTool>().enabled = true;
zoomGap = 0.0f;
scale = 1.0f;
}
private void OnDisable()
{
GetComponent<UIMultiScaleTool>().enabled = false;
}
public void OnPointerDown(PointerEventData eventData)
{
nowFingersCount++;
DebugUtil.Log("add new finger, nowFingersCount: " + nowFingersCount);
if (nowFingersCount == 1)
{
firstEnterFingerID = eventData.pointerId;
firstFingerPosition = eventData.position;
}
else if (nowFingersCount == 2)
{
lastEnterFingerID = eventData.pointerId;
lastFingerPosition = eventData.position;
distance = Vector2.Distance(firstFingerPosition, lastFingerPosition);
isPinchZooming = true;
pinchHandler?.OnPinchStart();
}
}
public void OnPointerUp(PointerEventData eventData)
{
nowFingersCount--;
DebugUtil.Log("remove a finger, nowFingersCount: " + nowFingersCount);
if (eventData.pointerId == firstEnterFingerID)
{
firstEnterFingerID = lastEnterFingerID;
firstFingerPosition = lastFingerPosition;
lastEnterFingerID = -1;
if (isPinchZooming)
{
isPinchZooming = false;
pinchHandler?.OnPinchEnd();
}
}
else if(eventData.pointerId == lastEnterFingerID)
{
lastEnterFingerID = -1;
if (isPinchZooming)
{
isPinchZooming = false;
pinchHandler?.OnPinchEnd();
}
}
}
public void OnDrag(PointerEventData eventData)
{
if (isPinchZooming)
{
if(eventData.pointerId == firstEnterFingerID)
{
firstFingerPosition = eventData.position;
}
else if(eventData.pointerId == lastEnterFingerID)
{
lastFingerPosition = eventData.position;
}
float nowDistance = Vector2.Distance(firstFingerPosition, lastFingerPosition);
zoomGapDelta = nowDistance - distance;
zoomGap = zoomGapDelta * zoomSpeed;
distance = nowDistance;
scale = Mathf.Clamp(scale + zoomGap * zoomGapDeltaSpeed, minZoom, maxZoom);
pinchHandler?.OnPinchZoom(scale);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d4f1ad880b5a106469fb5bbddd87d1ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIMultiScaleTool : MonoBehaviour, IPinchHandler
{
//该脚本由PinchZoom自动挂接
float scale = 1.0f;
public float minScale;
public float maxScale;
private void OnEnable()
{
scale = 1.0f;
}
void Update()
{
float scrollWheelDelta = Input.GetAxis("Mouse ScrollWheel");
if (scrollWheelDelta > 0.01f || scrollWheelDelta < 0.01f)//鼠标滚轮
{
scale += Input.GetAxis("Mouse ScrollWheel") * 0.5f;
scale = Mathf.Clamp(scale, minScale, maxScale);
transform.localScale = Vector3.one * scale;
}
}
public void OnPinchStart() { }
public void OnPinchEnd() { }
public void OnPinchZoom(float delta)
{
_processPinch(delta);
}
private void _processPinch(float delta)
{
transform.localScale = Vector3.one * delta;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99e7c98d3f86a1a45ad6cfba5ab817f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -205,6 +205,7 @@ public class UI_CultivateController : UIWindow
Button_ChangeSuit = GetComponent<Button>("Image_BG/Image_Cultivate_BG_Black/Button_ChangeSuit");
BindButton(Button_Look, OnButton_LookClick);
BindButton(Button_RankPlus, OnButton_RankPlusClick);
BindButton(Button_ChangeSuit, OnButton_ChangeSuit);
Button_Awake = GetComponent<Button>("Image_BG/Image_AdvanceLevel/AwakePlusBtn");
BindButton(Button_Awake, OnButton_Awake);
//BindButton(Button_ActiveSK_ArrowClose, OnButton_ActiveSK_ArrowCloseClick);
@ -534,6 +535,11 @@ public class UI_CultivateController : UIWindow
ControllInput(false);
}
private async void OnButton_ChangeSuit()
{
await SkinChangeController.Open(mCurCharaData);
}
public void SetCharaInfoInOpen(CharacterDataInfo info, List<CharacterDataInfo> mInfos)
{
PreLoadCfg();

View File

@ -0,0 +1,457 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
using Toggle = UnityEngine.UI.Toggle;
using Framework;
using Cysharp.Threading.Tasks;
using Gameplay;
using cfg.CharacterCfg;
using PhxhSDK;
using System.Threading.Tasks;
using UnityEngine.EventSystems;
using Gameplay.Performance;
using cfg.ActorCfg;
using Gameplay.Utils;
using UnityEngine.Playables;
public class SkinChangeController : UIWindow
{
//UI GameObj
///Auto Gen Start///
public Image Image_BG;
//public Button Button_Back;
public Button Button_back;
public TMP_Text Text_Back;
public Button Button_Home;
public Image Image_Dark;
public Image Image_LeftBG;
public Image Image_ModelPosition;
public Image Image_Poster;
public Image Image_PosterPreview;
public Image Image_MidBG;
public Button Button_ShowAllPic;
public TMP_Text Text_Name;
public TMP_Text Text_SkinName;
public TMP_Text Text_Info;
public TMP_Text Text_GetWay;
public Button Button_Buy;
public TMP_Text Text_Buy;
public Button Button_Wear;
public TMP_Text Text_Wear;
public GameObject UpperUI;
///Auto Gen End///
private PinchZoomModule PinchZoom;
private DragForUI Drag;
private PhxhSDK.PhxhScrollView ScrollView;
SkinScrollView skinScrollView = new SkinScrollView();
GameObject _sampleModel;
GameObject _instModel;
private bool isShowPosterPic = false;
private CharacterDataInfo curCharacterInfo;
private int curSelectSkinId;
private int curUsingSkinId;
List<DataCharacterSkin> characterSkinList;
Dictionary<int, Sprite> posterLargePics = new();
Dictionary<int, Sprite> posterHalfPics = new();
public static async UniTask<UIWindow> Open(CharacterDataInfo characterData)
{
CommonUtils.CaptureScreenshot();
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_SkinChange, characterData);
}
// deal with input data
public override void PreLoad(object data = null)
{
curCharacterInfo = data as CharacterDataInfo;
curSelectSkinId = (int)curCharacterInfo.SkinID + 1;
curUsingSkinId = curSelectSkinId;
characterSkinList = CommonUtils.GetCharacterSkinCfgList((int)curCharacterInfo.ID);
PreLoadSpritesAndModelAsync();
}
async void PreLoadSpritesAndModelAsync()
{
foreach (var dataCharacter in characterSkinList)
{
string path = CommonUtils.GetCharacterPicPath((int)curCharacterInfo.ID, CommonUtils.ECharacterPicPathType.Poster, dataCharacter.SkinID);
var sprite = await LoadAssetAsync<Sprite>(path);
if (!posterLargePics.ContainsKey(dataCharacter.SkinID))
posterLargePics.Add(dataCharacter.SkinID, sprite);
else
posterLargePics[dataCharacter.SkinID] = sprite;
path = CommonUtils.GetCharacterPicPath((int)curCharacterInfo.ID, CommonUtils.ECharacterPicPathType.Favorable, dataCharacter.SkinID);
var halfSprite = await LoadAssetAsync<Sprite>(path);
if (!posterHalfPics.ContainsKey(dataCharacter.SkinID))
posterHalfPics.Add(dataCharacter.SkinID, halfSprite);
else
posterHalfPics[dataCharacter.SkinID] = halfSprite;
}
//var prefabPath = PathEx.GetCharacterDisplayModelPath(curCharacterInfo.Cfg.NameID);
//_sampleModel = await LoadAssetAsync<GameObject>(prefabPath);
}
async void LoadModel()
{
var prefabPath = PathEx.GetCharacterDisplayModelPath(curCharacterInfo.Cfg.NameID);
_sampleModel = await LoadAssetAsync<GameObject>(prefabPath);
GameObject model = Object.Instantiate(_sampleModel, Image_ModelPosition.transform, true);
_instModel = model;
model.transform.localPosition = new Vector3(0, -200, -300);
model.transform.localRotation = new(0, 180, 0, 1);
model.transform.localScale = 300 * Vector3.one;
model.gameObject.SetLayerEx(5);
var pd = model.GetComponentInChildren<PlayableDirector>();
if (pd != null)
{
pd.enabled = false;
}
var animator = model.GetComponentInChildren<Animator>();
if (animator != null)
{
animator.Play("standready001");
}
}
// Use this for initialization
public override void OnInit()
{
//bind UI GameObj
SkinChangeBinder.GetComponents(this);
UpperUI = FindObj("Image_BG/UpperUI");
PinchZoom = GetComponent<PinchZoomModule>("Image_BG/Image_Poster");
Drag = GetComponent<DragForUI>("Image_BG/Image_Poster");
ScrollView = GetComponent<PhxhSDK.PhxhScrollView>("Image_BG/UpperUI/ChangeSkin/ScrollView");
skinScrollView.SetScrollRect(ScrollView);
skinScrollView.SetItemCountFunc(() => characterSkinList.Count + 2);
skinScrollView.SetItemSizeFunc((index) => skinScrollView.GetItemSizeFromList(index));
skinScrollView.SetUpdateFunc(_RefreshSkinItem);
skinScrollView.InitItemCellList(characterSkinList.Count);
BindButton(Button_ShowAllPic, OnShowPicButton);
BindButton(Button_back, OnReturnButton);
LoadModel();
Drag.OnDragStarted += OnDragBegin;
Drag.OnDraging += OnDrag;
Drag.OnDragCompleted += OnDragEnd;
}
//invoke when open window
protected override void OnShowWindow(object data = null)
{
if (PinchZoom != null)
PinchZoom.enabled = false;
isShowPosterPic = false;
SetPosterSkinPic();
SetSkinInfo();
SetPosterSkinPic();
_SetSkinPosYListData();
skinScrollView.UpdateData();
skinScrollView.ScrollTo(curSelectSkinId);
}
//invoke when reload window
protected override void OnReloadWindow(object data = null)
{
}
//invoke when close window
protected override void OnHideWindow()
{
}
//invoke when destroy
public override void OnRelease()
{
base.OnRelease();
}
#region Button Event
void OnShowPicButton()
{
ShowAllPic(true);
}
void OnReturnButton()
{
if(isShowPosterPic)
{
ShowAllPic(false);
SetSkinInfo();
}
else
{
CloseWindow();
}
}
void _OnClickSkinItem(int to)
{
if (curSelectSkinId == to)
{
return;
}
int from = curSelectSkinId;
curSelectSkinId = to;
//_RefreshPosterButton();
skinScrollView.DoTwoItemScale(to - 1, from - 1, skinScrollView.ItemFullRectTrans.rect.size, skinScrollView.ItemRectTrans.rect.size, 0.1f,
() =>
{
_SetSkinPosYListData(false);
}, () =>
{
skinScrollView.AnimScrollTo(to);
SetPosterSkinPic();
SetSkinInfo();
});
}
#endregion
#region drag event
float scaleFactor;
void OnDragBegin(PointerEventData data)
{
if(!isShowPosterPic)
{
return;
}
scaleFactor = UIRoot.Instance.RootCanvas.GetComponent<RectTransform>().sizeDelta.x / PerformanceManager.instance.fullScreenWidth;
}
void OnDrag(PointerEventData data)
{
if(!isShowPosterPic)
{
return;
}
Drag.GetComponent<RectTransform>().anchoredPosition += data.delta * scaleFactor;
//drag.transform.position = GoRoot.transform.position;
}
void OnDragEnd(PointerEventData data)
{
if (!isShowPosterPic)
{
return;
}
}
#endregion
private void _SetSkinPosYListData(bool setSize = true)
{
if (setSize)
{
for (int i = 0; i < characterSkinList.Count; i++)
{
Vector2 size = skinScrollView.SkinItemSize(i + 1, curSelectSkinId);
skinScrollView._itemCells[i].size = size;
}
}
var posY = -skinScrollView.SkinItemSize(-1, curSelectSkinId).y;
for (int i = 0; i < characterSkinList.Count; i++)
{
Vector2 size = skinScrollView._itemCells[i].size;
posY -= size.y / 2;
skinScrollView._itemCells[i].localPosY = posY;
posY -= size.y / 2;
}
}
private async void _RefreshSkinItem(int index, RectTransform item)
{
if (index <= 0 || index >= characterSkinList.Count + 1)
{
item.gameObject.SetActive(false);
return;
}
var go = item.gameObject;
go.SetActive(true);
var posterPic =
CommonUtils.GetCharacterPicPath((int)curCharacterInfo.ID, CommonUtils.ECharacterPicPathType.Favorable, index);
var imgSkin = CommonUtils.GetComponent<Image>(go, "ButtonChange/ImageSkin");
var imgSelect = CommonUtils.GetGameObject(go, "ButtonChange/ImageChooseRect");
var imgDoSelect = CommonUtils.GetGameObject(go, "ButtonChange/ImageCover");
var btnChange = CommonUtils.GetComponent<Button>(go, "ButtonChange");
var btnNotSelect = CommonUtils.GetComponent<Button>(go, "ButtonNotSelect");
if (posterHalfPics.ContainsKey(index))
imgSkin.sprite = posterHalfPics[index];
else
imgSkin.sprite = await LoadAssetAsync<Sprite>(posterPic);
btnChange.gameObject.SetActive(true);
btnNotSelect.gameObject.SetActive(false);
imgSelect.SetActive(curSelectSkinId == index);
imgDoSelect.SetActive(curSelectSkinId != index);
ClearBind(btnChange);
ClearBind(btnNotSelect);
BindButton(btnChange, _OnClickSkinItem, index);
btnChange.GetComponent<RectTransform>().sizeDelta = skinScrollView.GetItemSizeFromList(index);
}
void ShowAllPic(bool showPic)
{
var UI_HIDE_POSITION = new Vector3(0, -1800, 0);
isShowPosterPic = showPic;
PinchZoom.enabled = showPic;
UpperUI.transform.localPosition = showPic ? UI_HIDE_POSITION : Vector3.zero;
Image_LeftBG.gameObject.SetActive(!showPic);
if (!showPic)
{
Image_Poster.transform.localScale = Image_PosterPreview.transform.localScale;
Image_Poster.transform.position = Image_PosterPreview.transform.position;
var animator = _instModel.GetComponentInChildren<Animator>();
if (animator != null)
{
animator.Play("standready001");
}
}
}
async void SetPosterSkinPic()
{
if(posterLargePics.ContainsKey(curSelectSkinId))
{
Image_Poster.sprite = posterLargePics[curSelectSkinId];
return;
}
var posterPic =
CommonUtils.GetCharacterPicPath((int)curCharacterInfo.ID, CommonUtils.ECharacterPicPathType.Poster, curSelectSkinId);
Image_Poster.sprite = await LoadAssetAsync<Sprite>(posterPic);
}
void RefreshButton()
{
}
void SetSkinInfo()
{
if (curSelectSkinId == 0)
{
return;
}
var skinCfg = characterSkinList[curSelectSkinId - 1];
if (CategoryManager.Instance.TryGetSkinItemInfo((int)curCharacterInfo.ID, curSelectSkinId, out DataItem info))//非默认皮肤
{
if (CategoryManager.Instance.GetItemCount(info.ID) > 0)//拥有皮肤
{
Button_Buy.gameObject.SetActive(false);
Button_Wear.gameObject.SetActive(true);
Text_GetWay.text = string.Empty;
}
else
{
Button_Buy.gameObject.SetActive(true);
Button_Wear.gameObject.SetActive(false);
Text_GetWay.text = CommonUtils.GetLocalizeText(skinCfg.AcquireCondition);
}
}
else//初始皮肤
{
Button_Buy.gameObject.SetActive(false);
Button_Wear.gameObject.SetActive(true);
Text_GetWay.text = string.Empty;
if (curSelectSkinId != 1)
{
DebugUtil.LogError("这个皮肤在Item配置表内并未配置为皮肤物品且它不是ID为1的初始皮肤请检查\n角色ID" + curCharacterInfo.ID + " 皮肤ID" + curSelectSkinId);
}
}
Text_Name.text = skinCfg.Name;
Text_SkinName.text = CommonUtils.GetLocalizeText(skinCfg.SkinName);
Text_Info.text = CommonUtils.GetLocalizeText(skinCfg.SkinDesc);
}
class SkinScrollView : IPanelScrollView
{
public override void SetScrollRect(PhxhScrollView scrollRect)
{
centerAnchor = true;
canDrag = false;
Self_aligning = false;
base.SetScrollRect(scrollRect);
SetItemRectTrans(CommonUtils.GetComponent<RectTransform>(_scrollRect.itemTemplate.gameObject, "ButtonNotSelect"),
CommonUtils.GetComponent<RectTransform>(_scrollRect.itemTemplate.gameObject, "ButtonChange"));
SetPaddingSize(_itemRectTrans.rect.size);
}
public Vector2 SkinItemSize(int index, int curIndex)
{
if (index == 0 || index == _itemCells.Count + 1)
{
return _itemRectTrans.rect.size;
}
if (index == curIndex)
{
return _itemFullRectTrans.rect.size;
}
else
{
return _itemRectTrans.rect.size;
}
}
/// <summary>
/// 注意操作完请调用_SetSkinPosYListData
/// </summary>
/// <param name="count"></param>
public void InitItemCellList(int count)
{
_itemCells.Clear();
for (int i = 1; i <= count; i++)
{
UIScrollViewItemCell cell = new UIScrollViewItemCell();
cell.index = i;
_itemCells.Add(cell);
}
}
/// <summary>
/// 这个函数用于缓动动画动态的设置需要缩放的item的大小
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public Vector2 GetItemSizeFromList(int index)
{
if (index > _itemCells.Count + 1)
{
DebugUtil.Log("index out of range!index: " + index);
return _itemFullRectTrans.rect.size;
}
if (index == 0 || index == _itemCells.Count + 1)
{
return _itemFullRectTrans.rect.size;
}
else
{
return _itemCells[index - 1].size;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe8d695a74cf2ad48bec0b0111a080cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Framework;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
using Toggle = UnityEngine.UI.Toggle;
using ScrollView = PhxhSDK.PhxhScrollView;
public class SkinChangeBinder
{
public static void GetComponents(SkinChangeController window)
{
window.Image_BG = window.GetComponent<Image>("Image_BG");
//window.Button_Back = window.GetComponent<Button>("Image_BG/Button_Back");
window.Button_back = window.GetComponent<Button>("Image_BG/Button_Back/Button_back");
window.Text_Back = window.GetComponent<TMP_Text>("Image_BG/Button_Back/Button_back/Text_Back");
window.Button_Home = window.GetComponent<Button>("Image_BG/Button_Back/Button_Home");
window.Image_Dark = window.GetComponent<Image>("Image_BG/Image_Dark");
window.Image_LeftBG = window.GetComponent<Image>("Image_BG/UpperUI/Image_LeftBG");
window.Image_ModelPosition = window.GetComponent<Image>("Image_BG/UpperUI/Image_LeftBG/Image_ModelPosition");
window.Image_Poster = window.GetComponent<Image>("Image_BG/Image_Poster");
window.Image_PosterPreview = window.GetComponent<Image>("Image_BG/Image_PosterPreview");
window.Image_MidBG = window.GetComponent<Image>("Image_BG/UpperUI/Image_MidBG");
window.Button_ShowAllPic = window.GetComponent<Button>("Image_BG/UpperUI/Image_MidBG/Button_ShowAllPic");
window.Text_Name = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Image_MidBG/Text_Name");
window.Text_SkinName = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Image_MidBG/Text_SkinName");
window.Text_Info = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Image_MidBG/Text_Info");
window.Text_GetWay = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Image_MidBG/Text_GetWay");
window.Button_Buy = window.GetComponent<Button>("Image_BG/UpperUI/Button_Buy");
window.Text_Buy = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Button_Buy/Text_Buy");
window.Button_Wear = window.GetComponent<Button>("Image_BG/UpperUI/Button_Wear");
window.Text_Wear = window.GetComponent<TMP_Text>("Image_BG/UpperUI/Button_Wear/Text_Wear");
}
/****** ******
public Image Image_BG;
public Button Button_Back;
public Button Button_back;
public TMP_Text Text_Back;
public Button Button_Home;
public Image Image_Dark;
public Image Image_LeftBG;
public Image Image_ModelPosition;
public Image Image_Poster;
public Image Image_PosterPreview;
public Image Image_MidBG;
public Button Button_ShowAllPic;
public TMP_Text Text_Name;
public TMP_Text Text_SkinName;
public TMP_Text Text_Info;
public TMP_Text Text_GetWay;
public Button Button_Buy;
public TMP_Text Text_Buy;
public Button Button_Wear;
public TMP_Text Text_Wear;
****** End ******/
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c11637fcb29d04f42bc40c1640540ea9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1596,6 +1596,10 @@ public class IPanelScrollView
_scrollMidPosY = -_scrollRect.GetComponent<RectTransform>().rect.height * 0.5f;
DragForUI drag = _scrollRect.GetComponent<DragForUI>();
if (drag == null)
{
drag = _scrollRect.gameObject.AddComponent<DragForUI>();
}
drag.OnDragStarted += OnDragStart;
drag.OnDragCompleted += OnDragEnd;
}

View File

@ -239,7 +239,7 @@ namespace Gameplay
case ECharacterPicPathType.SelectCharacter:
return @"Assets/Art/UI/Texture/UI_Pic_Main/UI_Poster/Select/" + postCfg.Get(1, id).SelectCharacter + ".png";
case ECharacterPicPathType.Poster:
return Constants.UI_POSTER_DEFAULT_PATH + postCfg.Get(1, id).Poster + ".png";
return Constants.UI_POSTER_DEFAULT_PATH + postCfg.Get(skinID, id).Poster + ".png";
}
return null;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8d65afc51847db141b3d4c1299df830b
guid: b1d25bb273275d947aa50b60efb37067
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6e17aa2bf58c4524ca82902a889e093e
guid: cba4b189cbe5a6445bffb1de42cb5fed
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 293c90e4a891a344b82433ff75aa6d99
guid: 59b2a6da3fab009478eed2a725865226
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f619a89e98b0fdd4887a6edd57e18b35
guid: fcc3b2eea6d22ba47b4d371a2f1e19a4
TextScriptImporter:
externalObjects: {}
userData: