更新,spine和很多优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,6 +7,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
|
||||
public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
@@ -15,13 +16,14 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
set
|
||||
{
|
||||
character_Index = value;
|
||||
Set_Character_Illustration(Get_Character_Image_Data(character_Index).Image_Full);
|
||||
if(character_Index >= 0 && character_Index < data_List.Count)
|
||||
Set_Character_Illustration(Get_Character_Image_Data(character_Index).ally_hero_HD_image);
|
||||
}
|
||||
get => character_Index;
|
||||
}
|
||||
public int character_Index = 1;
|
||||
[SerializeField] List<Character_Data_Image_SO> data_List;
|
||||
public List<Character_Data_Image_SO> Data_List => data_List;
|
||||
public int character_Index = 0;
|
||||
[SerializeField] List<AllyHero_SO> data_List = new List<AllyHero_SO>();
|
||||
public List<AllyHero_SO> Data_List => data_List;
|
||||
[SerializeField] Button button_Character_Set;
|
||||
[SerializeField] GameObject ui_Panel_Character;
|
||||
[SerializeField] Button button_Encyclopendia;
|
||||
@@ -250,10 +252,8 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Kill_Enter_Tweens();
|
||||
foreach (var item in data_List)
|
||||
{
|
||||
Destroy(item);
|
||||
}
|
||||
// data_List contains references to assets in Resources, do not Destroy them.
|
||||
data_List.Clear();
|
||||
base.OnDestroy();
|
||||
}
|
||||
private void Start()
|
||||
@@ -263,24 +263,16 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
private IEnumerator InitDataRoutine()
|
||||
{
|
||||
var rawData = Resources.LoadAll<Character_Data_Image_SO>("Data");
|
||||
data_List = new List<Character_Data_Image_SO>();
|
||||
var rawData = Resources.LoadAll<AllyHero_SO>("so/ally");
|
||||
data_List = new List<AllyHero_SO>(rawData);
|
||||
|
||||
for (int i = 0; i < rawData.Length; i++)
|
||||
{
|
||||
var item = rawData[i];
|
||||
if (item == null) continue;
|
||||
|
||||
var so = Instantiate(item);
|
||||
data_List.Add(so);
|
||||
|
||||
// Documentation text normalized.
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
data_List.Sort((a, b) => a.ally_heroID.CompareTo(b.ally_heroID));
|
||||
|
||||
yield return null;
|
||||
|
||||
Character_Index = character_Index;
|
||||
if(Character_Index >= 0 && Character_Index < data_List.Count)
|
||||
Set_Character_Illustration(Get_Character_Image_Data(Character_Index).ally_hero_HD_image);
|
||||
|
||||
if (button_Character_Set != null)
|
||||
button_Character_Set.onClick.AddListener(
|
||||
@@ -297,10 +289,24 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
Character_Index = character_Index;
|
||||
if (button_Encyclopendia != null)
|
||||
button_Encyclopendia.onClick.AddListener(
|
||||
() => Try_Open_Panel(ui_Panel_Encyclopendia));
|
||||
() =>
|
||||
{
|
||||
gNotice.warning.display("此版本未开放该功能");
|
||||
//Try_Open_Panel(ui_Panel_Encyclopendia);
|
||||
});
|
||||
if (button_Story != null)
|
||||
button_Story.onClick.AddListener(
|
||||
() => Try_Open_Panel(ui_Panel_Story));
|
||||
() =>
|
||||
{
|
||||
gNotice.warning.display("此版本未开放该功能");
|
||||
//Try_Open_Panel(ui_Panel_Story);
|
||||
});
|
||||
if (button_Idol != null)
|
||||
button_Idol.onClick.AddListener(
|
||||
() =>
|
||||
{
|
||||
gNotice.warning.display("此版本未开放该功能");
|
||||
});
|
||||
if (music_Player != null && music_Player.Button_List != null)
|
||||
music_Player.Button_List.onClick.AddListener(
|
||||
() => Try_Open_Panel(ui_Panel_Music));
|
||||
@@ -677,13 +683,15 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
}
|
||||
}
|
||||
public Character_Data_Image_SO Get_Character_Image_Data(int index)
|
||||
public AllyHero_SO Get_Character_Image_Data(int index)
|
||||
{
|
||||
return data_List.Find(i => i.index == index);
|
||||
if(index < 0 || index >= data_List.Count) return null;
|
||||
return data_List[index];
|
||||
}
|
||||
public Character_Data_Image_SO Get_Character_Image_Data()
|
||||
public AllyHero_SO Get_Character_Image_Data()
|
||||
{
|
||||
return data_List.Find(i => i.index == character_Index);
|
||||
if(character_Index < 0 || character_Index >= data_List.Count) return null;
|
||||
return data_List[character_Index];
|
||||
}
|
||||
public void Set_Character_Illustration(Sprite sprite)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user