private void ThrowButtonPressed( ButtonTypes buttonType ) { if( ButtonPressed != null ) { ButtonPressed(buttonType); } }
public void UpdateToolTip(ButtonTypes toolTipType) { if (ToolTipText != null) { if (toolTipType == ButtonTypes.Previous) { ToolTipText.text = "Select Previous Particle Effect"; } else if (toolTipType == ButtonTypes.Next) { ToolTipText.text = "Select Next Particle Effect"; } } }
/************************************************************************/ /* SendButton - Payload format */ /* %i - button code */ /* %i - flags 0x01 => use button map/name instead of code */ /* 0x02 => btn down */ /* 0x04 => btn up */ /* 0x08 => use amount */ /* 0x10 => queue event */ /* 0x20 => do not repeat */ /* 0x40 => virtual key */ /* 0x80 => axis key */ /* %i - amount ( 0 => 65k maps to -1 => 1 ) */ /* %s - device map (case sensitive and required if flags & 0x01) */ /* "KB" - Standard keyboard map */ /* "XG" - Xbox Gamepad */ /* "R1" - Xbox Remote */ /* "R2" - Xbox Universal Remote */ /* "LI:devicename" - valid LIRC device map where 'devicename' */ /* is the actual name of the LIRC device */ /* "JS<num>:joyname" - valid Joystick device map where */ /* 'joyname' is the name specified in */ /* the keymap. JS only supports button code */ /* and not button name currently (!0x01). */ /* %s - button name (required if flags & 0x01) */ /************************************************************************/ private bool SendButton(string button, ushort buttonCode, string deviceMap, ButtonTypes flags, short amount) { if (!Connected) { return(false); } if (button.Length != 0) { if ((flags & ButtonTypes.BtnUseName) == 0) { flags |= ButtonTypes.BtnUseName; } buttonCode = 0; } else { button = ""; } if (amount > 0) { if ((flags & ButtonTypes.BtnUseAmount) == 0) { flags |= ButtonTypes.BtnUseAmount; } } if ((flags & ButtonTypes.BtnDown) == 0 || (flags & ButtonTypes.BtnUp) == 0) { flags |= ButtonTypes.BtnDown; } var payload = new byte[button.Length + deviceMap.Length + 8]; var offset = 0; payload[offset++] = (byte)((buttonCode & 0xff00) >> 8); payload[offset++] = (byte)(buttonCode & 0x00ff); payload[offset++] = (byte)(((ushort)flags & 0xff00) >> 8); payload[offset++] = (byte)((ushort)flags & 0x00ff); payload[offset++] = (byte)((amount & 0xff00) >> 8); payload[offset++] = (byte)(amount & 0x00ff); foreach (var t in deviceMap) { payload[offset++] = (byte)t; } payload[offset++] = (byte)'\0'; foreach (var t in button) { payload[offset++] = (byte)t; } payload[offset] = (byte)'\0'; return(Send(PacketType.PtButton, payload)); }
public void ButtonClicked(ButtonTypes type) { Debug.Log("ButtonClicked: " + type); switch (type) { case ButtonTypes.Start: Play(); break; case ButtonTypes.Rewind: Play(false); break; default: break; } }
private void KinectVFR_OnKinectJointEvent(JointType aJointType, System.Windows.Media.Media3D.Point3D Pos3D, Skeleton[] aFrame) { switch (aJointType) { case JointType.HandLeft: Pos3D.X = Pos3D.X + ButtonsSize / 2; //Pos3D.Y = Pos3D.Y - ButtonsSize / 2; ButtonTypes aButton = FindHitButton(Pos3D); if (aButton > ButtonTypes.None) { if (aButton != ButtonTypes.CaptureBtn && aButton != PrevButtonLeftState) { PlaySoundOnButton(aButton); } SelectDress(ButtonTypeToDressType(aButton)); if (aButton == ButtonTypes.SkeletonBtn && aButton != PrevButtonLeftState) { KinectVFR.EnableDrawSkeleton = !KinectVFR.EnableDrawSkeleton; } if (aButton == ButtonTypes.CaptureBtn && aButton != PrevButtonLeftState && !CaptureTimer.IsEnabled) { lblCaptureCounter.Content = 3; CaptureCount = 2; CaptureTimer.Start(); LabelCaptureTimer.Start(); } } PrevButtonLeftState = aButton; break; case JointType.HandRight: Pos3D.X = Pos3D.X - ButtonsSize / 2; Pos3D.Y = Pos3D.Y + ButtonsSize / 2; aButton = FindHitButton(Pos3D); if (aButton > ButtonTypes.None) { if (aButton != PrevButtonRightState) { PlaySoundOnButton(aButton); SelectDress(ButtonTypeToDressType(aButton)); } } PrevButtonRightState = aButton; break; case JointType.Head: KinectVFR.DrawSkeleton(VideoStreamGrid); break; } }
private Ranorex.Button PobierzGuzik(ButtonTypes enumGuzik) { switch (enumGuzik) { case ButtonTypes.ZASTOSUJ: return(_app.FindSingle <Ranorex.Button>("form/button[@text~'.astosuj' or @text~'.aply']", new Duration(30000))); case ButtonTypes.DRUKUJ: return(this._app.FindSingle <Ranorex.Button>("form/button[@text~'.rukuj' or @text~'.rint']", new Duration(30000))); case ButtonTypes.ANULUJ: return(_app.FindSingle <Ranorex.Button>("form/button[@text~'.nuluj' or @text~'.ancel']", new Duration(30000))); } return(null); }
private string NazwaGuzika(ButtonTypes enButton) { switch (enButton) { case ButtonTypes.DRUKUJ: return("Drukuj"); case ButtonTypes.ZASTOSUJ: return("Zastosuj"); case ButtonTypes.ANULUJ: return("Anuluj"); } return(string.Empty); }
private string NazwaGuzika(ButtonTypes enButton) { switch (enButton) { case ButtonTypes.OTWORZ: return("Otworz"); case ButtonTypes.ZAPISZ: return("Zapisz"); case ButtonTypes.ANULUJ: return("Anuluj"); } return(string.Empty); }
public override string GetButtonsColor(ButtonTypes type) { if ((type == ButtonTypes.Border) || (type == ButtonTypes.Continue)) { return(String.Empty); } else if (type == ButtonTypes.Font) { return(СontrastColor(LastColor)); } else { return(NextColor()); } }
private static string findButtonName(ButtonTypes type, ControllerPlayers player, out InputExButtonMap mapping) { foreach (var map in ButtonMappings) { if (map.Type == type && map.Player == player) { mapping = map; return(map.Name); } } Debug.LogError(string.Format("Failed to find Button {0} for Player {1}", type, player)); mapping = null; return("Unknown"); }
private ButtonTypes FindHitButton(Point3D Pos) { ButtonTypes Res = ButtonTypes.None; foreach (KeyValuePair <ButtonTypes, Grid> aItem in DressButtons) { if (Pos.X > Canvas.GetLeft(aItem.Value) && Pos.X < Canvas.GetLeft(aItem.Value) + aItem.Value.ActualWidth && Pos.Y > Canvas.GetTop(aItem.Value) && Pos.Y < Canvas.GetTop(aItem.Value) + aItem.Value.ActualHeight) { Res = aItem.Key; break; } } return(Res); }
/// <summary> /// User interfaces the button click. /// </summary> /// <param name="buttonTypeClicked">Button type clicked.</param> public void UIButtonClick(ButtonTypes buttonTypeClicked) { switch (buttonTypeClicked) { case ButtonTypes.Previous: // Select Previous Prefab SelectPreviousPE(); break; case ButtonTypes.Next: // Select Next Prefab SelectNextPE(); break; } }
public void UIButtonClick(ButtonTypes buttonTypeClicked) { if (buttonTypeClicked != ButtonTypes.Previous) { if (buttonTypeClicked != ButtonTypes.Next) { return; } this.SelectNextPE(); } else { this.SelectPreviousPE(); } }
private Ranorex.Button PobierzGuzik(ButtonTypes enumGuzik) { switch (enumGuzik) { case ButtonTypes.ZAPISZ: return(this._app.FindSingle <Ranorex.Button>("form/button[@text~'.apisz' or @text~'.ave']", new Duration(30000))); case ButtonTypes.OTWORZ: return(this._app.FindSingle <Ranorex.Button>("form/button[@text~'.twórz' or @text~'.pen']", new Duration(30000))); case ButtonTypes.ANULUJ: return(this._app.FindSingle <Ranorex.Button>("form/button[@text~'.nuluj' or @text~'.ancel']", new Duration(30000))); } return(null); }
protected virtual bool IsMouseAliasPress(bool validController, ButtonTypes buttonType, ButtonPressTypes pressType) { if (validController) { switch (buttonType) { case ButtonTypes.Trigger: return(MousePressType(pressType, 0)); case ButtonTypes.Grip: return(MousePressType(pressType, 1)); } } return(false); }
/*Добавление на контрол кнопок*/ private void AddButton(ButtonTypes type) { Button bt = new Button(); bt.Size = new Size(GetSystemMetrics(Indexes.SM_CXSIZE), this.Height); bt.Width -= 1; bt.BackgroundImageLayout = ImageLayout.Zoom; bt.BackColor = Color.Transparent; bt.FlatStyle = FlatStyle.Flat; bt.FlatAppearance.BorderSize = 0; /*В зависимости от вида кнопки устанавливаем ее положение на контроле * и изображение, добавляем обработчики нажатий*/ pictSide = (Convert.ToInt32(bt.Height * 0.7)); switch (type) { case ButtonTypes.exit: bt.Location = new Point(this.Width - bt.Width, 0); bt.Image = new Bitmap(Properties.Resources.close_window_icon, new Size(pictSide, pictSide)); bt.MouseClick += exitButton_OnClick; bt.MouseEnter += exitButton_MouseEnter; bt.MouseLeave += exitButton_MouseLeave; exitButton = bt; break; case ButtonTypes.resize: bt.Location = new Point(this.Width - 2 * bt.Width, 0); bt.Image = new Bitmap(Properties.Resources.resize_window_icon, new Size(pictSide, pictSide)); bt.MouseClick += resizeButton_OnClick; bt.MouseEnter += resizeButton_MouseEnter; bt.MouseLeave += resizeButton_MouseLeave; resizeButton = bt; break; case ButtonTypes.hide: bt.Location = new Point(this.Width - 3 * bt.Width, 0); bt.Image = new Bitmap(Properties.Resources.hide_window_icon, new Size(pictSide, pictSide)); bt.MouseClick += hideButton_MouseClick; bt.MouseEnter += hideButton_MouseEnter; bt.MouseLeave += hideButton_MouseLeave; hideButton = bt; break; } this.Controls.Add(bt); }
private void DrawButton(ButtonTypes type) { switch (type) { case ButtonTypes.Play: this.DrawPlayButton(); break; case ButtonTypes.Stop: this.DrawStopButton(); break; default: break; } }
/// <summary> /// User interfaces the button click. /// </summary> /// <param name="buttonTypeClicked">Button type clicked.</param> public void UIButtonClick(ButtonTypes buttonTypeClicked) { switch (buttonTypeClicked) { case ButtonTypes.Previous: // Select Previous Prefab SelectPreviousPE(); break; case ButtonTypes.Next: // Select Next Prefab SelectNextPE(); break; default: // Nothing break; } }
private void SetupButtons(ButtonTypes type) { if (type == ButtonTypes.Close) { CancelButton.Visibility = Visibility.Collapsed; } else if (type == ButtonTypes.Cancel) { CloseButton.Visibility = Visibility.Collapsed; } else { CancelButton.Visibility = Visibility.Collapsed; CloseButton.Visibility = Visibility.Collapsed; } }
public ActionResult ChangePassword(UserChangePasswordViewModel model, ButtonTypes pressedButtonType) { if (pressedButtonType == ButtonTypes.Save) { if (string.IsNullOrEmpty(model.LoginName)) { ModelState.AddModelError("incorrectUserPassword", "You have no permissions to change password."); return PartialView(Constants.Views.UserChangePassword, model.ClearPasswords()); } if (!ModelState.IsValidField("NewPassword") || !ModelState.IsValidField("ConfirmPassword") || !model.NewPassword.Equals(model.ConfirmPassword)) return PartialView(Constants.Views.UserChangePassword, model.ClearPasswords()); if (!_appraiserAccessManager.CanChangePasswordForUser(model.LoginName)) { ModelState.AddModelError("incorrectUserPassword", "You have no permissions to change password."); return PartialView(Constants.Views.UserChangePassword, model.ClearPasswords()); } if (model.LoginName.Equals(User.Identity.Name, StringComparison.OrdinalIgnoreCase)) { if (!_userManagement.CheckUserPassword(model.LoginName, model.OldPassword)) ModelState.AddModelError("OldPassword", "Incorrect old password"); } else ModelState["OldPassword"].Errors.Clear(); if (!ModelState.IsValid) return PartialView(Constants.Views.UserChangePassword, model.ClearPasswords()); var user = _userManagement.GetByEmail(model.LoginName); _userManagement.ChangePassword(model.LoginName, user.Id, model.NewPassword); _userManagement.ClearFailedAttempt(model.LoginName); if (model.LoginName.ToLower() != User.Identity.Name.ToLower()) { _taskManager.ScheduleChangePasswordNotification(model.LoginName, model.NewPassword); } CommitProviderInstance.Commit(); return Constants.Json.Default; } return Constants.Json.Default; }
/// <summary> /// The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place. /// </summary> /// <param name="buttonType">The type of button to check for the state of.</param> /// <param name="pressType">The button state to check for.</param> /// <param name="controllerReference">The reference to the controller to check the button state on.</param> /// <returns>Returns true if the given button is in the state of the given press type on the given controller reference.</returns> public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference) { if (!VRTK_ControllerReference.IsValid(controllerReference)) { return(false); } bool isRightController = (controllerReference.hand == ControllerHand.Right); KeyCode?touchButton = VRTK_SharedMethods.GetDictionaryValue((isRightController ? rightControllerTouchKeyCodes : leftControllerTouchKeyCodes), buttonType); KeyCode?pressButton = VRTK_SharedMethods.GetDictionaryValue((isRightController ? rightControllerPressKeyCodes : leftControllerPressKeyCodes), buttonType); switch (buttonType) { case ButtonTypes.Trigger: switch (pressType) { case ButtonPressTypes.Touch: case ButtonPressTypes.TouchDown: case ButtonPressTypes.TouchUp: return(IsButtonPressed(pressType, touchButton, pressButton)); case ButtonPressTypes.Press: case ButtonPressTypes.PressDown: case ButtonPressTypes.PressUp: return(IsMouseAliasPress(isRightController, buttonType, pressType) || IsAxisButtonPress(controllerReference, buttonType, pressType)); } break; case ButtonTypes.Grip: return(IsMouseAliasPress(isRightController, buttonType, pressType) || IsAxisButtonPress(controllerReference, buttonType, pressType)); case ButtonTypes.Touchpad: return(IsButtonPressed(pressType, touchButton, pressButton)); case ButtonTypes.ButtonOne: return(IsButtonPressed(pressType, touchButton, pressButton)); case ButtonTypes.ButtonTwo: return(IsButtonPressed(pressType, touchButton, pressButton)); case ButtonTypes.StartMenu: return(IsButtonPressed(pressType, touchButton, pressButton)); } return(false); }
/// <summary> /// Enables a button from the ButtonTypes enum. /// </summary> /// <param name="buttonType">The type of button to enable.</param> public void EnableButton(ButtonTypes buttonType) { switch (buttonType) { case ButtonTypes.BlockButton: _blockButton.interactable = true; break; case ButtonTypes.HomeButton: _homeButton.interactable = true; break; case ButtonTypes.GridButton: _gridButton.interactable = true; break; } }
private DressTypes ButtonTypeToDressType(ButtonTypes aButton) { DressTypes Res = DressTypes.None; foreach (DressTypes aDress in Enum.GetValues(typeof(DressTypes))) { if (aButton.ToString().Equals(aDress.ToString())) { Res = aDress; break; } } if (aButton == ButtonTypes.ClearBtn) { Res = DressTypes.Naked; } return(Res); }
private string NazwaGuzika(ButtonTypes enButton) { switch (enButton) { case ButtonTypes.OK: return("OK"); case ButtonTypes.TAK: return("TAK"); case ButtonTypes.NIE: return("NIE"); case ButtonTypes.ANULUJ: return("ANULUJ"); } return(string.Empty); }
public void SecondPlayerInit() { controllerInput = ControllerManager.GetControllerInput(2); lastButtonPressed = ButtonTypes.None; repeatDelayCount = 0f; menuActive = false; lockedMenu = false; isPlayerOne = false; selectedSpriteActive = false; cpuSelectorActive = false; canvas = GameObject.FindWithTag("Canvas"); playerSelector = Instantiate(Resources.Load <GameObject>("Prefabs/UI/P2 Selector"), canvas.transform); playerSelector.SetActive(false); cpuSelector = Instantiate(Resources.Load <GameObject>("Prefabs/UI/CPU Selector"), canvas.transform); cpuSelector.SetActive(false); unselectedSprite = Resources.Load <Texture>("2D Images/Player 2"); selectedSprite = Resources.Load <Texture>("2D Images/Player 2 Selected"); }
public void UpdateToolTip(ButtonTypes toolTipType) { if (!Object.op_Inequality((Object)this.ToolTipText, (Object)null)) { return; } if (toolTipType == ButtonTypes.Previous) { this.ToolTipText.set_text("Select Previous Particle Effect"); } else { if (toolTipType != ButtonTypes.Next) { return; } this.ToolTipText.set_text("Select Next Particle Effect"); } }
/// <summary> /// The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place. /// </summary> /// <param name="buttonType">The type of button to check for the state of.</param> /// <param name="pressType">The button state to check for.</param> /// <param name="controllerReference">The reference to the controller to check the button state on.</param> /// <returns>Returns true if the given button is in the state of the given press type on the given controller reference.</returns> public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference) { uint index = VRTK_ControllerReference.GetRealIndex(controllerReference); switch (buttonType) { case ButtonTypes.Touchpad: return(GetControllerButtonState(index, "TouchpadPress", pressType)); case ButtonTypes.ButtonOne: return(GetControllerButtonState(index, "ButtonOne", pressType)); case ButtonTypes.ButtonTwo: return(GetControllerButtonState(index, "ButtonTwo", pressType)); case ButtonTypes.StartMenu: return(GetControllerButtonState(index, "StartMenu", pressType)); } return(false); }
void CreateBgImgForButton(Button btn, ButtonTypes btnType) { var idx = (int)btnType; btn.Text = string.Empty; btn.FlatAppearance.BorderSize = 0; Bitmap clone; lock (drawImageLocker) { var size = btn.ClientSize; if (btnBgCaches[idx] == null || btnBgCaches[idx].Size != size) { btnBgCaches[idx] = CreateBgCache(size, btnType); } clone = btnBgCaches[idx].Clone() as Bitmap; } btn.BackgroundImage = clone; }
private string NazwaGuzika(ButtonTypes enButton) { switch (enButton) { case ButtonTypes.OK: return("OK"); case ButtonTypes.TAK: return("Tak"); case ButtonTypes.NIE: return("Nie"); case ButtonTypes.ANULUJ: return("Anuluj"); case ButtonTypes.ZATWIERDZ: return("Zatwierdź"); } return(string.Empty); }
private void ButtonInvokeHandler(ButtonTypes type) { switch (type) { case ButtonTypes.Load: if (OnLoadClickEvent != null) { OnLoadClickEvent.Invoke(); } break; case ButtonTypes.Restart: if (OnRestartClickEvent != null) { OnRestartClickEvent.Invoke(); } break; default: break; } }
Bitmap CreateBgCache(Size size, Padding padding, ButtonTypes btnType) { var bmp = new Bitmap( size.Width - padding.Left - padding.Right, size.Height - padding.Top - padding.Bottom); var r = Math.Min(bmp.Width, bmp.Height) * 0.6f / 2f; var cx = bmp.Width / 2f; var cy = bmp.Height / 2f; var pw = r * 0.4f; var pc = Color.FromArgb(50, 50, 50); using (var g = Graphics.FromImage(bmp)) using (var pen = new Pen(pc, pw)) { pen.StartCap = System.Drawing.Drawing2D.LineCap.Round; pen.EndCap = System.Drawing.Drawing2D.LineCap.Round; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; switch (btnType) { case ButtonTypes.Stop: DrawRect(g, cx, cy, r); break; case ButtonTypes.Start: DrawTriangle(g, pen, pw, cx, cy, r); break; case ButtonTypes.Menu: default: DrawHamburg(g, pen, pw, cx, cy, r); break; } } return(bmp); }
/// <summary> /// Set the type of the button. /// </summary> /// <param name="type">String representing the buttontype, if it's not an existing type, nothing happens.</param> public void SetButtonType(string type) { buttonType = (ButtonTypes)System.Enum.Parse(typeof(ButtonTypes), type); switch (buttonType) { case ButtonTypes.Next: GetComponent <Image>().sprite = sprites[0]; break; case ButtonTypes.a0: //GetComponent<Image>().sprite = sprites[1]; break; case ButtonTypes.a1: //GetComponent<Image>().sprite = sprites[2]; break; case ButtonTypes.Quit: GetComponent <Image>().sprite = sprites[3]; //GetComponent<RectTransform>().localScale = new Vector2(1, 1);//new Vector2(1.0f / GetComponent<RectTransform>().localScale.y, 1.0f / GetComponent<RectTransform>().localScale.x); break; case ButtonTypes.Restart: GetComponent <Image>().sprite = sprites[4]; break; case ButtonTypes.Record: GetComponent <Image>().sprite = sprites[5]; break; case ButtonTypes.Stop: GetComponent <Image>().sprite = sprites[6]; break; } GetComponent <Image>().preserveAspect = true; GetComponent <RectTransform>().sizeDelta = GetComponent <RectTransform>().sizeDelta *GetComponent <Image>().sprite.pixelsPerUnit; }
private bool DrawButton(string name, string iconName, ButtonTypes type) { GUILayoutOption[] options = null; switch (type) { case ButtonTypes.Standard: options = new GUILayoutOption[] { GUILayout.MaxHeight(_standardButtonMaxHeight) }; break; case ButtonTypes.Big: options = new GUILayoutOption[] { GUILayout.MaxHeight(_bigButtonMaxHeight) }; break; case ButtonTypes.SmallLongHeight: options = new GUILayoutOption[] { GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + (EditorGUIUtility.singleLineHeight * .5f)), GUILayout.MaxWidth(25) }; break; case ButtonTypes.SmallNormalHeight: options = new GUILayoutOption[] { GUILayout.MaxHeight(_standardButtonMaxHeight), GUILayout.MaxWidth(25) }; break; default: break; } if (iconName != null && iconName != "") { GUIContent c = new GUIContent(EditorGUIUtility.IconContent(iconName)); c.text = name; return(GUILayout.Button(c, _buttonStyle, options)); } else { return(GUILayout.Button(name, options)); } }
public bool SendButton(string button, string deviceMap, ButtonTypes bType, short amount) { return SendButton(button, 0, deviceMap, bType, amount); }
/************************************************************************/ /* SendButton - Payload format */ /* %i - button code */ /* %i - flags 0x01 => use button map/name instead of code */ /* 0x02 => btn down */ /* 0x04 => btn up */ /* 0x08 => use amount */ /* 0x10 => queue event */ /* 0x20 => do not repeat */ /* 0x40 => virtual key */ /* 0x80 => axis key */ /* %i - amount ( 0 => 65k maps to -1 => 1 ) */ /* %s - device map (case sensitive and required if flags & 0x01) */ /* "KB" - Standard keyboard map */ /* "XG" - Xbox Gamepad */ /* "R1" - Xbox Remote */ /* "R2" - Xbox Universal Remote */ /* "LI:devicename" - valid LIRC device map where 'devicename' */ /* is the actual name of the LIRC device */ /* "JS<num>:joyname" - valid Joystick device map where */ /* 'joyname' is the name specified in */ /* the keymap. JS only supports button code */ /* and not button name currently (!0x01). */ /* %s - button name (required if flags & 0x01) */ /************************************************************************/ private bool SendButton(string button, ushort buttonCode, string deviceMap, ButtonTypes flags, short amount) { if (!Connected) return false; if (button.Length != 0) { if ((flags & ButtonTypes.BtnUseName) == 0) flags |= ButtonTypes.BtnUseName; buttonCode = 0; } else button = ""; if (amount > 0) { if ((flags & ButtonTypes.BtnUseAmount) == 0) flags |= ButtonTypes.BtnUseAmount; } if ((flags & ButtonTypes.BtnDown) == 0 || (flags & ButtonTypes.BtnUp) == 0) flags |= ButtonTypes.BtnDown; var payload = new byte[button.Length + deviceMap.Length + 8]; var offset = 0; payload[offset++] = (byte)((buttonCode & 0xff00) >> 8); payload[offset++] = (byte)(buttonCode & 0x00ff); payload[offset++] = (byte)(((ushort)flags & 0xff00) >> 8); payload[offset++] = (byte)((ushort)flags & 0x00ff); payload[offset++] = (byte)((amount & 0xff00) >> 8); payload[offset++] = (byte)(amount & 0x00ff); foreach (var t in deviceMap) payload[offset++] = (byte)t; payload[offset++] = (byte)'\0'; foreach (var t in button) payload[offset++] = (byte)t; payload[offset] = (byte)'\0'; return Send(PacketType.PtButton, payload); }
public bool SendButton(ushort buttonCode, ButtonTypes bType) { return(SendButton("", buttonCode, "", bType, 0)); }
public Button(AControl parent, int x, int y, int gumpID1, int gumpID2, ButtonTypes buttonType, int param, int buttonID) : this(parent) { buildGumpling(x, y, gumpID1, gumpID2, buttonType, param, buttonID); }
void buildGumpling(int x, int y, int gumpID1, int gumpID2, ButtonTypes buttonType, int param, int buttonID) { Position = new Point2D(x, y); GumpUpID = gumpID1; ButtonType = buttonType; ButtonParameter = param; ButtonID = buttonID; _textRenderer = new TextRenderer("", 100, true); }
public Button(Control owner, int page, int x, int y, int gumpID1, int gumpID2, ButtonTypes buttonType, int param, int buttonID) : this(owner, page) { buildGumpling(x, y, gumpID1, gumpID2, buttonType, param, buttonID); }
// Overloaded Constructor public ButtonBase(ButtonTypes Type, int Width) { m_ButtonType = Type; m_Width = Width; }
private static string findButtonName(ButtonTypes type, ControllerPlayers player, out InputExButtonMap mapping) { foreach (var map in ButtonMappings) { if (map.Type == type && map.Player == player) { mapping = map; return map.Name; } } Debug.LogError(string.Format("Failed to find Button {0} for Player {1}", type, player)); mapping = null; return "Unknown"; }
/// <summary> /// Gets if the button was let up /// </summary> /// <returns>Returns if valid or not</returns> /// <param name="type">Button Type.</param> /// <param name="player">Player input accepted.</param> public static bool GetButtonUp(ButtonTypes type, ControllerPlayers player) { InputExButtonMap mapping; string name = findButtonName(type, player, out mapping); if (mapping != null && mapping.analogUp) return true; return Input.GetButtonUp(name); }
/// <summary> /// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class. /// </summary> /// <param name="type">Button Type.</param> /// <param name="player">Player input accepted.</param> /// <param name="name">Name from Unitys settings.</param> public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name) { this.Type = type; this.Player = player; this.Name = name; }
public bool SendButton(ushort buttonCode, ButtonTypes bType, short amount) { return SendButton("", buttonCode, "", bType, amount); }
public ActionResult ChangePassword(ExpirationChangePasswordViewModel model, ButtonTypes pressedButtonType) { if (!ModelState.IsValidField("NewPassword") || !ModelState.IsValidField("ConfirmPassword") || !model.NewPassword.Equals(model.ConfirmPassword)) return View(model.ClearPasswords()); if (!ModelState.IsValid) return View(model.ClearPasswords()); var user = SecurityContext.CurrentUser; _userManagement.ChangePassword(user.Email, user.Id, model.NewPassword); CommitProviderInstance.Commit(); ViewBag.ShowConfirmation = true; return View(model); }
public bool SendButton(string button, string deviceMap, ButtonTypes bType) { return SendButton(button, 0, deviceMap, bType, 0); }
void buildGumpling(int x, int y, int gumpID1, int gumpID2, ButtonTypes buttonType, int param, int buttonID) { Position = new Point(x, y); GumpUpID = gumpID1; GumpDownID = gumpID2; ButtonType = buttonType; ButtonParameter = param; ButtonID = buttonID; m_Texture = new RenderedText(string.Empty, 100, true); }
public bool SendButton(ushort buttonCode, string deviceMap, ButtonTypes bType) { return SendButton("", buttonCode, deviceMap, bType, 0); }
/// <summary> /// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class. /// </summary> /// <param name="type">Button Type.</param> /// <param name="player">Player input accepted.</param> /// <param name="name">Name from Unitys settings.</param> /// <param name="analogName">Analog name from Unitys settings.</param> /// <param name="analogPositive">Is analog button valid when value is positive.</param> public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name, string analogName, bool analogPositive) { this.Type = type; this.Player = player; this.Name = name; this.AnalogName = analogName; this.AnalogPositive = analogPositive; }
public bool SendButton(ushort buttonCode, ButtonTypes bType) { return SendButton("", buttonCode, "", bType, 0); }
void ui_ControlButtonPressed(IPlayerUI sender, ButtonTypes button) { switch (button) { case ButtonTypes.PlayPause: switch(_player.State) { case StreamPlayerState.Playing: case StreamPlayerState.Paused: _player.Pause(); _timer.Enabled = false; break; case StreamPlayerState.NotPlaying: _player.Play(_playlist.Current.StreamURL); _timer.Enabled = true; break; } break; case ButtonTypes.Forwards: _userChanging = true; _player.Stop(); _timer.Enabled = false; _playlist.MoveForwards(); _player.Play(_playlist.Current.StreamURL); _timer.Enabled = true; break; case ButtonTypes.Back: _userChanging = true; _player.Stop(); _timer.Enabled = false; _playlist.MoveBackwards(); _timer.Enabled = true; break; case ButtonTypes.Quit: _userChanging = true; _player.Stop(); _timer.Enabled = false; ((Form)_ui).Close(); break; case ButtonTypes.Stop: _userChanging = true; _timer.Enabled = false; _player.Stop(); break; } }