-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ゲーム終了画面の実装とバグ修正
- Loading branch information
Showing
12 changed files
with
1,475 additions
and
34 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using Cysharp.Threading.Tasks; | ||
using TMPro; | ||
using UnityEngine; | ||
using UnityEngine.SceneManagement; | ||
using UnityEngine.UI; | ||
|
||
namespace HackathonA | ||
{ | ||
|
||
public class ResultUIManager : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private TextMeshProUGUI resultText; | ||
[SerializeField] | ||
private Button restartButton; | ||
[SerializeField] | ||
private Button quitButton; | ||
// Start is called before the first frame update | ||
void Start() | ||
{ | ||
resultText.SetText(PlayerPrefs.GetInt("result") switch | ||
{ | ||
-1 => "Playerの負け", | ||
1 => "Playerの勝ち", | ||
_ => "Error" | ||
}); | ||
restartButton.onClick.AddListener(() => ButtonClicked(0).Forget()); | ||
quitButton.onClick.AddListener(() => ButtonClicked(1).Forget()); | ||
} | ||
|
||
private async UniTaskVoid ButtonClicked(int buttonId) | ||
{ | ||
if(buttonId == 0) | ||
{ | ||
await SceanLoadCoroutine(LoadSceneMode.Single, 0f).ToUniTask(); | ||
} | ||
else if(buttonId == 1) | ||
{ | ||
#if UNITY_EDITOR | ||
UnityEditor.EditorApplication.isPlaying = false; | ||
#else | ||
Application.Quit(); | ||
#endif | ||
} | ||
} | ||
|
||
internal IEnumerator SceanLoadCoroutine(LoadSceneMode sceneMode, float i_waitTime) | ||
{ | ||
var ao = SceneManager.LoadSceneAsync("BattleScene", sceneMode); | ||
if (i_waitTime > 0.0f) | ||
{ | ||
ao.allowSceneActivation = false; | ||
yield return new WaitForSeconds(i_waitTime); | ||
ao.allowSceneActivation = true; | ||
} | ||
yield return ao; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters