整合包

gameplay bundle has been imported together
This commit is contained in:
FloatGaming
2025-08-09 18:29:32 +08:00
parent e7962bf492
commit 1d818fa4eb
1654 changed files with 431813 additions and 103 deletions
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Character_Data_Image_SO", menuName = "Character_Data_Image_SO", order = 0)]
public class Character_Data_Image_SO : ScriptableObject
{
public int index;
public Sprite Image_Head;
public Sprite Image_Full;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1851ae8f0afcc54a9ca9cd1ac2198b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ed43632d5af6c9948b6f244030cab923
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5eee4bce0820aea429b1343e0a960377
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UI;
[CustomEditor(typeof(UI_Image), true)]
[CanEditMultipleObjects]
public class UI_Image_Editor : ImageEditor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
UI_Image uiSkewImage = (UI_Image)target;
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button("重置", GUILayout.Width(40)))
{
uiSkewImage.OffsetLeftTop = Vector3.zero;
}
uiSkewImage.OffsetLeftTop = EditorGUILayout.Vector3Field("左上", uiSkewImage.OffsetLeftTop, GUILayout.ExpandWidth(true));
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button("重置", GUILayout.Width(40)))
{
uiSkewImage.OffsetRightTop = Vector3.zero;
}
uiSkewImage.OffsetRightTop = EditorGUILayout.Vector3Field("右上", uiSkewImage.OffsetRightTop, GUILayout.ExpandWidth(true));
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button("重置", GUILayout.Width(40)))
{
uiSkewImage.OffsetLeftButtom = Vector3.zero;
}
uiSkewImage.OffsetLeftButtom = EditorGUILayout.Vector3Field("左下", uiSkewImage.OffsetLeftButtom, GUILayout.ExpandWidth(true));
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button("重置", GUILayout.Width(40)))
{
uiSkewImage.OffsetRightButtom = Vector3.zero;
}
uiSkewImage.OffsetRightButtom = EditorGUILayout.Vector3Field("右下", uiSkewImage.OffsetRightButtom, GUILayout.ExpandWidth(true));
EditorGUILayout.EndHorizontal();
if (GUI.changed)
{
EditorUtility.SetDirty(uiSkewImage);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8b2fcb9535ec47543b0734cac9e6f031
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UI;
[CustomEditor(typeof(UI_Text_Mesh_Modify), true)]
[CanEditMultipleObjects]
public class UI_Text_Mesh_Modify_Editor : ImageEditor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
var type = (UI_Text_Mesh_Modify)target;
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
if (GUILayout.Button("预览", GUILayout.Width(40)))
{
type.Prv();
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c02bcc439d935a040807d174c586b52b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
namespace FancyScrollView.Example01
{
class ItemData
{
public string Message { get; }
public ItemData(string message)
{
Message = message;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fe195dccef0874cf9b6f90eb82e8bb4d
timeCreated: 1552490564
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+32
View File
@@ -0,0 +1,32 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using UnityEngine;
using System.Collections.Generic;
namespace FancyScrollView.Example01
{
class ScrollView : FancyScrollView<ItemData>
{
[SerializeField] Scroller scroller = default;
public Scroller Scroller => scroller;
[SerializeField] GameObject cellPrefab = default;
protected override GameObject CellPrefab => cellPrefab;
protected override void Initialize()
{
base.Initialize();
scroller.OnValueChanged(UpdatePosition);
}
public void UpdateData(IList<ItemData> items)
{
UpdateContents(items);
scroller.SetTotalCount(items.Count);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c7e0222f92bdad84c9ee57a127efe088
timeCreated: 1487262733
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_Button_Character : MonoBehaviour
{
public Toggle Toggle;
public TMP_Text Text;
public Character_Data_SO so;
private void Awake()
{
Toggle.onValueChanged.AddListener(Click);
}
public void Init()
{
Toggle.onValueChanged.RemoveListener(Click);
Toggle.onValueChanged.AddListener(Click);
Toggle.isOn = true;
}
void Click(bool isOn)
{
Toggle.interactable = !isOn;
Toggle.image.gameObject.SetActive(!isOn);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 79ecac4eaa15bce4c80bab018f9bc0f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UI_Button_Character_Head_Slot : MonoBehaviour
{
public int index;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fbbb25f6435a6ce4fa7b1442ef1b0f9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+71
View File
@@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
[AddComponentMenu("UI/UI_Image", 99)]
[ExecuteInEditMode]
public class UI_Image : Image {
[SerializeField]
private Vector3 offsetLeftButtom = Vector3.zero;
public Vector3 OffsetLeftButtom{
get{return offsetLeftButtom;}
set{
offsetLeftButtom = value;
SetAllDirty();
}
}
[SerializeField]
private Vector3 offsetRightButtom = Vector3.zero;
public Vector3 OffsetRightButtom{
get{return offsetRightButtom;}
set{
offsetRightButtom = value;
SetAllDirty();
}
}
[SerializeField]
private Vector3 offsetLeftTop = Vector3.zero;
public Vector3 OffsetLeftTop{
get{return offsetLeftTop;}
set{
offsetLeftTop = value;
SetAllDirty();
}
}
[SerializeField]
private Vector3 offsetRightTop = Vector3.zero;
public Vector3 OffsetRightTop{
get{return offsetRightTop;}
set{
offsetRightTop = value;
SetAllDirty();
}
}
Vector3 GetOffsetVector(int i){
if (i == 0){
return offsetLeftButtom;
}else if (i == 1){
return offsetLeftTop;
}else if (i == 2){
return offsetRightTop;
}else {
return offsetRightButtom;
}
}
protected override void OnPopulateMesh(VertexHelper toFill){
base.OnPopulateMesh(toFill);
int count = toFill.currentVertCount;
for(int i=0;i<count;i++){
UIVertex vertex = new UIVertex();
toFill.PopulateUIVertex(ref vertex, i);
// Debug.Log(i.ToString() + ": " + oldPosition[i].ToString());
vertex.position += GetOffsetVector(i);
toFill.SetUIVertex(vertex, i);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56caaebe706267c419c17572b87c356e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
using UnityEngine;
using TMPro;
public class UI_Text_Mesh_Modify : MonoBehaviour //BaseMeshEffect
{
public TextMeshProUGUI tmp;
public float value = 0;
public Vector3 offset = new();
public Vector2Int index;
public void Prv()
{
LateUpdate();
}
private void Awake()
{
if (tmp == null)
{
tmp = GetComponent<TextMeshProUGUI>();
}
}
void LateUpdate()
{
if (tmp == null)
{
return;
}
tmp.ForceMeshUpdate();
var textInfo = tmp.textInfo;
for (int i = 0; i < textInfo.characterCount; i++)
{
TMP_CharacterInfo char_Info_Cur = textInfo.characterInfo[i];
TMP_MeshInfo mesh_Info_Cur = textInfo.meshInfo[char_Info_Cur.materialReferenceIndex];
int Vertex_Index;
if (i < textInfo.characterCount - 1)
{
TMP_CharacterInfo nextCharInfo = textInfo.characterInfo[i + 1];
Vertex_Index = nextCharInfo.vertexIndex - char_Info_Cur.vertexIndex;
}
else
{
Vertex_Index = mesh_Info_Cur.vertices.Length - char_Info_Cur.vertexIndex;
}
int Vertex_Index_Cur_Start = char_Info_Cur.vertexIndex;
Vector3 pos = new();
Vector3[] mesh_Vertices = mesh_Info_Cur.vertices;
for (int j = Vertex_Index_Cur_Start; j < Vertex_Index_Cur_Start + Vertex_Index; j++)
{
pos = new Vector3(0, offset.y * i, 0);
if (j % 4 == index.x)
{
pos += new Vector3(0, value, 0);
}
if (j % 4 == index.y)
{
pos += new Vector3(0, value, 0);
}
mesh_Vertices[j] = mesh_Vertices[j] + pos;
}
}
for (int i = 0; i < textInfo.meshInfo.Length; i++)
{
var meshInfo = textInfo.meshInfo[i];
meshInfo.mesh.vertices = meshInfo.vertices;
tmp.UpdateGeometry(meshInfo.mesh, i);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3233b62805d53754ca34f41100fa7d49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+19
View File
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Toggle))]
public class UI_Toggle : MonoBehaviour
{
Toggle toggle;
void Awake()
{
TryGetComponent(out toggle);
Active(toggle.isOn);
toggle.onValueChanged.AddListener(Active);
}
void Active(bool isOn)
{
toggle.graphic.gameObject.SetActive(isOn);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 21d6f4132530e8f43a7e425e714f0125
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca877d394b1980544992c55631e43da4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,121 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
class UI_Panel_Character : MonoBehaviour
{
[SerializeField] float anim_Time = 0.5f;
float Anim_Speed => 1f / anim_Time;
[SerializeField] List<Animator> ui_Anim;
[SerializeField] Transform content_Character_Slot;
[SerializeField] Button button_Character_Slot_Prefab;
[SerializeField] Text text_Character_Name;
[SerializeField] Image Image_Character_Illustration;
[SerializeField] Image Image_Character_Illustration_BG;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
void Start()
{
if (Image_Character_Illustration.transform.parent.TryGetComponent(out CanvasGroup canvasGroup))
{
canvasGroup.alpha = 0;
}
else if(canvasGroup == null)
{
//Debug.LogError("Error for getting canvas group");
return;
}
foreach (var item in ui_Anim)
{
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++)
{
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;
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));
}
}
}
public void Set_Character_Index(int index)
{
if (UI_Panel_Main.Singleton.Character_Index == index) return;
UI_Panel_Main.Singleton.Character_Index = index;
Set_Character();
}
private void OnEnable()
{
Set_Character();
}
Coroutine c_Character_Illustration_Anim;
public void Set_Character()
{
if (c_Character_Illustration_Anim != null)
{
StopCoroutine(c_Character_Illustration_Anim);
}
if (Image_Character_Illustration.transform.parent.TryGetComponent(out CanvasGroup canvasGroup))
{
c_Character_Illustration_Anim = StartCoroutine(C_Character_Illustration_Anim(canvasGroup, Set_Character_Show));
}
}
public void Set_Character_Show()
{
var data = UI_Panel_Main.Singleton.Get_Character_Image_Data();
var pos1 = Image_Character_Illustration.rectTransform.anchoredPosition;
Image_Character_Illustration.sprite = data.Image_Full;
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;
DOTween.To(value =>
{ Image_Character_Illustration_BG.rectTransform.anchoredPosition = new Vector2(value, pos.y); },
startValue: Image_Character_Illustration_BG.rectTransform.anchoredPosition.x - 200,
pos.x, anim_Time);
Image_Character_Illustration_BG.SetNativeSize();
Image_Character_Illustration_BG.transform.localScale = new(2.7f, 2.7f, 2.7f);
string text = text_Character_Name.text;
var t = DOTween.To(() => string.Empty, value => text_Character_Name.text = value, text, anim_Time).SetEase(Ease.Linear);
t.SetOptions(true);
}
IEnumerator C_Character_Illustration_Anim(CanvasGroup canvasGroup, Action onHide)
{
while (canvasGroup.alpha > 0)
{
canvasGroup.alpha -= Anim_Speed * Time.deltaTime;
yield return null;
}
onHide?.Invoke();
while (canvasGroup.alpha < 1)
{
canvasGroup.alpha += Anim_Speed * Time.deltaTime;
yield return null;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 110f0ff82704aa0429d5eba59d3a6ee2
timeCreated: 1487186233
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+63
View File
@@ -0,0 +1,63 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using FancyScrollView.Example01;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
class UI_Panel_Level : MonoBehaviour
{
[SerializeField] float anim_Time = 0.5f;
float Anim_Speed => 1f / anim_Time;
[SerializeField] List<Animator> ui_Anim;
[SerializeField] ScrollView scrollView = default;
[SerializeField] TMP_Text Text_Level;
private void OnEnable()
{
Text_Level.text = "1";
string text = Text_Level.text;
//var s = DOTween.Sequence();
// s.Append(DOTween.To(value => { Text_Level.text = Mathf.Floor(value).ToString(); }, startValue: UnityEngine.Random.Range(0, 99), UnityEngine.Random.Range(0, 99), duration: anim_Time / 4)
// );
// s.Append(DOTween.To(value => { Text_Level.text = Mathf.Floor(value).ToString(); }, startValue: UnityEngine.Random.Range(0, 99), UnityEngine.Random.Range(0, 99), duration: anim_Time / 4)
// );
// s.Append(DOTween.To(value => { Text_Level.text = Mathf.Floor(value).ToString(); }, startValue: UnityEngine.Random.Range(0, 99), UnityEngine.Random.Range(0, 99), duration: anim_Time / 4)
// );
// s.Append(DOTween.To(() => string.Empty, value => Text_Level.text = value, text, anim_Time / 4)
//);
//t.SetOptions(true);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
void Start()
{
foreach (var item in ui_Anim)
{
item.speed = Anim_Speed;
}
var items = Enumerable.Range(1, 100)
.Select(i => new ItemData($"{i}"))
.ToArray();
scrollView.UpdateData(items);
scrollView.Scroller.OnSelectionChanged(Set_Level);
}
private void Set_Level(int obj)
{
//obj++;
//Text_Level.text = obj.ToString();
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 69123a589054bf041ba5ead99364646f
timeCreated: 1487186233
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+42
View File
@@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
class UI_Panel_Mail : MonoBehaviour
{
[SerializeField] float anim_Time = 0.5f;
float Anim_Speed => 1f / anim_Time;
[SerializeField] List<Animator> ui_Anim;
[SerializeField] Transform content_Notice_Slot;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
void Start()
{
foreach (var item in ui_Anim)
{
item.speed = Anim_Speed;
}
StartCoroutine(C_Slot_Show());
}
IEnumerator C_Slot_Show()
{
var slots = content_Notice_Slot.GetComponentsInChildren<Button>();
foreach (var item in slots)
{
item.gameObject.SetActive(false);
}
foreach (var item in slots)
{
yield return new WaitForSeconds(0.1f);
item.gameObject.SetActive(true);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ef71b0bf89cb6354491f70a5cd33bdd1
timeCreated: 1487186233
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+138
View File
@@ -0,0 +1,138 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
{
public int Character_Index
{
set
{
character_Index = value;
Set_Character_Illustration(Get_Character_Image_Data(character_Index).Image_Full);
}
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;
[SerializeField] Button button_Character_Set;
[SerializeField] GameObject ui_Panel_Character;
[SerializeField] Button button_Encyclopendia;
[SerializeField] GameObject ui_Panel_Encyclopendia;
[SerializeField] Image image_Character;
[SerializeField] Button button_Mail;
[SerializeField] GameObject ui_Panel_Mail;
[SerializeField] Button button_Notice;
[SerializeField] GameObject ui_Panel_Notice;
[SerializeField] Button button_Level;
[SerializeField] GameObject ui_Panel_Level;
[SerializeField] MusicPlayer music_Player;
[SerializeField] GameObject ui_Panel_Music;
[SerializeField] Button button_Story;
[SerializeField] GameObject ui_Panel_Story;
[SerializeField] Button button_Setting;
[SerializeField] GameObject ui_Panel_Setting;
[SerializeField] Button button_Idol;
[SerializeField] Button button_Select_Music;
[SerializeField] string ui_Select_Music_Scene_Name= "selectYourSongFirst";
protected override void In_Init()
{
}
protected override bool Is_Singleton_Auto()
{
return true;
}
protected override void OnDestroy()
{
foreach (var item in data_List)
{
Destroy(item);
}
base.OnDestroy();
}
private void Start()
{
data_List = Resources.LoadAll<Character_Data_Image_SO>("Data").ToList();
List<Character_Data_Image_SO> data_List_New = new();
foreach (var item in data_List)
{
var so = Instantiate(item);
data_List_New.Add(so);
}
data_List = data_List_New;
Character_Index = character_Index;
button_Character_Set.onClick.AddListener(
() => ui_Panel_Character.SetActive(true));
button_Mail.onClick.AddListener(
() => ui_Panel_Mail.SetActive(true));
button_Notice.onClick.AddListener(
() => ui_Panel_Notice.SetActive(true));
button_Level.onClick.AddListener(
() => ui_Panel_Level.SetActive(true));
Character_Index = character_Index;
button_Encyclopendia.onClick.AddListener(
() => ui_Panel_Encyclopendia.SetActive(true));
button_Story.onClick.AddListener(
() => ui_Panel_Story.SetActive(true));
music_Player.Button_List.onClick.AddListener(
() => ui_Panel_Music.SetActive(true));
button_Setting.onClick.AddListener(
() => ui_Panel_Setting.SetActive(true));
button_Select_Music.onClick.AddListener(
() => SceneManager.LoadScene(ui_Select_Music_Scene_Name,LoadSceneMode.Single));
}
public Character_Data_Image_SO Get_Character_Image_Data(int index)
{
return data_List.Find(i => i.index == index);
}
public Character_Data_Image_SO Get_Character_Image_Data()
{
return data_List.Find(i => i.index == character_Index);
}
public void Set_Character_Illustration(Sprite sprite)
{
if (c_Character_Illustration_Anim != null)
{
StopCoroutine(c_Character_Illustration_Anim);
}
if (image_Character.TryGetComponent(out CanvasGroup canvasGroup))
{
c_Character_Illustration_Anim = StartCoroutine(C_Character_Illustration_Anim(canvasGroup, () =>
{
image_Character.sprite = sprite;
image_Character.SetNativeSize();
}));
}
}
Coroutine c_Character_Illustration_Anim;
[SerializeField] float character_Illustration_Time = 0.5f;
IEnumerator C_Character_Illustration_Anim(CanvasGroup canvasGroup, Action onHide)
{
float a = 1f / character_Illustration_Time;
while (canvasGroup.alpha > 0)
{
canvasGroup.alpha -= a * Time.deltaTime;
yield return null;
}
onHide?.Invoke();
while (canvasGroup.alpha < 1)
{
canvasGroup.alpha += a * Time.deltaTime;
yield return null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 12413895c2383c14aa5ab0357715c678
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+239
View File
@@ -0,0 +1,239 @@
using System;
using System.Collections;
using Mono.Cecil.Cil;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_Panel_Note : MonoBehaviour
{
[SerializeField] Button button_Close;
[SerializeField] float anim_Time = 0.5f;
[SerializeField] Button button_Character;
[SerializeField] Button button_Enemy;
[SerializeField] Button button_TERMINOLOGY;
[SerializeField] Button button_AGENDA;
[SerializeField] Button button_ORGANIZATIONS;
[SerializeField] Button button_TERRITORIAL;
[SerializeField] TMP_Text text_Select_Title;
[SerializeField] Transform transform_Select;
[SerializeField] ToggleGroup toggleGroup_Select;
[SerializeField] Animator Animator_Select_Content;
[SerializeField] UI_Button_Character button_Select_Prefab;
[SerializeField] TMP_Text text_Character_Title;
[SerializeField] Transform transform_Description_Content;
[SerializeField] TMP_Text text_Only;
[SerializeField] TMP_Text text_Character_Name;
[SerializeField] Scrollbar scrollbar_Character_Description;
[SerializeField] Image image_Character_Illustration;
[SerializeField] TMP_Text text_Character_RealName;
[SerializeField] TMP_Text text_Character_StageName;
[SerializeField] TMP_Text text_Character_Gender;
[SerializeField] TMP_Text text_Character_Age;
[SerializeField] TMP_Text text_Character_Height;
[SerializeField] TMP_Text text_Character_Weight;
[SerializeField] TMP_Text text_Character_Birthday;
[SerializeField] TMP_Text text_Character_Data;
[SerializeField] TMP_Text text_Character_Description;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
private void Awake()
{
button_Close?.onClick.AddListener(Close);
}
void Close()
{
gameObject.SetActive(false);
}
private void Start()
{
Set_Button_Image(button_Character);
button_Character.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.Character.ToString());
Set_Button_Image_Select(button_Character);
});
Set_Button_Image(button_Enemy);
button_Enemy.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.Enemy.ToString());
Set_Button_Image_Select(button_Enemy);
});
Set_Button_Image(button_TERMINOLOGY);
button_TERMINOLOGY.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.TERMINOLOGY.ToString());
Set_Button_Image_Select(button_TERMINOLOGY);
});
Set_Button_Image(button_AGENDA);
button_AGENDA.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.AGENDA.ToString());
Set_Button_Image_Select(button_AGENDA);
});
Set_Button_Image(button_ORGANIZATIONS);
button_ORGANIZATIONS.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.ORGANIZATIONS.ToString());
Set_Button_Image_Select(button_ORGANIZATIONS);
});
Set_Button_Image(button_TERRITORIAL);
button_TERRITORIAL.onClick.AddListener
(() =>
{
Set_Select_Content(E_Character_Type.TERRITORIAL.ToString());
Set_Button_Image_Select(button_TERRITORIAL);
});
button_Character.onClick.Invoke();
}
public void Set_Button_Image(Button btn)
{
btn.spriteState = new()
{
highlightedSprite = btn.spriteState.highlightedSprite,
selectedSprite = btn.spriteState.selectedSprite,
disabledSprite = btn.image.sprite,
};
}
public void Set_Button_Image_Select(Button btn)
{
if (btn.TryGetComponent(out Image image))
{
image.sprite = btn.spriteState.selectedSprite;
}
;
}
public void Clear_Select_Content()
{
button_Character.image.sprite = button_Character.spriteState.disabledSprite;
button_Enemy.image.sprite = button_Enemy.spriteState.disabledSprite;
button_TERMINOLOGY.image.sprite = button_TERMINOLOGY.spriteState.disabledSprite;
button_AGENDA.image.sprite = button_AGENDA.spriteState.disabledSprite;
button_ORGANIZATIONS.image.sprite = button_ORGANIZATIONS.spriteState.disabledSprite;
button_TERRITORIAL.image.sprite = button_TERRITORIAL.spriteState.disabledSprite;
toggleGroup_Select.transform.Get_Childrens_Component<UI_Button_Character>(true, true);
if (c_Clear_Select_Content != null)
{
StopCoroutine(c_Clear_Select_Content);
}
c_Clear_Select_Content = StartCoroutine(C_Clear_Select_Content());
}
Coroutine c_Clear_Select_Content;
IEnumerator C_Clear_Select_Content()
{
Animator_Select_Content.Play("Hide");
Animator_Select_Content.speed = 1 / anim_Time;
if (Animator_Select_Content.gameObject.activeSelf == true)
{
yield return new WaitForSeconds(anim_Time);
transform_Select.gameObject.SetActive(false);
}
transform_Select.gameObject.SetActive(true);
}
public void Set_Select_Content(string type)
{
Clear_Select_Content();
if (c_Set_Select_Content != null)
{
StopCoroutine(c_Set_Select_Content);
}
c_Set_Select_Content = StartCoroutine(C_Set_Select_Content(type));
}
Coroutine c_Set_Select_Content;
IEnumerator C_Set_Select_Content(string type)
{
Clear_Select_Content();
if (Animator_Select_Content.gameObject.activeSelf == true)
{
yield return new WaitForSeconds(anim_Time);
}
var data = CharacterDataManager.Singleton.data_Dic;
var data_List = CharacterDataManager.Singleton.data_Dic[type];
var type_Index = (int)(E_Character_Type)Enum.Parse(typeof(E_Character_Type), type);
if (data_List != null)
{
for (int i = 0; i < data_List.Count; i++)
{
Character_Data_SO item = data_List[i];
UI_Button_Character btn = null;
btn = Add_Select_Button(item, type_Index >= 2);
if (i == 0)
{
btn.Init();
}
}
text_Character_Title.text = type;
}
yield return null;
}
public UI_Button_Character Add_Select_Button(Character_Data_SO item, bool text_Only)
{
UI_Button_Character btn = Instantiate(button_Select_Prefab, toggleGroup_Select.transform);
btn.so = item;
btn.Toggle.group = toggleGroup_Select;
btn.Text.text = item.data.realName;
btn.gameObject.name = nameof(UI_Button_Character) + "_" + item.data.realName;
btn.gameObject.SetActive(true);
btn.transform.localScale = Vector3.one;
if (text_Only)
{
btn.Toggle.onValueChanged.AddListener((isOn) =>
{
if (isOn == true)
{
Set_Text_Only(btn.so);
}
});
}
else
{
btn.Toggle.onValueChanged.AddListener((isOn) =>
{
if (isOn == true)
{
Set_Character_Description(btn.so);
}
});
}
return btn;
}
public void Set_Text_Only(Character_Data_SO item)
{
text_Only.gameObject.SetActive(true);
transform_Description_Content.gameObject.SetActive(false);
text_Only.text = item.data.personalityDescription;
}
public void Set_Character_Description(Character_Data_SO item)
{
text_Only.gameObject.SetActive(false);
transform_Description_Content.gameObject.SetActive(true);
var data = item;
text_Character_Name.text = data.data.realName;
image_Character_Illustration.sprite = Resources.Load<Sprite>(data.data.image_Name);
text_Character_RealName.text = data.data.realName;
text_Character_StageName.text = data.data.stageName;
text_Character_Gender.text = data.data.stageName;
text_Character_Age.text = data.data.age.ToString();
text_Character_Height.text = data.data.height.ToString();
text_Character_Weight.text = data.data.weight.ToString();
text_Character_Birthday.text = data.data.birthday;
text_Character_Data.text = data.data.registrationDate;
text_Character_Description.text = data.data.personalityDescription;
scrollbar_Character_Description.value = 1;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 841b34bb42a66e24c81ad648c3cc187c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,51 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using FancyScrollView.Example01;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
class UI_Panel_Notice : MonoBehaviour
{
[SerializeField] float anim_Time = 0.5f;
float Anim_Speed => 1f / anim_Time;
[SerializeField] List<Animator> ui_Anim;
[SerializeField] Transform content_Notice_Slot;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
void Start()
{
foreach (var item in ui_Anim)
{
item.speed = Anim_Speed;
}
StartCoroutine(C_Slot_Show());
}
IEnumerator C_Slot_Show()
{
var slots = content_Notice_Slot.GetComponentsInChildren<Button>();
foreach (var item in slots)
{
item.gameObject.SetActive(false);
}
foreach (var item in slots)
{
yield return new WaitForSeconds(0.1f);
item.gameObject.SetActive(true);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 67cd8ae402414ae46903dfc88076e320
timeCreated: 1487186233
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
using UnityEngine;
using UnityEngine.UI;
public class ui_Panel_Setting : MonoBehaviour
{
[SerializeField] Button button_Close;
[SerializeField] Toggle toggle_Game;
[SerializeField] Toggle toggle_Game_Pie;
[SerializeField] GameObject game_Content;
[SerializeField] Toggle toggle_View;
[SerializeField] Toggle toggle_View_Pie;
[SerializeField] GameObject view_Content;
private void Awake()
{
button_Close?.onClick.AddListener(Close);
toggle_Game.onValueChanged.AddListener((isOn) =>
{
game_Content.SetActive(isOn);
if (isOn == false) return;
if (game_Content.TryGetComponent(out SimpleAxisTween simpleAxisTween))
{
simpleAxisTween.PlayTween();
}
});
toggle_Game_Pie.onValueChanged.AddListener((isOn) => { toggle_Game.isOn = isOn; });
toggle_View.onValueChanged.AddListener((isOn) =>
{
view_Content.SetActive(isOn);
if (isOn == false) return;
if (view_Content.TryGetComponent(out SimpleAxisTween simpleAxisTween))
{
simpleAxisTween.PlayTween();
}
});
toggle_View_Pie.onValueChanged.AddListener((isOn) => { toggle_View.isOn = isOn; });
toggle_Game.isOn = true;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
Close();
}
}
void Close()
{
gameObject.SetActive(false);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ca6219beec64ec4ea91e7eeeab1163e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+22
View File
@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UI;
public class UI_Panel_Story : MonoBehaviour
{
[SerializeField] Button button_Close;
private void Awake()
{
button_Close.onClick.AddListener(Close);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
Close();
}
}
void Close()
{
gameObject.SetActive(false);
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b6dd6744b2827264ebf834f49d435d20
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94acd256fac6f7642a8962491a2395eb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class MusicPlayer : MonoBehaviour
{
public Image Image_Cover;
public TMP_Text Text_Title;
public TMP_Text Text_Time;
public Button Button_Play;
public Button Button_Pause;
public Button Button_Last;
public Button Button_Next;
public Button Button_List;
public Slider Slider_Progress;
public Music_Data Music_Data => Music_Mgr.Singleton.Music_Cur;
public static AudioSource Music_Source => Music_Mgr.Singleton.AudioSource;
private void Start()
{
if (Music_Data != null)
{
Refresh(Music_Data);
}
}
public void Refresh(Music_Data data)
{
Image_Cover.sprite = data.Cover;
Text_Title.text = data.Name;
}
private void Update()
{
if (Music_Source.clip != null)
{
Text_Time.text = Music_Mgr.Get_Time_Cur(Music_Source) + "/" + Music_Mgr.Get_Time_Max(Music_Source.clip);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a632bc37b464fc54496812fa78e321a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class Music_Mgr : Singleton_Mono<Music_Mgr>
{
public static string Get_Time_Max(AudioClip clip)
{
return Get_Time(clip == null ? 0 : (int)clip.length);
}
public static string Get_Time_Cur(AudioSource aus)
{
return Get_Time((int)aus.time);
}
public static string Get_Time(int time)
{
var currentHour = time / 3600;
var currentMinute = (time - currentHour * 3600) / 60;
var currentSecond = time - currentHour * 3600 - currentMinute * 60;
return string.Format("{0:D2}:{1:D2}:{2:D2} ",
currentHour, currentMinute, currentSecond);
}
public static float Get_Time_Cur_Prv(AudioSource aus)
{
return aus.time / aus.clip.length;
}
public List<Music_Data> Music_Data_List;
public AudioSource AudioSource;
public Music_Data Music_Cur;
protected override void In_Init()
{
if (TryGetComponent(out AudioSource) == false)
{
AudioSource = gameObject.AddComponent<AudioSource>();
}
Music_Data_List = Resources.LoadAll<Music_Data>("Data/Music").ToList();
if (Music_Data_List.Count > 0)
{
Play(Music_Data_List[0]);
}
}
public void Play(Music_Data data)
{
Music_Cur = data;
AudioSource.clip = data.Clip;
AudioSource.Play();
}
protected override bool Is_Singleton_Auto()
{
return true;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 33690802e9b6e224da3b831aae73d867
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_Panel_Music : MonoBehaviour
{
[SerializeField] UI_Slot_Music prefab_Music_Slot;
[SerializeField] List<UI_Slot_Music> music_Slot_List;
[SerializeField] List<Music_Data> music_Data_List;
[SerializeField] GridLayoutGroup group_Music;
[SerializeField] MusicPlayer musicPlayer;
[SerializeField] TMP_Text text_Page;
[SerializeField] Button button_Page_Last;
[SerializeField] Button button_Page_Next;
[SerializeField] int pageIndex;
[SerializeField] int pageIndexMax => Music_Mgr.Singleton.Music_Data_List.Count / pageCount;
[SerializeField] int pageCount = 8;
private void Awake()
{
var mgr = Music_Mgr.Singleton;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
private void Start()
{
music_Slot_List = group_Music.GetComponentsInChildren<UI_Slot_Music>().ToList();
Clear_Page();
Set_Page(pageIndex);
button_Page_Last.onClick.AddListener(() => { Set_Page(pageIndex - 1); });
button_Page_Next.onClick.AddListener(() => { Set_Page(pageIndex + 1); });
}
void Clear_Page()
{
foreach (var item in music_Slot_List)
{
Destroy(item.gameObject);
}
music_Slot_List.Clear();
}
public void Set_Page(int index)
{
if (index > pageIndexMax) return;
if (index < 0) return;
Clear_Page();
pageIndex = index;
text_Page.text = index + 1 + "/" + (pageIndexMax + 1);
music_Data_List = Get_Music_Page(index);
foreach (var item in music_Data_List)
{
var slot = Instantiate(prefab_Music_Slot, group_Music.transform);
slot.Refresh(item);
music_Slot_List.Add(slot);
}
}
public List<Music_Data> Get_Music_Page(int index)
{
var list = new List<Music_Data>();
for (int i = index * pageCount; i < Music_Mgr.Singleton.Music_Data_List.Count; i++)
{
if (i >= (index + 1) * pageCount)
{
break;
}
list.Add(Music_Mgr.Singleton.Music_Data_List[i]);
}
return list;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d6f9b5d0cc46d074da7dd58bc5eb699d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_Slot_Music : MonoBehaviour
{
public Image Image_Cover;
public TMP_Text Text_Title;
public TMP_Text Text_Description;
public TMP_Text Text_Time;
public Button Button_Play;
public void Refresh(Music_Data data)
{
Image_Cover.sprite = data.Cover;
Text_Title.text = data.Name;
Text_Description.text = data.Description;
Text_Time.text = Music_Mgr.Get_Time_Max(data.Clip);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e84a3ae7079924148b7f3e5a7b7798be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c1ad9ed4c18b01d45b4e563661a400d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+43
View File
@@ -0,0 +1,43 @@
/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace FancyScrollView.Example01
{
class Cell : FancyCell<ItemData>
{
[SerializeField] Animator animator = default;
[SerializeField] TMP_Text message = default;
static class AnimatorHash
{
public static readonly int Scroll = Animator.StringToHash("scroll");
}
public override void UpdateContent(ItemData itemData)
{
message.text = itemData.Message;
}
public override void UpdatePosition(float position)
{
currentPosition = position;
if (animator.isActiveAndEnabled)
{
animator.Play(AnimatorHash.Scroll, -1, position);
}
animator.speed = 0;
}
float currentPosition = 0;
void OnEnable() => UpdatePosition(currentPosition);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b77a04c729f174c478baf21a47c16620
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,74 @@
using System.Collections;
using UnityEngine;
// 通过 PlayTween() 触发动画
public class SimpleAxisTween : MonoBehaviour
{
public enum Axis { X, Y } // 轴向选项
[Header("Tween Settings")]
public Axis axis = Axis.X; // 要缓动的轴
public float from = 0f; // 起始值
public float to = 100f; // 终点值
public float duration = 1f; // 总时长(秒)——外部可调
public AnimationCurve ease = AnimationCurve.EaseInOut(0, 0, 1, 1);
private Coroutine tweenCo;
private RectTransform rt;
public void PlayTween()
{
if (tweenCo != null) StopCoroutine(tweenCo);
tweenCo = StartCoroutine(TweenRoutine());
}
private void Awake()
{
TryGetComponent(out rt);
}
private IEnumerator TweenRoutine()
{
float elapsed = 0f;
SetPosition(from);
while (elapsed < duration)
{
elapsed += Time.deltaTime;
float t = Mathf.Clamp01(elapsed / duration);
float easedT = ease.Evaluate(t);
// 缓动插值
float current = Mathf.LerpUnclamped(from, to, easedT);
SetPosition(current);
yield return null;
}
// 强制落在终点
SetPosition(to);
tweenCo = null;
}
private void SetPosition(float value)
{
if (rt != null)
{
Vector2 pos = rt.anchoredPosition;
if (axis == Axis.X) pos.x = value;
else pos.y = value;
rt.anchoredPosition = pos;
}
else
{
Vector3 pos = transform.localPosition;
if (axis == Axis.X) pos.x = value;
else pos.y = value;
transform.localPosition = pos;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f2d99df04537994d9ed3332354ac7b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+82
View File
@@ -0,0 +1,82 @@
using UnityEngine;
internal interface I_Singleton
{
}
public abstract class Singleton_Mono<T> : MonoBehaviour, I_Singleton where T : Singleton_Mono<T>
{
private static T singleton;
private static object _lock = new object();
public static T Singleton
{
get
{
if (singleton == null)
{
lock (_lock)
{
T obj = FindFirstObjectByType<T>();
if (obj != null)
{
obj.TryGetComponent(out Singleton_Mono<T> s);
}
if (obj == null)
{
var gameObj = new GameObject(typeof(T).Name);
obj = gameObj.AddComponent<T>();
if (!obj.Is_Singleton_Auto())
{
Destroy(obj.gameObject);
return null;
}
}
singleton = obj;
}
}
return singleton;
}
}
private void Awake()
{
var s = Singleton;
if (s != null && singleton != this) Destroy(gameObject);
if (s != this) return;
Init();
}
public T Init()
{
if (singleton == this)
{
In_Init();
}
return singleton;
}
protected abstract bool Is_Singleton_Auto();
protected abstract void In_Init();
protected virtual void OnDestroy()
{
if (singleton == this)
{
singleton = null;
}
}
}
public class Singleton_Static<T> where T : new()
{
protected static T singleton;
private static object _lock = new object();
public static T Singleton
{
get
{
if (singleton == null)
{
lock (_lock)
{
singleton ??= new T();
}
}
return singleton;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c74a683b29521d04f9d0008307992452
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+30
View File
@@ -0,0 +1,30 @@
using DG.Tweening;
using UnityEngine;
public class UI_Show_Anim : MonoBehaviour
{
public float animTime_Alpha = 1f;
public float animTime_Scale = 1f;
private void OnEnable()
{
Clear();
transform.localScale = new();
transform.DOScale(1, animTime_Scale);
gameObject.Try_Get_Component(out CanvasGroup canvasGroup);
float a = 0;
DOTween.To(() => a, (f) => { a = f; canvasGroup.alpha = f; }, 1, animTime_Alpha);
}
public void Close()
{
Clear();
transform.DOScale(0, animTime_Scale);
gameObject.Try_Get_Component(out CanvasGroup canvasGroup);
float a = 1;
DOTween.To(() => a, (f) => { a = f; canvasGroup.alpha = f; }, 0, animTime_Alpha);
}
void Clear()
{
DOTween.KillAll(transform);
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a18edaa7e274bec4ea9df9d1811f4609