added font, updated ui, fixed some code

This commit is contained in:
TAASONI3
2023-12-13 12:49:38 +01:00
parent 10ad860d3e
commit 17a0a22dd4
65 changed files with 1697 additions and 5019 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Player;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -9,7 +10,7 @@ namespace Assets.Scripts
public class ButtonHandler : MonoBehaviour
{
UIHandler uihandler;
Player player;
PlayerGameObject player;
AudioHandler audioHandler;
WorldGenerator worldGenerator;
GameObject fight;
@@ -17,7 +18,7 @@ namespace Assets.Scripts
private void Start()
{
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandler>();
player = GameObject.Find("Player").GetComponent<Player>();
player = GameObject.Find("Player").GetComponent<PlayerGameObject>();
worldGenerator = GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>();
audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandler>();
fight = GameObject.Find("Fight");
@@ -98,12 +99,6 @@ namespace Assets.Scripts
uihandler.startGame();
}
public void switchCharactersheet()
{
audioHandler.playButtonClick();
uihandler.switchCharactersheet();
}
public void switchQuestlog()
{
audioHandler.playButtonClick();

View File

@@ -1,4 +1,5 @@
using Steamworks;
using Assets.Scripts.Player;
using Steamworks;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +11,7 @@ namespace Assets.Scripts
{
class EasterEggHandler
{
public static void applyEasterEgg(Player player)
public static void applyEasterEgg(PlayerObject player)
{
if (player.getPlayerName().ToLower().Length > 0)
{
@@ -18,10 +19,10 @@ namespace Assets.Scripts
}
}
private static void applyNameEasterEgg(Player player)
private static void applyNameEasterEgg(PlayerObject player)
{
//maxHealth, maxSecondary, strength, dexterity, intelligence
int[] result = new int[5];
/*int[] result = new int[5];
int[] stats = player.getStats();
switch (player.getPlayerName().ToLower())
{
@@ -62,10 +63,12 @@ namespace Assets.Scripts
result[4] = stats[6];
break;
}
player.setStats(result);
player.setStats(result);*/
//TODO FIX whole Easteregg mechanic to go with the new player
}
public static bool isGodMode(Player player)
public static bool isGodMode(PlayerObject player)
{
bool result = false;
if (player != null)

View File

@@ -9,6 +9,7 @@ using UnityEngine.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine.Localization.Settings;
using Assets.Scripts.Player;
namespace Assets.Scripts
{
@@ -24,7 +25,7 @@ namespace Assets.Scripts
sw.Close();
}
public static void loadGame(Player player, WorldGenerator worldGenerator, Inventory inventory, QuestLog questLog)
public static void loadGame(PlayerGameObject player, WorldGenerator worldGenerator, Inventory inventory, QuestLog questLog)
{
if (hasSaveFile())
{

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using Steamworks;
using Assets.Scripts;
using Assets.Scripts.Player;
public class SteamWorksHandler : MonoBehaviour
{
@@ -97,7 +98,7 @@ public class SteamWorksHandler : MonoBehaviour
private static bool isGodMode()
{
return EasterEggHandler.isGodMode(GameObject.Find("Player").GetComponent<Player>());
return EasterEggHandler.isGodMode(GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayer());
}
public static void getItemAchievement(Item item)

View File

@@ -3,19 +3,20 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using Assets.Scripts.Player;
namespace Assets.Scripts
{
public class TooltipHandler : MonoBehaviour
{
public GameObject tooltip;
Player player;
PlayerGameObject player;
UIHandler uihandler;
// Start is called before the first frame update
void Start()
{
player = GameObject.Find("Player").GetComponent<Player>();
player = GameObject.Find("Player").GetComponent<PlayerGameObject>();
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandler>();
}

View File

@@ -1,4 +1,5 @@
using Assets.Scripts.Classes;
using Assets.Scripts.Player;
using Assets.Scripts.Races;
using System.Collections;
using System.Collections.Generic;
@@ -15,7 +16,6 @@ namespace Assets.Scripts
public GameObject information;
public GameObject fight;
public GameObject message;
public GameObject charactersheet;
public GameObject deathscreen;
public GameObject options;
public GameObject pauseMenu;
@@ -33,6 +33,7 @@ namespace Assets.Scripts
void Start()
{
FileHandler.loadOptions(true);
GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayerStat("Killcount").changeAmount(1);
}
// Update is called once per frame
@@ -75,7 +76,7 @@ namespace Assets.Scripts
private void updatePlayerHUD()
{
updateHUD(GameObject.Find("Player").GetComponent<Player>());
updateHUD(GameObject.Find("Player").GetComponent<PlayerGameObject>());
}
public bool canPlayerMove()
@@ -110,18 +111,6 @@ namespace Assets.Scripts
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnCloseTutorial"));
}
public void switchCharactersheet()
{
if (state == UIState.CHARACTER)
{
closeCharactersheet();
}
else
{
openCharactersheet();
}
}
public void openOptions()
{
FileHandler.loadOptionDisplay();
@@ -137,22 +126,6 @@ namespace Assets.Scripts
openPauseMenu();
}
public void openCharactersheet()
{
hideOtherElements(charactersheet);
state = UIState.CHARACTER;
if(GameObject.Find("btnStrengthIncrease").transform.localScale != new Vector3(0,0,0)){
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnStrengthIncrease"));
}
}
public void closeCharactersheet()
{
charactersheet.transform.localScale = new Vector3(0, 0, 0);
showHUD();
state = UIState.GAME;
}
public void switchInventory()
{
if (state == UIState.INVENTORY)
@@ -373,38 +346,36 @@ namespace Assets.Scripts
public void updateFightInterface(GameObject enemy, GameObject player)
{
updateFightInterfacePlayer(player);
updateFightInterfacePlayer(player.GetComponent<PlayerGameObject>());
updateFightInterfaceEnemy(enemy);
updateFightInterfaceActions(player);
updateFightInterfaceActions(player.GetComponent<PlayerGameObject>());
GameObject.Find("txtRounds").GetComponent<Text>().text = (int.Parse(GameObject.Find("txtRounds").GetComponent<Text>().text) + 1).ToString();
}
private void updateFightInterfaceActions(GameObject player)
private void updateFightInterfaceActions(PlayerGameObject player)
{
GameObject actionFour = GameObject.Find("btnActionFour");
GameObject actionFive = GameObject.Find("btnActionFive");
GameObject actionSix = GameObject.Find("btnActionSix");
player.GetComponent<Player>().displayAction(0, actionFour.transform.Find("imgAction").gameObject, actionFour.transform.Find("descAction").gameObject);
player.GetComponent<Player>().displayAction(1, actionFive.transform.Find("imgAction").gameObject, actionFive.transform.Find("descAction").gameObject);
player.GetComponent<Player>().displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
player.displayAction(0, actionFour.transform.Find("imgAction").gameObject, actionFour.transform.Find("descAction").gameObject);
player.displayAction(1, actionFive.transform.Find("imgAction").gameObject, actionFive.transform.Find("descAction").gameObject);
player.displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
}
private void updateFightInterfacePlayer(GameObject player)
private void updateFightInterfacePlayer(PlayerGameObject player)
{
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
int[] playerStats = player.GetComponent<Player>().getStats();
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
GameObject foreground = GameObject.Find("healthForegroundPlayer");
GameObject background = GameObject.Find("healthBackgroundPlayer");
GameObject text = GameObject.Find("healthTextPlayer");
updateBar(foreground, background, text, playerStats[1] + equipment["HP"], playerStats[0]);
updateBar(foreground, background, text, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
foreground = GameObject.Find("secondaryForegroundPlayer");
background = GameObject.Find("secondaryBackgroundPlayer");
text = GameObject.Find("secondaryTextPlayer");
updateBar(foreground, background, text, playerStats[3] + equipment["MP"], playerStats[2]);
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
}
private void updateFightInterfaceEnemy(GameObject enemy)
@@ -423,24 +394,22 @@ namespace Assets.Scripts
updateBar(foreground, background, text, enemyStats[3], enemyStats[2]);
}
public void adjustInformation(Player player)
public void adjustInformation(PlayerGameObject player)
{
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points};
int[] playerStats = player.GetComponent<Player>().getStats();
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
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 = TextHandler.getText("health") + " " + playerStats[1] + " (+" + equipment["HP"] + ")";
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + playerStats[3] + " (+" + equipment["MP"] + ")";
GameObject.Find("txtStrength").GetComponent<Text>().text = "STR: " + player.getPlayerStat("Strength").getAmount() + " (+" + equipment["STR"] + ")";
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + player.getPlayerStat("Dexterity").getAmount() + " (+" + equipment["DEX"] + ")";
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + player.getPlayerStat("Intelligence").getAmount() + " (+" + equipment["INT"] + ")";
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + player.getPlayerStat("Health").getAmount() + " (+" + equipment["HP"] + ")";
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + player.getPlayerStat("Secondary").getAmount() + " (+" + equipment["MP"] + ")";
updateHealthUI(playerStats[0], playerStats[1] + equipment["HP"]);
updateSecondaryUI(playerStats[2], playerStats[3] + equipment["MP"]);
updateExperienceUI(playerStats[8], playerStats[9]);
updateHealthUI(player.getPlayerStat("Health").getAmount(), player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"]);
updateSecondaryUI(player.getPlayerStat("Secondary").getAmount(), player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"]);
updateExperienceUI(player.getPlayerStat("Experience").getAmount(), player.getPlayerStat("MaxExperience").getAmount());
player.updateName(GameObject.Find("txtName").GetComponent<Text>());
updatePoints(playerStats[10]);
updatePoints(player.getPlayerStat("Points").getAmount());
player.displaySkills(GameObject.Find("pnlSkills"));
}
@@ -496,20 +465,18 @@ namespace Assets.Scripts
updateFill(fill, null, maxExperience, experience);
}
public void updateHUD(Player player)
public void updateHUD(PlayerGameObject player)
{
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience};
int[] playerStats = player.GetComponent<Player>().getStats();
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
GameObject information = GameObject.Find("txtInformationHUD");
player.updateNameHUD(information.GetComponent<Text>());
GameObject fill = GameObject.Find("HUD_healthFill");
updateFill(fill, null, playerStats[1] + equipment["HP"], playerStats[0]);
updateFill(fill, null, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
fill = GameObject.Find("HUD_secondaryFill");
updateFill(fill, null, playerStats[3] + equipment["MP"], playerStats[2]);
updateFill(fill, null, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
}
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
@@ -552,15 +519,14 @@ namespace Assets.Scripts
if (PlayerPrefs.GetInt("isLoad") == 0)
{
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(PlayerPrefs.GetInt("cityAmount"));
GameObject.Find("Player").GetComponent<Player>().generatePlayer();
GameObject.Find("Player").GetComponent<Player>().finishPlayerCreation();
GameObject.Find("Player").GetComponent<PlayerGameObject>().generatePlayer();
hideOtherElements(introduction);
state = UIState.INTRODUCTION;
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnClose"));
}
else
{
FileHandler.loadGame(GameObject.Find("Player").GetComponent<Player>(), GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>(), GameObject.Find("Inventory").GetComponent<Inventory>(), GameObject.Find("QuestLog").GetComponent<QuestLog>());
FileHandler.loadGame(GameObject.Find("Player").GetComponent<PlayerGameObject>(), GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>(), GameObject.Find("Inventory").GetComponent<Inventory>(), GameObject.Find("QuestLog").GetComponent<QuestLog>());
hideOtherElements(introduction);
introduction.transform.localScale = new Vector3(0, 0, 0);
tutorial.transform.localScale = new Vector3(0,0,0);