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(); } }
public override void OnEndDrag() { if (DragSuccessful() == 0) { int chosenRow = 0; int tablePos = playerOwner.playerView.frontRowView.BoardPositionForNewCard(Camera.main.ScreenToWorldPoint( new Vector3(Input.mousePosition.x, Input.mousePosition.y, transform.position.z - Camera.main.transform.position.z)).x); playerOwner.PlayCardFromHand(GetComponent <IDHolder>().UniqueID, chosenRow, tablePos); } else if (DragSuccessful() == 1) { int chosenRow = 1; int tablePos = playerOwner.playerView.backRowView.TablePositionForNewCard(Camera.main.ScreenToWorldPoint( new Vector3(Input.mousePosition.x, Input.mousePosition.y, transform.position.z - Camera.main.transform.position.z)).x); playerOwner.PlayCardFromHand(GetComponent <IDHolder>().UniqueID, chosenRow, tablePos); } else { // Set old sorting order whereIsCard.SetHandSortingOrder(); whereIsCard.VisualState = tempState; // Move this card back to its slot position HandView PlayerHand = playerOwner.playerView.handView; Vector3 oldCardPos = PlayerHand.slots.Children[savedHandSlot].transform.localPosition; transform.DOLocalMove(oldCardPos, 1f); } }
public MatchViewManager() { FieldView = UiViewHandler.Handler.InstantiateUiView <FieldView>("Field"); HandView = UiViewHandler.Handler.InstantiateUiView <HandView>("Hand"); StartListening(); }
public void Initialize(HandView HandRef, BoardView BoardRef, DiscardSectionView DiscardSectionRef) { HandCached = HandRef; BoardCached = BoardRef; DiscardSectionCached = DiscardSectionRef; BattleSystem.Get().OnDrawCards += DrawCards; BattleSystem.Get().OnDiscardAllCardsFromTimeline += DiscardAllCardsFromTimeline; BattleSystem.Get().OnEnemyChanged += RegenerateBoard; BattleSystem.Get().OnDiscardCardsFromDiscardSection += DiscardCardsFromDiscardSection; }
public BlackJack() { _BJHit = new BJHit(this); _BJStand = new BJStand(this); _BJBet = new BJBet(this); _BJSplit = new BJSplit(this); _game_loop_context = new BJLoopContext(ref _state, new BJInit()); _hand1 = new HandView(GameState.Players[0]); _hand2 = new HandView(GameState.Players[1]); _dealerhand = new DealerView(GameState.Dealer); }
public void Initialize() { _gameDeck = Deck.CreateFullDeck(); OkeyTile = _gameDeck.GetRandom(); CurrentHand = CreateHand(); _currentHandView = _handPool.Spawn(); _currentHandView.transform.SetParent(_container); _currentHandView.Setup(CurrentHand); _currentHandView.PlayDistributeAnimation(); _signalBus.TryFire(new BoardCreatedSignal(OkeyTile)); }
void ReleaseDesignerOutlets() { if (BonusButton != null) { BonusButton.Dispose(); BonusButton = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (HandLabel != null) { HandLabel.Dispose(); HandLabel = null; } if (HandView != null) { HandView.Dispose(); HandView = null; } if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } if (NameView != null) { NameView.Dispose(); NameView = null; } if (SpecialButton != null) { SpecialButton.Dispose(); SpecialButton = null; } }
public override void ExecuteCommand() { CardOnBoardController newCardOnBoard = new CardOnBoardController(Player, Card.cardAsset); Player.PlayerHealth += newCardOnBoard.cardAsset.cardHealth; if (ChosenRow == 0) { Player.frontRow.CardsOnFrontRow.Insert(RowPosition, newCardOnBoard); } else { Player.backRow.CardsOnBackRow.Insert(RowPosition, newCardOnBoard); } if (newCardOnBoard.abilityToBeExecuted != null) { newCardOnBoard.abilityToBeExecuted.WhenCardPlayed(); } Player.hand.CardsInHand.Remove(Card); if (GameManager.IsHeadlessMode == false) { HandView PlayerHand = Player.playerView.handView; GameObject card = IDHolder.GetGameObjectWithID(Card.ID); PlayerHand.RemoveCard(card); HoverPreview.PreviewsAllowed = true; if (ChosenRow == 0) { Player.playerView.frontRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition); } else { Player.playerView.backRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition); } newCardOnBoard.cardOwner.playerView.playerHealth.playerHealth.text = newCardOnBoard.cardOwner.PlayerHealth.ToString(); new DestroyObjectCommand(card).AddToQueue(); } CommandExecutionComplete(); }
//TODO: Some behaviours can move to PileController protected virtual void CollectCard(Card card) { Hand hand = Player.Hand; HandView handView = PlayerView.HandView; Pile pile = pileController.Pile; hand.Remove(card); handView.RemoveCard(card); if (pile.CanCollected(card)) { Player.CollectedCards += pile.Count; byte collectScore = pileController.Collect(card); AddScore(collectScore); } else { pileController.AddCard(card); } pile.IsBusy = false; GameManager.Instance.NextTurn(); }
public BattleCardsControlStrategy(HandView HandRef, BoardView BoardRef) : base(HandRef, BoardRef) { }
public CardsControlStrategyBase(HandView HandRef, BoardView BoardRef) { HandCached = HandRef; BoardCached = BoardRef; }
public DiscardCardsControlStrategy(HandView HandRef, BoardView BoardRef, DiscardSectionView DiscardSectionRef) : base(HandRef, BoardRef) { DiscardSectionCached = DiscardSectionRef; }