Added german language, finished controller

This commit is contained in:
TAASONI3
2023-07-05 14:43:52 +02:00
parent 7aba856b17
commit 0dc2ff831f
127 changed files with 15311 additions and 356 deletions

View File

@@ -97,14 +97,14 @@ public class AudioHandler : MonoBehaviour
{
cameraAudio.volume = GameObject.Find("slideMusic").GetComponent<Slider>().value;
int volume = (int)(cameraAudio.volume * 100);
GameObject.Find("txtMusic").GetComponent<Text>().text = "Music (" + volume + "%)";
GameObject.Find("txtMusic").GetComponent<Text>().text = TextHandler.getText("music") + " (" + volume + "%)";
}
public void changeVolumeEffects()
{
playerAudio.volume = GameObject.Find("slideEffects").GetComponent<Slider>().value;
int volume = (int)(playerAudio.volume * 100);
GameObject.Find("txtEffects").GetComponent<Text>().text = "Effects (" + volume + "%)";
GameObject.Find("txtEffects").GetComponent<Text>().text = TextHandler.getText("effects") + " (" + volume + "%)";
}
public void setSlider()
@@ -118,8 +118,8 @@ public class AudioHandler : MonoBehaviour
string result = "";
float music = GameObject.Find("slideMusic").GetComponent<Slider>().value;
float effects = GameObject.Find("slideEffects").GetComponent<Slider>().value;
result = result + "Music:" + music + "\r\n";
result = result + "Effects:" + effects;
result = result + TextHandler.getText("music") + ": " + music + "\r\n";
result = result + TextHandler.getText("effects") + ": " + effects;
return result;
}
}

View File

@@ -56,7 +56,8 @@ namespace Assets.Scripts
sw.WriteLine("Effects:0.5");
sw.WriteLine("Resolution:0");
sw.WriteLine("Mode:0");
sw.WriteLine("Sensitivity:1");
sw.WriteLine("SensitivityMouse:1");
sw.WriteLine("SensitivityController:1");
sw.Flush();
sw.Close();
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Localization.Settings;
public class TextHandler : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public static string getText(string key){
key = key.Replace("(","").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);
return text;
}
public static string translate(string text){
string result = "";
for(int i = 0; i < text.Split(" ").Length; i++){
result += getText(text.Split(" ")[i]) + " ";
}
return result;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f0489ac871d11fd2a6d4a982ad24837
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -61,7 +61,7 @@ namespace Assets.Scripts
{
tiletype = "Spawn";
}
coordinates.GetComponent<Text>().text = tiletype + "(" + (int)position.x + "/" + (int)position.y + "/" + (int)position.z + ")";
coordinates.GetComponent<Text>().text = TextHandler.getText(tiletype) + "(" + (int)position.x + "/" + (int)position.y + "/" + (int)position.z + ")";
}
private void switchWaterLayer()
@@ -421,7 +421,7 @@ namespace Assets.Scripts
GameObject.Find("txtStrength").GetComponent<Text>().text = "STR: " + playerStats[4] + " (+" + equipment["STR"] + ")";
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + playerStats[5] + " (+" + equipment["DEX"] + ")";
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + playerStats[6] + " (+" + equipment["INT"] + ")";
GameObject.Find("txtHealth").GetComponent<Text>().text = "Health: " + playerStats[1] + " (+" + equipment["HP"] + ")";
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + playerStats[1] + " (+" + equipment["HP"] + ")";
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + playerStats[3] + " (+" + equipment["MP"] + ")";
updateHealthUI(playerStats[0], playerStats[1] + equipment["HP"]);
@@ -442,7 +442,7 @@ namespace Assets.Scripts
GameObject secondary = GameObject.Find("btnSecondaryIncrease");
GameObject txtPoints = GameObject.Find("txtPoints");
txtPoints.GetComponent<Text>().text = "Your available points: " + points;
txtPoints.GetComponent<Text>().text = TextHandler.getText("points") + " " + points;
if (points > 0)
{