Пример #1
0
        public void CalculatePossibleWaitingTiles()
        {
            if (LocalPlayerHandTiles == null)
            {
                return;
            }
            if (!GameSetting.AllowHint)
            {
                PossibleWaitingTiles = null;
                return;
            }

            var handTiles = new List <Tile>(LocalPlayerHandTiles);
            var lastDraw  = GetLastDraw(0);

            PossibleWaitingTiles = MahjongLogic.DiscardForReady(LocalPlayerHandTiles, lastDraw);
            if (PossibleWaitingTiles == null)
            {
                Debug.Log("WaitingTiles: null");
            }
            else
            {
                Debug.Log(
                    $"WaitingTiles: {string.Join(";", PossibleWaitingTiles.Select(x => x.Key + ": " + string.Join(",", x.Value)))}");
            }
            NotifyObservers();
        }
Пример #2
0
    public static void TestDiscard()
    {
        var handTiles = new List <Tile> {
            new Tile(Suit.M, 1), new Tile(Suit.M, 2), new Tile(Suit.M, 3), new Tile(Suit.M, 4), new Tile(Suit.M, 4),
            new Tile(Suit.M, 5), new Tile(Suit.M, 5, true)
        };
        var dict = MahjongLogic.DiscardForReady(handTiles, new Tile(Suit.Z, 1));

        foreach (var item in dict)
        {
            Debug.Log($"{item.Key}, {string.Join(",", item.Value)}");
        }
    }