Removed Many Things
This commit is contained in:
@@ -33,7 +33,7 @@ namespace BITKit.UX
|
||||
[UXBindPath("reload-mod-button",true)]
|
||||
private Button reloadModButton;
|
||||
|
||||
private readonly ConcurrentDictionary<string,UXContainer> _modContainers=new();
|
||||
private readonly ConcurrentDictionary<string,VisualElement> _modContainers=new();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace BITKit.UX
|
||||
|
||||
if (_returnButton is not null)
|
||||
{
|
||||
_returnButton.clicked += UXService.Return;
|
||||
_returnButton.clicked += UxService.Return;
|
||||
}
|
||||
|
||||
_modsContainer.Clear();
|
||||
@@ -94,7 +94,7 @@ namespace BITKit.UX
|
||||
await UniTask.SwitchToMainThread();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
_modContainers.TryRemove(obj.Name, out var container);
|
||||
container.visualElement.RemoveFromHierarchy();
|
||||
container.RemoveFromHierarchy();
|
||||
}
|
||||
|
||||
private async void OnModInstalled(IMod obj)
|
||||
@@ -102,7 +102,7 @@ namespace BITKit.UX
|
||||
await UniTask.SwitchToMainThread();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
container.visualElement.RegisterCallback<MouseDownEvent>(x =>
|
||||
container.RegisterCallback<MouseDownEvent>(x =>
|
||||
{
|
||||
if (x.button != 1) return;
|
||||
ContextMenuBuilder.Create().BuildAction("卸载", () =>
|
||||
@@ -119,7 +119,7 @@ namespace BITKit.UX
|
||||
//var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
if(_modContainers.TryGetValue(obj.Name,out var container))
|
||||
{
|
||||
container.toggle.SetValueWithoutNotify(false);
|
||||
container.Get<Toggle>().SetValueWithoutNotify(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace BITKit.UX
|
||||
await UniTask.SwitchToMainThread();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
container.toggle.SetValueWithoutNotify(true);
|
||||
container.Get<Toggle>().SetValueWithoutNotify(true);
|
||||
}
|
||||
|
||||
private static void OpenMod()
|
||||
@@ -202,21 +202,10 @@ namespace BITKit.UX
|
||||
}
|
||||
|
||||
}
|
||||
private UXContainer Create(IMod mod)
|
||||
private VisualElement Create(IMod mod)
|
||||
{
|
||||
var container = new UXContainer(_modsContainer.Create(modTemplate))
|
||||
{
|
||||
titleLabel =
|
||||
{
|
||||
text = mod.Name
|
||||
},
|
||||
descriptionLabel =
|
||||
{
|
||||
text = mod.Description
|
||||
}
|
||||
|
||||
};
|
||||
container.toggle.RegisterValueChangedCallback(evt =>
|
||||
var container =_modsContainer.Create(modTemplate);
|
||||
container.Get<Toggle>().RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
if (evt.newValue)
|
||||
{
|
||||
@@ -227,9 +216,9 @@ namespace BITKit.UX
|
||||
ModService.UnLoad(mod);
|
||||
}
|
||||
});
|
||||
container.visualElement.tooltip = mod.Name+"\n"+mod.Description;
|
||||
container.tooltip = mod.Name+"\n"+mod.Description;
|
||||
|
||||
container.button.clicked += () =>
|
||||
container.Get<Button>().clicked += () =>
|
||||
{
|
||||
_modNameLabel.text = mod.Name;
|
||||
_modDescriptionLabel.text = mod.Description;
|
||||
|
Reference in New Issue
Block a user