Exemplo n.º 1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 2
0
    void GameStart()
    {
        ShogiNetwork network = ShogiNetwork.Instance;

        network.GetUserInfo(me.PlayId, ParseUserInfo);
        StartCoroutine(GameLoopCoroutine());
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        Button       button = GetComponent <Button> ();
        ShogiNetwork net    = ShogiNetwork.Instance;

        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(() => net.LeaveRoom());
    }
Exemplo n.º 4
0
    // 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));
    }
Exemplo n.º 5
0
    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();
    }
Exemplo n.º 6
0
    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));
            }
        }
    }
Exemplo n.º 7
0
 void Awake()
 {
     if (instance == null)
         instance = this;
 }