Added save for inventory, slot and item, changed item generation, fixed luck in calculation
This commit is contained in:
@@ -10,7 +10,6 @@ namespace Assets.Scripts
|
||||
{
|
||||
TooltipHandler tooltip;
|
||||
Item[] items = new Item[3];
|
||||
public bool[] itemRemoved = {false, false, false};
|
||||
int currentBag = 0;
|
||||
public ItemPlace place;
|
||||
Item equip;
|
||||
@@ -31,7 +30,6 @@ namespace Assets.Scripts
|
||||
public void setItem(Item item, int bag)
|
||||
{
|
||||
items[bag] = item;
|
||||
itemRemoved[bag] = false;
|
||||
}
|
||||
|
||||
public Item getItem(int bag)
|
||||
@@ -42,7 +40,6 @@ namespace Assets.Scripts
|
||||
public void removeItem()
|
||||
{
|
||||
items[currentBag] = null;
|
||||
itemRemoved[currentBag] = true;
|
||||
}
|
||||
|
||||
public void showTooltip()
|
||||
@@ -247,5 +244,36 @@ namespace Assets.Scripts
|
||||
gameObject.GetComponent<RawImage>().texture = image;
|
||||
}
|
||||
}
|
||||
|
||||
public string saveGame()
|
||||
{
|
||||
string result = "";
|
||||
if (place == ItemPlace.BAG)
|
||||
{
|
||||
for (int i = 1; i <= items.Length;i++)
|
||||
{
|
||||
if (items[i-1] == null)
|
||||
{
|
||||
result = result + "\"bag" + i + "\": \"empty\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result + "\"bag" + i + "\": {\r\n";
|
||||
result = result + items[i-1].saveGame();
|
||||
result = result + "\r\n}";
|
||||
}
|
||||
if (i != 3)
|
||||
{
|
||||
result = result + ",\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result + equip.saveGame();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user