-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[PS] Display fade overlay for locked skins #63
base: develop
Are you sure you want to change the base?
Conversation
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Data/PSWorldSubsystem.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
Source/ProgressionSystemRuntime/Private/Components/PSSpotComponent.cpp
Outdated
Show resolved
Hide resolved
* refactoring * renamed the properties for shorter names * drastically improved comments * fixed code style issues * code style updates * made const elements * simplified if statement * added pointer handle * added additional state for the FadeOut to return early, renamed one more time variable for better naming * simplified same verification * improved naming to be clear * fixed ticket with state none * fixed issue with skins get unlocked accidentally * added ability to have instant switch for skin change but keep animation for plat change
// find last unlocked skin | ||
for (int32 Count = CurrentSkinIndex; Count >= 0; Count--) | ||
{ | ||
bool bIsLastUnlockedFound = Count > 0 ? MeshComp.IsSkinAvailable(Count) : bIsCurrentSkinAvailable = 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.
- The main problem here: assigning
= true
at the end of ternary is mistake, you probably wanted the equality==
operator instead, but mistakenly used assigning=
- Please dont forget about
const
Expected Result
Where I additionally further simplified the line by replacing ternary with simple condition, that is the same:
const bool bIsLastUnlockedFound = Count > 0 && MeshComp.IsSkinAvailable(Count) || bIsCurrentSkinAvailable;
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.
here I need to assign bIsCurrentSkinAvailable to true and then assign bIsLastUnlcokedUnlockedFound.
I can simplify reading this to something like:
bool bIsLastUnlockedFound = Count > 0 ? MeshComp.IsSkinAvailable(Count) : bIsCurrentSkinAvailable = true; | |
bool bIsLastUnlockedFound = false; | |
if (Count > 0) | |
{ | |
bIsLastUnlockedFound = MeshComp.IsSkinAvailable(Count); | |
} | |
else | |
{ | |
bIsCurrentSkinAvailable = true; | |
bIsLastUnlockedFound = bIsCurrentSkinAvailable; | |
} |
Let me know if I need to incorporate those changes.
by far const added as part of c1a8d9d
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.
@moinm3uw, current logic still looks overcomplicated. Please simplify it by removing the unused bIsCurrentSkinAvailable
variable entirely, avoid assignments inside ternary, and replace the ternary with a clean inline condition using logical operators. This will improve clarity and prevent side effects that may confuse future readers.
Next simplified logic should do all the same as original:
// Skip if current skin is already available
if (MeshComp.IsSkinAvailable(CurrentSkinIndex))
{
return;
}
// Find last available skin from current index downward
for (int32 Count = CurrentSkinIndex; Count >= 0; Count--)
{
if (Count == 0 || MeshComp.IsSkinAvailable(Count))
{
MeshComp.ApplySkinByIndex(Count);
constexpr bool bApplySkin = true;
RefreshAmountOfUnlockedSkins(bApplySkin);
break;
}
}
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.
done 07bfc89
https://trello.com/c/G8zgZpPx/926-ps-display-fade-overlay-for-locked-skins?filter=member:valeriirotermel
418413730-7b54060d-f92e-4c49-947f-7c7444ded8ce.mp4