Add StickGame Assets
This commit is contained in:
15
phr/StickGame/Assets/UI/CButton.cs
Normal file
15
phr/StickGame/Assets/UI/CButton.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class AButton : Button
|
||||
{
|
||||
public AButton() {
|
||||
base.clicked += PlayClickSound;
|
||||
}
|
||||
|
||||
private void PlayClickSound() {
|
||||
Resources.Load<AudioClip>("buttonClick");
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/CButton.cs.meta
Normal file
11
phr/StickGame/Assets/UI/CButton.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c7973601ad23764fa72b8dbe66dbaf9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
4
phr/StickGame/Assets/UI/DesignDocument.uxml
Normal file
4
phr/StickGame/Assets/UI/DesignDocument.uxml
Normal file
@@ -0,0 +1,4 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/Resources/Default.uss?fileID=7433441132597879392&guid=536c19025cccb09499864fd2904ef37d&type=3#Default" />
|
||||
<MainMenu />
|
||||
</ui:UXML>
|
||||
10
phr/StickGame/Assets/UI/DesignDocument.uxml.meta
Normal file
10
phr/StickGame/Assets/UI/DesignDocument.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fae7e25cea2b40468a8200f26c9f92e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
2
phr/StickGame/Assets/UI/Document.uxml
Normal file
2
phr/StickGame/Assets/UI/Document.uxml
Normal file
@@ -0,0 +1,2 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
</ui:UXML>
|
||||
10
phr/StickGame/Assets/UI/Document.uxml.meta
Normal file
10
phr/StickGame/Assets/UI/Document.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc86b894843ad5d489097b204cfe360f
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
66
phr/StickGame/Assets/UI/GameMenu.cs
Normal file
66
phr/StickGame/Assets/UI/GameMenu.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class GameMenu : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<GameMenu> { }
|
||||
|
||||
const string defaultStyleSheetPath = "Default";
|
||||
const string ussGameContainer = "GameMenuContainer";
|
||||
|
||||
public Label label = new Label() { text = "Game Menu" };
|
||||
public Button buttonResume = new AButton() { text = "Resume" };
|
||||
public Button buttonSettings = new AButton() { text = "Settings" };
|
||||
public Button buttonMainMenu = new AButton() { text = "MainMenu" };
|
||||
public Button buttonQuit = new AButton() { text = "Quit" };
|
||||
public GameMenu()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(defaultStyleSheetPath));
|
||||
|
||||
VisualElement menuContainer = new VisualElement();
|
||||
AddToClassList(ussGameContainer);
|
||||
|
||||
|
||||
buttonResume.clicked += ButtonResumeClicked;
|
||||
buttonSettings.clicked += ButtonSettingsClicked;
|
||||
buttonMainMenu.clicked += ButtonMainMenuClicked;
|
||||
buttonQuit.clicked += ButtonQuitClicked;
|
||||
|
||||
menuContainer.Add(label);
|
||||
menuContainer.Add(buttonResume);
|
||||
menuContainer.Add(buttonSettings);
|
||||
menuContainer.Add(buttonMainMenu);
|
||||
menuContainer.Add(buttonQuit);
|
||||
|
||||
Add(menuContainer);
|
||||
}
|
||||
|
||||
public event Action OnButtonResumeClicked;
|
||||
public event Action OnButtonSettingsClicked;
|
||||
public event Action OnButtonMainMenuClicked;
|
||||
public event Action OnButtonQuitClicked;
|
||||
private void ButtonResumeClicked()
|
||||
{
|
||||
OnButtonResumeClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonSettingsClicked()
|
||||
{
|
||||
OnButtonSettingsClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonMainMenuClicked()
|
||||
{
|
||||
OnButtonMainMenuClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonQuitClicked()
|
||||
{
|
||||
OnButtonQuitClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/GameMenu.cs.meta
Normal file
11
phr/StickGame/Assets/UI/GameMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2806e254105637b489f0d032dad701c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
phr/StickGame/Assets/UI/InfoText.cs
Normal file
28
phr/StickGame/Assets/UI/InfoText.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class InfoText : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<InfoText> { }
|
||||
|
||||
const string styleSheetPath = "Default";
|
||||
const string ussInfoText = "InfoText";
|
||||
|
||||
Label label = new Label() { text = "Some text to fill this thing" };
|
||||
|
||||
public InfoText()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(styleSheetPath));
|
||||
AddToClassList(ussInfoText);
|
||||
Add(label);
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
label.text = text;
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/InfoText.cs.meta
Normal file
11
phr/StickGame/Assets/UI/InfoText.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35b76aa156e0bb94a8307a5c422ed652
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
phr/StickGame/Assets/UI/InputText.cs
Normal file
36
phr/StickGame/Assets/UI/InputText.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class InputText : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<InputText> { }
|
||||
|
||||
const string styleSheetPath = "Default";
|
||||
const string ussInputText = "InputText";
|
||||
|
||||
Label label = new Label(text: "Enter text");
|
||||
TextField input = new TextField();
|
||||
Button actionButton;
|
||||
public InputText()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(styleSheetPath));
|
||||
AddToClassList(ussInputText);
|
||||
actionButton = new Button() { text = "Confirm" };
|
||||
actionButton.clicked += ActionButtonClicked;
|
||||
Add(label);
|
||||
Add(input);
|
||||
Add(actionButton);
|
||||
}
|
||||
|
||||
event Action buttonClicked;
|
||||
|
||||
private void ActionButtonClicked()
|
||||
{
|
||||
buttonClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/InputText.cs.meta
Normal file
11
phr/StickGame/Assets/UI/InputText.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80261eef24db71b41b5a393c514dd10c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
phr/StickGame/Assets/UI/MainMenu.cs
Normal file
79
phr/StickGame/Assets/UI/MainMenu.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class MainMenu : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<MainMenu> { }
|
||||
|
||||
const string defaultStyleSheetPath = "Default";
|
||||
const string ussMenuContainer = "MainMenu";
|
||||
|
||||
public Image logo = new Image();
|
||||
public Button buttonPlay = new AButton() { text = "Play" };
|
||||
public Button buttonSettings = new AButton() { text = "Settings" };
|
||||
public Button buttonQuit = new AButton() { text = "Quit" };
|
||||
public MainMenu()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(defaultStyleSheetPath));
|
||||
|
||||
VisualElement menuContainer = new VisualElement();
|
||||
AddToClassList(ussMenuContainer);
|
||||
|
||||
//Label label = new Label() { text = "OOPS! Steam initialization failed" };
|
||||
//label.AddToClassList(ussLabel);
|
||||
Sprite imgLogo = Resources.Load<Sprite>("Sprites/MainMenuLogo");
|
||||
logo.sprite = imgLogo;
|
||||
Add(logo);
|
||||
|
||||
|
||||
buttonPlay.clicked += ButtonPlayClicked;
|
||||
buttonSettings.clicked += ButtonSettingsClicked;
|
||||
buttonQuit.clicked += ButtonQuitClicked;
|
||||
|
||||
|
||||
menuContainer.Add(buttonPlay);
|
||||
menuContainer.Add(buttonSettings);
|
||||
menuContainer.Add(buttonQuit);
|
||||
|
||||
//Button retryButton = new AButton() { text = "Retry" };
|
||||
|
||||
//retryButton.clicked += ButtonClickedRetry;
|
||||
//retryButton.AddToClassList(ussRetryButton);
|
||||
//Button offlineButton = new AButton() { text = "Play Local" };
|
||||
//offlineButton.clicked += ButtonClickedOffline;
|
||||
//offlineButton.AddToClassList(ussOfflineButton);
|
||||
|
||||
//dialogContainer.Add(retryButton);
|
||||
//dialogContainer.Add(offlineButton);
|
||||
|
||||
//buttonOne.clicked += ButtonOneClicked;
|
||||
//buttonTwo.clicked += ButtonTwoClicked;
|
||||
//dialogContainer.Add(buttonOne);
|
||||
//dialogContainer.Add(buttonTwo);
|
||||
|
||||
Add(menuContainer);
|
||||
}
|
||||
|
||||
public event Action OnButtonPlayClicked;
|
||||
public event Action OnButtonSettingsClicked;
|
||||
public event Action OnButtonQuitClicked;
|
||||
private void ButtonPlayClicked()
|
||||
{
|
||||
OnButtonPlayClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonSettingsClicked()
|
||||
{
|
||||
OnButtonSettingsClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonQuitClicked()
|
||||
{
|
||||
OnButtonQuitClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/MainMenu.cs.meta
Normal file
11
phr/StickGame/Assets/UI/MainMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35d097e843fd60b47bcf10596c6407a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
phr/StickGame/Assets/UI/MultiplayerDialog.cs
Normal file
56
phr/StickGame/Assets/UI/MultiplayerDialog.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class MultiplayerDialog : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<MultiplayerDialog> { }
|
||||
|
||||
const string defaultStyleSheetPath = "Default";
|
||||
const string styleSheetPath = "MultiplayerDialog";
|
||||
const string ussLabel = "Label";
|
||||
const string ussDialogContainer = "MultiplayerDialog";
|
||||
const string ussRetryButton = "RetryButton";
|
||||
const string ussOfflineButton = "RetryButton";
|
||||
public MultiplayerDialog()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(defaultStyleSheetPath));
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(styleSheetPath));
|
||||
|
||||
VisualElement dialogContainer = new VisualElement();
|
||||
dialogContainer.AddToClassList(ussDialogContainer);
|
||||
|
||||
Label label = new Label() { text = "OOPS! Steam initialization failed" };
|
||||
label.AddToClassList(ussLabel);
|
||||
dialogContainer.Add(label);
|
||||
|
||||
|
||||
Button retryButton = new AButton() { text = "Retry" };
|
||||
|
||||
retryButton.clicked += ButtonClickedRetry;
|
||||
retryButton.AddToClassList(ussRetryButton);
|
||||
Button offlineButton = new AButton() { text = "Play Local" };
|
||||
offlineButton.clicked += ButtonClickedOffline;
|
||||
offlineButton.AddToClassList(ussOfflineButton);
|
||||
|
||||
dialogContainer.Add(retryButton);
|
||||
dialogContainer.Add(offlineButton);
|
||||
|
||||
Add(dialogContainer);
|
||||
}
|
||||
|
||||
public event Action ClickedRetry;
|
||||
public event Action ClickedOffline;
|
||||
private void ButtonClickedRetry()
|
||||
{
|
||||
}
|
||||
|
||||
private void ButtonClickedOffline()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/MultiplayerDialog.cs.meta
Normal file
11
phr/StickGame/Assets/UI/MultiplayerDialog.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c1f19970ffe80a49991a0cf7d96af1d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
phr/StickGame/Assets/UI/Panel Settings.asset
Normal file
38
phr/StickGame/Assets/UI/Panel Settings.asset
Normal file
@@ -0,0 +1,38 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: Panel Settings
|
||||
m_EditorClassIdentifier:
|
||||
themeUss: {fileID: -4733365628477956816, guid: 49216170c4cf7c943a6fd0d954be27f6, type: 3}
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_ScaleMode: 1
|
||||
m_ReferenceSpritePixelsPerUnit: 150
|
||||
m_Scale: 1
|
||||
m_ReferenceDpi: 50
|
||||
m_FallbackDpi: 96
|
||||
m_ReferenceResolution: {x: 1200, y: 800}
|
||||
m_ScreenMatchMode: 0
|
||||
m_Match: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
m_ClearDepthStencil: 1
|
||||
m_ClearColor: 0
|
||||
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_DynamicAtlasSettings:
|
||||
m_MinAtlasSize: 64
|
||||
m_MaxAtlasSize: 4096
|
||||
m_MaxSubTextureSize: 64
|
||||
m_ActiveFilters: -1
|
||||
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
|
||||
textSettings: {fileID: 0}
|
||||
8
phr/StickGame/Assets/UI/Panel Settings.asset.meta
Normal file
8
phr/StickGame/Assets/UI/Panel Settings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86c134f241755d8479edf9c87edd1b3f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
phr/StickGame/Assets/UI/PlayButton.cs
Normal file
27
phr/StickGame/Assets/UI/PlayButton.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class PlayButton : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<PlayButton> { }
|
||||
|
||||
const string styleSheetPath = "Default";
|
||||
const string ussActionButton = "PlayButton";
|
||||
public PlayButton()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(styleSheetPath));
|
||||
AddToClassList(ussActionButton);
|
||||
Button actionButton = new Button() { text = "Play" };
|
||||
actionButton.clicked += ActionButtonClicked;
|
||||
Add(actionButton);
|
||||
}
|
||||
|
||||
private void ActionButtonClicked()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/PlayButton.cs.meta
Normal file
11
phr/StickGame/Assets/UI/PlayButton.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2be7ebbe57f9d414dbf346fe8e2e4afc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
phr/StickGame/Assets/UI/PopupWindow.cs
Normal file
64
phr/StickGame/Assets/UI/PopupWindow.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class Dialog : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<Dialog> { }
|
||||
|
||||
const string defaultStyleSheetPath = "Default";
|
||||
//const string ussLabel = "Label";
|
||||
const string ussDialogContainer = "Dialog";
|
||||
//const string ussRetryButton = "RetryButton";
|
||||
//const string ussOfflineButton = "RetryButton";
|
||||
|
||||
public Label label = new Label();
|
||||
public Button buttonOne = new AButton();
|
||||
public Button buttonTwo = new AButton();
|
||||
public Dialog()
|
||||
{
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(defaultStyleSheetPath));
|
||||
|
||||
VisualElement dialogContainer = new VisualElement();
|
||||
dialogContainer.AddToClassList(ussDialogContainer);
|
||||
|
||||
//Label label = new Label() { text = "OOPS! Steam initialization failed" };
|
||||
//label.AddToClassList(ussLabel);
|
||||
dialogContainer.Add(label);
|
||||
|
||||
|
||||
//Button retryButton = new AButton() { text = "Retry" };
|
||||
|
||||
//retryButton.clicked += ButtonClickedRetry;
|
||||
//retryButton.AddToClassList(ussRetryButton);
|
||||
//Button offlineButton = new AButton() { text = "Play Local" };
|
||||
//offlineButton.clicked += ButtonClickedOffline;
|
||||
//offlineButton.AddToClassList(ussOfflineButton);
|
||||
|
||||
//dialogContainer.Add(retryButton);
|
||||
//dialogContainer.Add(offlineButton);
|
||||
|
||||
buttonOne.clicked += ButtonOneClicked;
|
||||
buttonTwo.clicked += ButtonTwoClicked;
|
||||
dialogContainer.Add(buttonOne);
|
||||
dialogContainer.Add(buttonTwo);
|
||||
|
||||
Add(dialogContainer);
|
||||
}
|
||||
|
||||
public event Action ButOneClicked;
|
||||
public event Action ButTwoClicked;
|
||||
private void ButtonOneClicked()
|
||||
{
|
||||
ButOneClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void ButtonTwoClicked()
|
||||
{
|
||||
ButTwoClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/PopupWindow.cs.meta
Normal file
11
phr/StickGame/Assets/UI/PopupWindow.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39b61d32bb99d244587b07f5b1e56eba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
87
phr/StickGame/Assets/UI/SettingsMenu.cs
Normal file
87
phr/StickGame/Assets/UI/SettingsMenu.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class SettingsMenu : VisualElement
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<SettingsMenu> { }
|
||||
|
||||
const string defaultStyleSheetPath = "Default";
|
||||
const string ussMenuContainer = "SettingsContainer";
|
||||
|
||||
|
||||
Resolution[] resolutions;
|
||||
public DropdownField dropdownFieldRes;
|
||||
public DropdownField dropdownFieldScreenMode = new DropdownField("Screen Mode", new List<string>() { "Windowed", "Fullscreen" }, 0);
|
||||
public Slider sliderMaster = new Slider { label = "Master Volume", lowValue = 0f, highValue = 200f, value = 100f };
|
||||
public Button buttonBack = new AButton() { text = "Back" };
|
||||
public SettingsMenu()
|
||||
{
|
||||
// Resolutions dropdown
|
||||
|
||||
resolutions = Screen.resolutions;
|
||||
List<string> options = new List<string>();
|
||||
|
||||
int currentResIndex = 0;
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
string option = resolutions[(resolutions.Length - 1) - i].width + "x" + resolutions[(resolutions.Length - 1) - i].height;
|
||||
options.Add(option);
|
||||
if (resolutions[(resolutions.Length - 1) - i].width == Screen.currentResolution.width && resolutions[(resolutions.Length - 1) - i].height == Screen.currentResolution.height) {
|
||||
currentResIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
dropdownFieldRes = new DropdownField("Resolutions", options, 0);
|
||||
dropdownFieldRes.index = currentResIndex;
|
||||
styleSheets.Add(Resources.Load<StyleSheet>(defaultStyleSheetPath));
|
||||
|
||||
VisualElement menuContainer = new VisualElement();
|
||||
menuContainer.AddToClassList(ussMenuContainer);
|
||||
|
||||
dropdownFieldRes.RegisterValueChangedCallback(evt => DropDownChangedRes());
|
||||
dropdownFieldScreenMode.RegisterValueChangedCallback(evt => DropDownChangedScreen()); ;
|
||||
sliderMaster.RegisterValueChangedCallback(evt => SliderMasterValueChanged());
|
||||
buttonBack.clicked += ButtonBackClicked;
|
||||
|
||||
menuContainer.Add(dropdownFieldRes);
|
||||
menuContainer.Add(dropdownFieldScreenMode);
|
||||
menuContainer.Add(sliderMaster);
|
||||
menuContainer.Add(buttonBack);
|
||||
|
||||
Add(menuContainer);
|
||||
}
|
||||
|
||||
public event Action OnDropdownChangedResolution;
|
||||
public event Action OnDropdownChangedScreenMode;
|
||||
public event Action OnSliderMasterChanged;
|
||||
public event Action OnButtonBackClicked;
|
||||
|
||||
private void DropDownChangedRes()
|
||||
{
|
||||
OnDropdownChangedResolution?.Invoke();
|
||||
}
|
||||
|
||||
private void DropDownChangedScreen()
|
||||
{
|
||||
OnDropdownChangedScreenMode?.Invoke();
|
||||
}
|
||||
|
||||
private void SliderMasterValueChanged()
|
||||
{
|
||||
OnSliderMasterChanged?.Invoke();
|
||||
}
|
||||
|
||||
public float GetSliderMasterValue()
|
||||
{
|
||||
return (float)sliderMaster.value;
|
||||
}
|
||||
|
||||
private void ButtonBackClicked()
|
||||
{
|
||||
OnButtonBackClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
11
phr/StickGame/Assets/UI/SettingsMenu.cs.meta
Normal file
11
phr/StickGame/Assets/UI/SettingsMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bccd398c19764e48a48b794c3b701b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user