private void AddControls() { var Keyboard = Game.Instance.Keyboard; for (int i = 0; i < Math.Min(Buttons.Length, keys.Length); i++) { var l = Keyboard.Listen(keys[i], ButtonState.Pressed, SelectButton, null, i).InContext(this); associatedListeners.Add(l); } Action selectPrev = delegate { SelectButton(_selectedIndex > 0 ? _selectedIndex - 1 : Buttons.Length - 1); }; Action selectNext = delegate { SelectButton(_selectedIndex < Buttons.Length - 1 ? _selectedIndex + 1 : 0); }; Action confirmSelect = delegate { SelectedButton.Click(); }; var l1 = Keyboard.Listen(Key.Up, ButtonState.Pressed, selectPrev, null).InContext(this); var l2 = Keyboard.Listen(Key.Down, ButtonState.Pressed, selectNext, null).InContext(this); var l3 = Keyboard.Listen(Key.Enter, ButtonState.Pressed, confirmSelect, null).InContext(this); associatedListeners.AddItems(l1, l2, l3); foreach (var controller in Game.Instance.GameControllers) { l1 = controller.Listen(Button.DPadUp, ButtonState.Pressed, selectPrev, null).InContext(this); l2 = controller.Listen(Button.DPadDown, ButtonState.Pressed, selectNext, null).InContext(this); l3 = controller.Listen(Button.A, ButtonState.Pressed, confirmSelect, null).InContext(this); associatedListeners.AddItems(l1, l2, l3); } }
// Update is called once per frame void Update() { if (NorthButtonPressed.action.triggered) { selectedButton = SelectedButton.North; Debug.Log("UI: North Button pressed"); SelectSpecialAttack(); } if (SouthButtonPressed.action.triggered) { selectedButton = SelectedButton.South; Debug.Log("UI: South Button pressed"); SelectSpecialAttack(); } if (EastButtonPressed.action.triggered) { selectedButton = SelectedButton.East; Debug.Log("UI: East Button pressed"); SelectSpecialAttack(); } if (WestButtonPressed.action.triggered) { selectedButton = SelectedButton.West; Debug.Log("UI: West Button pressed"); SelectSpecialAttack(); } }
private void UnselectButton() { if (_selectedIndex < 0) { return; } SelectedButton.SetState(PushButton.State.Released); _selectedIndex = -1; }
public NavigationMenuViewModel() { GenConfigButton = new DelegateCommand(() => { RegionManagerA.RequestNavigate(SHELL_CONFIG_REGION, nameof(GeneralConfigView)); Selected = SelectedButton.GenConfig; }); TimersButton = new DelegateCommand(() => { RegionManagerA.RequestNavigate(SHELL_CONFIG_REGION, nameof(TimersListView)); Selected = SelectedButton.Timers; }); }
private void SelectButton(int p) { UnselectButton(); if (p < 0 || p >= Buttons.Length) { return; } _selectedIndex = p; SelectedButton.SetState(PushButton.State.Selected); }
public MainMenu() { background = new Sprite(new Texture("Textures/MainMenu_Background.jpg")); startButton = new Texture("Textures/MainMenuButton/StartButton.png"); startButtonHover = new Texture("Textures/MainMenuButton/StartButtonHover.png"); start = new Sprite(startButtonHover); quitButton = new Texture("Textures/MainMenuButton/QuitButton.png"); quitButtonHover = new Texture("Textures/MainMenuButton/QuitButtonHover.png"); quit = new Sprite(quitButton); currentSelected = SelectedButton.Start; indexButton = 0; }
protected override void OnAttached() { formsElement = Element as SelectedButton; nativeControl = Control as UIButton; nativeControl.Layer.BorderWidth = 3.0f; nativeControl.Layer.BorderColor = Xamarin.Forms.Color.FromHex("#2e72c0").ToCGColor(); nativeControl.BackgroundColor = formsElement.BackgroundColor.ToUIColor(); var gr = new UILongPressGestureRecognizer(); gr.AddTarget(() => this.ButtonLongPressed(gr)); nativeControl.AddGestureRecognizer(gr); }
protected override void OnAttached() { formsElement = Element as SelectedButton; nativeControl = Control as Android.Widget.Button; nativeControl.SetBackgroundResource(Resource.Layout.button_border); GradientDrawable drawable = (GradientDrawable)nativeControl.Background; drawable.SetColor(formsElement.BackgroundColor.ToAndroid()); nativeControl.LongClick += (s, args) => { formsElement.LongPressCommand.Execute(new object()); }; }
private void nextButton() { switch ( currentButton ) { case SelectedButton.START: currentButton = SelectedButton.CONTROLS; break; case SelectedButton.CONTROLS: currentButton = SelectedButton.CREDITS; break; case SelectedButton.CREDITS: currentButton = SelectedButton.EXIT; break; case SelectedButton.EXIT: currentButton = SelectedButton.START; break; } }
public void Move(Canvas canvas) { if (canvases.Contains(canvas)) { //현재 이미지 off ChangeImage(m_OffImageIndex); //이미지 사이즈 변경 SetImageSizeAndPosition(true); //현재 캔버스 비활성화 canvases[m_CurrentCanvas].gameObject.SetActive(false); //이동할 캔버스의 인덱스를 구한다. int index = canvases.IndexOf(canvas); // 이전 캔버스와 이동할 캔버스가 같으면 이전 캔버스로 돌아간다. if (m_StackOfButton.Count != 0 && m_StackOfButton.Peek().canvasIndex == index) { var prevButton = m_StackOfButton.Pop(); m_CurrentCanvas = prevButton.canvasIndex; m_CurrentImage = prevButton.imageIndex; m_NextImage = m_CurrentImage; } else { SelectedButton selectedButton = new SelectedButton(m_CurrentCanvas, m_CurrentImage); m_StackOfButton.Push(selectedButton); m_CurrentCanvas = index; m_CurrentImage = 0; m_NextImage = 0; } //이동한 캔버스 활성화 canvases[m_CurrentCanvas].gameObject.SetActive(true); SetImageSizeAndPosition(false); //처음 이미지 활성화 ChangeImage(m_ONImageIndex); } }
public void SelectFigure(Figure figure) { if (SelectedFigure != null) { SelectedFigure.isSelected = false; } SelectedFigure = figure; SelectedFigure.isSelected = true; if (SelectedButton != null) { SelectedButton.COMPLETED = false; SelectedButton.RestartInput(); sceneState = SceneState.Free; } }
void selectButton() { if (currentSelected > (SelectedButton)1 && upInputPressed()) { indexButton--; currentSelected = (SelectedButton)indexButton; start = new Sprite(startButtonHover); quit = new Sprite(quitButton); } else if (downInputPressed() && currentSelected < SelectedButton.Size - 1) { indexButton++; currentSelected = (SelectedButton)indexButton; start = new Sprite(startButton); quit = new Sprite(quitButtonHover); } }
public void return_to_menu() { selectedButton = SelectedButton.QuitToMenu; #if !UNITY_EDITOR if (!isCharacterPlayable()) { CharacterPanel.SetActive(true); return; } if (adManager.ShowInterstitialAd()) { return; } #endif returnToMenu(); }
public void UnLock(bool lockSelected) { if (!Disabled) { for (int i = 0; i < Buttons.Count; i++) { if (Buttons[i].Locked) { Buttons[i].Enable(); } } if (lockSelected && SelectedButton != null) { SelectedButton.Disable(); } else { SelectedButton = null; SelectedIndex = -1; } } }
public void next_level() { selectedButton = SelectedButton.NextLevel; #if !UNITY_EDITOR if (!isCharacterPlayable()) { CharacterPanel.SetActive(true); return; } if (enableAds && secondLevel && adManager.ShowInterstitialAd()) { secondLevel = false; return; } else { secondLevel = true; } #endif nextLevel(); }
void OnGUI() { GUI.skin = guiSkin; setButtonImages(); GUI.DrawTexture( new Rect( 0f, 0f, Screen.width + 10f, Screen.height + 10f ), black ); switch ( state ) { case StartState.SPLASH: if ( Time.time > splashScreenTimeout ) { state = StartState.MAIN_MENU; } GUI.skin.label.fontSize = 40; GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUI.Label( new Rect( Screen.width * 0.1f, Screen.height / 2 - 150f, Screen.width * 0.8f, 200f ), "This game was developed as part of Indie Speed Run 2012\n(www.indiespeedrun.com)." ); break; case StartState.MAIN_MENU: GUI.skin.label.fontSize = 60; GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUI.Label( new Rect( Screen.width * 0.5f - 150, Screen.height * 0.2f, 300f, 100f ), "SUNBLOCK" ); GUI.DrawTexture( new Rect( Screen.width * 0.5f + 60f, Screen.height * 0.2f - 70f, 200f, 200f ), logo ); if ( GUI.Button( new Rect( Screen.width * 0.5f - 100f, Screen.height * 0.2f + 150f, 200f, 62f ), startButton, GUIStyle.none ) ) { currentButton = SelectedButton.START; performAction(); } if ( GUI.Button( new Rect( Screen.width * 0.5f - 100f, Screen.height * 0.2f + 240f, 200f, 62f ), controlButton, GUIStyle.none ) ) { currentButton = SelectedButton.CONTROLS; performAction(); } if ( GUI.Button( new Rect( Screen.width * 0.5f - 100f, Screen.height * 0.2f + 330f, 200f, 62f ), creditsButton, GUIStyle.none ) ) { currentButton = SelectedButton.CREDITS; performAction(); } if ( GUI.Button( new Rect( Screen.width * 0.5f - 100f, Screen.height * 0.2f + 420f, 200f, 62f ), exitButton, GUIStyle.none ) ) { currentButton = SelectedButton.EXIT; performAction(); } break; case StartState.CONTROLS: GUI.skin.label.fontSize = 40; GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f +100f, Screen.width * 0.8f, 100f ), "Arrow keys/WASD\t\tMovement" ); GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + 160f, Screen.width * 0.8f, 100f ), "Space\t\t\t\t\t\t\t\t\t\t\t\t\tJump" ); GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + 220f, Screen.width * 0.8f, 100f ), "Z\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAttack" ); break; case StartState.CREDITS: GUI.skin.label.alignment = TextAnchor.MiddleCenter; //GUI.skin.label.fontSize = 25; //GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f, Screen.width * 0.5f, 100f ), "Artist/Producer" ); GUI.skin.label.fontSize = 40; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + titleSpace, Screen.width * 0.5f, 100f ), "Christopher Barakian" ); //GUI.skin.label.fontSize = 25; //GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace, Screen.width * 0.5f, 100f ), "Lorem ipsum dolor sit amet" ); GUI.skin.label.fontSize = 40; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace + titleSpace, Screen.width * 0.5f, 100f ), "Bryan Edelman" ); //GUI.skin.label.fontSize = 25; //GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace * 2f, Screen.width * 0.5f, 100f ), "Lead Programmer" ); GUI.skin.label.fontSize = 40; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace * 2f + titleSpace, Screen.width * 0.5f, 100f ), "Dennis McGrogan" ); //GUI.skin.label.fontSize = 25; //GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace * 3f, Screen.width * 0.5f, 100f ), "Maecenas tempus" ); GUI.skin.label.fontSize = 40; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace * 3f + titleSpace, Screen.width * 0.5f, 100f ), "Ali Timnak" ); GUI.skin.label.fontSize = 30; GUI.Label( new Rect( Screen.width * 0.25f, Screen.height * 0.1f + nameSpace * 4f + titleSpace + 30, Screen.width * 0.5f, 100f ), "Beach sounds and fire sizzle were recorded by Mike Koenig" ); break; } }
private void InitFields() { var context = new PSOConnect(); var team = context.team.FirstOrDefault(teams => teams.idTeam == Login.CurrentUser.idTeam); var missingPeople = context.GetPeopleData(); foreach (var people in missingPeople) { SelectMissingPeopleField.Items.Add($"{people.idPeople}-ФАМИЛИЯ: {people.family} ИМЯ: {people.name} ОТЧЕСТВО: {people.middleName} ДАТА РОЖДЕНИЯ: {people.dateOfBirth.Value.ToLongDateString()}\n ДАТА ПРОПАЖИ: {people.dateOfLoss.Value.ToLongDateString()} ПОСЛЕДНЕЕ МЕСТО: {people.lastLocation} ОПИСАНИЕ: {people.specialSign}"); if (team.idPeople == null || team.idPeople != people.idPeople) { continue; } SelectMissingPeopleField.SelectedItem = SelectMissingPeopleField.Items[SelectMissingPeopleField.Items.Count - 1]; IdPeopleText.Text = people.idPeople.ToString(); FioResultText.Text = $"{people.family} {people.name} {people.middleName}"; DateOfBirthResultText.Text = people.dateOfBirth.Value.ToShortDateString(); SpecialSignResultText.Text = people.specialSign; LastLocationResultText.Text = people.lastLocation; DateOfLossResultText.Text = people.dateOfLoss.Value.ToShortDateString(); } IdPeopleText.Hide(); NoFoundMissingPeopleText.Hide(); if (team.idPeople == null) { FioResultText.Hide(); DateOfBirthResultText.Hide(); SpecialSignResultText.Hide(); LastLocationResultText.Hide(); DateOfLossResultText.Hide(); FIOText.Hide(); DateOfBirthText.Hide(); SpecialSignText.Hide(); LastLocationText.Hide(); DateOfLossText.Hide(); SelectMissingPeopleField.Show(); SelectMissingPeopleText.Show(); SelectedButton.Show(); CompletedButton.Hide(); if (SelectMissingPeopleField.Items.Count > 0) { SelectMissingPeopleField.SelectedIndex = 0; } else { SelectedButton.Hide(); NoFoundMissingPeopleText.Show(); SelectMissingPeopleField.Hide(); } } else { FioResultText.Show(); DateOfBirthResultText.Show(); SpecialSignResultText.Show(); LastLocationResultText.Show(); DateOfLossResultText.Show(); FIOText.Show(); DateOfBirthText.Show(); SpecialSignText.Show(); LastLocationText.Show(); DateOfLossText.Show(); SelectMissingPeopleField.Hide(); SelectMissingPeopleText.Hide(); SelectedButton.Hide(); CompletedButton.Show(); } if (SelectMissingPeopleField.Items.Count == 0) { SelectMissingPeopleField.Hide(); NoFoundMissingPeopleText.Show(); CompletedButton.Hide(); } }
public void RefreshSelectedText() { SelectedButton.GetBindingExpression(Button.ContentProperty).UpdateTarget(); }
private void InitFields() { var context = new PSOConnect(); var team = context.team.FirstOrDefault(teams => teams.idTeam == Login.CurrentUser.idTeam); foreach (var disaster in context.disaster) { SelectDisasterField.Items.Add($"{ disaster.idDisaster}-СТРАНА: { disaster.country} ГОРОД: { disaster.city} ДАТА: { disaster.date.Value.ToLongDateString()}"); if (team.idDisaster == null || team.idDisaster != disaster.idDisaster) { continue; } SelectDisasterField.SelectedItem = SelectDisasterField.Items[SelectDisasterField.Items.Count - 1]; _disaster = disaster; CountyResultText.Text = disaster.country.ToString(); CityResultText.Text = disaster.city.ToString(); DateResultText.Text = disaster.date.Value.ToShortDateString(); ReasonText.Text = disaster.reason.Count > 1 ? "Причины" : "Причина"; foreach (var reason in disaster.reason) { ListInfo.Items.Add($"ТИП: {reason.typeReason} ПРИЧИНА: {reason.reason1}"); } } NoFoundDisasterText.Hide(); if (team.idDisaster == null) { ListInfo.Hide(); ReasonText.Hide(); DateResultText.Hide(); DateText.Hide(); CountryText.Hide(); CountyResultText.Hide(); CityResultText.Hide(); CityText.Hide(); SelectDisasterField.Show(); SelectDisasterText.Show(); SelectedButton.Show(); CompletedButton.Hide(); if (SelectDisasterField.Items.Count > 0) { SelectDisasterField.SelectedIndex = 0; } else { SelectedButton.Hide(); NoFoundDisasterText.Show(); SelectDisasterField.Hide(); } } else { ListInfo.Show(); ReasonText.Show(); DateResultText.Show(); DateText.Show(); CountryText.Show(); CountyResultText.Show(); CityResultText.Show(); CityText.Show(); SelectDisasterField.Hide(); SelectDisasterText.Hide(); SelectedButton.Hide(); CompletedButton.Show(); } if (SelectDisasterField.Items.Count == 0) { SelectDisasterField.Hide(); NoFoundDisasterText.Show(); CompletedButton.Hide(); } }
/// <summary> /// Generates a hash code for this <see cref="TaskDialogResult"/>. /// </summary> /// <returns>A <see cref="Int32"/> that represents the hash code of this instance.</returns> public override Int32 GetHashCode() { return(SelectedButton.GetHashCode() ^ SelectedRadioButton.GetHashCode() ^ VerificationChecked.GetHashCode()); }