Skip to content

Commit

Permalink
Added support for SetByDerived on static variables
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru committed Nov 21, 2023
1 parent 684a557 commit 3dc7fac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"RecentFiles":["C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/Migo.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/Evilvine.achx","C:/Users/vchel/Documents/GitHub/FlatRedBall/FRBDK/Glue/OfficialPlugins/Wizard/EmbeddedContent/Platformer/PlatformerAnimations.achx","C:/Users/vchel/Documents/FlatRedBallProjects/WallJumpTutorial/WallJumpTutorial/Content/Entities/Player/PlatformerAnimations.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Bullet/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/masteroid/Masteroid/Content/GlobalContent/Asteroids.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/StaticDestroyableObject/AnimationChainListFile.achx","C:/Users/vchel/Documents/FlatRedBallProjects/Beefball3/Beefball3/Content/Screens/GameScreen/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Ui/Emoticons/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Prop/PropAnimations.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Player/PlayerBodyAnimations1.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/HomeBase/HomeBaseAnimations.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Player/FlashlightAnimations.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/EyeballThing.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/BoomBabyShoggoth.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/PoisonCloudAnimation.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyDeathEffect/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/BlackHoleShotAnimation.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/ParasiteShotAnimation.achx","C:/Users/vchel/Documents/FlatRedBallProjects/LiveEditTest/LiveEditTest/Content/Entities/AnimatedEntity/AnimationChainListFile.achx"]}
{"RecentFiles":["C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/UiAnimationChains.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/Migo.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/Evilvine.achx","C:/Users/vchel/Documents/GitHub/FlatRedBall/FRBDK/Glue/OfficialPlugins/Wizard/EmbeddedContent/Platformer/PlatformerAnimations.achx","C:/Users/vchel/Documents/FlatRedBallProjects/WallJumpTutorial/WallJumpTutorial/Content/Entities/Player/PlatformerAnimations.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Bullet/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/masteroid/Masteroid/Content/GlobalContent/Asteroids.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/StaticDestroyableObject/AnimationChainListFile.achx","C:/Users/vchel/Documents/FlatRedBallProjects/Beefball3/Beefball3/Content/Screens/GameScreen/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Ui/Emoticons/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Prop/PropAnimations.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Player/PlayerBodyAnimations1.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/HomeBase/HomeBaseAnimations.achx","C:/Users/vchel/Documents/GitHub/KidDefense/GameProject/KidDefense/Content/Entities/Player/FlashlightAnimations.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/EyeballThing.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/Enemy/BoomBabyShoggoth.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/PoisonCloudAnimation.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyDeathEffect/AnimationChainListFile.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/BlackHoleShotAnimation.achx","C:/Users/vchel/Documents/GitHub/Kimuzukash-chibi-kuto-urufu/CrankyChibiCthulu/Content/Entities/EnemyBullet/ParasiteShotAnimation.achx"]}
19 changes: 14 additions & 5 deletions FRBDK/Glue/Glue/SetProperty/CustomVariableSaveSetPropertyLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,20 @@ private static void HandleSetByDerivedChanged(CustomVariable customVariable, obj
{
bool didErrorOccur = false;

if (customVariable.SetByDerived && customVariable.IsShared)
{
GlueCommands.Self.DialogCommands.ShowMessageBox("Variables that are IsShared cannot be SetByDerived");
didErrorOccur = true;
}
// November 20, 2023
// This was a limitation
// for a long time, but we
// want to have the ability
// to define variables in the
// base class, and have those overridden
// in the derived. For example, an Enemy's
// display name should be defined in base, but
// set on derived like "Skeleton" or "Goblin".
//if (customVariable.SetByDerived && customVariable.IsShared)
//{
//GlueCommands.Self.DialogCommands.ShowMessageBox("Variables that are IsShared cannot be SetByDerived");
//didErrorOccur = true;
//}

if (didErrorOccur)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public override void GenerateAdditionalClasses(ICodeBlock codeBlock, IElement el
block.Line($"GetFile = {QualifiedTypeName(derivedElement)}.GetFile,");
block.Line($"LoadStaticContent = {QualifiedTypeName(derivedElement)}.LoadStaticContent,");

foreach (var variable in element.CustomVariables.Where(item => item.SetByDerived && !item.IsShared))
foreach (var variable in element.CustomVariables.Where(item => item.SetByDerived
// Why don't we generate is shared? Now that we can inherit shared variables, let's do it so that the user can specify variables for the type, like a Display Name
//&& !item.IsShared
))
{
if (!ShouldSkip(variable))
{
Expand Down

0 comments on commit 3dc7fac

Please sign in to comment.