fixed unity inventory and texts
This commit is contained in:
@@ -19,16 +19,28 @@ public class TextHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public static string getText(string key){
|
||||
key = key.Replace("(","").Replace(")","");
|
||||
bool hasLeftBracket = false;
|
||||
bool hasRightBracket = false;
|
||||
if(key.Contains("(")){
|
||||
hasLeftBracket = true;
|
||||
key = key.Replace("(","");
|
||||
}
|
||||
if(key.Contains(")")){
|
||||
hasRightBracket = true;
|
||||
key = key.Replace(")","");
|
||||
}
|
||||
|
||||
if(key[0].Equals(Char.ToUpperInvariant(key[0]))){
|
||||
key = Char.ToLowerInvariant(key[0]) + key.Substring(1);
|
||||
}
|
||||
|
||||
if(key.Contains("\r\n")){
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
string text = LocalizationSettings.StringDatabase.GetLocalizedString("MyTexts",key);
|
||||
if(hasLeftBracket){
|
||||
text = "(" + text;
|
||||
}
|
||||
if(hasRightBracket){
|
||||
text = text + ")";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace Assets.Scripts
|
||||
TooltipHandler tooltip;
|
||||
|
||||
public GameObject currentSlot;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -50,18 +49,19 @@ namespace Assets.Scripts
|
||||
|
||||
private void createStatBoost()
|
||||
{
|
||||
if (statBoost == null)
|
||||
{
|
||||
statBoost = new Dictionary<string, int>();
|
||||
statBoost.Add("HP", 0);
|
||||
statBoost.Add("MP", 0);
|
||||
statBoost.Add("HPR", 0);
|
||||
statBoost.Add("MPR", 0);
|
||||
statBoost.Add("STR", 0);
|
||||
statBoost.Add("DEX", 0);
|
||||
statBoost.Add("INT", 0);
|
||||
statBoost.Add("LCK", 0);
|
||||
}
|
||||
statBoost = new Dictionary<string, int>();
|
||||
statBoost.Add("HP", 0);
|
||||
statBoost.Add("MP", 0);
|
||||
statBoost.Add("HPR", 0);
|
||||
statBoost.Add("MPR", 0);
|
||||
statBoost.Add("STR", 0);
|
||||
statBoost.Add("DEX", 0);
|
||||
statBoost.Add("INT", 0);
|
||||
statBoost.Add("LCK", 0);
|
||||
}
|
||||
|
||||
void OnDisable(){
|
||||
statBoost = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
public void addItem(Item item)
|
||||
@@ -195,6 +195,41 @@ namespace Assets.Scripts
|
||||
public Dictionary<string, int> getEquipmentBonus()
|
||||
{
|
||||
createStatBoost();
|
||||
GameObject equip = head;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
equip = head;
|
||||
break;
|
||||
case 1:
|
||||
equip = rightHand;
|
||||
break;
|
||||
case 2:
|
||||
equip = leftHand;
|
||||
break;
|
||||
case 3:
|
||||
equip = amulet;
|
||||
break;
|
||||
case 4:
|
||||
equip = feet;
|
||||
break;
|
||||
case 5:
|
||||
equip = shoulders;
|
||||
break;
|
||||
case 6:
|
||||
equip = chest;
|
||||
break;
|
||||
case 7:
|
||||
equip = ring;
|
||||
break;
|
||||
}
|
||||
if (equip.GetComponent<InventorySlot>().getEquip() != null)
|
||||
{
|
||||
calculateStatBoost(equip.GetComponent<InventorySlot>().getEquip().getAttributes(), true);
|
||||
}
|
||||
}
|
||||
return statBoost;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Assets.Scripts
|
||||
}
|
||||
else
|
||||
{
|
||||
itemName = place.ToString() + " of " + itemName + " attribute \r\n (" + rarity.ToString() + ")";
|
||||
itemName = place.ToString() + " of " + itemName + " attribute (" + rarity.ToString() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -126,11 +126,11 @@ namespace Assets.Scripts
|
||||
{
|
||||
if (replacement.Length > 0)
|
||||
{
|
||||
itemName = replacement + " \r\n" + rarity.ToString();
|
||||
itemName = replacement + " " + rarity.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
itemName = place.ToString() + " \r\n" + rarity.ToString();
|
||||
itemName = place.ToString() + " " + rarity.ToString();
|
||||
}
|
||||
}
|
||||
itemName = itemName.ToLower();
|
||||
|
||||
8
Assets/Scripts/UI.meta
Normal file
8
Assets/Scripts/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b28188d6b76b96d38e71a4b554ef98f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user