privatevoidOnGUI() { var labelWidth = 600f; var labelHeight = 100f; var labelSize = new Vector2(labelWidth, labelHeight); var labelPosition = new Vector2(Screen.width - labelWidth, Screen.height - labelHeight)*0.5f; var labelRect = new Rect(labelPosition, labelSize); GUI.Label(labelRect,"ShootingEditor2D",mLableStyle.Value);
var buttonWidth = 300f; var buttonHeight = 100f; var buttonSize = new Vector2(buttonWidth, buttonHeight); var buttonPosition = new Vector2(Screen.width - buttonWidth, Screen.height - buttonHeight) * 0.5f + Vector2.up * 150f; var buttonRect = new Rect(buttonPosition, buttonSize); if (GUI.Button(buttonRect, "开始游戏", mButtonStyle.Value)) { SceneManager.LoadSceneAsync("SampleScene"); } } } }
privatevoidOnGUI() { var labelWidth = 600f; var labelHeight = 100f; var labelSize = new Vector2(labelWidth, labelHeight); var labelPosition = new Vector2(Screen.width - labelWidth, Screen.height - labelHeight)*0.5f; var labelRect = new Rect(labelPosition, labelSize); GUI.Label(labelRect,"游戏结束",mLableStyle.Value);
var buttonWidth = 300f; var buttonHeight = 100f; var buttonSize = new Vector2(buttonWidth, buttonHeight); var buttonPosition = new Vector2(Screen.width - buttonWidth, Screen.height - buttonHeight) * 0.5f + Vector2.up * 150f; var buttonRect = new Rect(buttonPosition, buttonSize); if (GUI.Button(buttonRect, "回到首页", mButtonStyle.Value)) { SceneManager.LoadSceneAsync("GameStart"); } } } }