WXGame/Blacksmith/Assets/Script/UI/SwithPanel.cs

67 lines
1.4 KiB
C#
Raw Normal View History

2024-12-04 17:26:27 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 底部栏界面
/// </summary>
2024-12-04 17:26:27 +08:00
public class SwithPanel : MonoBehaviour
{
[SerializeField] private Button storeButton;
[SerializeField] private Button drawingButton;
[SerializeField] private Button shopButton;
[SerializeField] private Button battleButton;
// Start is called before the first frame update
void Start()
{
}
private void OnEnable()
{
storeButton.onClick.AddListener(StoreEvent);
drawingButton.onClick.AddListener(DrawingEvent);
shopButton.onClick.AddListener(ShopEvent);
battleButton.onClick.AddListener(BattleEvent);
}
// Update is called once per frame
void Update()
{
}
private void OnDisable()
{
storeButton.onClick.RemoveListener(StoreEvent);
drawingButton.onClick.RemoveListener(DrawingEvent);
shopButton.onClick.RemoveListener(ShopEvent);
battleButton.onClick.RemoveListener(BattleEvent);
}
private void StoreEvent()
{
UIMgr.ins.OpenStorePanel();
}
private void DrawingEvent()
{
UIMgr.ins.OpenDrawingPanel();
}
private void ShopEvent()
{
UIMgr.ins.OpenForgePanel();
}
private void BattleEvent()
{
UIMgr.ins.OpenBattlePanel();
}
}