fixed options, fixed save, new Screenshots, v.140
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Assets.Scripts
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
FileHandler.loadOptions(true);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -88,6 +88,15 @@ namespace Assets.Scripts
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool canPlayerRotate()
|
||||
{
|
||||
if (state == UIState.GAME)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool isPlayerInFight()
|
||||
{
|
||||
return state == UIState.FIGHT;
|
||||
@@ -116,7 +125,7 @@ namespace Assets.Scripts
|
||||
public void openOptions()
|
||||
{
|
||||
options.SetActive(true);
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().setSlider();
|
||||
FileHandler.loadOptionDisplay();
|
||||
hideOtherElements(options);
|
||||
state = UIState.PAUSEOPTIONS;
|
||||
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
|
||||
@@ -243,21 +252,20 @@ namespace Assets.Scripts
|
||||
showHUD();
|
||||
}
|
||||
|
||||
public void adaptScreen()
|
||||
{
|
||||
public string saveVideoSettings(){
|
||||
GameObject resolution = GameObject.Find("dropResolution");
|
||||
GameObject mode = GameObject.Find("dropMode");
|
||||
|
||||
string result = "";
|
||||
switch (resolution.GetComponent<Dropdown>().value)
|
||||
{
|
||||
case 0:
|
||||
Screen.SetResolution(800,600, Screen.fullScreenMode);
|
||||
Screen.SetResolution(800, 600, Screen.fullScreenMode);
|
||||
break;
|
||||
case 1:
|
||||
Screen.SetResolution(1280, 800, Screen.fullScreenMode);
|
||||
break;
|
||||
case 2:
|
||||
Screen.SetResolution(1920,1080, Screen.fullScreenMode);
|
||||
Screen.SetResolution(1920, 1080, Screen.fullScreenMode);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -282,6 +290,9 @@ namespace Assets.Scripts
|
||||
}
|
||||
break;
|
||||
}
|
||||
result = result + "Resolution:"+resolution.GetComponent<Dropdown>().value+"\r\n";
|
||||
result = result + "Mode:"+mode.GetComponent<Dropdown>().value;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void openPauseMenu()
|
||||
@@ -442,29 +453,25 @@ namespace Assets.Scripts
|
||||
|
||||
private void updateHealthUI(int health, int maxHealth)
|
||||
{
|
||||
GameObject foreground = GameObject.Find("healthForegroundInformation");
|
||||
GameObject background = GameObject.Find("healthBackgroundInformation");
|
||||
GameObject fill = GameObject.Find("pnlHealthBar");
|
||||
GameObject text = GameObject.Find("healthTextInformation");
|
||||
|
||||
updateBar(foreground, background, text, maxHealth, health);
|
||||
updateFill(fill, text, maxHealth, health);
|
||||
}
|
||||
|
||||
private void updateSecondaryUI(int secondary, int maxSecondary)
|
||||
{
|
||||
GameObject foreground = GameObject.Find("secondaryForegroundInformation");
|
||||
GameObject background = GameObject.Find("secondaryBackgroundInformation");
|
||||
GameObject fill = GameObject.Find("pnlSecondaryBar");
|
||||
GameObject text = GameObject.Find("secondaryTextInformation");
|
||||
|
||||
updateBar(foreground, background, text, maxSecondary, secondary);
|
||||
updateFill(fill, text, maxSecondary, secondary);
|
||||
}
|
||||
|
||||
private void updateExperienceUI(int experience, int maxExperience)
|
||||
{
|
||||
GameObject foreground = GameObject.Find("experienceForeground");
|
||||
GameObject background = GameObject.Find("experienceBackground");
|
||||
GameObject text = GameObject.Find("experienceText");
|
||||
GameObject fill = GameObject.Find("pnlExperience");
|
||||
|
||||
updateBar(foreground, background, text, maxExperience, experience);
|
||||
updateFill(fill, null, maxExperience, experience);
|
||||
}
|
||||
|
||||
public void updateHUD(Player player)
|
||||
@@ -476,13 +483,11 @@ namespace Assets.Scripts
|
||||
GameObject information = GameObject.Find("txtInformationHUD");
|
||||
player.updateNameHUD(information.GetComponent<Text>());
|
||||
|
||||
GameObject foreground = GameObject.Find("healthForegroundHUD");
|
||||
GameObject background = GameObject.Find("healthBackgroundHUD");
|
||||
updateBar(foreground, background, null, playerStats[1] + equipment["HP"], playerStats[0]);
|
||||
GameObject fill = GameObject.Find("HUD_healthFill");
|
||||
updateFill(fill, null, playerStats[1] + equipment["HP"], playerStats[0]);
|
||||
|
||||
foreground = GameObject.Find("secondaryForegroundHUD");
|
||||
background = GameObject.Find("secondaryBackgroundHUD");
|
||||
updateBar(foreground, background, null, playerStats[3] + equipment["MP"], playerStats[2]);
|
||||
fill = GameObject.Find("HUD_secondaryFill");
|
||||
updateFill(fill, null, playerStats[3] + equipment["MP"], playerStats[2]);
|
||||
}
|
||||
|
||||
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
|
||||
@@ -503,6 +508,22 @@ namespace Assets.Scripts
|
||||
bar.GetComponent<RectTransform>().offsetMax = new Vector2(-change, bar.GetComponent<RectTransform>().offsetMax.y);
|
||||
}
|
||||
|
||||
public void updateFill(GameObject fill, GameObject textField, int maxValue, int minValue)
|
||||
{
|
||||
string text = minValue + "/" + maxValue;
|
||||
float percentage = 0;
|
||||
if (maxValue > 0)
|
||||
{
|
||||
percentage = (1 / (float)maxValue) * minValue;
|
||||
}
|
||||
|
||||
if (textField != null)
|
||||
{
|
||||
textField.GetComponent<Text>().text = text;
|
||||
}
|
||||
fill.GetComponent<Image>().fillAmount = percentage;
|
||||
}
|
||||
|
||||
public void openIntroduction()
|
||||
{
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().Start();
|
||||
|
||||
Reference in New Issue
Block a user