Net.Like.Xue.Tokyo/Assets/Artists/Scripts/UX/UXMenu.cs

56 lines
1.4 KiB
C#
Raw Normal View History

2025-02-28 21:17:03 +08:00
using System;
2024-11-03 16:42:23 +08:00
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using BITKit.UX;
using Cysharp.Threading.Tasks;
using Project.B.Entities;
using Project.B.Map;
using UnityEngine;
using UnityEngine.UIElements;
using YooAsset;
namespace Net.Like.Xue.Tokyo.UX
{
public class UXMenu : UIToolKitPanel
{
2025-02-28 21:17:03 +08:00
private readonly IGameMapService _gameMapService;
2024-11-03 16:42:23 +08:00
protected override string DocumentPath => "ux_menu";
public override bool AllowInput => false;
public override bool AllowCursor => true;
2024-12-28 23:19:55 +08:00
[UXBindPath("play-button")]
private Button _playButton;
2025-02-28 21:17:03 +08:00
public UXMenu(IUXService uxService, IGameMapService gameMapService) : base(uxService)
2024-12-28 23:19:55 +08:00
{
2025-02-28 21:17:03 +08:00
_gameMapService = gameMapService;
2024-12-28 23:19:55 +08:00
OnInitiated += Initiated;
2025-02-28 21:17:03 +08:00
_gameMapService.OnMapChanged += OnMapChanged;
}
private void OnMapChanged(Guid arg1, string arg2)
{
if (string.IsNullOrEmpty(arg2))
{
UXService.Entry(this);
}
2024-12-28 23:19:55 +08:00
}
2025-02-28 21:17:03 +08:00
2024-12-28 23:19:55 +08:00
private void Initiated()
2024-11-03 16:42:23 +08:00
{
UXUtils.Inject(this);
2024-12-28 23:19:55 +08:00
_playButton.clicked += UXService.Entry<UXLevel>;
2024-11-03 16:42:23 +08:00
}
2025-02-28 21:17:03 +08:00
public override void Dispose()
{
base.Dispose();
_gameMapService.OnMapChanged -= OnMapChanged;
}
2024-11-03 16:42:23 +08:00
}
}