private int EvaluateFlop(Card[] playerFlop) { var cardLayout = new CardLayout(playerFlop); PokerMark mark = (PokerMark)cardLayout.GetMark(); return(Math.Min((int)mark.PokerLayout / 2, 3)); }
public static CardLayoutDto ToDto(this CardLayout cardLayout) => new CardLayoutDto { CardLayoutId = cardLayout.CardLayoutId, Name = cardLayout.Name, Version = cardLayout.Version };
private void SaveLayout() { var layout = new CardLayout { BackgroundColor = _layoutDocument.BackgroundColor.ToHex(), BackgroundImage = Convert.ToBase64String(_layoutDocument.BackgroundImage ?? new byte[0]) }; foreach (var imageElement in _layoutDocument.Elements.OfType <ImageElement>()) { if (imageElement.ImageSource == "Image") { imageElement.LinkedAttribute = String.Empty; } else if (imageElement.ImageSource == "Card Attribute") { imageElement.ImageData = String.Empty; } } layout.Elements.AddRange(LayoutConverter.FromDesignerElements(_layoutDocument.Elements)); _cardGameDataStore.SaveLayout(_cardTypeViewModel.Id, layout); _cardGameDataStore.UpdateCardTypeImage(_cardTypeViewModel.Id, CardImageComposer.CreateCardImage(layout)); }
public CardEditorViewModel(ICardGameDataStore cardGameDataStore, IDialogService dialogService, Card card, Action <Card> cardUpdated) { _cardGameDataStore = cardGameDataStore ?? throw new ArgumentNullException(nameof(cardGameDataStore)); _dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService)); _cardUpdated = cardUpdated; _card = card ?? throw new ArgumentNullException(nameof(card)); _cardValues = _card.AttributeValues.Select(attr => new CardAttributeValueViewModel(attr)).Cast <NamedValueViewModel>().ToList(); _cardValues.Insert(0, new CardNameValueViewModel(_card)); _cardValues.Insert(1, new CardTypeValueViewModel(_card)); _layout = _cardGameDataStore.GetLayout(card.CardType.Id); _elements = LayoutConverter.ToDesignerElements(_layout.Elements); foreach (var cardValue in _cardValues) { cardValue.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(NamedValueViewModel.Value)) { UpdatePreview(cardValue); } }; } }
public static byte[] CreateCardImage(CardLayout layout) { var background = GetBackground(layout); var elements = LayoutConverter.ToDesignerElements(layout.Elements); return(CreateCardImage(background, elements)); }
void Start() { CardLayout layout = CardLayout.Instance; layout.AddCardSpot(this); onCardSpotSelection += layout.Select; }
public static CardLayoutDto FromCardLayout(CardLayout cardLayout) { var model = new CardLayoutDto(); model.CardLayoutId = cardLayout.CardLayoutId; model.Name = cardLayout.Name; model.Description = cardLayout.Description; return model; }
public HandInfo GenerateRandomHand() { HandInfo handInfo = new HandInfo(); Card[] cards = GetShuffledCards(); CardLayout playerDeck = new CardLayout(cards.Take(7)); CardLayout oppDeck = new CardLayout(cards.Skip(7).Take(2).Union(cards.Skip(2).Take(5))); CardSet cardSet = new CardSet(new[] { playerDeck, oppDeck }); if (cardSet.IsWinning) { handInfo.WinningPlayer = 0; } else if (cardSet.IsLoosing) { handInfo.WinningPlayer = 1; } else { handInfo.WinningPlayer = -1; } //PreFlop,Flop,Turn,River hand evaluation int hand = 0; Card[] playerHand = playerDeck.Cards.Take(2).ToArray(); hand += EvaluatePreflop(playerHand); Card[] playerFlop = playerDeck.Cards.Take(5).ToArray(); hand += EvaluateFlop(playerFlop) * _maxHandResolution; Card[] playerTurn = playerDeck.Cards.Take(6).ToArray(); hand += EvaluateTurn(playerTurn) * _maxHandResolution * _maxHandResolution; Card[] playerRiver = playerDeck.Cards.Take(7).ToArray(); hand += EvaluateRiver(playerRiver) * _maxHandResolution * _maxHandResolution * _maxHandResolution; int hand2 = 0; if (_twoPlayer) { Card[] oppHand = oppDeck.Cards.Take(2).ToArray(); hand2 += EvaluatePreflop(oppHand); Card[] oppFlop = oppDeck.Cards.Take(5).ToArray(); hand2 += EvaluateFlop(oppFlop) * _maxHandResolution; Card[] oppTurn = oppDeck.Cards.Take(6).ToArray(); hand2 += EvaluateTurn(oppTurn) * _maxHandResolution * _maxHandResolution; Card[] oppRiver = oppDeck.Cards.Take(7).ToArray(); hand2 += EvaluateRiver(oppRiver) * _maxHandResolution * _maxHandResolution * _maxHandResolution; } handInfo.Hand = hand; handInfo.OppHand = hand2; return(handInfo); }
public void SaveLayout(Guid cardTypeId, CardLayout cardLayout) { _cardGameData.CardLayouts.RemoveAll(l => l.CardTypeId == cardTypeId); var layoutData = JsonCardLayout.FromLayout(cardLayout); layoutData.CardTypeId = cardTypeId; _cardGameData.CardLayouts.Add(layoutData); SaveChanges(); }
public static CardLayoutApiModel FromCardLayout(CardLayout cardLayout) { var model = new CardLayoutApiModel(); model.CardLayoutId = cardLayout.CardLayoutId; model.Name = cardLayout.Name; model.Description = cardLayout.Description; return(model); }
void DiscardHelper(Card c, CardLayout layout) { if (c.IsPopulation()) { discardedPop++; } layout.RemoveCard(c); Destroy(c.gameObject); }
private CardLayout destinationLayout; // used to redraw the destination layout when the dropDestination moves within that layout void Start() { canvasGroup = this.GetComponent <CanvasGroup>(); if (dropDestination == null) { dropDestination = new GameObject("Where" + this.name + "WillDrop", typeof(RectTransform)).GetComponent <RectTransform>(); } storesObjectDuringDrag = this.transform.parent.parent; destinationLayout = this.transform.parent.GetComponent <CardLayout>(); }
private void OnTriggerExit(Collider other) { if (other.CompareTag("Player")) { return; } if (cardLayout) { cardLayout = null; } }
void Awake() { _instance = this; cardSpots = new List <CardSpot>(); if (cardViewUI == null) { cardViewUI = FindObjectOfType <CardViewUI>(); } if (hand == null) { hand = FindObjectOfType <Hand>(); } }
public static JsonCardLayout FromLayout(CardLayout layout) { return(new JsonCardLayout { BackgroundColor = layout.BackgroundColor, BackgroundImage = layout.BackgroundImage, Elements = layout.Elements.Select(el => new JsonCardElement { ElementType = el.GetType().Name, JsonData = Newtonsoft.Json.JsonConvert.SerializeObject(el) }).ToList() }); }
private static Brush GetBackground(CardLayout layout) { if (String.IsNullOrEmpty(layout.BackgroundImage) == false) { return(new ImageBrush((ImageSource) new ImageSourceConverter().ConvertFrom(Convert.FromBase64String(layout.BackgroundImage)))); } else if (String.IsNullOrEmpty(layout.BackgroundColor) == false) { return(new SolidColorBrush((Color)ColorConverter.ConvertFromString(layout.BackgroundColor))); } return(null); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { return; } //Debug.Log($"Trigger + {other.gameObject.name} and {gameObject.name}"); CardLayout cl = other.GetComponent <CardLayout>(); if (cl != null) { cardLayout = cl; } }
public void ToggleSelected(Card c, CardLayout layout) { if (state == GameState.PLAY) { if (hasSelected && selectedCard != c) { selectedLayout.DeselectCard(selectedCard); } selectedLayout = layout; selectedCard = c; hasSelected = true; } layout.ToggleSelected(c); }
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { var cardLayout = await _context.CardLayouts.FindAsync(request.CardLayout.CardLayoutId); if (cardLayout == null) { _context.CardLayouts.Add(cardLayout = new CardLayout()); } cardLayout.Name = request.CardLayout.Name; await _context.SaveChangesAsync(cancellationToken); return(new Response() { CardLayoutId = cardLayout.CardLayoutId }); }
public CheckoutPage() { InitializeComponent(); PayButton.Clicked += async delegate { if (string.IsNullOrEmpty(CardNumber.Text) && string.IsNullOrEmpty(MonthYear.Text) && string.IsNullOrEmpty(CVC.Text)) { await DisplayAlert("Missing Data", "Please add valid credit data.", "OK"); return; } await CardLayout.FadeTo(0); CardLayout.IsVisible = false; Loader.IsVisible = true; await Loader.FadeTo(1); await Payment.Methods.Pay(PaymentIntentResponse, new Stripe.PaymentMethodCardCreateOptions { Number = CardNumber.Text.Replace("/", string.Empty), ExpMonth = Convert.ToInt64(MonthYear.Text.Split('/')[0]), ExpYear = Convert.ToInt64(MonthYear.Text.Split('/')[1]), Cvc = CVC.Text }); await Loader.FadeTo(0); Loader.IsVisible = false; CardNumber.Text = string.Empty; MonthYear.Text = string.Empty; CVC.Text = string.Empty; CardLayout.IsVisible = true; await CardLayout.FadeTo(1); }; }
public DashboardFrame(bool competition) { int num = competition ? 1 : 0; base.\u002Ector("SmartDashboard - "); DashboardFrame dashboardFrame = this; this.prefs = new DashboardPrefs(this); this.displayMode = DashboardFrame.DisplayMode.__\u003C\u003ESmartDashboard; this.shouldHideMenu = ((Boolean) this.prefs.__\u003C\u003EhideMenu.getValue()).booleanValue(); this.logger = new LogToCSV(this); this.setLayout((LayoutManager) new BorderLayout()); DashboardPanel.__\u003Cclinit\u003E(); this.smartDashboardPanel = new DashboardPanel(this, Robot.getTable()); ((Component) this.smartDashboardPanel).setName("SmartDashboard"); DashboardPanel.__\u003Cclinit\u003E(); this.liveWindowPanel = new DashboardPanel(this, Robot.getLiveWindow()); ((Component) this.liveWindowPanel).setName("LiveWindow"); MainPanel.__\u003Cclinit\u003E(); CardLayout cardLayout = new CardLayout(); DashboardPanel defaultPanel = this.smartDashboardPanel; DashboardPanel[] dashboardPanelArray = new DashboardPanel[2]; int index1 = 0; DashboardPanel dashboardPanel1 = this.liveWindowPanel; dashboardPanelArray[index1] = dashboardPanel1; int index2 = 1; DashboardPanel dashboardPanel2 = this.smartDashboardPanel; dashboardPanelArray[index2] = dashboardPanel2; this.mainPanel = new MainPanel((LayoutManager) cardLayout, defaultPanel, dashboardPanelArray); ((Container) this.mainPanel).add((Component) this.smartDashboardPanel, (object) DashboardFrame.DisplayMode.__\u003C\u003ESmartDashboard.toString()); ((Container) this.mainPanel).add((Component) this.liveWindowPanel, (object) DashboardFrame.DisplayMode.__\u003C\u003ELiveWindow.toString()); this.setDisplayMode(DashboardFrame.DisplayMode.__\u003C\u003ESmartDashboard); DashboardMenu.__\u003Cclinit\u003E(); this.menuBar = (JMenuBar) new DashboardMenu(this, this.mainPanel); this.propEditor = new PropertyEditor((JFrame) this); if (!this.shouldHideMenu) ((Container) this).add((Component) this.menuBar, (object) "North"); ((Container) this).add((Component) this.mainPanel, (object) "Center"); DashboardFrame\u00241 dashboardFrame1 = new DashboardFrame\u00241(this); this.smartDashboardPanel.addMouseListener((MouseListener) dashboardFrame1); this.smartDashboardPanel.addMouseMotionListener((MouseMotionListener) dashboardFrame1); if (num != 0) { ((Component) this).setPreferredSize(DashboardFrame.NETBOOK_SIZE); ((Frame) this).setUndecorated(true); ((Window) this).setLocation(0, 0); ((Frame) this).setResizable(false); } else { ((Window) this).setMinimumSize(DashboardFrame.MINIMUM_SIZE); this.setDefaultCloseOperation(0); Dimension.__\u003Cclinit\u003E(); ((Component) this).setPreferredSize(new Dimension(this.prefs.__\u003C\u003Ewidth.getValue().intValue(), this.prefs.__\u003C\u003Eheight.getValue().intValue())); ((Window) this).setLocation(this.prefs.__\u003C\u003Ex.getValue().intValue(), this.prefs.__\u003C\u003Ey.getValue().intValue()); } ((Window) this).addWindowListener((WindowListener) new DashboardFrame\u00242(this)); ((Component) this).addComponentListener((ComponentListener) new DashboardFrame\u00243(this)); DashboardFrame.INSTANCE = this; }
CardLayoutTemplate CreateCustomCardLayoutTemplate() { CardCustomLayoutTemplate customTemplate = new CardCustomLayoutTemplate(); CardLayout layout = new CardLayout(); CardSparklineRow sparklineRow = new CardSparklineRow { Indent = 10, Height = 40, VerticalAlignment = CardVerticalAlignment.Top }; CardRow captionRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center }; CardRowTextElement captionTextElement = new CardRowTextElement { FontSize = 14, HorizontalAlignment = CardHorizontalAlignment.Left, Text = "Country: " }; CardRowDataElement captionValueElement = new CardRowDataElement { ValueType = CardRowDataElementType.Title, FontSize = 18, ForeColor = Color.Blue, FontStyle = FontStyle.Italic, HorizontalAlignment = CardHorizontalAlignment.Right }; CardRowIndicatorElement deltaIndicator = new CardRowIndicatorElement(CardHorizontalAlignment.Right, 22); captionRow.Elements.AddRange(captionTextElement, captionValueElement, deltaIndicator); CardRow absoluteVariationRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center, Indent = 20 }; CardRowTextElement absoluteVariationText = new CardRowTextElement { FontSize = 16, ForeColor = Color.MediumBlue, HorizontalAlignment = CardHorizontalAlignment.Left, Text = "Absolute Variation: " }; CardRowDataElement absoluteVariationValue = new CardRowDataElement { FontSize = 20, ValueType = CardRowDataElementType.AbsoluteVariation, HorizontalAlignment = CardHorizontalAlignment.Right, PredefinedForeColor = CardPredefinedColor.Delta }; absoluteVariationRow.Elements.AddRange(absoluteVariationText, absoluteVariationValue); CardRow percentVariationRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center, Indent = 20 }; CardRowTextElement percentVariationText = new CardRowTextElement { FontSize = 16, ForeColor = Color.MediumBlue, HorizontalAlignment = CardHorizontalAlignment.Left, Text = "Percent Variation: " }; CardRowDataElement percentVariationValue = new CardRowDataElement { FontSize = 20, ValueType = CardRowDataElementType.PercentVariation, PredefinedForeColor = CardPredefinedColor.Delta, HorizontalAlignment = CardHorizontalAlignment.Right }; percentVariationRow.Elements.AddRange(percentVariationText, percentVariationValue); CardRow percentOfTargetRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center, Indent = 20 }; CardRowTextElement percentOfTargetText = new CardRowTextElement { FontSize = 16, ForeColor = Color.MediumBlue, HorizontalAlignment = CardHorizontalAlignment.Left, Text = "Percent of Target: " }; CardRowDataElement percentOfTargetValue = new CardRowDataElement { FontSize = 20, ValueType = CardRowDataElementType.PercentOfTarget, PredefinedForeColor = CardPredefinedColor.Delta, HorizontalAlignment = CardHorizontalAlignment.Right }; percentOfTargetRow.Elements.AddRange(percentOfTargetText, percentOfTargetValue); CardRow totalSalesRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center }; CardRowTextElement totalSalesText = new CardRowTextElement { FontStyle = FontStyle.Underline, FontSize = 14, ForeColor = Color.BlueViolet, Text = "Total Sales: ", HorizontalAlignment = CardHorizontalAlignment.Left }; CardRowDataElement totalSalesValue = new CardRowDataElement { ForeColor = Color.CadetBlue, FontSize = 16, ValueType = CardRowDataElementType.ActualValue, HorizontalAlignment = CardHorizontalAlignment.Right }; totalSalesRow.Elements.AddRange(totalSalesText, totalSalesValue); CardRow targetSalesRow = new CardRow { VerticalAlignment = CardVerticalAlignment.Center }; CardRowTextElement targetSalesText = new CardRowTextElement { FontStyle = FontStyle.Underline, FontSize = 14, ForeColor = Color.BlueViolet, Text = "Target Sales: ", HorizontalAlignment = CardHorizontalAlignment.Left }; CardRowDataElement targetSalesValue = new CardRowDataElement { ForeColor = Color.CadetBlue, FontSize = 16, ValueType = CardRowDataElementType.TargetValue, HorizontalAlignment = CardHorizontalAlignment.Right }; targetSalesRow.Elements.AddRange(targetSalesText, targetSalesValue); layout.Rows.AddRange(sparklineRow, captionRow, absoluteVariationRow, percentVariationRow, percentOfTargetRow, totalSalesRow, targetSalesRow); customTemplate.Layout = layout; customTemplate.MinWidth = 300; customTemplate.MaxWidth = 350; return(customTemplate); }
public override void init() { Scheduler scheduler = this; CardLayout cardLayout1 = new CardLayout(); CardLayout cardLayout2 = cardLayout1; this.cardLayout = cardLayout1; ((Container) this).setLayout((LayoutManager) cardLayout2); this.labels = (List) new ArrayList(); this.buttons = (List) new ArrayList(); this.commandPanel = new JPanel(); ((Container) this.commandPanel).setLayout((LayoutManager) new GridLayout(0, 2)); this.commandLabels = new JPanel(); this.cancelButtons = new JPanel(); ((Container) this.commandPanel).add((Component) this.commandLabels, (object) "West"); ((Container) this.commandPanel).add((Component) this.cancelButtons, (object) "Center"); this.commandLayout = new GridLayout(0, 1); this.cancelLayout = new GridLayout(0, 1); ((Container) this.commandLabels).setLayout((LayoutManager) this.commandLayout); ((Container) this.cancelButtons).setLayout((LayoutManager) this.cancelLayout); ((Container) this).add((Component) this.commandPanel, (object) "Commands"); this.noCommands = new JLabel("No commands running."); this.noCommands.setHorizontalAlignment(0); ((Container) this).add((Component) this.noCommands, (object) "No Command"); this.cardLayout.show((Container) this, "No Command"); ((Component) this).repaint(); }
public override void init() { this.setResizable(false); JPanel.__\u003Cclinit\u003E(); Command command = this; CardLayout cardLayout1 = new CardLayout(); CardLayout cardLayout2 = cardLayout1; this.layout = cardLayout1; this.buttonPanel = new JPanel((LayoutManager) cardLayout2); ((JComponent) this.buttonPanel).setOpaque(false); this.start = new JButton("start"); ((JComponent) this.start).setOpaque(false); ((AbstractButton) this.start).addActionListener((ActionListener) new Command\u00241(this)); ((JComponent) this.start).setForeground((Color) this.__\u003C\u003EstartBackground.getValue()); ((Container) this.buttonPanel).add((Component) this.start, (object) "Start"); this.cancel = new JButton("cancel"); ((JComponent) this.cancel).setOpaque(false); ((AbstractButton) this.cancel).addActionListener((ActionListener) new Command\u00242(this)); ((JComponent) this.cancel).setForeground((Color) this.__\u003C\u003EcancelBackground.getValue()); ((Container) this.buttonPanel).add((Component) this.cancel, (object) "Cancel"); JLabel.__\u003Cclinit\u003E(); this.name = new JLabel(this.getFieldName()); ((Container) this).add((Component) this.name); ((Container) this).add((Component) this.buttonPanel); }
public static string CreateCardImageBase64(Card card, CardLayout cardLayout) { return(Convert.ToBase64String(CreateCardImage(card, cardLayout))); }