更新,spine和很多优化

This commit is contained in:
FloatGaming
2026-02-24 05:36:08 +08:00
parent 14fb281d6f
commit d5c8966abd
2039 changed files with 348643 additions and 2589 deletions
+30 -10
View File
@@ -1,4 +1,4 @@
/*
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
@@ -22,6 +22,14 @@ class UI_Panel_Character : MonoBehaviour
[SerializeField] Image Image_Character_Illustration;
[SerializeField] Image Image_Character_Illustration_BG;
[Header("Data Paths")]
[Tooltip("Path relative to Resources folder for Editor mode")]
public string editorResourcePath = "so/ally";
[Tooltip("Path relative to Resources folder for Runtime mode")]
public string runtimeResourcePath = "so/ally";
private List<AllyHero_SO> allyHeroList = new List<AllyHero_SO>();
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
@@ -46,15 +54,24 @@ class UI_Panel_Character : MonoBehaviour
item.speed = Anim_Speed;
}
content_Character_Slot.Get_Childrens_Component<UI_Button_Character_Head_Slot>(true, true);
for (int i = 0; i < UI_Panel_Main.Singleton.Data_List.Count; i++)
// Load AllyHero_SO data
string path = Application.isEditor ? editorResourcePath : runtimeResourcePath;
var loadedData = Resources.LoadAll<AllyHero_SO>(path);
allyHeroList = new List<AllyHero_SO>(loadedData);
// Ensure consistent order with UI_Panel_Main
allyHeroList.Sort((a, b) => a.ally_heroID.CompareTo(b.ally_heroID));
for (int i = 0; i < allyHeroList.Count; i++)
{
var obj = Instantiate(button_Character_Slot_Prefab, content_Character_Slot);
var data = UI_Panel_Main.Singleton.Data_List[i];
obj.image.sprite = data.Image_Head;
var data = allyHeroList[i];
obj.image.sprite = data.ally_hero_squareProfile;
if (obj.TryGetComponent(out UI_Button_Character_Head_Slot head_Slot))
{
head_Slot.index = data.index;
obj.onClick.AddListener(() => Set_Character_Index(head_Slot.index));
head_Slot.index = i;
int capturedIndex = i;
obj.onClick.AddListener(() => Set_Character_Index(capturedIndex));
}
}
}
@@ -82,16 +99,19 @@ class UI_Panel_Character : MonoBehaviour
}
public void Set_Character_Show()
{
var data = UI_Panel_Main.Singleton.Get_Character_Image_Data();
int index = UI_Panel_Main.Singleton.Character_Index;
if (allyHeroList == null || index < 0 || index >= allyHeroList.Count) return;
var data = allyHeroList[index];
var pos1 = Image_Character_Illustration.rectTransform.anchoredPosition;
Image_Character_Illustration.sprite = data.Image_Full;
Image_Character_Illustration.sprite = data.ally_hero_HD_image;
DOTween.To(value =>
{ Image_Character_Illustration.rectTransform.anchoredPosition = new Vector2(value, pos1.y); },
startValue: Image_Character_Illustration.rectTransform.anchoredPosition.x - 200,
pos1.x, anim_Time);
Image_Character_Illustration.SetNativeSize();
var pos = Image_Character_Illustration_BG.rectTransform.anchoredPosition;
Image_Character_Illustration_BG.sprite = data.Image_Full;
Image_Character_Illustration_BG.sprite = data.ally_hero_HD_image;
DOTween.To(value =>
{ Image_Character_Illustration_BG.rectTransform.anchoredPosition = new Vector2(value, pos.y); },
startValue: Image_Character_Illustration_BG.rectTransform.anchoredPosition.x - 200,
@@ -100,7 +120,7 @@ class UI_Panel_Character : MonoBehaviour
Image_Character_Illustration_BG.transform.localScale = new(2.7f, 2.7f, 2.7f);
string text = text_Character_Name.text;
string text = data.ally_heroName;
var t = DOTween.To(() => string.Empty, value => text_Character_Name.text = value, text, anim_Time).SetEase(Ease.Linear);
t.SetOptions(true);
}