Skip to content

Commit

Permalink
Fixing content type hierarchy comment (#33)
Browse files Browse the repository at this point in the history
* Expand doc comment for Armor content type.

Point out that armor will be nested under items as items.armor.

* Expand doc comment on ComplexItem for content type.

Same note about nesting as on the Armor content type.
  • Loading branch information
allister-beamable committed May 9, 2023
1 parent ee8f973 commit 5ba852c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Expand Up @@ -16,7 +16,9 @@ public class ComplexItemLink : ContentLink<ComplexItem> {}
/// Using validation is optional.
///
/// See "Beamable.Common.Content.Validation" for full list.
///
///
/// The content type for this class will be "items.complex_item", nested
/// under the "items" content type.
/// </summary>
[ContentType("complex_item")]
public class ComplexItem : ItemContent
Expand All @@ -26,15 +28,15 @@ public class ComplexItem : ItemContent
/// </summary>
[CannotBeBlank]
public string Name = "";

/// <summary>
/// Custom: Validation requires that the value be string and of
/// string length of 2 or 3.
/// See <see cref="MustBeStringLength"/>.
/// </summary>
[MustBeStringLength (2, 3)]
public string FavoriteLetters = "";

/// <summary>
/// Built-in: Validation requires that the value be positive and
/// non-zero.
Expand All @@ -47,4 +49,4 @@ public class ComplexItem : ItemContent
/// </summary>
public OptionalInt Health;
}
}
}
12 changes: 8 additions & 4 deletions client/Assets/Examples/Runtime/Shared/Scripts/Armor.cs
Expand Up @@ -6,18 +6,22 @@ namespace Beamable.Examples.Shared
{
[Serializable]
public class ArmorLink : ContentLink<Armor> {}

[Serializable]
public class ArmorRef : ContentRef<Armor> {}

/// <summary>
/// This type defines a custom ItemContent for use in
/// several example scenes
/// several example scenes.
///
/// Note that content types are hierarchical. Because this is a subclass of
/// ItemContent, it also inherits "items" as a parent content type. The
/// resulting content type will be "items.armor", nested under "items".
/// </summary>
[ContentType("armor")]
public class Armor : ItemContent
{
public string Name = "";
public int Defense = 0;
}
}
}

0 comments on commit 5ba852c

Please sign in to comment.