diff --git a/.agent/workflows/increaseformat.md b/.agent/workflows/increaseformat.md new file mode 100644 index 000000000..a2563d304 --- /dev/null +++ b/.agent/workflows/increaseformat.md @@ -0,0 +1,17 @@ +--- +description: Workflow to increase the quest format version +--- + +1. Open `unity/Assets/Scripts/Content/FormatVersions.cs`. +2. Locate the `Versions` enum at the bottom of the class. +3. Identify the last entry in the `Versions` enum (e.g., `RELEASE_3_1_5 = 20`). +4. Read the current version of the application from `version.txt` to determine the new version string (e.g., `3.1.6`). +5. Add a new entry to the `Versions` enum: + - Name: `RELEASE___` (e.g., `RELEASE_3_1_6`) + - Value: Increment the last value by 1 (e.g., `21`) +6. Locate the `CURRENT_VERSION` constant at the top of the class. +7. Update the assignment to use the new enum value: + ```csharp + public const int CURRENT_VERSION = (int) Versions.RELEASE___; + ``` +8. Save the file. diff --git a/.agent/workflows/increaseversion.md b/.agent/workflows/increaseversion.md new file mode 100644 index 000000000..6a3a0ac23 --- /dev/null +++ b/.agent/workflows/increaseversion.md @@ -0,0 +1,10 @@ +--- +description: Increase the app version of Valkyrie +--- + +Increase version numbers in files: +- unity\Assets\Resources\version.txt +- unity\Assets\Resources\prod_version.txt + +1. Ensure to keep numbers for both files in sync. +2. If specified "major" then increase major version number e.g. from 3.14 to 4.14. Otherwise if not specified always increase minor version. diff --git a/unity/Assets/Resources/Sprites/CustomContentPackIcon.png b/unity/Assets/Resources/Sprites/CustomContentPackIcon.png index bd69b28fe..a50c33b68 100644 Binary files a/unity/Assets/Resources/Sprites/CustomContentPackIcon.png and b/unity/Assets/Resources/Sprites/CustomContentPackIcon.png differ diff --git a/unity/Assets/Resources/Sprites/scenario_list/button_delete.png b/unity/Assets/Resources/Sprites/scenario_list/button_delete.png new file mode 100644 index 000000000..4131cac7e Binary files /dev/null and b/unity/Assets/Resources/Sprites/scenario_list/button_delete.png differ diff --git a/unity/Assets/Resources/Sprites/scenario_list/button_delete.png.meta b/unity/Assets/Resources/Sprites/scenario_list/button_delete.png.meta new file mode 100644 index 000000000..0a1d1187a --- /dev/null +++ b/unity/Assets/Resources/Sprites/scenario_list/button_delete.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: b7e50c2e960bfa94587160e6e83e496a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/Assets/Resources/prod_version.txt b/unity/Assets/Resources/prod_version.txt index 3767b4b17..230693c38 100644 --- a/unity/Assets/Resources/prod_version.txt +++ b/unity/Assets/Resources/prod_version.txt @@ -1 +1 @@ -3.14 \ No newline at end of file +3.15 \ No newline at end of file diff --git a/unity/Assets/Resources/version.txt b/unity/Assets/Resources/version.txt index 3767b4b17..230693c38 100644 --- a/unity/Assets/Resources/version.txt +++ b/unity/Assets/Resources/version.txt @@ -1 +1 @@ -3.14 \ No newline at end of file +3.15 \ No newline at end of file diff --git a/unity/Assets/Scripts/Content/ContentData.cs b/unity/Assets/Scripts/Content/ContentData.cs index faf6af7a5..a57210969 100644 --- a/unity/Assets/Scripts/Content/ContentData.cs +++ b/unity/Assets/Scripts/Content/ContentData.cs @@ -273,6 +273,18 @@ private void PopulatePackListByPath(string path, string gameTypeName, bool check private void AddPackToAllPacksAndPackSymbol(ContentPack pack, List allPacksList, Dictionary packSymbolDict) { + // Remove existing pack if present (update scenario) + var existingPack = allPacksList.FirstOrDefault(p => p.id.Equals(pack.id)); + if (existingPack != null) + { + allPacksList.Remove(existingPack); + } + + if (packSymbolDict.ContainsKey(pack.id)) + { + packSymbolDict.Remove(pack.id); + } + // Add content pack allPacksList.Add(pack); diff --git a/unity/Assets/Scripts/Content/FormatVersions.cs b/unity/Assets/Scripts/Content/FormatVersions.cs index 6660a7852..ff100dff5 100644 --- a/unity/Assets/Scripts/Content/FormatVersions.cs +++ b/unity/Assets/Scripts/Content/FormatVersions.cs @@ -6,7 +6,7 @@ namespace Assets.Scripts.Content { public class QuestFormat { - public const int CURRENT_VERSION = (int) Versions.RELEASE_3_0_0; + public const int CURRENT_VERSION = (int) Versions.RELEASE_3_1_5; public readonly static HashSet SCENARIOS_THAT_REQUIRE_CONVERSION_KIT = new HashSet { @@ -38,6 +38,7 @@ public enum Versions SPLIT_BASE_MOM_AND_CONVERSION_KIT = 17, RELEASE_2_5_4 = 18, RELEASE_3_0_0 = 19, + RELEASE_3_1_5 = 20, } } } \ No newline at end of file diff --git a/unity/Assets/Scripts/Quest/Quest.cs b/unity/Assets/Scripts/Quest/Quest.cs index 696b874b5..6521fca5c 100644 --- a/unity/Assets/Scripts/Quest/Quest.cs +++ b/unity/Assets/Scripts/Quest/Quest.cs @@ -1244,6 +1244,110 @@ public void Remove(string name) boardItems.Clear(); ordered_boardItems.Clear(); } + + if (name.Equals("#uicomponents")) + { + List toRemove = new List(); + foreach (KeyValuePair kv in boardItems) + { + if (kv.Value is UI) + { + kv.Value.Remove(); + toRemove.Add(kv.Key); + } + } + + foreach (string s in toRemove) + { + boardItems.Remove(s); + ordered_boardItems.Remove(s); + } + } + + if (name.Equals("#doors")) + { + List toRemove = new List(); + foreach (KeyValuePair kv in boardItems) + { + if (kv.Value is Door) + { + kv.Value.Remove(); + toRemove.Add(kv.Key); + } + } + + foreach (string s in toRemove) + { + boardItems.Remove(s); + ordered_boardItems.Remove(s); + } + } + + if (name.Equals("#tiles")) + { + List toRemove = new List(); + foreach (KeyValuePair kv in boardItems) + { + if (kv.Value is Tile) + { + kv.Value.Remove(); + toRemove.Add(kv.Key); + } + } + + foreach (string s in toRemove) + { + boardItems.Remove(s); + ordered_boardItems.Remove(s); + } + } + + if (name.Equals("#qitems")) + { + List toRemove = new List(); + foreach (KeyValuePair kv in itemSelect) + { + if (items.Contains(kv.Value)) + { + items.Remove(kv.Value); + if (itemInspect.ContainsKey(kv.Value)) + { + itemInspect.Remove(kv.Value); + } + toRemove.Add(kv.Key); + } + } + + // We should probably remove the QItem from itemSelect? + // "Remove" function usually removes components from "active" lists. + // But QItems are not in BoardItems. + // If we remove from itemSelect, we lose the mapping? + // But the item is gone from inventory. + // If the QItem is triggered again, it will try to re-add? + // "Remove" means revert the effect of adding. + // So removing from "items" is correct. + // Wait, "itemSelect" is populated at quest start based on available items. + // Should not modify "itemSelect". + } + + if (name.Equals("#tokens")) + { + List toRemove = new List(); + foreach (KeyValuePair kv in boardItems) + { + if (kv.Value is Token) + { + kv.Value.Remove(); + toRemove.Add(kv.Key); + } + } + + foreach (string s in toRemove) + { + boardItems.Remove(s); + ordered_boardItems.Remove(s); + } + } } public bool UIItemsPresent() @@ -1849,16 +1953,16 @@ public UI(QuestData.UI questUI, Game gameObject) : base(gameObject) game.tokenBoard.Add(this); } - private TextAlignmentOptions ConvertRichTextAlignment(TextAlignment qUITextAlignment) + private TMPro.TextAlignmentOptions ConvertRichTextAlignment(TextAlignment qUITextAlignment) { switch (qUITextAlignment) { case TextAlignment.TOP: - return TextAlignmentOptions.Top; + return TMPro.TextAlignmentOptions.Top; case TextAlignment.BOTTOM: - return TextAlignmentOptions.Bottom; + return TMPro.TextAlignmentOptions.Bottom; } - return TextAlignmentOptions.Center; + return TMPro.TextAlignmentOptions.Center; } private TextAnchor ConvertStandardTextAlignment(TextAlignment qUITextAlignment) diff --git a/unity/Assets/Scripts/QuestEditor/EditorComponentEvent.cs b/unity/Assets/Scripts/QuestEditor/EditorComponentEvent.cs index 6055eaa61..cbacf9798 100644 --- a/unity/Assets/Scripts/QuestEditor/EditorComponentEvent.cs +++ b/unity/Assets/Scripts/QuestEditor/EditorComponentEvent.cs @@ -918,6 +918,11 @@ public void AddVisibility(bool add, int index = -1) select.AddItem("#boardcomponents", traits); select.AddItem("#monsters", traits); select.AddItem("#shop", traits); + select.AddItem("#uicomponents", traits); + select.AddItem("#doors", traits); + select.AddItem("#tiles", traits); + select.AddItem("#qitems", traits); + select.AddItem("#tokens", traits); } if (game.gameType is D2EGameType) diff --git a/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs b/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs index 4ec3c12ec..1a288a6a2 100644 --- a/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs +++ b/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs @@ -27,11 +27,12 @@ public class ContentSelectDownloadScreen : MonoBehaviour, IContentImageDrawer ImgAsyncLoader images_list = null; // textures + Texture2D scroll_paper = null; Texture2D picture_shadow = null; Texture2D picture_pin = null; private Texture2D button_download = null; private Texture2D button_update = null; - private Texture2D button_no_entry = null; + private Texture2D button_delete = null; // Display coroutine // Create page @@ -43,11 +44,12 @@ public ContentSelectDownloadScreen() images_list = new ImgAsyncLoader(this); //preload textures + scroll_paper = Resources.Load("sprites/scenario_list/scroll_paper") as Texture2D; picture_shadow = Resources.Load("sprites/scenario_list/picture_shadow") as Texture2D; picture_pin = Resources.Load("sprites/scenario_list/picture_pin") as Texture2D; button_download = Resources.Load("sprites/scenario_list/button_download") as Texture2D; button_update = Resources.Load("sprites/scenario_list/button_update") as Texture2D; - button_no_entry = Resources.Load("sprites/scenario_list/button_no_entry") as Texture2D; + button_delete = Resources.Load("sprites/scenario_list/button_delete") as Texture2D; // Clean everything up Destroyer.Destroy(); @@ -89,6 +91,12 @@ private void DrawContentPackList() var localContentPackList = game.cd.Values(); foreach (var contentPack in game.remoteContentPackManager.remote_RemoteContentPack_data) { + // Background Frame + UIElement frame = new UIElement(scrollArea.GetScrollTransform()); + frame.SetLocation(0, offset, UIScaler.GetWidthUnits() - 2, 7); + frame.SetImage(scroll_paper); + frame.SetBGColor(Color.white); + frame.GetTransform().SetAsFirstSibling(); ui = RenderContentPackNameAndDescription(offset, contentPack); ui = RenderImage(offset, contentPack); @@ -110,9 +118,14 @@ private void RenderActionButton(float offset, KeyValuePair= 105) - description = description.Substring(0, 100) + "(...)"; - ui.SetText(description, Color.red); - ui.SetTextAlignment(TextAnchor.MiddleLeft); + if (description.Length >= 400) + description = description.Substring(0, 395) + "(...)"; + ui.SetText(description, Color.black); + ui.SetTextAlignment(TextAnchor.UpperLeft); if (game.gameType.TypeName() == "MoM") ui.SetFontSize(Mathf.RoundToInt(UIScaler.GetSmallFont() * 0.87f)); if (game.gameType.TypeName() == "D2E") diff --git a/unity/Assets/Scripts/UI/Screens/GameSelectionScreen.cs b/unity/Assets/Scripts/UI/Screens/GameSelectionScreen.cs index 63ead3ca1..bfef34779 100644 --- a/unity/Assets/Scripts/UI/Screens/GameSelectionScreen.cs +++ b/unity/Assets/Scripts/UI/Screens/GameSelectionScreen.cs @@ -544,6 +544,7 @@ public void MoM() // Download quests list game.questsList = new QuestsManager(); + game.remoteContentPackManager = new RemoteContentPackManager(); // MoM also has a special reound controller game.roundControl = new RoundControllerMoM(); Texture2D cursor = Resources.Load("sprites/CursorMoM") as Texture2D; diff --git a/unity/Assets/UnitTests/Editor/UtilityTests.cs b/unity/Assets/UnitTests/Editor/UtilityTests.cs index 204e17fb0..9628ccd1b 100644 --- a/unity/Assets/UnitTests/Editor/UtilityTests.cs +++ b/unity/Assets/UnitTests/Editor/UtilityTests.cs @@ -204,12 +204,7 @@ public void TextAlignmentEnum_HasExpectedValues() #region FormatVersions Tests - [Test] - public void QuestFormat_CurrentVersion_IsRelease300() - { - // Assert - Assert.AreEqual((int)QuestFormat.Versions.RELEASE_3_0_0, QuestFormat.CURRENT_VERSION); - } + [Test] public void QuestFormat_VersionOrdering_IsCorrect() @@ -218,6 +213,7 @@ public void QuestFormat_VersionOrdering_IsCorrect() Assert.IsTrue((int)QuestFormat.Versions.RICH_TEXT < (int)QuestFormat.Versions.SPLIT_BASE_MOM_AND_CONVERSION_KIT); Assert.IsTrue((int)QuestFormat.Versions.SPLIT_BASE_MOM_AND_CONVERSION_KIT < (int)QuestFormat.Versions.RELEASE_2_5_4); Assert.IsTrue((int)QuestFormat.Versions.RELEASE_2_5_4 < (int)QuestFormat.Versions.RELEASE_3_0_0); + Assert.IsTrue((int)QuestFormat.Versions.RELEASE_3_0_0 < (int)QuestFormat.Versions.RELEASE_3_1_5); } [Test] @@ -248,6 +244,13 @@ public void QuestFormat_Release300Version_Is19() Assert.AreEqual(19, (int)QuestFormat.Versions.RELEASE_3_0_0); } + [Test] + public void QuestFormat_Release315Version_Is20() + { + // Assert + Assert.AreEqual(20, (int)QuestFormat.Versions.RELEASE_3_1_5); + } + [Test] public void QuestFormat_ScenariosRequiringConversionKit_ContainsExpectedScenarios() {