Changes

Jump to navigation Jump to search
→‎Content: + Name(s)WithoutLocale
Line 83: Line 83:  
  |arg name 1 = <samp>e.Name</samp>
 
  |arg name 1 = <samp>e.Name</samp>
 
  |arg type 1 = <samp>IAssetName</samp>
 
  |arg type 1 = <samp>IAssetName</samp>
  |arg desc 1 = The name of the asset being requested. This includes utility methods to parse the value, like <code>e.Name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
+
  |arg desc 1 = The name of the asset being requested, including the locale code if any (like the <samp>.fr-FR</samp> in <samp>Data/Bundles.fr-FR</samp>). This includes utility methods to parse the value, like <code>e.Name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
   −
  |arg name 2 = <samp>e.LoadFrom(...)</samp>
+
  |arg name 2 = <samp>e.NameWithoutLocale</samp>
  |arg type 2 = ''method''
+
|arg type 2 = <samp>IAssetName</samp>
  |arg desc 2 = Call this method to provide the initial instance for the asset, instead of trying to load it from the game's <samp>Content</samp> folder. For example:
+
|arg desc 2 = Equivalent to <samp>e.Name</samp> but without the locale code (if any). For example, if <samp>e.Name</samp> is <samp>Data/Bundles.fr-FR</samp>, this field will contain <samp>Data/Bundles</samp>.
 +
 
 +
|arg name 3 = <samp>e.LoadFrom(...)</samp>
 +
  |arg type 3 = ''method''
 +
  |arg desc 3 = Call this method to provide the initial instance for the asset, instead of trying to load it from the game's <samp>Content</samp> folder. For example:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
e.LoadFrom(() => this.Helper.Content.Load<Texture2D>("assets/portraits.png"));
 
e.LoadFrom(() => this.Helper.Content.Load<Texture2D>("assets/portraits.png"));
Line 96: Line 100:  
* Each asset can logically only have one initial instance. If multiple loads apply at the same time, SMAPI will raise an error and ignore all of them. If you're making changes to the existing asset instead of replacing it, you should use the <samp>Edit</samp> method instead to avoid those limitations and improve mod compatibility.
 
* Each asset can logically only have one initial instance. If multiple loads apply at the same time, SMAPI will raise an error and ignore all of them. If you're making changes to the existing asset instead of replacing it, you should use the <samp>Edit</samp> method instead to avoid those limitations and improve mod compatibility.
   −
  |arg name 3 = <samp>e.LoadFromModFile<T>(...)</samp>
+
  |arg name 4 = <samp>e.LoadFromModFile<T>(...)</samp>
  |arg type 3 = ''method''
+
  |arg type 4 = ''method''
  |arg desc 3 = Call this method to provide the initial instance for the asset by loading a file from your mod folder. For example:
+
  |arg desc 4 = Call this method to provide the initial instance for the asset by loading a file from your mod folder. For example:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
e.LoadFromModFile<Texture2D>("assets/portraits.png");
 
e.LoadFromModFile<Texture2D>("assets/portraits.png");
Line 105: Line 109:  
See usage notes on <samp>e.LoadFrom</samp>.
 
See usage notes on <samp>e.LoadFrom</samp>.
   −
  |arg name 4 = <samp>e.Edit(...)</samp>
+
  |arg name 5 = <samp>e.Edit(...)</samp>
  |arg type 4 = ''method''
+
  |arg type 5 = ''method''
  |arg desc 4 = Call this method to apply edits to the asset after it's loaded. For example:
+
  |arg desc 5 = Call this method to apply edits to the asset after it's loaded. For example:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
e.Edit(asset =>
 
e.Edit(asset =>
Line 129: Line 133:  
  |arg name 1 = <samp>e.Names</samp>
 
  |arg name 1 = <samp>e.Names</samp>
 
  |arg type 1 = <samp>IReadOnlySet<IAssetName></samp>
 
  |arg type 1 = <samp>IReadOnlySet<IAssetName></samp>
  |arg desc 1 = The asset names that were invalidated. These include utility methods to parse the values, like <code>name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
+
  |arg desc 1 = The asset names that were invalidated, including the locale code if any (like the <samp>.fr-FR</samp> in <samp>Data/Bundles.fr-FR</samp>). These include utility methods to parse the values, like <code>name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
 +
 
 +
|arg name 2 = <samp>e.NamesWithoutLocale</samp>
 +
|arg type 2 = <samp>IReadOnlySet<IAssetName></samp>
 +
|arg desc 2 = Equivalent to <samp>e.Names</samp> but without the locale code (if any). For example, if <samp>e.Names</samp> contains <samp>Data/Bundles.fr-FR</samp>, this field will contain <samp>Data/Bundles</samp>.
 
}}
 
}}
 
{{/event
 
{{/event
Line 140: Line 148:  
  |arg name 1 = <samp>e.Name</samp>
 
  |arg name 1 = <samp>e.Name</samp>
 
  |arg type 1 = <samp>IAssetName</samp>
 
  |arg type 1 = <samp>IAssetName</samp>
  |arg desc 1 = The name of the asset that was loaded. This includes utility methods to parse the value, like <code>e.Name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
+
  |arg desc 1 = The name of the asset that was loaded, including the locale code if any (like the <samp>.fr-FR</samp> in <samp>Data/Bundles.fr-FR</samp>). This includes utility methods to parse the value, like <code>e.Name.IsEquivalentTo("Portraits/Abigail")</code> (which handles any differences in formatting for you).
 +
 
 +
|arg name 2 = <samp>e.NameWithoutLocale</samp>
 +
|arg type 2 = <samp>IAssetName</samp>
 +
|arg desc 2 = Equivalent to <samp>e.Name</samp> but without the locale code (if any). For example, if <samp>e.Name</samp> is <samp>Data/Bundles.fr-FR</samp>, this field will contain <samp>Data/Bundles</samp>.
 
}}
 
}}
 
{{!}}}
 
{{!}}}
translators
8,437

edits

Navigation menu