Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.0.1 Release #31

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Assets/Examples/Resources/ItemDatabase.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
_autoLoad: 1
_definitions:
- {fileID: 11400000, guid: 80d3b6ab2a78e6b418da8aed88e32926, type: 2}
- {fileID: 11400000, guid: d3988ba3f8a2c44e6a1b98201ce75ee2, type: 2}
- {fileID: 11400000, guid: 4e2438a1b36c043e587e88575d07b5ff, type: 2}
- {fileID: 11400000, guid: 5e7593ddbeb614a3984bd7fcc9251406, type: 2}
Expand Down
15 changes: 15 additions & 0 deletions Assets/Examples/Shop/Definitions/CustomItem.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e149b91f3de145dc9820a3c795b7b05a, type: 3}
m_Name: CustomItem
m_EditorClassIdentifier:
_id: fe563339-c771-4245-9db6-3b38dccf7426
8 changes: 8 additions & 0 deletions Assets/Examples/Shop/Definitions/CustomItem.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using CleverCrow.Fluid.ElasticInventory;

namespace CleverCrow.Fluid.Examples {
/// <summary>
/// Simulates creating a custom display name and category for an item definition
/// </summary>
[ItemDefinitionDetails("Custom Display Details")]
public class ItemDefinitionCustomDisplayName : ItemDefinitionBase {
public override string DisplayName => "Custom Display Name";
public override string Category => "Custom Category";
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ void CreateItemDefinition (ItemDatabase database, Type type) {

var serializedObject = new SerializedObject(itemDefinition);
var fileName = System.IO.Path.GetFileNameWithoutExtension(path);
serializedObject.FindProperty("_displayName").stringValue = MakeSpacedWord(fileName);

// Set the display name to be the spaced version of the file name (if it exists)
var displayName = serializedObject.FindProperty("_displayName");
if (displayName != null) {
displayName.stringValue = MakeSpacedWord(fileName);
}

// @TODO Duplicate IDs are inevitable due to object cloning, repair them automatically when refreshing asset references
serializedObject.FindProperty("_id").stringValue = Guid.NewGuid().ToString();
serializedObject.ApplyModifiedPropertiesWithoutUndo();
Expand Down
Loading