-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review #2764
base: dev
Are you sure you want to change the base?
Review #2764
Conversation
Interesting, we aren't supporting multiple inheritance levels, we must fix it. |
@@ -59,6 +64,10 @@ public Singleton(T value) | |||
/// <typeparam name="TObject">The type of the object.</typeparam> | |||
/// <param name="instance">The object instance.</param> | |||
/// <returns><see langword="true"/> if the object instance is not null and can be casted as the specified type; otherwise, <see langword="false"/>.</returns> | |||
// @nao It will return the Instance. | |||
// But with this curent class definition you can register derived class of T. | |||
// They can be registred but not retrived. Also why make this method generic if this not to get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was high writing most of this code
@@ -40,6 +40,10 @@ public UniqueUnmanagedEnumClass() | |||
values ??= new(); | |||
TypeCode code = Convert.GetTypeCode(typeof(TSource).GetField("MinValue").GetValue(null)); | |||
|
|||
// @Nao If the value is not an Uxxxxx it will get an overflow. Like if it use an Int16, Byte or SByte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right
@@ -53,6 +57,9 @@ public UniqueUnmanagedEnumClass() | |||
while (values.ContainsKey(value)); | |||
|
|||
Value = value; | |||
|
|||
// @nao If the value is register when a new instance is created. | |||
// Maybe put the ctor in protected to avoid exteranal code (outisde the enum) to create new values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal protected
can be cool if Exiled need to create dedicated new instance in an helper class
{ | ||
ev.MaxWaveSize = customTeam.Size; | ||
return; | ||
} | ||
|
||
// @Nao, it cool to use the event system for this. But if an other plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna ignore the Grade 12 spelling.
I do not get the point of TypeCastObject do the C# default I know that implementing cast operators don't allow Is it to do runtime editable castable object ? If yes, where do you need this ? I do not see an usage of ITypeCast in any method. And the class using TypeCastMono and TypeCastObject only use the |
The code has been simplified to no longer use a dictionary to manage multiple instances of `Singleton<T>`. Now a single instance of `T` is used via a static `Instance` property. The `Create` method has been changed to set the instance if it is not already set, and a new `Destroy` method has been added to reset the instance to `null`. The `TryGet` and `Destroy` methods have been simplified to work with the new single instance implementation. The calls to `Singleton<VirtualPlugin>.Create(this)` and `Singleton<VirtualPlugin>.Destroy(this)` in `VirtualPlugin.cs` have been commented out, with annotations suggesting that use of the class itself as a singleton might require a different approach to avoid overwriting other instances.
@NaoUnderscore I rewrite the Singleton, are you ok ? |
That's a way to make everything more versatile, so we can safely define our own |
Go ahead, I've made some changes to |
The code has been simplified to no longer use a dictionary to manage multiple instances of `Singleton<T>`. Now a single instance of `T` is used via a static `Instance` property. The `Create` method has been changed to set the instance if it is not already set, and a new `Destroy` method has been added to reset the instance to `null`. The `TryGet` and `Destroy` methods have been simplified to work with the new single instance implementation. The calls to `Singleton<VirtualPlugin>.Create(this)` and `Singleton<VirtualPlugin>.Destroy(this)` in `VirtualPlugin.cs` have been commented out, with annotations suggesting that use of the class itself as a singleton might require a different approach to avoid overwriting other instances.
…mClass, UniqueUnmagedEnumClass and EnumClass if a IComparable class i needed the Comparer<ExiledEnumClass>.Default provide one.
I no longer have time to work on this project. |
I don't want to impose my decisions. But, I want this to be change or at least be heard.
Some stuffs seem to me to have been rushed. So i added comamnt and do litle edition.
I don't know how you prefer to resolve the problem. So i pointed them with comment for the most.
Why not discord:
Discussions here will be easier than discord to keep up with change.
I also try to use the new Enum. But realy i do not get who it work.
When I fold the code, it seems to me that there is an error in the management of super classes.
And when i try, This isn't working, I don't know if it's me or the code. So I place my experiences here:
Interactive Test