Skip to content

Added always show self and preventing cache change#2

Merged
Tischel merged 3 commits intoTischel:mainfrom
RyadaProductions:dev
Feb 3, 2024
Merged

Added always show self and preventing cache change#2
Tischel merged 3 commits intoTischel:mainfrom
RyadaProductions:dev

Conversation

@RyadaProductions
Copy link
Copy Markdown

This merge accomplishes 2 front facing things and a few more backend related things:

  • Added the option to always show your own bar even if you are outside of the view range (clamps to top or bottom bar).
  • Made it so that we do not overwrite the name in our cache which makes us unable to have a responsive design process.

Now some more information as to what was involved in adding these things:
We were using our source of truth (will be refered to as SoT) as a cache point which is fine in essence nothing was changed here but it creates the issue that if we mutate the returned cached list/objects our SoT will be corrupted.
This wasn't bad with the initial feature set aside from a single point, more on that in a bit but if we want to make changes into how we render said information without corrupting the SoT would be relatively impossible.
This is alleviated by creating a copy of the list when we grab the cached source of truth and using that for all our render specific changes.
The downside to this is that we don't create a deep copy so all the objects inside of the list will still be able to be corrupted but for this change I found that we can postpone fixing that until absolutely necessary to fix.

The other thing we had to change was the combatants data. We were overwriting the combatants SoT Name field inside of a Draw method (this is all kinds of bad but I digress). To alleviate this I moved the Name field's deserialization to a backing field named OriginalName and creating a new field NameOverwrite and a new property Name to replace our lost field, the property is an expression body that returns the overwrite to the name or the original name. The original name being our SoT and being forwarded to us from ACT.

Now that had a ripple effect of not working due to our Tag system only supporting fields, I have changed our Tag system to support both Fields and Properties, so that maybe in the future we can use expression type properties instead of LazyStrings. Lazystrings in the current implementation showcase a big problem, namely there is no cache invalidation. This was out of scope to add for this PR so I left that as it was to begin with.

@Tischel Tischel merged commit 3e58710 into Tischel:main Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants