76 lines
1.9 KiB
C#
76 lines
1.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
public class ClientGameSceneController : MonoBehaviour
|
|
{
|
|
public static ClientGameSceneController Instance;
|
|
|
|
public Button goTalkingButton;
|
|
public Button goTypingButton;
|
|
public Button goSticksButton;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
if (goTalkingButton)
|
|
{
|
|
goTalkingButton.onClick.AddListener(goTalkingButton_onClicked);
|
|
}
|
|
if (goTypingButton)
|
|
{
|
|
goTypingButton.onClick.AddListener(goTypingButton_onClicked);
|
|
}
|
|
if (goSticksButton)
|
|
{
|
|
goSticksButton.onClick.AddListener(goSticksButton_onClicked);
|
|
}
|
|
}
|
|
|
|
private void goSticksButton_onClicked()
|
|
{
|
|
if(ClientMessageHandler.Instance)
|
|
{
|
|
ClientMessageHandler.Instance.SendMessageToServer("gameOpen", "sticks");
|
|
}
|
|
StartCoroutine(LoadNextScene("ClientGameSticksScene"));
|
|
}
|
|
|
|
private void goTypingButton_onClicked()
|
|
{
|
|
if (ClientMessageHandler.Instance)
|
|
{
|
|
ClientMessageHandler.Instance.SendMessageToServer("gameOpen", "typing");
|
|
}
|
|
StartCoroutine(LoadNextScene("ClientGameTypingScene"));
|
|
}
|
|
|
|
private void goTalkingButton_onClicked()
|
|
{
|
|
if (ClientMessageHandler.Instance)
|
|
{
|
|
ClientMessageHandler.Instance.SendMessageToServer("gameOpen", "talking");
|
|
}
|
|
StartCoroutine(LoadNextScene("ClientGameTalkingScene"));
|
|
}
|
|
|
|
IEnumerator LoadNextScene(string sceneName)
|
|
{
|
|
yield return new WaitForSeconds(0f);
|
|
SceneManager.LoadScene(sceneName);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|