Added controls for gamepad, changed input & UI

This commit is contained in:
TAASONI3
2023-07-04 20:15:06 +02:00
parent 0b058f9248
commit 7aba856b17
48 changed files with 24176 additions and 15427 deletions

View File

@@ -42,6 +42,9 @@ namespace Assets.Scripts
updatePlayerHUD();
switchWaterLayer();
updateCoordinates();
if(EventSystem.current.currentSelectedGameObject != null){
EventSystem.current.SetSelectedGameObject(null);
}
}
}
@@ -107,6 +110,7 @@ namespace Assets.Scripts
tutorial.transform.localScale = new Vector3(1, 1, 1);
showHUD();
state = UIState.TUTORIAL;
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnCloseTutorial"));
}
public void switchCharactersheet()
@@ -127,7 +131,8 @@ namespace Assets.Scripts
FileHandler.loadOptionDisplay();
hideOtherElements(options);
state = UIState.PAUSEOPTIONS;
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnAudio"));
showOptionView("audio");
}
public void closeOptions()
@@ -141,6 +146,9 @@ namespace Assets.Scripts
{
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()
@@ -166,12 +174,13 @@ namespace Assets.Scripts
{
hideOtherElements(inventory);
state = UIState.INVENTORY;
EventSystem.current.SetSelectedGameObject(GameObject.Find("bagOne"));
}
public void closeInventory()
{
inventory.GetComponent<Inventory>().OnMouseUp();
inventory.transform.localScale = new Vector3(0, 0, 0);
GameObject.Find("pnlInventoryActions").transform.localScale = new Vector3(0,0,0);
showHUD();
state = UIState.GAME;
}
@@ -242,6 +251,7 @@ namespace Assets.Scripts
questlog.GetComponent<QuestLog>().showQuests();
state = UIState.QUEST;
hideOtherElements(questlog);
EventSystem.current.SetSelectedGameObject(GameObject.Find("scrollQuestlog"));
}
public void closeQuestLog()
@@ -298,6 +308,7 @@ namespace Assets.Scripts
{
hideOtherElements(pauseMenu);
state = UIState.PAUSE;
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnContinue"));
}
public void closePauseMenu()
@@ -311,6 +322,7 @@ namespace Assets.Scripts
{
state = UIState.DEATH;
hideOtherElements(deathscreen);
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnMenu"));
}
public void hideOtherElements(GameObject obj)
@@ -358,9 +370,9 @@ namespace Assets.Scripts
private void updateFightInterfaceActions(GameObject player)
{
GameObject actionFour = GameObject.Find("action4");
GameObject actionFive = GameObject.Find("action5");
GameObject actionSix = GameObject.Find("action6");
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);
@@ -533,6 +545,7 @@ namespace Assets.Scripts
GameObject.Find("Player").GetComponent<Player>().finishPlayerCreation();
hideOtherElements(introduction);
state = UIState.INTRODUCTION;
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnClose"));
}
else
{
@@ -551,5 +564,17 @@ namespace Assets.Scripts
tutorial.transform.localScale = new Vector3(0,0,0);
state = UIState.GAME;
}
public void showOptionView(string key){
GameObject optionContent = GameObject.Find("pnlContent");
for(int i = 0; i < optionContent.transform.childCount; i++){
if(optionContent.transform.GetChild(i).name.ToLower().Contains(key)){
optionContent.transform.GetChild(i).transform.localScale = new Vector3(1,1,1);
}
else{
optionContent.transform.GetChild(i).transform.localScale = new Vector3(0,0,0);
}
}
}
}
}