This commit is contained in:
CortexCore
2025-04-28 15:11:01 +08:00
parent 2d8978e694
commit f8bcf8a4d4
19 changed files with 526 additions and 15 deletions

View File

@@ -161,7 +161,17 @@ namespace BITKit.Entities
if (instances.TryGetValue(h0, out var v0) is false)
{
instances[h0] = v0 = _entitiesInternal[id].ServiceProvider.GetRequiredService<T>();
try
{
instances[h0] = v0 = _entitiesInternal[id].ServiceProvider.GetRequiredService<T>();
}
catch (KeyNotFoundException)
{
_logger.LogWarning($"Missing Entity {id},Ignore for now");
hashset.Remove(id);
break;
}
}
array[i] = Unsafe.As<T>(v0);

View File

@@ -39,7 +39,7 @@ namespace BITKit.Entities
public void Dispose()
{
_serviceProvider.Dispose();
_serviceProvider?.Dispose();
}
}
}

View File

@@ -152,20 +152,11 @@ namespace BITKit
list.Remove(t);
return list.ToArray();
}
public static bool TryRemove<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey t)
{
return self.ContainsKey(t) && self.Remove(t);
}
public static bool TryRemove<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey t) => self.Remove(t);
public static void Set<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey key, TValue value)
{
if (self.ContainsKey(key))
{
self[key] = value;
}
else
{
self.Add(key, value);
}
self[key] = value;
}
public static TValue Get<TKey,TValue>(this IDictionary<Type,TValue> self)
{

View File

@@ -0,0 +1,16 @@
namespace Net.BITKit.UX.SnackBar
{
public enum Severity
{
Normal,
Info,
Success,
Warning,
Error
}
public interface ISnackBar
{
void Add(string message, Severity severity = Severity.Normal);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c47bfae1d8985004181217f413fa6c64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: