예제 #1
0
 /// <summary>
 /// 全てのパネルの着色を消す
 /// </summary>
 public void DeleteHoverSetPlace()
 {
     foreach (Transform CoinPlace in transform)
     {
         CoinPlaceController CoinPlaceController = CoinPlace.gameObject.GetComponent <CoinPlaceController>();
         CoinPlace.gameObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 0f);
     }
 }
예제 #2
0
    /// <summary>
    /// 全てのパネルを返す
    /// </summary>
    /// <returns></returns>
    public List <CoinPlaceController> GetCoinPlaceControllers()
    {
        List <CoinPlaceController> res = new List <CoinPlaceController>();

        foreach (Transform CoinPlace in transform)
        {
            CoinPlaceController CoinPlaceController = CoinPlace.gameObject.GetComponent <CoinPlaceController>();
            res.Add(CoinPlaceController);
        }

        return(res);
    }
예제 #3
0
    public void UpdateCoinPanel(List <PieceInfo> pieces, bool is_player)
    {
        int user_id = PlayerSession.user_id;

        if (transform.childCount > 0)
        {
            foreach (Transform child in transform)
            {
                GameObject          go   = child.gameObject;
                CoinPlaceController coin = go.GetComponent <CoinPlaceController>();

                coin.piece_id          = 0;
                coin.is_myplayer_piece = false;
                coin.DeleteCoin();
            }
        }

        int counta = 0;

        foreach (PieceInfo piece in pieces)
        {
            if (!piece.captured)
            {
                continue;
            }
            if (piece.owner_user_id == user_id && !is_player)
            {
                continue;
            }
            if (piece.owner_user_id != user_id && is_player)
            {
                continue;
            }

            counta += 1;

            int width  = counta % 4;
            int height = counta / 4 + 1;

            GameObject go = transform.Find("coin_place_clone_" + height + "" + width).gameObject;

            CoinPlaceController init_coin = go.GetComponent <CoinPlaceController>();

            init_coin.piece_id          = piece.piece_id;
            init_coin.is_myplayer_piece = false;
            init_coin.UpdateCoinPlace(init_coin.CoinId(piece.kind));
        }
    }
예제 #4
0
    /// <summary>
    /// 初期配置できる範囲内のパネルを着色する
    /// </summary>
    public void HoverInitialiseSetPlace()
    {
        foreach (Transform CoinPlace in transform)
        {
            CoinPlaceController CoinPlaceController = CoinPlace.gameObject.GetComponent <CoinPlaceController>();

            string width_str  = "" + CoinPlaceController.width_id + "";
            string height_str = "" + CoinPlaceController.height_id + "";

            if (Regex.IsMatch(width_str, "[3456]") && Regex.IsMatch(height_str, "[12]"))
            {
                if (CoinPlaceController.coin_id == 0)
                {
                    CoinPlace.gameObject.GetComponent <Image>().color = new Color(0f, 1f, 0f, 100f / 255f);
                }
            }
        }
    }
예제 #5
0
    /// <summary>
    /// 初期配置がすべて完了してるかどうかを返す
    /// </summary>
    /// <returns></returns>
    public bool IsCompleteInitialiseSetPlace()
    {
        foreach (Transform CoinPlace in transform)
        {
            CoinPlaceController CoinPlaceController = CoinPlace.gameObject.GetComponent <CoinPlaceController>();

            string width_str  = "" + CoinPlaceController.width_id + "";
            string height_str = "" + CoinPlaceController.height_id + "";

            if (Regex.IsMatch(width_str, "[3456]") && Regex.IsMatch(height_str, "[12]"))
            {
                if (CoinPlaceController.coin_id == 0)
                {
                    return(false);
                }
            }
        }

        return(true);
    }
예제 #6
0
    public void InitialiseSetCoin()
    {
        foreach (Transform coin_place in transform)
        {
            CoinPlaceController coin_place_controller = coin_place.gameObject.GetComponent <CoinPlaceController>();

            if (coin_place_controller.panel_id == 2)
            {
                coin_place_controller.SetCoinUra();
            }
            else if (coin_place_controller.height_id == 1)
            {
                coin_place_controller.SetCoinGood();
            }
            else
            {
                coin_place_controller.SetCoinEvil();
            }
        }
    }
예제 #7
0
    public void UpdateCoinPanel(List <PieceInfo> pieces, bool is_first)
    {
        if (transform.childCount > 0)
        {
            foreach (Transform child in transform)
            {
                GameObject          go   = child.gameObject;
                CoinPlaceController coin = go.GetComponent <CoinPlaceController>();

                coin.piece_id          = 0;
                coin.is_myplayer_piece = false;
                coin.DeleteCoin();
            }
        }

        foreach (PieceInfo piece in pieces)
        {
            if (piece.captured)
            {
                continue;
            }

            int width  = piece.point_x + 1;
            int height = piece.point_y;

            if (!is_first)
            {
                width  = 9 - width;
                height = 7 - height;
            }

            Debug.Log("coin_place_clone_" + height + "" + width);
            GameObject go = transform.Find("coin_place_clone_" + height + "" + width).gameObject;

            CoinPlaceController init_coin = go.GetComponent <CoinPlaceController>();

            init_coin.piece_id          = piece.piece_id;
            init_coin.is_myplayer_piece = piece.kind != "unknown";
            init_coin.UpdateCoinPlace(init_coin.CoinId(piece.kind));
        }
    }
예제 #8
0
    // 移動の始点と終点のマスを取得して、プレイヤーやフェイズ、ターンに合わせて処理をする。
    public void SetCoinPlace(GameObject CoinPlaceObject)
    {
        // 以下の場合は操作不能とする
        // * マッチングできていない
        // * スタートしていない
        if (is_matching)
        {
            return;
        }
        if (game_status != "preparing" && !game_started)
        {
            return;
        }

        if (!is_start_set)
        {
            StartCoinPlace           = CoinPlaceObject;
            StartCoinPlaceController = StartCoinPlace.GetComponent <CoinPlaceController>();

            // コインがないマスを選択できないようにする
            if (StartCoinPlaceController.coin_id == 0)
            {
                return;
            }

            // 相手の手持ちのパネルを選択できないようにする
            if (StartCoinPlaceController.panel_id == 2)
            {
                return;
            }

            is_start_set = true;

            BoardPanelController.HoverInitialiseSetPlace();
        }
        else
        {
            EndCoinPlace           = CoinPlaceObject;
            EndCoinPlaceController = EndCoinPlace.GetComponent <CoinPlaceController>();

            is_start_set = false;

            BoardPanelController.DeleteHoverSetPlace();

            // フェイズ分岐
            switch (game_status)
            {
            case "preparing":
                // 重複が発生した場合、動作を行わない。
                if (CheckIsOverlap())
                {
                    return;
                }

                // 手持ちからボードに移す場合の条件処理
                if (CheckIsSendToBoard())
                {
                    return;
                }

                break;

            case "playing":
                // 自分自身のターンの場合の動作処理
                if (CheckIsMyselfTurn())
                {
                    return;
                }

                break;
            }
        }
    }