using System.Collections; using System.Collections.Generic; using System.IO; using BITKit; using BITKit.UX; using Cysharp.Threading.Tasks; using Net.BITKit.Localization; using Net.Project.B.World; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Networking; using UnityEngine.UIElements; namespace Net.Project.B.UX { public class UXSnapshotWindow:UIToolKitPanel, IUXSnapshotWindow { private readonly ILocalizationService _localizationService; private readonly ISnapshotService _snapshotService; protected override string DocumentPath => "ui_snapshot_window"; public override bool IsWindow => true; public override bool CloseWhenClickOutside => true; public override bool AllowCursor => true; private float _currentOpacity = 1; [UXBindPath("open-button",true)] private Button _openButton; [UXBindPath("delete-button",true)] private Button _deleteButton; public UXSnapshotWindow(IUXService uxService, ISnapshotService snapshotService, ILocalizationService localizationService) : base(uxService) { _snapshotService = snapshotService; _localizationService = localizationService; _snapshotService.OnSnapshot += Open; _snapshotService.OnSnapshot += x => { _currentOpacity = 1; }; } public async void Open(SnapshotData scopeData) { UXService.Entry(this); await WaitUtilInitialized.Task; await UniTask.SwitchToMainThread(); if (_openButton is not null) { _openButton.clickable = null; _openButton.clicked += new BITApp.OpenPath() { path = scopeData.FileName }.Execute; } if (_deleteButton is not null) { _deleteButton.clickable = null; _deleteButton.clicked += new FileInfo(scopeData.FileName).Delete; _deleteButton.clicked += UXService.Return; } RootVisualElement.Get