Added continue menu
This commit is contained in:
parent
586098b3cf
commit
44fb498e99
11 changed files with 3392 additions and 1 deletions
|
@ -19,6 +19,7 @@ public class GameBoardInstance : MonoBehaviour {
|
|||
}
|
||||
|
||||
public void SetupGame(){
|
||||
|
||||
if (NetworkManager.inRoom){
|
||||
var players = NetworkManager.net.CurrentRoom.Players.Values.OrderBy(p => p.ID);
|
||||
var p1 = players.ElementAt(0);
|
||||
|
|
15
Assets/RealCode/Menu/ButtonS/ButtonContinueOption.cs
Normal file
15
Assets/RealCode/Menu/ButtonS/ButtonContinueOption.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ButtonContinueOption : ButtonOnClick {
|
||||
|
||||
public int option;
|
||||
|
||||
public override void OnClick() {
|
||||
if (GameTransition.Instance.state == GameState.Continue){
|
||||
Rematch.Instance.SelectOption(option);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Assets/RealCode/Menu/ButtonS/ButtonContinueOption.cs.meta
Normal file
11
Assets/RealCode/Menu/ButtonS/ButtonContinueOption.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 22272928c157b2445b238da54d3d2d59
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load diff
|
@ -58,7 +58,7 @@ public class LobbySetup : MonoBehaviour {
|
|||
GameBoardInstance.instance.player2.authorityID = p2.ID;
|
||||
}
|
||||
var pready = PlayerProperties.lobbyStatus.Get(p2);
|
||||
readyCheck2.localRotation = Quaternion.RotateTowards(readyCheck1.localRotation, pready ? Quaternion.identity : Quaternion.Euler(0f, 0f, 45f), delta);
|
||||
readyCheck2.localRotation = Quaternion.RotateTowards(readyCheck2.localRotation, pready ? Quaternion.identity : Quaternion.Euler(0f, 0f, 45f), delta);
|
||||
readyImage2.color = pready ? Color.green : Color.red;
|
||||
} else {
|
||||
GameBoardInstance.instance.player2.authorityID = -1;
|
||||
|
|
54
Assets/RealCode/Menu/Rematch.cs
Normal file
54
Assets/RealCode/Menu/Rematch.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class Rematch : MonoBehaviour {
|
||||
|
||||
public static Rematch Instance { get; private set; }
|
||||
|
||||
public GameObject[] buttons;
|
||||
public TextMeshProUGUI continueTextMesh;
|
||||
public string continueKey, waitKey;
|
||||
|
||||
public Image continueBar;
|
||||
public float continueDuration = 10f;
|
||||
private float continueTime;
|
||||
|
||||
private void Awake() {
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (GameTransition.Instance.state == GameState.Continue){
|
||||
var delta = Mathf.Clamp01(1f - (Time.time - continueTime) / continueDuration);
|
||||
|
||||
continueBar.fillAmount = delta;
|
||||
|
||||
if (delta <= 0f && PlayerProperties.playerResponse.GetLocal() == -1){
|
||||
PlayerProperties.playerResponse.SetLocal(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Setup(){
|
||||
foreach(var b in buttons){
|
||||
b.SetActive(true);
|
||||
}
|
||||
|
||||
continueTextMesh.text = Localization.GetString(continueKey);
|
||||
continueBar.fillAmount = 1f;
|
||||
continueTime = Time.time;
|
||||
}
|
||||
|
||||
public void SelectOption(int i){
|
||||
PlayerProperties.playerResponse.SetLocal(i);
|
||||
foreach(var b in buttons){
|
||||
b.SetActive(false);
|
||||
}
|
||||
|
||||
continueTextMesh.text = Localization.GetString(waitKey);
|
||||
}
|
||||
|
||||
}
|
11
Assets/RealCode/Menu/Rematch.cs.meta
Normal file
11
Assets/RealCode/Menu/Rematch.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23ed198f9b5a8df43ad32d56ca6bd311
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue