本文整理汇总了C#中GUIState类的典型用法代码示例。如果您正苦于以下问题:C# GUIState类的具体用法?C# GUIState怎么用?C# GUIState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUIState类属于命名空间,在下文中一共展示了GUIState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
void OnGUI()
{
if (Event.current.type == EventType.KeyDown) {
if (Event.current.keyCode == KeyCode.Escape) {
if (guiState != GUIState.None) {
guiState = GUIState.None;
Time.timeScale = 1;
}
else {
guiState = GUIState.Pause;
Time.timeScale = 0;
}
}
}
if (guiState != GUIState.None) {
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity,
new Vector3(Screen.width / trgtRes.x, Screen.height / trgtRes.y, 1));
GUI.skin = mSkin;
switch (guiState) {
case GUIState.Pause:
GUIStatePause();
break;
}
}
}
示例2: SetState
public static void SetState(GUIState state){
if (currentState != null) {
currentState.ExitState(state);
}
state.EnterState (currentState);
currentState=state;
}
示例3: CreateMenuWindow
void CreateMenuWindow(int windowID)
{
GUILayout.Label("Room name: ");
nwm.GameName = GUILayout.TextField(nwm.GameName, NetworkManager.MAX_NAME_LENGTH);
GUILayout.Label("Max players: " + nwm.MaxPlayers);
nwm.MaxPlayers = Mathf.RoundToInt(GUILayout.HorizontalSlider(nwm.MaxPlayers, 1, NetworkManager.MAX_CLIENTS));
if (GUILayout.Button("Create Game", GUILayout.Height(createButtonHeight)))
{
if (nwm.GameName != "")
{
PlayerPrefs.SetString("gameName", nwm.GameName);
PlayerPrefs.SetInt("maxPlayers", nwm.MaxPlayers);
nwm.StartServer();
}
else
{
displayInfo = "The room name cannot be left blank!";
gotoState = GUIState.CreateGame;
currentState = GUIState.DisplayInfo;
}
}
if (GUILayout.Button("Main Menu", GUILayout.Height(createButtonHeight)))
{
currentState = GUIState.MainMenu;
}
}
示例4: DisplayNewGUI
void DisplayNewGUI()
{
float halfWidth = Screen.width / 2;
float halfHeight = Screen.height / 2;
GUI.Box(new Rect (halfWidth - 150, halfHeight - 200, 300, 400),"Level Editor Settings");
GUI.Box(new Rect (halfWidth - 75, halfHeight - 100, 150, 200),"Size");
if(GUI.Button(new Rect(halfWidth - 50, halfHeight - 60, 100, 45), "Small\n(11x9)"))
{
CreateNewMap(11, 9);
}
if(GUI.Button(new Rect(halfWidth - 50, halfHeight - 10, 100, 45), "Medium\n(15x13)"))
{
CreateNewMap(15, 13);
}
if(GUI.Button(new Rect(halfWidth - 50, halfHeight + 40, 100, 45), "Large\n(21x15)"))
{
CreateNewMap(21, 15);
}
if(GUI.Button(new Rect(halfWidth - 75, halfHeight + 150, 150, 45), "Back"))
{
guiState = GUIState.Root;
}
}
示例5: SetState
public void SetState(GUIState state)
{
currentState = state;
if (state == GUIState.intro) {
titleScreen.enabled = pressStartText.enabled = whiteOverlay.enabled = true;
deathText.enabled = false;
pauseMenu.SetActive(false);
}
else if (state == GUIState.normal) {
titleScreen.enabled = false;
pressStartText.enabled = false;
whiteOverlay.enabled = false;
deathText.enabled = false;
pauseMenu.SetActive(false);
}
else if (state == GUIState.dead) {
titleScreen.enabled = false;
pressStartText.enabled = false;
whiteOverlay.enabled = false;
deathText.enabled = true;
pauseMenu.SetActive(false);
}
else if (state == GUIState.pause) {
titleScreen.enabled = false;
pressStartText.enabled = false;
whiteOverlay.enabled = false;
deathText.enabled = false;
pauseMenu.SetActive(true);
}
}
示例6: MainLogic
public MainLogic()
{
_currentState = GUIState.None;
_frames = new List<FrameInfo>();
_vertices = new List<VertexData>(10);
_ribs = new List<RibData>(10);
}
示例7: Start
void Start()
{
lastTime = Time.realtimeSinceStartup;
availableStates[State.NORMAL] = new GUIStatePlayerNormal(this);
availableStates[State.INVENTORY] = new GUIStatePlayerInventory(this);
state = State.NORMAL;
activeGUIState = availableStates[State.NORMAL];
activeGUIState.OnActivated();
}
示例8: setGUIState
public void setGUIState(GUIState gs)
{
guiState = gs;
if(guiState == GUIState.HIDDEN)
{
showInfoButton(true);
}
else
{
showInfoButton(false);
}
}
示例9: SetSubGUIState
public void SetSubGUIState(GUIState guiState)
{
if (_current_sub_gui_state != null)
{
_current_sub_gui_state.State_End();
_current_sub_gui_state.enabled = false;
}
_current_sub_gui_state = guiState;
_current_sub_gui_state.State_Start();
_current_sub_gui_state.enabled = true;
}
示例10: CreateNewMap
void CreateNewMap(int width, int height)
{
map.width = width;
map.height = height;
map.enabled = true;
guiState = GUIState.Editor;
map.Populate(TileObject.Grid);
// foreach(GameObject go in map.tileObjects.Values)
// {
// go.AddComponent<EditorObject>();
// }
}
示例11: ShowEndOfGameReport
public GUIResult ShowEndOfGameReport(EndOfGameInfo info, float displayTimeSpan)
{
if (guiState != GUIState.EndOfGameReport)
{
endOfGameInfo = info;
endOfGameStartTime = Time.time;
endOfGameDisplayTimeSpan = displayTimeSpan;
guiState = GUIState.EndOfGameReport;
guiResult = GUIResult.NotStarted;
}
return guiResult;
}
示例12: OnGUI
void OnGUI()
{
GUI.skin = TracySkin;
switch (guiState)
{
case GUIState.Menu:
GUI.Box(new Rect(0, 0, Screen.width, Screen.height / 2), TracyDick);
GUI.backgroundColor = Color.black;
if (GUI.Button(new Rect(0, Screen.height - screenHeight, 200, 50), "Rules"))
{
guiState = GUIState.Rules;
}
if (GUI.Button(new Rect(Screen.width / 2 - 200, Screen.height - screenHeight, 200, 50), "Play"))
{
ShowBlack = true;
OnItSound();
guiState = GUIState.Main;
Invoke("LoadNextLevel", 2f);
}
if (GUI.Button(new Rect(Screen.width / 2 + 100, Screen.height - screenHeight, 200, 50), "Credits"))
{
guiState = GUIState.Credits;
}
if (GUI.Button(new Rect(Screen.width - 200, Screen.height - screenHeight, 200, 50), "Quit"))
{
Application.Quit();
}
break;
case GUIState.Credits:
foreach(string credit in Credits)
{
GUI.Label(new Rect(0, 200, 500, 50), credit);
}
GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height / 2 + 200, 300, 100), "Programming - Will Foldi", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height / 2 + 250, 300, 100), "Sound - Jim Welch", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height / 2 + 300, 300, 100), "Art - Young Wang", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 - 130, Screen.height / 2 + 200, 300, 100), "Art - Nasser Elsamadisy", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 - 130, Screen.height / 2 + 250, 300, 100), "Writing - Christi Heiskell", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 - 130, Screen.height / 2 + 300, 300, 100), "Voice Acting - Adrienne Welch", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 + 195, Screen.height / 2 + 200, 300, 100), "Art - Andrew Shirk", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 + 195, Screen.height / 2 + 250, 300, 100), "Art - Brandon Shirk", "CreditGUI");
GUI.Label(new Rect(Screen.width / 2 + 195, Screen.height / 2 + 300, 300, 100), "Art - Adam Zaelit", "CreditGUI");
break;
}
}
示例13: ShipTileClicked
public void ShipTileClicked(ShipTile shiptile) {
/* Called when a ShipTile is clicked by the player.
If the state is 'playing', ignore this.
If the state is 'constructing', set state to 'editing' and create an editor context.
If the state is 'editing', something went wrong; that shouldn't ever happen.
*/
if (guistate == GUIState.playing) {
return;
} else if (guistate == GUIState.constructing) {
guistate = GUIState.editing;
menu = shiptile.AttachEditorContextMenu();
ShipTileEditor.main.SetConstructableTileVisibility(false);
} else if (guistate == GUIState.editing) {
throw new Exception("ShipTile clicked during 'editing' phase; this shouldn't happen.");
}
}
示例14: BaseGUI
void BaseGUI ()
{
if (GUILayout.Button(new GUIContent("Record Logs", logsTooltip))) {
LumosDiagnosticsDemo.RecordLogs();
}
if (GUILayout.Button(new GUIContent("Show Feedback Window", feedbackTooltip))) {
state = GUIState.DefaultFeedback;
LumosFeedbackGUI.ShowDialog();
}
if (GUILayout.Button(new GUIContent("Show Custom Feedback Window", customFeedbackTooltip))) {
state = GUIState.CustomFeedback;
var margin = 10;
windowRect = new Rect(margin, margin, Screen.width - (2 * margin), Screen.height - (2 * margin));
}
}
示例15: ToggleEditState
public void ToggleEditState() {
/* Called when a ShipTile is clicked by the player.
If the state is 'playing', set state to 'constructing' and show construction GUI elements.
If the state is 'constructing', set state to 'playing' and hide construction GUI elements.
If the state is 'editing', something went wrong; that shouldn't ever happen.
*/
switch (guistate) {
case GUIState.constructing:
guistate = GUIState.playing;
break;
case GUIState.playing:
guistate = GUIState.constructing;
break;
case GUIState.editing:
throw new Exception("GUIState toggled during editing mode! This shouldn't happen.");
}
}