Esempio n. 1
0
        public void CreateHands()
        {
            if (!_hands.IsEmpty())
            {
                return;
            }

            Setup();

            int handIdWithExtraTile = Random.Range(0, _handCount);

            _indicatorTileView = _tileViewPoolManager.Spawn(_indicatorTileContainer);
            _indicatorTileView.Initialize(_okeyTile);
            _indicatorTileView.Setup();

            for (int i = 0; i < _handCount; i++)
            {
                Hand hand = new Hand(i, GetHandTiles(handIdWithExtraTile == i ? HandDefaultTileCount + 1 : HandDefaultTileCount));
                _hands.Add(hand);

                HandView handView = _handViewPoolManager.Spawn(_boardContainer);
                _currentHandViews.Add(handView);
                _handGridLayoutGroup.AddChild(handView.gameObject);
                handView.Initialize(hand, _tileViewPoolManager);
                handView.Setup();
            }
        }
Esempio n. 2
0
        public void Setup()
        {
            _handId.text = $"Hand Id:{_hand.Id}";

            for (int i = 0; i < _hand.Tiles.Count; i++)
            {
                TileView tileView = _tileViewPoolManager.Spawn();
                tileView.Initialize(_hand.Tiles[i]);
                tileView.Setup();
                _instantiatedTileViews.Add(tileView);
                _gridLayoutGroup.AddChild(tileView.gameObject);
            }

            gameObject.SetActive(true);
        }