void Awake() { if (instance == null) { instance = this; } }
void GameStart() { ShogiNetwork network = ShogiNetwork.Instance; network.GetUserInfo(me.PlayId, ParseUserInfo); StartCoroutine(GameLoopCoroutine()); }
// Use this for initialization void Start() { Button button = GetComponent <Button> (); ShogiNetwork net = ShogiNetwork.Instance; button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => net.LeaveRoom()); }
// Use this for initialization void Start() { Button button = GetComponent <Button> (); ShogiNetwork net = ShogiNetwork.Instance; button.onClick.RemoveAllListeners(); //button.onClick.AddListener (() => Debug.Log("hoge")); button.onClick.AddListener(() => net.JoinRoom(controller)); }
IEnumerator WaitForPlayer() { int level = Application.loadedLevel; ShogiNetwork network = ShogiNetwork.Instance; while (me.GetState() != UserInfo.State.Playing) { network.GetRoomState(me.PlayId, ParseRoomState); yield return(new WaitForSeconds(1f)); } while (Application.loadedLevel == level) { yield return(null); } GameStart(); }
IEnumerator GameLoopCoroutine() { while (first == null || last == null) { yield return(null); } isGameFinish = false; isTurnChanged = true; ShogiNetwork network = ShogiNetwork.Instance; PieceController controller = PieceController.Instance; controller.Init(); History history = History.Instance; history.Init(); bool isPlayer = me.GetRole() == UserInfo.Role.Player; while (!IsGameFinish) { if (isPlayer) { if ((!PromotionWindow.IsShowing) && isTurnChanged) { network.GetPiecesInfo(me.PlayId, ParsePieces); isTurnChanged = false; } network.GetBattleInfo(me.PlayId, ParseBattleInfo); yield return(new WaitForSeconds(1f)); } else { network.GetPiecesInfo(me.PlayId, ParsePieces); network.GetBattleInfo(me.PlayId, ParseBattleInfo); yield return(new WaitForSeconds(1f)); } } }
void Awake() { if (instance == null) instance = this; }