void SetEnableButtonType(EButtonType type) { this.currentType = type; ButtonStepData[] buttonData = Array.FindAll <ButtonStepData>(dataButtons, b => b.type == type); foreach (ButtonItem item in itemButtons) { ButtonStepData data = Array.Find <ButtonStepData>(buttonData, b => b.slot == item.slot); bool activeToggle = true; if (type == EButtonType.OutTurn && PokerObserver.Game.MainPlayer != null && PokerObserver.Game.MainPlayer.GetPlayerState() == PokerPlayerState.fold) { activeToggle = false; } NGUITools.SetActive(item.button, data != null && activeToggle); if (data != null) { bool enableButton = EnableButton(type, item.slot); item.button.collider.enabled = enableButton; item.button.GetComponent <UISprite>().color = new Color(1f, 1f, 1f, enableButton ? 1f : 0.45f); string moreText = AddMoreTextButton(type, item.slot); string overrideName = OverrideName(type, item.slot); item.label.text = (overrideName ?? data.text) + (string.IsNullOrEmpty(moreText) ? string.Empty : string.Format("\n({0})", moreText)); item.label.fontSize = data.labelFontSize; item.label.transform.localPosition = data.labelPosition; NGUITools.SetActive(item.checkboxObject.gameObject, data.enableCheckBox); item.checkboxObject.transform.localPosition = data.checkBoxPosition; item.button.GetComponent <UIToggle>().enabled = data.enableCheckBox; } } }
private void AddStayPressedListener(string _buttonName, EButtonType _type, Protocol _func) { int count = m_Buttons.Count; for (int i = 0; i < count; i++) { if (m_Buttons[i].Name == _buttonName) { if (_type == EButtonType.Positive || _type == EButtonType.Both) { m_Buttons[i].OnPositiveStayEvent += _func.Invoke; } else if (_type == EButtonType.Negative || _type == EButtonType.Both) { m_Buttons[i].OnNegativeStayEvent += _func.Invoke; } } } count = m_Axis.Count; for (int i = 0; i < count; i++) { if (m_Axis[i].Name == _buttonName) { if (_type == EButtonType.Positive || _type == EButtonType.Both) { m_Axis[i].OnPositiveStayEvent += _func.Invoke; } else if (_type == EButtonType.Negative || _type == EButtonType.Both) { m_Axis[i].OnNegativeStayEvent += _func.Invoke; } } } }
public string ToVRButton(EButtonType type) { switch (type) { case EButtonType.One: return(VRButton.One); case EButtonType.Two: return(VRButton.Two); case EButtonType.Three: return(VRButton.Three); case EButtonType.Four: return(VRButton.Four); case EButtonType.Trigger: return(VRButton.Trigger); case EButtonType.Touch: return(VRButton.Touch); case EButtonType.Back: return(VRButton.Back); default: return("None"); } }
private void AddReleasedListener(string _buttonName, EButtonType _type, UnityEvent _func) { int count = m_Buttons.Count; for (int i = 0; i < count; i++) { if (m_Buttons[i].Name == _buttonName) { if (_type == EButtonType.Positive || _type == EButtonType.Both) { m_Buttons[i].OnPositiveReleasedEvent += _func.Invoke; } if (_type == EButtonType.Negative || _type == EButtonType.Both) { m_Buttons[i].OnNegativeReleasedEvent += _func.Invoke; } } } count = m_Axis.Count; for (int i = 0; i < count; i++) { if (m_Axis[i].Name == _buttonName) { if (_type == EButtonType.Positive || _type == EButtonType.Both) { m_Axis[i].OnPositiveReleasedEvent += _func.Invoke; } if (_type == EButtonType.Negative || _type == EButtonType.Both) { m_Axis[i].OnNegativeReleasedEvent += _func.Invoke; } } } }
/// <summary> /// Renders a 'Buy Now' or 'Pay Now' PayPal button. /// </summary> /// <param name="helper">Renders HTML controls in a view.</param> /// <param name="useSandbox">True to use the PayPal test environment as a form action, otherwise false.</param> /// <param name="buttonType">The type of button to render.</param> /// <returns>The HTML that renders a PayPal button.</returns> public static MvcHtmlString PayPalButton(this HtmlHelper helper, bool useSandbox, EButtonType buttonType, string email, string itemName, string itemNumber, float amount, ECurrencyCode currency, string completeUrl, string cancelUrl, string ipnUrl) { string action = useSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr"; StringBuilder html = new StringBuilder("\r\n<form action=\"").Append(action).Append("\">"); string cmd; string buttonImageUrl; string pixelImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" : "https://www.paypal.com/en_US/i/scr/pixel.gif"; switch (buttonType) { case EButtonType.BuyNow: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"; break; case EButtonType.PayNow: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"; break; default: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"; break; } html.Append("\r\n<input type=\"hidden\" name=\"cmd\" value=\"").Append(cmd).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"business\" value=\"").Append(email).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"item_name\" value=\"").Append(itemName).Append("\" />"); //html.Append("\r\n<input type=\"hidden\" name=\"item_number\" value=\"").Append(itemNumber).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"amount\" value=\"").Append(amount.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"currency_code\" value=\"").Append(currency).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"return\" value=\"").Append(completeUrl).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"cancel_return\" value=\"").Append(cancelUrl).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"notify_url\" value=\"").Append(ipnUrl).Append("\" />"); // By default do not prompt customers to include a note with their payment. // Remove this line or set the value to 0 to enable notes. html.Append("\r\n<input type=\"hidden\" name=\"no_note\" value=\"1\" />"); // Render the payment button. html.Append("\r\n<input type=\"image\" src=\"").Append(buttonImageUrl).Append("\" name=\"submit\" alt=\"PayPal — The safer, easier way to pay online.\" />"); // Renders a one-pixel image that should probably be there for tracking purposes. html.Append("\r\n<input type=\"image\" src=\"").Append(pixelImageUrl).Append("\" width=\"1\" height=\"1\" alt=\"\" />"); html.Append("\r\n</form>"); return(new MvcHtmlString(html.ToString())); }
public ButtonLayout(bool resizeKeyboard, bool oneTimeKeyboard, EButtonType layoutType) { ResizeKeyboard = resizeKeyboard; OneTimeKeyboard = oneTimeKeyboard; Buttons = new List <List <ButtonInfo> >(); LayoutType = layoutType; }
public void LoadContentBasic(ContentManager load_Content, string load_Texture, int Width, int Height) { sprite.SpriteLoadContent(load_Texture, load_Content, position.X, position.Y, Width, Height); font = new Fonts(load_Content, position.X, position.Y); BtnType = EButtonType.Basic; }
/// <summary> /// Renders a 'Buy Now' or 'Pay Now' PayPal button. /// </summary> /// <param name="helper">Renders HTML controls in a view.</param> /// <param name="useSandbox">True to use the PayPal test environment as a form action, otherwise false.</param> /// <param name="buttonType">The type of button to render.</param> /// <returns>The HTML that renders a PayPal button.</returns> public static MvcHtmlString PayPalButton(this HtmlHelper helper, bool useSandbox, EButtonType buttonType, string email, string itemName, string itemNumber, float amount, ECurrencyCode currency, string completeUrl, string cancelUrl, string ipnUrl) { string action = useSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr"; StringBuilder html = new StringBuilder("\r\n<form action=\"").Append(action).Append("\">"); string cmd; string buttonImageUrl; string pixelImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" : "https://www.paypal.com/en_US/i/scr/pixel.gif"; switch (buttonType) { case EButtonType.BuyNow: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"; break; case EButtonType.PayNow: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"; break; default: cmd = "_xclick"; buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" : "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"; break; } html.Append("\r\n<input type=\"hidden\" name=\"cmd\" value=\"").Append(cmd).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"business\" value=\"").Append(email).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"item_name\" value=\"").Append(itemName).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"item_number\" value=\"").Append(itemNumber).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"amount\" value=\"").Append(amount.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"currency_code\" value=\"").Append(currency).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"return\" value=\"").Append(completeUrl).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"cancel_return\" value=\"").Append(cancelUrl).Append("\" />"); html.Append("\r\n<input type=\"hidden\" name=\"notify_url\" value=\"").Append(ipnUrl).Append("\" />"); // By default do not prompt customers to include a note with their payment. // Remove this line or set the value to 0 to enable notes. html.Append("\r\n<input type=\"hidden\" name=\"no_note\" value=\"1\" />"); // Render the payment button. html.Append("\r\n<input type=\"image\" src=\"").Append(buttonImageUrl).Append("\" name=\"submit\" alt=\"PayPal — The safer, easier way to pay online.\" />"); // Renders a one-pixel image that should probably be there for tracking purposes. html.Append("\r\n<input type=\"image\" src=\"").Append(pixelImageUrl).Append("\" width=\"1\" height=\"1\" alt=\"\" />"); html.Append("\r\n</form>"); return new MvcHtmlString(html.ToString()); }
public void LoadContentOverlay(ContentManager load_Content, string load_Texture, string load_Overlay, int Width, int Height) { sprite.SpriteLoadContent(load_Texture, load_Content, position.X, position.Y, Width, Height); overlay.SpriteLoadContent(load_Overlay, load_Content, position.X, position.Y, Width, Height); font = new Fonts(load_Content, position.X, position.Y); BtnType = EButtonType.Overlay; }
private static string GetButtonClass(EButtonType buttonType, params EButtonClass[] buttonClasses) { switch (buttonType) { case EButtonType.Delete: return(Bootstrap.Classes.ButtonDanger); default: return(!buttonClasses.Any() ? Bootstrap.Classes.ButtonPrimary : GetButtonClasses(buttonClasses) .Select(_ => _.ToCssClass()) .Aggregate((a, b) => $"{a} {b}".Trim())); } }
string OverrideName(EButtonType type, EButtonSlot slot) { //if (slot == EButtonSlot.First && type == EButtonType.InTurn) if (slot == EButtonSlot.First) { if (PokerObserver.Game.MaxCurrentBetting == 0 || PokerObserver.Game.CurrentBettingDiff == 0) { return("XEM BÀI"); } } else if (slot == EButtonSlot.First && type == EButtonType.OutTurn) { if (PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting) { return("TỰ ĐỘNG XEM BÀI"); } } return(null); }
string AddMoreTextButton(EButtonType type, EButtonSlot slot) { if (PokerObserver.Game.gameDetails != null) { if (slot == EButtonSlot.Third && type == EButtonType.OutGame) { return(PokerObserver.Game.LastBetForSitdown.ToString("#,##")); } if ((type == EButtonType.InTurn || type == EButtonType.OutTurn) && slot == EButtonSlot.First) { double diff = PokerObserver.Game.CurrentBettingDiff; if (diff > 0) { return(diff.ToString("#,##")); } } } return(null); }
public int GetMouseNumber(EButtonType type) { var mouseNumber = 0; switch (type) { case EButtonType.LeftMouse: mouseNumber = 0; break; case EButtonType.MiddleMouse: mouseNumber = 2; break; case EButtonType.RightMouse: mouseNumber = 1; break; } return(mouseNumber); }
bool EnableButton(EButtonType type, EButtonSlot slot) { if (slot == EButtonSlot.Third && type == EButtonType.InTurn) { try { if (GetMaxRaise() <= 0) { return(false); } else { return(PokerObserver.Game.MainPlayer.GetMoney() + PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting); } } catch (Exception ex) { return(PokerObserver.Game.MainPlayer.GetMoney() + PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting); } } else if (type == EButtonType.OutTurn && PokerObserver.Game.MainPlayer.GetMoney() == 0) { return(false); } return(true); }
public void AddButtonListener(string _buttonName, EInputState _state, EButtonType _type, UnityEvent _func) { if (!CheckButton(_buttonName)) { AddButton(_buttonName); } switch (_state) { case EInputState.Pressed: AddPressedListener(_buttonName, _type, _func); break; case EInputState.Stay: AddStayPressedListener(_buttonName, _type, _func); break; case EInputState.Released: AddReleasedListener(_buttonName, _type, _func); break; default: break; } }
public void SetText(EButtonType buttonType) { Type = buttonType; _text.text = visibleNames[buttonType]; }
public ButtonInfoBuilder ButtonType(EButtonType buttonType) { _buttonType = buttonType; return(this); }
bool EnableButton(EButtonType type, EButtonSlot slot) { if (slot == EButtonSlot.Third && type == EButtonType.InTurn) { try { if (GetMaxRaise() <= 0) return false; else return PokerObserver.Game.MainPlayer.GetMoney() + PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting; } catch (Exception ex) { return PokerObserver.Game.MainPlayer.GetMoney() + PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting; } } else if (type == EButtonType.OutTurn && PokerObserver.Game.MainPlayer.GetMoney() == 0) return false; return true; }
string OverrideName(EButtonType type, EButtonSlot slot) { //if (slot == EButtonSlot.First && type == EButtonType.InTurn) if (slot == EButtonSlot.First) { if(PokerObserver.Game.MaxCurrentBetting == 0 || PokerObserver.Game.CurrentBettingDiff == 0) return "XEM BÀI"; } else if (slot == EButtonSlot.First && type == EButtonType.OutTurn) { if (PokerObserver.Game.MainPlayer.currentBet >= PokerObserver.Game.MaxCurrentBetting) return "TỰ ĐỘNG XEM BÀI"; } return null; }
void SetEnableButtonType(EButtonType type) { this.currentType = type; ButtonStepData[] buttonData = Array.FindAll<ButtonStepData>(dataButtons, b => b.type == type); foreach(ButtonItem item in itemButtons) { ButtonStepData data = Array.Find<ButtonStepData>(buttonData, b => b.slot == item.slot); bool activeToggle = true; if (type == EButtonType.OutTurn && PokerObserver.Game.MainPlayer != null && PokerObserver.Game.MainPlayer.GetPlayerState() == PokerPlayerState.fold) activeToggle = false; NGUITools.SetActive(item.button, data != null && activeToggle); if (data != null) { bool enableButton = EnableButton(type, item.slot); item.button.collider.enabled = enableButton; item.button.GetComponent<UISprite>().color = new Color(1f, 1f, 1f, enableButton ? 1f : 0.45f); string moreText = AddMoreTextButton(type, item.slot); string overrideName = OverrideName(type, item.slot); item.label.text = (overrideName ?? data.text) + (string.IsNullOrEmpty(moreText) ? string.Empty : string.Format("\n({0})", moreText)); item.label.fontSize = data.labelFontSize; item.label.transform.localPosition = data.labelPosition; NGUITools.SetActive(item.checkboxObject.gameObject, data.enableCheckBox); item.checkboxObject.transform.localPosition = data.checkBoxPosition; item.button.GetComponent<UIToggle>().enabled = data.enableCheckBox; } } }
public LayoutBuilder LayoutType(EButtonType layoutType) { _layoutType = layoutType; return(this); }
public static MvcHtmlString BootstrapButton(this HtmlHelper html, string value, EButtonType buttonType = EButtonType.Submit, string iconCssClass = "", params EButtonClass[] buttonClasses) { var button = new TagBuilder(Tags.Button); var isRightAlignedCaret = buttonClasses.Contains(EButtonClass.IconRight); var leftAlignedText = isRightAlignedCaret ? $"{value} " : string.Empty; var rightAlignedText = !isRightAlignedCaret ? $" {value}" : string.Empty; button.MergeAttribute(Attributes.Type, buttonType.ToString()); button.MergeAttribute(Attributes.Class, GetButtonClass(buttonType, buttonClasses)); button.MergeAttribute(Attributes.DataLoadingText, $"<i class='fa fa-circle-o-notch fa-spin'></i> {value}"); switch (buttonType) { case EButtonType.Delete: button.InnerHtml = $"{leftAlignedText}<i class='fa fa-trash'></i>{rightAlignedText}"; break; case EButtonType.Edit: button.InnerHtml = $"{leftAlignedText}<i class='fa fa-pencil'></i>{rightAlignedText}"; break; default: if (string.IsNullOrEmpty(iconCssClass)) { button.InnerHtml = value; } else { button.InnerHtml = $"{leftAlignedText}<i class='fa {iconCssClass}'></i>{rightAlignedText}"; } break; } return(MvcHtmlString.Create(button.ToString())); }
string AddMoreTextButton(EButtonType type, EButtonSlot slot) { if (PokerObserver.Game.gameDetails != null) { if (slot == EButtonSlot.Third && type == EButtonType.OutGame) return PokerObserver.Game.LastBetForSitdown.ToString("#,##"); if ((type == EButtonType.InTurn || type == EButtonType.OutTurn) && slot == EButtonSlot.First) { double diff = PokerObserver.Game.CurrentBettingDiff; if(diff > 0) return diff.ToString("#,##"); } } return null; }
/// <inheritdoc /> public CButton(string text, EButtonType type = EButtonType.button, string href = "", string onclick = "") : base(text, type, href, onclick) { CachingType = ECachingType.Cacheable; }