Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
inventory [2019/04/10 08:49] – [Multilingual] admininventory [2020/06/02 13:21] – [Inventory-Designer] admin
Line 106: Line 106:
 As mentioned also this resulting items need to be registered as templates in the inventory. As mentioned also this resulting items need to be registered as templates in the inventory.
  
-==== Crafting ====+=== Crafting ===
 <file pascal> <file pascal>
   LFire : TGorillaInventoryItemTemplate;   LFire : TGorillaInventoryItemTemplate;
Line 134: Line 134:
 </file> </file>
  
-==== Up-/Downgrading ====+=== Combining === 
 +Combining items works the same way like crafting. The only difference is the used time. While crafting expects a predefined time span, combining should work immediatly. 
 + 
 +So simply set TimeNeeded property on manufacturer construction to less-equal zero. 
 +<file pascal> 
 +LMan.TimeNeeded := 0; 
 +</file> 
 + 
 +The Manufacture() method will then not start an async thread for construction, instead it will directly build the new item. 
 + 
 +=== Up-/Downgrading ===
  
 To allow up-/downgrading simple link each template to the other. To allow up-/downgrading simple link each template to the other.
Line 143: Line 153:
   LChimney.Group := LMainGrp;   LChimney.Group := LMainGrp;
   LChimney.ImageIndex := 6;   LChimney.ImageIndex := 6;
 +  LChimney.Name.Add(LLangEN_US, 'chimney');
 +  LChimney.Name.Add(LLangDE_DE, 'Kamin');  
      
   // link with fire template for possible downgrade   // link with fire template for possible downgrade
   LChimney.DowngradeItem := LFire;   LChimney.DowngradeItem := LFire;
-   
-  LChimney.Name.Add(LLangEN_US, 'chimney'); 
-  LChimney.Name.Add(LLangDE_DE, 'Kamin'); 
  
   // link with chimney template for possible upgrade   // link with chimney template for possible upgrade
Line 154: Line 163:
 </file> </file>
  
 +To downgrade we call the Downgrade() method with the specific collected item:
 +<file pascal>
 +procedure TForm1.MenuItem8Click(Sender: TObject);
 +var LColl : TGorillaInventoryCollectable;
 +begin
 +  // downgrade the item
 +  LColl := PopUpMenu1.TagObject as TGorillaInventoryCollectable;
 +  if not Assigned(LColl) then
 +    Exit;
  
 +  // check if the item is downgradable
 +  if LColl.IsDowngradable() then
 +    FInventory.Downgrade(LColl)
 +  else
 +    ShowMessage('Collected item not downgradable!');
 +end;
 +</file>
 +
 +Equivalent to downgrading we call Upgrade() with the specific collected item to level up our item:
 +<file pascal>
 +procedure TForm1.MenuItem7Click(Sender: TObject);
 +var LColl : TGorillaInventoryCollectable;
 +begin
 +  // upgrade the item
 +  LColl := PopUpMenu1.TagObject as TGorillaInventoryCollectable;
 +  if not Assigned(LColl) then
 +    Exit;
 +
 +  // Check if the item is upgradable
 +  if LColl.IsUpgradable() then
 +    FInventory.Upgrade(LColl)
 +  else
 +    ShowMessage('Collected item not upgradable!');
 +end;
 +</file>
 ==== Multilingual ==== ==== Multilingual ====
  
-The component supports multilingual text content for your items and groups. +The component supports multilingual text content for your items and groups names
-To set the value for a specific language we need the language-name, requested by GetLanguageName().+To set the value for a specific language we need the language-name, requested by GetLanguageName() function.
 By this index we can set a multilingual name for the item as shown below: By this index we can set a multilingual name for the item as shown below:
  
Line 176: Line 219:
 </file> </file>
  
-In the inventory component itself we can set language. This is the base setting for auto-language detection by the user-interface.+In the inventory component itself we can set the active language.  
 +This is the base setting for auto-language detection by the user-interface.
  
 <file pascal> <file pascal>
 FInventory.Language := GORILLA_LANG_EN_US; FInventory.Language := GORILLA_LANG_EN_US;
 +FIFrame.UpdateInventory();
 </file> </file>
  
 Currently supported languages are: Currently supported languages are:
  
-^Language ^ID ^ +^ID ^Language 
-| english | GORILLA_LANG_EN_US +| GORILLA_LANG_EN_US | english | 
-| english | GORILLA_LANG_EN_UK +GORILLA_LANG_EN_UK english 
-german GORILLA_LANG_DE_DE +| GORILLA_LANG_DE_DE | german | 
-| german | GORILLA_LANG_DE_AT +| GORILLA_LANG_DE_AT | german 
-| german | GORILLA_LANG_DE_CH |+| GORILLA_LANG_DE_CH | german |
 ==== Collect ==== ==== Collect ====
  
Line 315: Line 360:
  
 The inventory component is a non-visual component which needs an user-interface to make your items visible. The inventory component is a non-visual component which needs an user-interface to make your items visible.
-You can extend the **TInventoryFrame** [Gorilla.UI.Inventory] component to build your own user-interface.+You can extend the **TInventoryFrame, TInventoryGroup and TInventoryCollectedItem ** [Gorilla.UI.Inventory] component to build your own user-interface. 
 + 
 +^Class ^Description ^ 
 +| TInventoryFrame | A custom inventory frame component to manage a inventory system. | 
 +| TInventoryGroup | A inventory grouping component. Use this component to categorize your collected items into groups. | 
 +| TInventoryCollectedItem | A custom collected item component. Use this component as basis for all of your collected items. |
 ==== Inventory-Designer ==== ==== Inventory-Designer ====
  
Line 327: Line 377:
 The tool provides a sandbox mode, where you can test your item and manufacturer settings directly. The tool provides a sandbox mode, where you can test your item and manufacturer settings directly.
  
-Inventory-Files are also supported in AssetsManager packages, so you add those to your application package without extra file handling.+Inventory-Files are also supported in AssetsManager packages. 
 + 
 +Next step: [[dialogues|Dialogues]]