//-------------------------------------------------- #endregion MONOBEHAVIOUR #region PUBLIC METHODS //-------------------------------------------------- public void SwitchHandUI(HandUI uiElement) //-------------------------------------------------- { m_dataSelectorUI.SetActive(false); m_loadingUI.SetActive(false); m_mainUI.SetActive(false); switch (uiElement) { case HandUI.DATA_SELECTOR: m_dataSelectorUI.SetActive(true); if (!m_dataListInitialized) { // First time data list is initialized, // unable to select buttons until UI is // turned off and on again. GetComponentInParent <UIActivator>(). RefreshUI(); m_dataListInitialized = true; } break; case HandUI.LOADING: m_loadingUI.SetActive(true); break; case HandUI.MAIN_MENU: m_mainUI.SetActive(true); break; default: break; } }
/// <summary> /// /// Selects the card in hand /// /// </summary> public void SelectDisplay() { //Sets the card being selected to the opposite of its current state isSelected = !isSelected; //Moves the card in or out depending on its state MoveCard(isSelected); //Only shows the buttons if there is a card display object (not an upgrade display) if (CardDisplay != null) { if (GameManager.instance.CurrentGamePhase == GameManager.GamePhases.Gameplay) { buttonGroup.gameObject.SetActive(isSelected); } } //If the card is being selected, updates all other cards in hand to minimise if (isSelected) { HandUI.MinimiseNonSelectedCards(HandIndex); } //Hides the hand count area based on whether the card is selected or not HandUI.UpdateHandObjects(isSelected); }
/// <summary> /// 设置默认图标 /// </summary> public void SetNormalIcon() { if (HandUI == null) { return; } HandUI.SetNormalIcon(); }
/// <summary> /// 设置手势大小 /// </summary> /// <param name="icon"></param> /// <param name="size"></param> public void SetHandIcon(Sprite icon, Vector2?size = null) { if (HandUI == null) { return; } HandUI.SetHandIcon(icon, size); }
public override void OnEnter(GameWorld world) { handUI = GameObject.Find("Canvas").FindObject("HandUI"); handUIScript = handUI.GetComponent <HandUI>(); var cards = world.Deck.Draw(6); handUIScript.Draw(cards); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } HandUI = handUI; ScoreUI = scoreUI; GameOverUI = gameOverUI; TutorialUI = tutorialUI; }
public PokerMainView(IEventAggregator aggregator) { _aggregator = aggregator; _aggregator.Subscribe(this); _deckGPile = new BaseDeckXF <PokerCardInfo, ts, DeckOfCardsXF <PokerCardInfo> >(); StackLayout stack = new StackLayout(); stack.Children.Add(_deckGPile); _deckGPile.Margin = new Thickness(5, 5, 5, 5); _deckGPile.HorizontalOptions = LayoutOptions.Start; _deckGPile.VerticalOptions = LayoutOptions.Start; StackLayout otherStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; otherStack.Children.Add(_deckGPile); _bet = new BetUI(); _bet.Margin = new Thickness(40, 5, 10, 10); otherStack.Children.Add(_bet); var tempButton = GetSmallerButton("New Round", nameof(PokerMainViewModel.NewRoundAsync)); //maybe smallerbutton does not work //MakeGameButtonSmaller(tempButton); tempButton.HorizontalOptions = LayoutOptions.Start; tempButton.VerticalOptions = LayoutOptions.Start; otherStack.Children.Add(tempButton); SimpleLabelGridXF thisLabel = new SimpleLabelGridXF(); CurrencyConverter thisConvert = new CurrencyConverter(); thisLabel.AddRow("Money", nameof(PokerMainViewModel.Money), thisConvert); thisLabel.AddRow("Round", nameof(PokerMainViewModel.Round)); thisLabel.AddRow("Winnings", nameof(PokerMainViewModel.Winnings), thisConvert); thisLabel.AddRow("Hand", nameof(PokerMainViewModel.HandLabel)); stack.Children.Add(otherStack); stack.Children.Add(thisLabel.GetContent); _hand = new HandUI(_aggregator); _hand.Margin = new Thickness(5); stack.Children.Add(_hand); Content = stack; //if not doing this, rethink. }
// Use this for initialization void Start() { player = transform.parent.GetComponent <RpsHumanPlayer>(); if (!player.isLocalPlayer) { this.gameObject.SetActive(false); //Destroy(this.gameObject); return; } player.OnMatchRequest += DisplayMatchRequest; player.OnMatchStart += DisplayHumanMatchUI; player.OnMatchEnd += DisplayMatchResults; //TODO: //player.OnMatchRequestResponse += something player.OnObserveMatch += DisplayObservationMatch; matchResultAnimation = -1.0f; HandUI[] hands = this.GetComponentsInChildren <HandUI>(); foreach (HandUI h in hands) { if (h is HumanHandUI) { humanHand = h as HumanHandUI; humanHand.Initialize(player); } if (h.dir == Direction.North) { northHand = h; } else { southHand = h; } } humanHand.gameObject.SetActive(false); northHand.gameObject.SetActive(false); southHand.gameObject.SetActive(false); tableBackdropImage = this.transform.FindChild("TableBackdrop").GetComponent <Image>(); northHandLabels = this.transform.FindChild("NorthInfo").gameObject; southHandLabels = this.transform.FindChild("SouthInfo").gameObject; SetMatchUIActive(false); }
public PokerMainView(IEventAggregator aggregator) { _aggregator = aggregator; _aggregator.Subscribe(this); _deckGPile = new BaseDeckWPF <PokerCardInfo, ts, DeckOfCardsWPF <PokerCardInfo> >(); StackPanel stack = new StackPanel(); _deckGPile.Margin = new Thickness(5, 5, 5, 5); _deckGPile.HorizontalAlignment = HorizontalAlignment.Left; _deckGPile.VerticalAlignment = VerticalAlignment.Top; StackPanel otherStack = new StackPanel() { Orientation = Orientation.Horizontal }; otherStack.Children.Add(_deckGPile); _bet = new BetUI(); _bet.Margin = new Thickness(60, 5, 10, 10); otherStack.Children.Add(_bet); var tempButton = GetGamingButton("New Round", nameof(PokerMainViewModel.NewRoundAsync)); tempButton.HorizontalAlignment = HorizontalAlignment.Left; tempButton.VerticalAlignment = VerticalAlignment.Center; otherStack.Children.Add(tempButton); SimpleLabelGrid thisLabel = new SimpleLabelGrid(); CurrencyConverter thisConvert = new CurrencyConverter(); thisLabel.AddRow("Money", nameof(PokerMainViewModel.Money), thisConvert); thisLabel.AddRow("Round", nameof(PokerMainViewModel.Round)); thisLabel.AddRow("Winnings", nameof(PokerMainViewModel.Winnings), thisConvert); thisLabel.AddRow("Hand", nameof(PokerMainViewModel.HandLabel)); stack.Children.Add(otherStack); stack.Children.Add(thisLabel.GetContent); _hand = new HandUI(_aggregator); _hand.Margin = new Thickness(5); stack.Children.Add(_hand); Content = stack; //if not doing this, rethink. }
/// <summary> /// 每帧执行 /// </summary> /// <param name="inputPoint">输入端世界坐标值</param> public void OnUpdate(Vector3 inputPoint) { if (!isEnable) { return; } currentPoint = inputPoint; if (lastPoint == null) { lastPoint = currentPoint; } //移动坐标 if (HandUI != null) { HandUI.MoveHand(ScreenPoint); } //获取到射线 Ray ray = MUtility.ScreenPointToRay(ScreenPoint); Ray uiRay = MUtility.UIScreenPointToRay(ScreenPoint); //发送射线信息 EventHandRay.SendListener(ray, HandIndex); EventHandUIRay.SendListener(uiRay, HandIndex); EventHandRays.SendListener(ray, uiRay, HandIndex); //算直接坐标的插值 lerpPoint = currentPoint - lastPoint.Value; //记录上一帧 lastPoint = currentPoint; }
private void Start() { deck = GetComponent <Deck>(); handUI = GetComponentInChildren <HandUI>(); DrawStartingHand(); }
/// <summary> /// /// Initialise the container object for a card /// /// </summary> public void InitHandContainer <T>( HandUI _handUI, GameplayUI gameplayUI, int _handIndex, int playerIndex, T objectData, bool showCard, string containerName = "", float scalingFactor = defaultScalingFactor, bool cardMoveUpward = true, bool isRedeploy = false) { HandUI = _handUI; GameplayUI = gameplayUI; HandIndex = _handIndex; PlayerIndex = playerIndex; isSelected = false; CardMoveUpward = cardMoveUpward; IsRedeploy = isRedeploy; //Direction Mod is used to determine which way to move the card when it is clicked- varies depending on if the bar is at the top or bottom of the screen var directionMod = CardMoveUpward ? 1 : -1; buttonGroup.gameObject.transform.localPosition *= directionMod; buttonGroup.gameObject.SetActive(false); //transform.parent.gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(cardSizex * scalingFactor, cardSizey * scalingFactor); var type = typeof(T); switch (type) { case Type _ when type == typeof(Card): case Type _ when type == typeof(Unit): var card = (Card)(object)objectData; var newCardObj = GameManager.instance.libraryManager.CreateCardObject(card, cardParent.transform, scalingFactor); newCardObj.name = containerName; //Sibling Index is set to 1 so that it is set in the correct order of the marker and the back newCardObj.transform.SetSiblingIndex(1); CardDisplay = newCardObj.GetComponent <CardDisplay>(); DisplayObject = newCardObj; if (IsRedeploy) { redeployButtons.SetActive(true); playButtons.SetActive(false); } else { redeployButtons.SetActive(false); playButtons.SetActive(true); } break; case Type _ when type == typeof(UpgradeData): var upgradeData = (UpgradeData)(object)objectData; var newUpgradeObj = GameManager.instance.upgradeManager.CreateUpgrade(upgradeData, cardParent.transform, scaling: scalingFactor); newUpgradeObj.name = containerName; //Sibling Index is set to 1 so that it is set in the correct order of the marker and the back newUpgradeObj.transform.SetSiblingIndex(1); UpgradeDisplay = newUpgradeObj.GetComponent <UpgradeDisplay>(); DisplayObject = newUpgradeObj; break; } ShowCard(showCard); }
public void Initialize(Card card, HandUI handUI) { this.handUI = handUI; this.card = card; this.sprite = card.image; }