Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,329 changes: 2,929 additions & 400 deletions Assets/Resources/Prefabs/UI/PauseMenu.prefab

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Assets/Scripts/Game/CustomKeybinds/Keybinds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ private void UpdateControls(Keybinds tempControls)

pause = tempControls.pause;
reset = tempControls.reset;

keys = tempControls.keys;

UpdateDictionaryFromAttributes();
}
Expand Down
19 changes: 12 additions & 7 deletions Assets/Scripts/UI/Options/Controls.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Game.CustomKeybinds;
Expand Down Expand Up @@ -309,6 +306,9 @@ void Update()
}
i = val;
}
else if (Input.GetKeyDown(KeyCode.Tab)) {
return; // Reserved key for viewing controls
}
else if (Input.inputString.Length != 0) {
curr_keys[i] = Input.inputString[0].ToString().ToUpper();
int val = findfrom(curr_keycodes, (KeyCode)System.Enum.Parse(typeof(KeyCode), curr_keys[i]));
Expand Down Expand Up @@ -473,7 +473,7 @@ void getSprite(KeyCode key, int button) {
break;
case KeyCode.Return:
getSelectedButton(button).GetComponent<Image>().sprite = key_long;
getSelectedButton(button).GetComponent<RectTransform>().sizeDelta = new Vector2(50, 35);
getSelectedButton(button).GetComponent<RectTransform>().sizeDelta = new Vector2(75, 35);
break;
case KeyCode.RightShift:
getSelectedButton(button).GetComponent<Image>().sprite = key_long;
Expand Down Expand Up @@ -562,10 +562,15 @@ void btnApply() {
Keybinds.GetInstance().clearAllEntangled = curr_keycodes[6];
Keybinds.GetInstance().entangle = curr_keycodes[7];
Keybinds.GetInstance().unentangle = curr_keycodes[8];
Keybinds.GetInstance().pause = curr_keycodes[9];
Keybinds.GetInstance().pause = curr_keycodes[9];

SaveLoadKeybinds.SaveControlScheme();

SaveLoadKeybinds.SaveControlScheme();

viewControl controlView = FindObjectOfType<viewControl>();

if (controlView != null)
controlView.UpdateKeys();

// Show option_screen
option_screen.SetActive(true);

Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/UI/Options/Display.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void Update() {
void change_res() {
Resolution r = resolution[res_dropdown.value];

print("Option value: " + res_dropdown.value + "Res:" + r.width + " x " + r.height);
Screen.SetResolution(r.width, r.height, fullscreen.isOn);
res_dropdown.RefreshShownValue();
}
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/UI/PauseMenu/PauseMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ void menuState() {
resumeState();
}


public bool isPaused() {
return paused;
}

}
116 changes: 116 additions & 0 deletions Assets/Scripts/UI/PauseMenu/viewControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using Game.CustomKeybinds;
using UnityEngine.UI;
using UnityEngine;

public class viewControl : MonoBehaviour
{
// keybinds
public Image jump;
public Image walk_left;
public Image walk_right;
public Image push_pull;
public Image reset;
public Image interact;
public Image clear;
public Image entangle;
public Image unentangle;
public Image pause;

// Sprites
public Sprite key_short;
public Sprite key_long;
public Sprite mouse_r;
public Sprite mouse_l;

// For reference, simple check if menu is paused
public PauseMenu pause_menu;

// Controls view
public GameObject control;

// LateStart is called after the first frame update
void LateStart()
{
UpdateKeys();
}

private void Update() {

if (!pause_menu.isPaused() && Input.GetKeyDown("tab")) {
control.SetActive(true);
}
else if (Input.GetKeyUp("tab")) {
control.SetActive(false);
}
}
public void UpdateKeys() {

jump.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[0];
updateSprite(Keybinds.GetInstance().jump, jump);

walk_left.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[1];
updateSprite(Keybinds.GetInstance().moveLeft, walk_left);

walk_right.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[2];
updateSprite(Keybinds.GetInstance().moveRight, walk_right);

push_pull.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[3];
updateSprite(Keybinds.GetInstance().grabRelease, push_pull);

reset.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[4];
updateSprite(Keybinds.GetInstance().reset, reset);

interact.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[5];
updateSprite(Keybinds.GetInstance().interact, interact);

clear.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[6];
updateSprite(Keybinds.GetInstance().clearAllEntangled, clear);

entangle.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[7];
updateSprite(Keybinds.GetInstance().entangle, entangle);

unentangle.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[8];
updateSprite(Keybinds.GetInstance().unentangle, unentangle);

pause.GetComponentInChildren<Text>().text = Keybinds.GetInstance().keys[9];
updateSprite(Keybinds.GetInstance().pause, pause);

}

void updateSprite(KeyCode key, Image image) {
switch (key) {
case KeyCode.Mouse0:
image.sprite = mouse_l;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(58, 48);
break;
case KeyCode.Mouse1:
image.sprite = mouse_r;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(58, 48);
break;
case KeyCode.Return:
image.sprite = key_long;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(120, 48);
break;
case KeyCode.RightShift:
image.sprite = key_long;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(120, 48);
break;
case KeyCode.LeftShift:
image.sprite = key_long;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(120, 48);
break;
case KeyCode.Backspace:
image.sprite = key_long;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(120, 48);
break;
case KeyCode.Space:
image.sprite = key_long;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(120, 48);
break;
default:
image.sprite = key_short;
image.GetComponent<RectTransform>().sizeDelta = new Vector2(48, 48);
break;
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/UI/PauseMenu/viewControl.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c6b15050311242b6712353e3d143de5df1637fab578fce9332b25
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c721518020b6501292f3e002c1326acf53a31f6fe
value: 22424703114646680e0b0227036c6f050c0d142f3f670a353b2c116aacf53a31f6fe
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c6f050c0d142f3f670a353b2c116aacf53a31f6fe
value: 22424703114646680e0b0227036c721518020b6501292f3e002c1326acf53a31f6fe
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
Expand Down