public PsProfileButton(ButtonName name, int note, int channel, int noteOffValue) { this.Name = name; this.Note = note; this.Channel = channel; this.NoteOffValue = noteOffValue; }
void HandleGuiInputOnClick(object sender, ButtonName e) { switch(e.name){ case ENTER: SoundManager.SOUNDS.playSound(SoundManager.UI_CLICK,MasterController.UI_CAMERA_ALT); _highScore.hS().set_name(_hsi.initials()); _highScore.saveScores(); _state = State.DISPLAY; break; case LEFT: _hsi.swipe(SwipeDirection.Left); break; case RIGHT: _hsi.swipe(SwipeDirection.Right); break; case UP1: case UP2: case UP3: _hsi.swipe(SwipeDirection.Up); guiInput.SetGUINameProperty(INITIALS,_hsi.initials()); break; case DOWN1: case DOWN2: case DOWN3: _hsi.swipe(SwipeDirection.Down); guiInput.SetGUINameProperty(INITIALS,_hsi.initials()); break; default: break; } }
public void SetKeyName(ButtonName buttonName, KeyCode code, string newName) { buttonKeys.Remove(buttonName); buttonKeys.Add(buttonName, code); keysName.Remove(buttonName); keysName.Add(buttonName, newName); }
public MenuWindow() : base(0, 0, 120, 30, "MENU") { diamond1 = new Diamond(10, 5); diamond2 = new Diamond(92, 5); candle1 = new Candle(5, 18); candle2 = new Candle(105, 18); title = new TextLine(20, 3, 80, " !!! My super TODO APP !!! ", true, ConsoleColor.Cyan, ConsoleColor.DarkRed); copirightText = new TextLine(10, 27, 100, "All right Not reserved, go wild!, 2020", true, ConsoleColor.DarkGray); int menuY = 16; int menuX = 22; int menuGaps = 28; int menuButtonWidth = 20; int menuButtonHeight = 5; List <ButtonName> menuButtonNames = new List <ButtonName>() { ButtonName.Start, ButtonName.Credits, ButtonName.Quit }; activeButtonName = menuButtonNames[0]; for (int i = 0; i < menuButtonNames.Count; i++) { Button button = new Button(menuX + menuGaps * i, menuY, menuButtonWidth, menuButtonHeight, menuButtonNames[i].ToString()); menuButtons.Add(menuButtonNames[i], button); } SetButtonActive(activeButtonName); }
private void RaiseOnClosed(ButtonName buttonName) { if (onClosed != null) { onClosed.Invoke(buttonName); } }
private int clickedDelay = 10; //onödig variabel? //Constructor(s) public Button(Texture2D texture, Vector2 position, Color btnColorOverlay, ButtonName bName) { this.Texture = texture; this.Position = position; this.ButtonColorOverlay = btnColorOverlay; this.BName = bName; }
//onClick - GUIManager void HandleGuiOnClick(object sender, ButtonName e) { switch(e.name){ case MINUS1: //texture if(_texture>0) _texture--; gui.SetGUINameProperty(MATHIUS_COLOR_DISPLAY,colorArray[_texture]); MasterController.BRAIN.m().set_texture(_texturemap[colorArray[_texture]]); prefs.set_mathiusTexture(_texture); break; case MINUS2: //perceptual sound if(_sound>0) _sound--; gui.SetGUINameProperty(VOICE_VOLUME_DISPLAY,soundArray[_sound]); prefs.set_perceptualVolume(_sound); break; case PLUS1: //texture if(_texture<(_mathiusTextures.Length-1)) _texture++; gui.SetGUINameProperty(MATHIUS_COLOR_DISPLAY,colorArray[_texture]); MasterController.BRAIN.m().set_texture(_texturemap[colorArray[_texture]]); break; case PLUS2: // perceptual sound if(_sound<(soundArray.Length-1)) _sound++; gui.SetGUINameProperty(VOICE_VOLUME_DISPLAY,soundArray[_sound]); prefs.set_perceptualVolume(_sound); break; case MAIN_MENU: Application.LoadLevel("MainMenu"); break; default: break; } }
protected override void button2_Click(object sender, EventArgs e) { //base.button2_Click(sender, e); try { if (ButtonName.Equals("Edit")) { parentForm.editItemQuery = CreateEditQuery(); Close(); } else { SendAddQuery(CreateAddQuery()); textBox1.Text = ""; comboBox1.SelectedItem = null; parentForm.actualizeDataGridView("Teams"); if (parentForm.closingAddForms) { Close(); } } } catch (SqlException exc) { MessageBox.Show(exc.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (InvalidDataException exc) { MessageBox.Show(exc.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BackColorSet(ButtonName index) { btnView.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnPraraSet.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnCtrlProcess.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnAlarm.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnTrend.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnReport.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnOPC.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnSysMaintenance.BackColor = Color.FromKnownColor(KnownColor.Highlight); btnExit.BackColor = Color.FromKnownColor(KnownColor.Highlight); switch (index) { case ButtonName.View: btnView.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.ParaSet: btnPraraSet.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.CtrlProcess: btnCtrlProcess.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.Alarm: btnAlarm.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.Tend: btnTrend.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.Report: btnReport.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.OpcView: btnOPC.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.SysMaintenance: btnSysMaintenance.BackColor = Color.FromKnownColor(KnownColor.Green); break; case ButtonName.Exit: btnExit.BackColor = Color.FromKnownColor(KnownColor.Green); break; default: break; } }
void Update() { if (PauseTimer > 0) { PauseTimer = Mathf.Max(0f, PauseTimer - Time.deltaTime); return; } if (Input.GetButtonDown(ButtonName.ToString())) // This Is a **TAP**; { LastTapTime = Time.time; TapCount++; DirAtTap = INPUT.I.DirLS; if (TapCount == 1) { PLAYER.I.FirstTap(this); // If this is the FIRST tap, alert PLAYER immediately for instant graphic response. } } else if (Input.GetButton(ButtonName.ToString()) && LastTapTime > 0f && Time.time - LastTapTime > PREFS.I.Leeway && !IsHolding) { PLAYER.I.StartHold(this, TapCount, (Vector3)DirAtTap); // ELSE IF button held for longer than leeway, this is a **HOLD**. IsHolding = true; Clear(); } else if (IsHolding && Input.GetButtonUp(ButtonName.ToString())) { PLAYER.I.EndHold(this); IsHolding = false; Clear(); } else if (TapCount > 0 && !Input.GetButton(ButtonName.ToString()) && (Time.time - LastTapTime > PREFS.I.Leeway || TapCount >= PREFS.I.MaxTaps)) { PLAYER.I.MultiTap(this, TapCount, (Vector3)DirAtTap); Clear(); } }
public Button GetAssignedKey(ButtonName name) { if (assignedKey.ContainsKey(name)) { return(assignedKey[name]); } return(null); }
public NoteDetector(MidiViewModel midiViewModel, ButtonName buttonName) : this() { this.MidiViewModel = midiViewModel; this.midiViewModel.MidiModel.MessageReceived += this.MidiMessageReceived; this.ButtonName = buttonName; this.Status = "Waiting for midi note on event"; }
public ListViewItem GetAssignedOverlay(ButtonName name) { if (assignedOverlay.ContainsKey(name)) { return(assignedOverlay[name]); } return(null); }
public void SetButtonActive(ButtonName buttonName) { // sena migtuka diaktivuot. menuButtons[activeButtonName].Deactivate(); activeButtonName = buttonName; // nauja migtuka aktivuot menuButtons[activeButtonName].Activate(); }
/// <summary> /// Constructor for the button that is linked to a feature. /// </summary> /// <param name="buttonType">The type of the button.</param> /// <param name="isRight">True if it represents a button on the right controller.</param> public Button(ButtonName buttonType, ButtonActions action, bool isRight, bool overridesInteraction, Action method, Type featureOwner) { this.IsRightControllerButton = isRight; Name = buttonType; Action = action; buttonDelegate = method; FeatureOwner = featureOwner; }
public void EmptyInputData() { _pressedButtonName = ButtonName.None; _selectedObject = null; _button3Pressed = false; _button3HeldDown = false; _button8Pressed = false; }
public Button(Player player, ButtonName buttonName, Keys[] keys, Buttons[] buttons, float timeHeld = 0f, ActionState actionState = ActionState.None) { Player = player; ButtonName = buttonName; ActionState = actionState; Keys = keys; Buttons = buttons; TimeHeld = timeHeld; }
// Handle a button press. protected override void OnButtonPress (int x, int y, ButtonName button, ModifierMask modifiers) { if (IsSelect(button)) { entered = true; pressed = true; Draw(); } }
public void LoadCustomToolButton(ButtonName buttonName, Action <object> methodName, object commandParam, DrawingModeDef drawingModeDef, int mapCursorId, bool bModifierKey = false) { _dic.Add(buttonName.ToString(), Program.miApplication.RegisterCustomTool(new Button(), new DelegateCommand(methodName), null, (int)drawingModeDef, mapCursorId.ToString(), bModifierKey)); }
void HandleGuiOnClick(object sender, ButtonName e) { switch(e.name){ case MAINMENU: Application.LoadLevel("MainMenu"); break; default: break; } }
public void TypeToInputField(ButtonName b) { string editInputFieldText = targetinputField.text; string textToAppend = ""; switch (b) { case ButtonName.Num0: textToAppend = "0"; break; case ButtonName.Num1: textToAppend = "1"; break; case ButtonName.Num2: textToAppend = "2"; break; case ButtonName.Num3: textToAppend = "3"; break; case ButtonName.Num4: textToAppend = "4"; break; case ButtonName.Num5: textToAppend = "5"; break; case ButtonName.Num6: textToAppend = "6"; break; case ButtonName.Num7: textToAppend = "7"; break; case ButtonName.Num8: textToAppend = "8"; break; case ButtonName.Num9: textToAppend = "9"; break; case ButtonName.Comma: textToAppend = "."; break; } editInputFieldText += textToAppend; targetinputField.text = editInputFieldText; }
// Update is called once per frame private void Update() { /* * This code is just a test and must be rewritten */ if (hand == ControllerHand.Left) { return; } if (!_keyboardHand) { _keyboardHand = GameObject.Find("Right Hand"); _keyboardHand.transform.parent = transform; } CheckButton3Input(); CheckButton8Input(); if (_button3Pressed) { DetectRayCollision(); _pressedButtonName = ButtonName.Button3; _button3Pressed = false; } else if (_button3HeldDown) { if (!_selectedObject) { DetectRayCollision(); } _pressedButtonName = ButtonName.Button3; } else if (_button8Pressed) { _pressedButtonName = ButtonName.Button8; _button8Pressed = false; if (_nodePivot) { return; } SpawnNodePivot( transform.position + 4.0f * transform.forward, transform.rotation); } else { _pressedButtonName = ButtonName.None; } }
// Override the button double click event from Xsharp. protected override void OnButtonDoubleClick (int x, int y, ButtonName button, ModifierMask modifiers) { if (sink != null) { sink.ToolkitMouseDown (DrawingWindow.MapButton(button), DrawingWindow.MapKey(KeyName.XK_VoidSymbol, modifiers), 2, x, y, 0); } }
// Override the button release event from Xsharp. protected override void OnButtonRelease(int x, int y, ButtonName button, ModifierMask modifiers) { if (sink != null) { sink.ToolkitMouseUp (DrawingWindow.MapButton(button), DrawingWindow.MapKey(KeyName.XK_VoidSymbol, modifiers), 1, x, y, 0); } }
void HandleGuiOnClick(object sender, ButtonName e) { switch(e.name){ case NEXT: SoundManager.SOUNDS.playSound(SoundManager.UI_CLICK,MasterController.UI_CAMERA_ALT); gs++; creditTimer = 20.0f; break; default: break; } }
// Override the button press event from Xsharp. protected override void OnButtonPress(int x, int y, ButtonName button, ModifierMask modifiers) { if (sink != null) { sink.ToolkitMouseDown (MapButton(button), MapKey(KeyName.XK_VoidSymbol, modifiers), 1, x, y, 0); } this.button = button; }
private static Button First(IGamepad gamepad, ButtonName name) // now without the LINQ { foreach (var button in gamepad.Buttons) { if (button.Name == name) { return(button); } } throw new PlatformNotSupportedException("This button is not supported by the input backend."); }
public void Highlight(ButtonName button, bool isNoteOn, byte velocity) { Visibility result = Convert.ToVisibility(isNoteOn); var status = isNoteOn ? MIDIStatus.NoteOn : MIDIStatus.NoteOff; MidiNote note = MidiNote.None; if (button == ButtonName.Red) { this.RedVisibility = result; note = MidiNote.AcousticSnare; } else if (button == ButtonName.Yellow_Tom) { this.YellowTomVisibility = result; note = MidiNote.LowTom; } else if (button == ButtonName.Blue_Tom) { this.BlueTomVisibility = result; note = MidiNote.HighFloorTom; } else if (button == ButtonName.Green_Tom) { this.GreenTomVisibility = result; note = MidiNote.LowFloorTom; } else if (button == ButtonName.Yellow) { this.YellowCymbalVisibility = result; note = MidiNote.ClosedHiHat; } else if (button == ButtonName.Green) { this.GreenCymbalVisibility = result; note = MidiNote.CrashCymbal1; } else if (button == ButtonName.Blue) { this.BlueCymbalVisibility = result; note = MidiNote.RideCymbal2; } else if (button == ButtonName.Bass) { this.BassVisibility = result; note = MidiNote.BassDrum1; } if (note != MidiNote.None) { MidiModel.Send(new MidiShortMessage(status, 9, (byte)note, velocity, 0)); } }
/* Прописано жестко для каждой кнопки * пока не понятно, как это будет выглядеть в будуюзем */ public void ManagingBackground(ButtonName buttonName) { TradeConfiguration config; switch (buttonName) { case ButtonName.BTCUSD_LONG: config = configRepository.Get("BTC", "USDT", "LONG"); if (config != null) { config.Active = !config.Active; var configNew = configRepository.Update(config, Resources.SAVED_STRATEGIES); UpdateBrushBackground(buttonName, configNew.Active); } else { MessageBox.Show("Для данной стратегии не найдена сохраненная конфигурация.", "Конфигурация", MessageBoxButton.OK, MessageBoxImage.Information); } break; case ButtonName.BTCUSD_SHORT: config = configRepository.Get("BTC", "USDT", "SHORT"); if (config != null) { config.Active = !config.Active; var configNew = configRepository.Update(config, Resources.SAVED_STRATEGIES); UpdateBrushBackground(buttonName, configNew.Active); } else { MessageBox.Show("Для данной стратегии не найдена сохраненная конфигурация.", "Конфигурация", MessageBoxButton.OK, MessageBoxImage.Information); } break; case ButtonName.ETHUSD_SHORT: config = configRepository.Get("ETH", "USDT", "SHORT"); if (config != null) { config.Active = !config.Active; var configNew = configRepository.Update(config, Resources.SAVED_STRATEGIES); UpdateBrushBackground(buttonName, configNew.Active); } else { MessageBox.Show("Для данной стратегии не найдена сохраненная конфигурация.", "Конфигурация", MessageBoxButton.OK, MessageBoxImage.Information); } break; default: break; } }
void HandleGuiOnClick(object sender, ButtonName e) { switch(e.name){ case MINUS1://terrain if(_terrain_num>1) _terrain_num--; gui.SetGUINameProperty(TERRAIN_NUM,_terrain_num.ToString()); prefs.set_tileNum(_terrain_num); break; case MINUS2://eq format if(_format_num>0) _format_num--; gui.SetGUINameProperty(EQUATION_FORMAT,formatArray[_format_num]); prefs.set_eqFormat(_format_num); break; case MINUS3://num to win if(_num_to_win>1) _num_to_win--; gui.SetGUINameProperty(NUMBER_TO_WIN_VALUE,_num_to_win.ToString()); prefs.set_numWin(_num_to_win); break; case PLUS1://terrain _terrain_num++; gui.SetGUINameProperty(TERRAIN_NUM,_terrain_num.ToString()); prefs.set_tileNum(_terrain_num); break; case PLUS2://eq format if(_format_num<(formatArray.Length-1)) _format_num++; gui.SetGUINameProperty(EQUATION_FORMAT,formatArray[_format_num]); prefs.set_eqFormat(_format_num); break; case PLUS3://num to win _num_to_win++; gui.SetGUINameProperty(NUMBER_TO_WIN_VALUE,_num_to_win.ToString()); prefs.set_numWin(_num_to_win); break; case SAVE: Application.LoadLevel("MainMenu"); break; case RESET: prefs.set_operations((byte)15); prefs.set_tileNum(1); prefs.set_terrains((byte)1); prefs.set_eqFormat(0); prefs.set_numWin(25); prefs.set_alienSpeed(0.0f); Application.LoadLevel("MainMenu"); break; case CUSTOM_GAME: Application.LoadLevel("Earth Scene"); break; default: break; } }
void HandleGuiDisplayOnClick(object sender, ButtonName e) { switch(e.name){ case MAINMENU: Application.LoadLevel("MainMenu"); SoundManager.SOUNDS.playSound(SoundManager.UI_MUSIC_MAIN,MasterController.UI_CAMERA_ALT); SoundManager.SOUNDS.playSound(SoundManager.UI_MAIN_LOOP,MasterController.UI_CAMERA_ALT); break; case REPLAY: Application.LoadLevel("Earth Scene"); break; } }
private void UpdateBrushBackground(ButtonName buttonName, bool isActive) { var button = colorButtons.First(x => x.Name == buttonName); if (isActive) { button.BrushBackground = (Brush)Application.Current.Resources["SolidGreen"]; } else { button.BrushBackground = (Brush)Application.Current.Resources["SolidWhite"]; } }
public void Click_To_Button(ButtonName _buttonName) { switch (_buttonName.ToString()) { case "Refresh": RefreshButton.Click(); break; case "Login": LoginButton.Click(); break; } }
protected override bool OnButtonWheel(int x, int y, ButtonName button, ModifierMask modifiers, int iDelta) { if (sink != null) { sink.ToolkitMouseWheel (MapButton(button), MapKey(KeyName.XK_VoidSymbol, modifiers), 1, x, y, iDelta); } return(true); }
public void ManagingBackground(ButtonName buttonName) { foreach (var item in colorButtons) { if (item.Name == buttonName) { item.BrushBackground = (Brush)Application.Current.Resources["SolidYellow"]; } else { item.BrushBackground = (Brush)Application.Current.Resources["SolidGray"]; } } }
public void Highlight(ButtonName button, bool isNoteOn, byte velocity) { if (button == ButtonName.None) { return; } foreach (var removeableButton in this.RemoveableButtons) { if (removeableButton.MonitorButton.ProfileButton.Name == button) { removeableButton.Highlight(isNoteOn); } } }
/// <summary> /// ボタン入力の取得(モバイル環境) /// </summary> /// <param name="button">対象のボタン</param> /// <param name="eventType">対象のイベントタイプ</param> private void GetButtonInput(ButtonName button, EventTriggerType eventType) { switch (eventType) { case EventTriggerType.PointerDown: buttons[button] = ButtonState.Press; break; case EventTriggerType.PointerUp: buttons[button] = ButtonState.Up; break; } }
//onScroll - GUIManager void HandleGuiOnScroll(object sender, ButtonName e) { switch(e.name){ case MUSIC_DISPLAY: _music = e.amount; gui.SetGUINameProperty(MUSIC,("Music: " + (Mathf.Round(_music *100f)/100f))); prefs.set_musicVolume(_music); break; case EFFECTS_DISPLAY: _sfx = e.amount; gui.SetGUINameProperty(EFFECTS,"Effects: " + (Mathf.Round(_sfx*100f)/100f)); prefs.set_SFXVolume(_sfx); break; default: break; } }
public GUIButton(string assetFile, string hoverTextureFile, ButtonName name, RenderContext context) : base(assetFile, context) { Scale(m_Scalefactor); m_NormalTextureFile = assetFile; m_HoverTextureFile = hoverTextureFile; m_NormalTexture = m_Texture; m_HoverTexture = context.Content.Load<Texture2D>(m_HoverTextureFile); BtnName = name; float w = (float)Width * m_Scalefactor; float h = (float)Height * m_Scalefactor; NewWidth = (int)w; NewHeight = (int)h; IsClicked = false; m_HitRect = new Rectangle((int)Position.X, (int)Position.Y, NewWidth, NewHeight); }
void HandleGuiOnClick(object sender, ButtonName e) { switch(e.name){ case START_GAME: Application.LoadLevel("Earth Scene"); break; case LEVEL_EDITOR: Application.LoadLevel("Settings"); break; case OPTIONS: Application.LoadLevel("Options"); break; case HIGH_SCORE: Application.LoadLevel("HighScores"); break; case CREDITS: Application.LoadLevel("Credits"); break; case EXIT: Application.Quit(); break; } }
/// <summary> /// <para>Method that is called when the mouse wheel is turned.</para> /// </summary> /// /// <param name="x"> /// <para>The X co-ordinate of the pointer position.</para> /// </param> /// /// <param name="y"> /// <para>The Y co-ordinate of the pointer position.</para> /// </param> /// /// <param name="button"> /// <para>The button that was pressed.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> /// /// <param name="iDelta"> /// <para>Delta indicating how far the wheel was turned.</para> /// </param> protected virtual bool OnButtonWheel(int x, int y, ButtonName button, ModifierMask modifiers, int iDelta) { // Nothing to do in this class. return true; }
// Map an Xsharp button name into a "ToolkitMouseButtons" value. internal static ToolkitMouseButtons MapButton(ButtonName button) { switch(button) { case ButtonName.Button1: return ToolkitMouseButtons.Left; case ButtonName.Button2: return ToolkitMouseButtons.Middle; case ButtonName.Button3: return ToolkitMouseButtons.Right; case ButtonName.Button4: return ToolkitMouseButtons.XButton1; case ButtonName.Button5: return ToolkitMouseButtons.XButton2; default: return ToolkitMouseButtons.None; } }
protected override bool OnButtonWheel(int x, int y, ButtonName button, ModifierMask modifiers, int iDelta) { if(sink != null) { sink.ToolkitMouseWheel (MapButton(button), MapKey(KeyName.XK_VoidSymbol, modifiers), 1, x, y, iDelta); } return true; }
// Override the button double click event from Xsharp. protected override void OnButtonDoubleClick (int x, int y, ButtonName button, ModifierMask modifiers) { if(sink != null) { sink.ToolkitMouseDown (DrawingWindow.MapButton(button), DrawingWindow.MapKey (KeyName.XK_VoidSymbol, modifiers), 2, x, y, 0); } }
void HandleGuiOnScroll(object sender, ButtonName e) { switch(e.name){ case ALIEN_SLIDER_SPEED: _alien_speed = e.amount; gui.SetGUINameProperty(ALIEN_SPEED,"Alien Speed: " +(Mathf.Round(_alien_speed *100f)/100f)); prefs.set_alienSpeed(_alien_speed); break; default: break; } }
/// <summary> /// 指定のボタンが押された瞬間、trueを返す /// 注意 : FixedUpdate()内でのみ呼ぶこと /// </summary> /// <param name="buttonName">検知したいボタン</param> /// <returns></returns> public static bool GetButtonDownInFixedUpdate(ButtonName buttonName) { switch (buttonName) { case ButtonName.Attack: case ButtonName.Jump: // 同時入力判定中、または同時押し確定時 if (jumpTrampledInputCount < jumpTrampledInputSeconds || buttonState[ButtonName.JumpTrampled]) { return false; } break; case ButtonName.JumpTrampled: // 同時入力判定中、または同時押し確定時 if (jumpTrampledInputCount < jumpTrampledInputSeconds) { return false; } break; case ButtonName.Barrier: case ButtonName.ItemGet: case ButtonName.LockOn: case ButtonName.CameraToFront: case ButtonName.RightLockOnChanged: case ButtonName.LeftLockOnChanged: break; default: throw new ArgumentException("不正な引数が渡されました"); } return buttonState[buttonName]; }
// Dispatch an event to this widget. internal override void DispatchEvent(ref XEvent xevent) { ButtonName button; XTime time; switch((EventType)(xevent.xany.type__)) { case EventType.ButtonPress: { // Process button events. button = xevent.xbutton.button; time = xevent.xbutton.time; if(lastClickButton == button && lastClickTime != XTime.CurrentTime && (time - lastClickTime) < 500) { OnButtonDoubleClick(xevent.xbutton.x, xevent.xbutton.y, button, xevent.xbutton.state); time = XTime.CurrentTime; } else { OnButtonPress(xevent.xbutton.x, xevent.xbutton.y, button, xevent.xbutton.state); } lastClickTime = time; lastClickButton = button; } break; case EventType.ButtonRelease: { // Dispatch a button release event. button = xevent.xbutton.button; OnButtonRelease(xevent.xbutton.x, xevent.xbutton.y, button, xevent.xbutton.state); } break; case EventType.MotionNotify: { // Dispatch a pointer motion event. OnPointerMotion(xevent.xmotion.x, xevent.xmotion.y, xevent.xmotion.state); } break; case EventType.EnterNotify: { // Dispatch a widget enter event. Widget child = dpy.handleMap [xevent.xcrossing.subwindow]; OnEnter(child, xevent.xcrossing.x, xevent.xcrossing.y, xevent.xcrossing.state, xevent.xcrossing.mode, xevent.xcrossing.detail); } break; case EventType.LeaveNotify: { // Dispatch a widget leave event. Widget child = dpy.handleMap [xevent.xcrossing.subwindow]; OnLeave(child, xevent.xcrossing.x, xevent.xcrossing.y, xevent.xcrossing.state, xevent.xcrossing.mode, xevent.xcrossing.detail); } break; } }
// Handle a button double-click. protected void OnButtonDoubleClick (int x, int y, int x_root, int y_root, ButtonName button, ModifierMask modifiers) { HitTest hitTest = SetCursor(x, y); if(IsSelect(button)) { if(hitTest == HitTest.Caption) { // Double-clicking the caption de-iconifies, maximizes, // or restores. if(child.IsIconic) { child.Deiconify(); } else if((flags & CaptionFlags.HasMaximize) != 0) { child.Maximize(); } else if((flags & CaptionFlags.HasRestore) != 0) { child.Restore(); } } else { // Double-click elsewhere is the same as single-click. OnButtonPress(x, y, x_root, y_root, button, modifiers); } } }
// Handle a button press. protected override void OnButtonPress (int x, int y, ButtonName button, ModifierMask modifiers) { if(IsSelect(button)) { entered = true; pressed = true; Draw(); } }
// Handle a button release. protected void OnButtonRelease(int x, int y, int x_root, int y_root, ButtonName button, ModifierMask modifiers) { // Set the cursor and bail out if we aren't in a click mode. if(clickMode == HitTest.Outside) { SetCursor(x, y); return; } // Bail out if it wasn't the select button that was released. if(!IsSelect(button)) { return; } // Get the area currently occupied by the cursor. HitTest hitTest = PerformHitTest(x, y); // Process the button release according to the click mode. switch(clickMode) { case HitTest.Close: case HitTest.Maximize: case HitTest.Minimize: case HitTest.Restore: case HitTest.Help: { if(ChangeButtonState(clickMode, false) && clickMode == hitTest) { // A caption button has been clicked. switch(clickMode) { case HitTest.Close: child.Close(); break; case HitTest.Maximize: if(child.IsIconic) { child.Deiconify(); } child.Maximize(); break; case HitTest.Minimize: child.Iconify(); break; case HitTest.Restore: if(child.IsIconic) { child.Deiconify(); } else { child.Restore(); } break; case HitTest.Help: child.Help(); break; } } } break; } // Exit the click mode and return to normal. clickMode = HitTest.Outside; SetCursor(x, y); }
// Handle a button press. protected void OnButtonPress(int x, int y, int x_root, int y_root, ButtonName button, ModifierMask modifiers) { // Ignore button presses in a click mode because they // will be for something other than the select button. if(clickMode != HitTest.Outside) { return; } // Adjust the cursor to match the current position. HitTest hitTest = SetCursor(x, y); // Bail out if we are not processing the select button. if(!IsSelect(button)) { return; } // Enter the appropriate click mode. if(hitTest != HitTest.Outside && hitTest != HitTest.Client) { clickMode = hitTest; startX = x; startY = y; startWidth = width; startHeight = height; startRootX = x_root; startRootY = y_root; } // Depress a button if one was pressed. switch(hitTest) { case HitTest.Close: case HitTest.Maximize: case HitTest.Minimize: case HitTest.Restore: case HitTest.Help: { ChangeButtonState(hitTest, true); } break; } }
//method(s) public override void Update(GameTime gameTime) { base.Update(gameTime); if (IsDead == true) { characterSelected = false; if (hasDiedAnimated == false) { Texture = DeathAnim; direction = Direction.Dead; AnimWidth = 300; AnimHeight = 301; MaxFrames = 8; SpritesPerRow = 3; deathTimer++; if (deathTimer == MaxFrames) { hasDiedAnimated = true; } } if (hasDiedAnimated == true) { Texture = DeadTexture; MaxFrames = 1; } } if (characterSelected == true && hasCreatedButtons == false) { hasCreatedButtons = true; buttonList.Add(CharButton1); buttonList.Add(CharButton2); buttonList.Add(CharButton3); buttonList.Add(CharButton4); } if (hasCreatedButtons == true && characterSelected) { foreach (Button b in buttonList) { b.Update(gameTime); if(b.Pressed) { selectedOption = b.BName; } } } if (healSelected) { if (Position == new Vector2(400, 350)) { direction = Direction.None; Position = new Vector2(-500, -500); } else if (Position.X > 400) { Position = new Vector2(Position.X - 1, Position.Y); direction = Direction.Left; } else if (Position.X < 400) { Position = new Vector2(Position.X + 1, Position.Y); direction = Direction.Right; } else if (Position.X == 400 && Position.Y > 350) { Position = new Vector2(Position.X, Position.Y - 1); direction = Direction.Up; } } if (yesIsSelected) { if (Position == new Vector2(-500, -500)) { direction = Direction.None; for (int i = 0; i < ListOfEvents.StatListEvents.Count; i++) { if (ListOfEvents.StatListEvents[i].eventFinished == true) { if(ListOfEvents.StatListEvents[i].Chara.ID == this.ID) { yesIsSelected = false; Position = OldPos; ListOfEvents.StatListEvents.RemoveAt(i); } } } } else if (Position == new Vector2(400, 350)) { direction = Direction.None; Position = new Vector2(-500, -500); } else if (Position.X > 400) { Position = new Vector2(Position.X - 1, Position.Y); direction = Direction.Left; } else if (Position.X < 400) { Position = new Vector2(Position.X + 1, Position.Y); direction = Direction.Right; } else if (Position.X == 400 && Position.Y > 350) { Position = new Vector2(Position.X, Position.Y - 1); direction = Direction.Up; } } if (selectedOption == ButtonName.Resolve) { resolvePressed = true; selectedOption = ButtonName.Default; //Position = new Vector2((Position.X - 1.3f), Position.Y); //direction = Direction.Left; } else if (selectedOption == ButtonName.Eat) { if (Resource.Food - 25 >= 0) { Resource.Food -= 25; Hunger += 10; selectedOption = ButtonName.Default; } } else if (selectedOption == ButtonName.Heal) { healSelected = true; selectedOption = ButtonName.Default; } else if (selectedOption == ButtonName.Upgrade) { if (Resource.ScrapMetal - 35 >= 0) { Resource.Hull += 10; Resource.ScrapMetal -= 35; selectedOption = ButtonName.Default; } } if (direction == Direction.Left) { Texture = WalkLeft; SpritesPerRow = WalkLeftSpritesPerRow; MaxFrames = WalkLeftFrames; characterIdle = false; } else if (direction == Direction.Right) { Texture = WalkRight; SpritesPerRow = WalkRightSpritesPerRow; MaxFrames = WalkRightFrames; characterIdle = false; } else if (direction == Direction.Up) { Texture = WalkUp; SpritesPerRow = WalkUpSpritesPerRow; MaxFrames = WalkUpFrames; characterIdle = false; } else if (direction == Direction.Down) { Texture = WalkDown; SpritesPerRow = WalkDownSpritesPerRow; MaxFrames = WalkDownFrames; characterIdle = false; } else if (direction == Direction.None) { Texture = OldTexture; SpritesPerRow = OldSPR; MaxFrames = OldFrames; characterIdle = true; } }
/// <summary> /// <para>Method that is called when any mouse button is released /// while the pointer is inside this widget.</para> /// </summary> /// /// <param name="x"> /// <para>The X co-ordinate of the pointer position.</para> /// </param> /// /// <param name="y"> /// <para>The Y co-ordinate of the pointer position.</para> /// </param> /// /// <param name="button"> /// <para>The button that was released.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> protected virtual void OnButtonRelease(int x, int y, ButtonName button, ModifierMask modifiers) { // Nothing to do in this class. }
BaseGame[] subSelect; //それぞれの検索モード #endregion Fields #region Constructors /// <summary> /// コンストラクタ /// </summary> /// <param name="mainGame"></param> public IjinSelectMain(MainGame mainGame) : base(mainGame) { this.selectedButton = ButtonName.name; isSelectMain = true; }
/// <summary> /// <para>Method that is called when any mouse button is double-clicked /// while the pointer is inside this widget.</para> /// </summary> /// /// <param name="x"> /// <para>The X co-ordinate of the pointer position.</para> /// </param> /// /// <param name="y"> /// <para>The Y co-ordinate of the pointer position.</para> /// </param> /// /// <param name="button"> /// <para>The button that was pressed.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> protected virtual void OnButtonDoubleClick (int x, int y, ButtonName button, ModifierMask modifiers) { // Nothing to do in this class. }
/// <summary> /// 更新 /// </summary> public override void Update() { //それぞれの検索モード if(fadeOut.isEnd) { subSelect[(int)selectedButton].Update(); } //どの検索か選ぶ else if(isSelectMain && fadeIn.isEnd) { //ボタンを次にすすめる if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Right) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right)) { selectedButton += 1; if ((int)selectedButton == 4) { selectedButton = 0; } } //ボタンを前に戻す if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Left) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left)) { selectedButton -= 1; if ((int)selectedButton == -1) { selectedButton = (ButtonName)3; } } //詳細な検索に移る if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Enter) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter)) { isSelectMain = false; fadeOut.isEnabled = true; } } base.Update(); }
/// <summary> /// 指定のボタンが押された瞬間、trueを返す /// 注意 : Update()内でのみ呼ぶこと /// </summary> /// <param name="buttonName">検知したいボタン</param> /// <returns></returns> public static bool GetButtonDown(ButtonName buttonName) { switch (buttonName) { case ButtonName.Attack: // 同時入力判定中、または同時押し確定時 if (jumpTrampledInputCount < jumpTrampledInputSeconds || jumpTrampled) { return false; } return Input.GetButtonDown(InputName.Attack); case ButtonName.Jump: // 同時入力判定中、または同時押し確定時 if (jumpTrampledInputCount < jumpTrampledInputSeconds || jumpTrampled) { return false; } return Input.GetButtonDown(InputName.Jump); case ButtonName.Barrier: return Input.GetButtonDown(InputName.Barrier); case ButtonName.ItemGet: return Input.GetButtonDown(InputName.ItemGet); case ButtonName.LockOn: return Input.GetButtonDown(InputName.LockOn); case ButtonName.CameraToFront: return Input.GetButtonDown(InputName.CameraToFront); case ButtonName.JumpTrampled: return jumpTrampled; default: throw new ArgumentException("不正な引数が渡されました"); } }
// Override the button release event from Xsharp. protected override void OnButtonRelease(int x, int y, ButtonName button, ModifierMask modifiers) { if(sink != null) { sink.ToolkitMouseUp (DrawingWindow.MapButton(button), DrawingWindow.MapKey (KeyName.XK_VoidSymbol, modifiers), 1, x, y, 0); } }
// Handle a button release. protected override void OnButtonRelease (int x, int y, ButtonName button, ModifierMask modifiers) { if(IsSelect(button)) { pressed = false; Draw(); if(entered) { CaptionWidget child = mdi.activeChild; if(child != null) { if((flags & CaptionWidget.CaptionFlags.HasClose) != 0) { child.Child.Close(); } else if((flags & CaptionWidget.CaptionFlags. HasRestore) != 0) { if(child.Child.iconic) { child.Child.Deiconify(); } else { child.Child.Restore(); } } else { child.Child.Iconify(); } } } } }
void HandleGuiOnToggle(object sender, ButtonName e) { switch(e.name){ case TERRAIN0: toggleTerrain[0] = e.state; break; case TERRAIN1: toggleTerrain[1] = e.state; break; case TERRAIN2: toggleTerrain[2] = e.state; break; case TERRAIN3: toggleTerrain[3] = e.state; break; case TERRAIN4: toggleTerrain[4] = e.state; break; case TERRAIN5: toggleTerrain[5] = e.state; break; case TERRAIN6: toggleTerrain[6] = e.state; break; case TERRAIN7: toggleTerrain[7] = e.state; break; case PLUS: toggleOperation[0] = e.state; break; case MINUS: toggleOperation[1] = e.state; break; case MULTIPLY: toggleOperation[2] = e.state; break; case DIVIDE: toggleOperation[3] = e.state; break; default: break; } prefs.set_terrains(using_terrains()); prefs.set_operations(using_operations()); }