Files
bansonic_beta_main/Assets/scripts/UI/Panel/UI_Panel_Notice.cs
T
2026-07-20 22:19:25 +08:00

63 lines
1.5 KiB
C#

/*
* 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))
{
ClosePanel();
}
}
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);
}
}
private void ClosePanel()
{
UI_PanelExitUtility.PlayExitThen(gameObject, () =>
{
if (gameObject != null)
{
gameObject.SetActive(false);
}
});
}
}