예제 #1
0
    /// <summary>
    /// syoki settei
    /// send
    /// </summary>
    void SendPrepareGame()
    {
        RequestPrepareGame param = new RequestPrepareGame();

        param.game_id = PlayerSession.game_id;

        param.piece_preparations = new List <PiecePreparationInfo>();
        int i = 0;

        foreach (CoinPlaceController coinPlace in BoardPanelController.GetCoinPlaceControllers())
        {
            string width_str  = "" + coinPlace.width_id + "";
            string height_str = "" + coinPlace.height_id + "";

            if (Regex.IsMatch(width_str, "[3456]") && Regex.IsMatch(height_str, "[12]"))
            {
                PiecePreparationInfo temp = new PiecePreparationInfo();

                temp.point_x = coinPlace.width_id - 1;
                temp.point_y = coinPlace.height_id;
                if (!is_first)
                {
                    switch (temp.point_x)
                    {
                    case 2: temp.point_x = 5; break;

                    case 3: temp.point_x = 4; break;

                    case 4: temp.point_x = 3; break;

                    case 5: temp.point_x = 2; break;
                    }
                    if (temp.point_y == 1)
                    {
                        temp.point_y = 6;
                    }
                    else
                    {
                        temp.point_y = 5;
                    }
                }
                temp.kind = coinPlace.Kind();

                // Debug.Log("x: " + temp.point_x + ", y: " + temp.point_y + ", kind: " + temp.kind);
                param.piece_preparations.Add(temp);
            }
        }
        Debug.Log(param.piece_preparations);
        ApiClient.Instance.ResponsePrepareGame = ResponsePrepareGame;
        ApiClient.Instance.RequestPrepareGame(param);
    }
예제 #2
0
    // ------------------------------------------------
    // コマの初期情報送信
    // ------------------------------------------------
    void PostInitPieces()
    {
        ApiClient.Instance.ResponsePrepareGame = ResponsePrepareGame;
        var param = new RequestPrepareGame();

        param.game_id            = UserInfo.game_id;
        param.piece_preparations = new List <PiecePreparationInfo>();

        var pieces = Utility.GetPieceInfo();

        foreach (var piece in pieces)
        {
            PiecePreparationInfo info = new PiecePreparationInfo();
            PieceInfo            p    = piece.GetComponent <Piece>().info;
            info.point_y = p.point_y;
            info.point_x = p.point_x;
            info.kind    = p.kind;

            param.piece_preparations.Add(info);
        }

        ApiClient.Instance.RequestPrepareGame(param);
    }