Skip to content

Commit

Permalink
[Files/UI] Many more controllers & components
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenkai committed May 29, 2024
1 parent bcf5bea commit 2216658
Show file tree
Hide file tree
Showing 165 changed files with 4,573 additions and 520 deletions.
7 changes: 6 additions & 1 deletion GBFRDataTools.Files/UI/BulkReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ public UIObject ReadObject(List<UIPropertyTypeDef> validProperties)
{
Dictionary<uint, UIPropertyTypeDef> validPropertiesDict = validProperties.ToDictionary(e => e.Hash);
if (!validPropertiesDict.TryGetValue(entriesHashes[i], out UIPropertyTypeDef propertyTypedef))
throw new KeyNotFoundException($"Not found hash 0x{entriesHashes[i]:X8}");
{
if (UIPropertyTypeDef.HashToPropName.TryGetValue(entriesHashes[i], out string name))
throw new KeyNotFoundException($"Not found hash 0x{entriesHashes[i]:X8} (hint: name is {name})");
else
throw new KeyNotFoundException($"Not found hash 0x{entriesHashes[i]:X8}");
}

string compName = null;
List<UIPropertyTypeDef> childProperties = propertyTypedef.ChildProperties;
Expand Down
21 changes: 21 additions & 0 deletions GBFRDataTools.Files/UI/Components/AnimationEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using GBFRDataTools.Files.UI;
using GBFRDataTools.Hashing;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GBFRDataTools.Files.UI.Components;

// ui::component::AnimationEvent
public class AnimationEvent // : Component
{
public static List<UIPropertyTypeDef> GetAllProperties()
{
var list = new List<UIPropertyTypeDef>();
list.AddRange(Component.Properties);
return list;
}
}
10 changes: 5 additions & 5 deletions GBFRDataTools.Files/UI/Components/AnimationHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public class AnimationHandle // : Component
{
public static readonly List<UIPropertyTypeDef> Properties =
[
new UIPropertyTypeDef("Offset", FieldType.S32),
new UIPropertyTypeDef("Handles", FieldType.ObjectArray,
new("Offset", FieldType.S32),
new("Handles", FieldType.ObjectArray,
[
// ui::component::AnimationHandleObj
new UIPropertyTypeDef("LayerName", FieldType.String),
new UIPropertyTypeDef("Clips", FieldType.StringVector),
new UIPropertyTypeDef("Skip", FieldType.Bool),
new("LayerName", FieldType.String),
new("Clips", FieldType.StringVector),
new("Skip", FieldType.Bool),
])
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using GBFRDataTools.Files.UI.IconSetters;
using GBFRDataTools.Files.UI;
using GBFRDataTools.Hashing;

using System;
Expand All @@ -9,18 +9,18 @@

namespace GBFRDataTools.Files.UI.Components;

// ui::component::NumSetter
public class NumSetter // NumSetter
// ui::component::ArrowOffsetTarget
public class ArrowOffsetTarget // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } = new()
{
new UIPropertyTypeDef("Images", FieldType.ObjectRefVector),
new("ArrowID", FieldType.String),
};

public static List<UIPropertyTypeDef> GetAllProperties()
{
var list = new List<UIPropertyTypeDef>();
list.AddRange(IconSetter.GetAllProperties());
list.AddRange(Component.Properties);
list.AddRange(Properties);
return list;
}
Expand Down
18 changes: 9 additions & 9 deletions GBFRDataTools.Files/UI/Components/ButtonGuide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ public class ButtonGuide // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } = new()
{
new UIPropertyTypeDef("ButtonGuideType", FieldType.String),
new UIPropertyTypeDef("Dark", FieldType.Bool),
new UIPropertyTypeDef("Buttons", FieldType.ObjectRefVector),
new UIPropertyTypeDef("Button2S", FieldType.ObjectRefVector),
new UIPropertyTypeDef("Texts", FieldType.ObjectRefVector),
new("ButtonGuideType", FieldType.String),
new("Dark", FieldType.Bool),
new("Buttons", FieldType.ObjectRefVector),
new("Button2S", FieldType.ObjectRefVector),
new("Texts", FieldType.ObjectRefVector),
// TODO: Shortcuts
new UIPropertyTypeDef("SlashRoot", FieldType.ObjectRef),
new UIPropertyTypeDef("SlashShadow", FieldType.ObjectRef),
new UIPropertyTypeDef("Button2Root", FieldType.ObjectRef),
new UIPropertyTypeDef("ItemButton", FieldType.ObjectRef),
new("SlashRoot", FieldType.ObjectRef),
new("SlashShadow", FieldType.ObjectRef),
new("Button2Root", FieldType.ObjectRef),
new("ItemButton", FieldType.ObjectRef),
};

public static List<UIPropertyTypeDef> GetAllProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace GBFRDataTools.Files.UI.Components;

// ui::component::ImageSetter
public class ImageSetter // : Component
// ui::component::ButtonLabel
public class ButtonLabel // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } = new()
{
new UIPropertyTypeDef("ImageDataPath", FieldType.String),
new UIPropertyTypeDef("Target", FieldType.ObjectRef),

new UIPropertyTypeDef(0x2DA95AA8, FieldType.CyanStringHash),
new("Cursor", FieldType.ObjectRef),
new("Button", FieldType.ObjectRef),
new("Text", FieldType.ObjectRef),
new("ImageButton", FieldType.ObjectRef),
};

public static List<UIPropertyTypeDef> GetAllProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

namespace GBFRDataTools.Files.UI.Components;

// ui::component::ValueInfo
public class ValueInfo // : Component
// ui::component::Canvas
public class Canvas // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } =
[
new UIPropertyTypeDef("Sets", FieldType.ObjectRefVector),
new UIPropertyTypeDef("Values", FieldType.ObjectRefVector),
new UIPropertyTypeDef("Arrow", FieldType.ObjectRef),
new UIPropertyTypeDef("Animator", FieldType.ObjectRef),
new("Priority", FieldType.F32),
];

public static List<UIPropertyTypeDef> GetAllProperties()
Expand Down
31 changes: 31 additions & 0 deletions GBFRDataTools.Files/UI/Components/ChangeSkillDispMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using GBFRDataTools.Files.UI;
using GBFRDataTools.Hashing;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GBFRDataTools.Files.UI.Components;

// ui::component::ChangeSkillDispMode
public class ChangeSkillDispMode // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } = new()
{
new("Animator", FieldType.ObjectRef),
new("SoundContainer", FieldType.ObjectRef),
new(0x99CA5014, FieldType.ObjectRef),
new(0xC98629F2, FieldType.ObjectRef),
new("ChangeSkillDispMode", FieldType.ObjectRef),
};

public static List<UIPropertyTypeDef> GetAllProperties()
{
var list = new List<UIPropertyTypeDef>();
list.AddRange(Component.Properties);
list.AddRange(Properties);
return list;
}
}
44 changes: 0 additions & 44 deletions GBFRDataTools.Files/UI/Components/GemEffectInfo.cs

This file was deleted.

58 changes: 0 additions & 58 deletions GBFRDataTools.Files/UI/Components/GemInfo.cs

This file was deleted.

33 changes: 17 additions & 16 deletions GBFRDataTools.Files/UI/Components/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@ public class Image // : Component
{
public static List<UIPropertyTypeDef> Properties { get; set; } = new()
{
new UIPropertyTypeDef("Color", FieldType.CVec4),
new UIPropertyTypeDef("Sprite", FieldType.Object, new()
{
new("Color", FieldType.CVec4),
new("Sprite", FieldType.Object,
[
// ui::SpriteRef
new UIPropertyTypeDef("TexturePath", FieldType.String),
new UIPropertyTypeDef("SpriteName", FieldType.CyanStringHash),
}),
new("TexturePath", FieldType.String),
new("SpriteName", FieldType.CyanStringHash),
]),

new UIPropertyTypeDef("MaterialPath", FieldType.String),
new UIPropertyTypeDef("Type", FieldType.S32),
new UIPropertyTypeDef("FillCenter", FieldType.Bool),
new UIPropertyTypeDef("FillMethod", FieldType.S32),
new UIPropertyTypeDef("FillOrigin", FieldType.S32),
new UIPropertyTypeDef("FillAmount", FieldType.S32),
new UIPropertyTypeDef("UvRect", FieldType.CVec4),
new UIPropertyTypeDef("RawImage", FieldType.Bool),
new UIPropertyTypeDef("Clockwise", FieldType.Bool),
new UIPropertyTypeDef("PreserveAspect", FieldType.Bool),
new("MaterialPath", FieldType.String),
new("Type", FieldType.S32),
new("FillCenter", FieldType.Bool),
new("FillMethod", FieldType.S32),
new("FillOrigin", FieldType.S32),
new("FillAmount", FieldType.S32),
new("UvRect", FieldType.CVec4),
new("RawImage", FieldType.Bool),
new("Clockwise", FieldType.Bool),
new("PreserveAspect", FieldType.Bool),
new(0xE3ED5266, FieldType.S8),
};

public static List<UIPropertyTypeDef> GetAllProperties()
Expand Down
34 changes: 0 additions & 34 deletions GBFRDataTools.Files/UI/Components/ItemLevel.cs

This file was deleted.

Loading

0 comments on commit 2216658

Please sign in to comment.