Options Menu
This commit is contained in:
@@ -25,10 +25,6 @@ public class StartHandler : MonoBehaviour
|
||||
|
||||
private string roomcode;
|
||||
|
||||
int width = Screen.width;
|
||||
int height = Screen.height;
|
||||
private float divisionLevel = 1;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -176,16 +172,5 @@ public class StartHandler : MonoBehaviour
|
||||
stream.Write(new byte[] { 126, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
|
||||
}
|
||||
|
||||
public void OnQualitySliderChanged(float value)
|
||||
{
|
||||
divisionLevel = value;
|
||||
}
|
||||
|
||||
public void ButtonApply()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
Screen.SetResolution(width / (int)divisionLevel, height / (int)divisionLevel, Screen.fullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,9 +12,14 @@ public class UIHandler : MonoBehaviour
|
||||
[SerializeField] private GameObject layoutBuyStar;
|
||||
[SerializeField] private GameObject layoutItemShop;
|
||||
[SerializeField] private GameObject layoutSelectItem;
|
||||
[SerializeField] private GameObject layoutOptions;
|
||||
|
||||
private static UIHandler currentInstance;
|
||||
|
||||
int width = Screen.width;
|
||||
int height = Screen.height;
|
||||
private float divisionLevel = 1;
|
||||
|
||||
public static UIHandler GetInstance()
|
||||
{
|
||||
return currentInstance;
|
||||
@@ -39,6 +44,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
|
||||
currentInstance = this;
|
||||
}
|
||||
@@ -52,6 +58,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutMiniMap()
|
||||
@@ -75,6 +82,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
|
||||
LayoutBuyStarController controller = layoutBuyStar.GetComponent<LayoutBuyStarController>();
|
||||
|
||||
@@ -101,6 +109,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout2.SetActive(true);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutItemShop()
|
||||
@@ -113,6 +122,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutItemShop.SetActive(true);
|
||||
layoutItemShop.GetComponent<ItemShop>().Init(currentPlayer);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +139,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutOptions.SetActive(false);
|
||||
|
||||
layoutSelectItem.GetComponent<ItemSelector>().Init(currentPlayer.items);
|
||||
|
||||
@@ -136,6 +147,18 @@ public class UIHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateLayoutOptions()
|
||||
{
|
||||
layout0.SetActive(false);
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
layoutSelectItem.SetActive(false);
|
||||
layoutOptions.SetActive(true);
|
||||
}
|
||||
|
||||
public void ButtonBuyStar()
|
||||
{
|
||||
((PlayablePlayer)currentPlayer).BuyStar(true);
|
||||
@@ -171,4 +194,18 @@ public class UIHandler : MonoBehaviour
|
||||
ActivateLayout1();
|
||||
|
||||
}
|
||||
public void OnQualitySliderChanged(float value)
|
||||
{
|
||||
divisionLevel = value;
|
||||
}
|
||||
|
||||
public void ButtonApplySettings()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
Screen.SetResolution(width / (int)divisionLevel, height / (int)divisionLevel, Screen.fullScreen);
|
||||
}
|
||||
|
||||
ActivateLayout1();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user