private void beOptions_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Kind != ButtonPredefines.Plus) return; if (sender == beMPAA) { if (String.IsNullOrEmpty((String)beMPAA.Text)) return; if (MPAAList.Contains(beMPAA.Text)) return; MPAAList.Add((String)beMPAA.Text); MPAAdirty = true; lbcMPAA.Refresh(); beMPAA.Text = String.Empty; } else if (sender == beTags) { if (String.IsNullOrEmpty((String)beTags.Text)) return; if (TagList.Contains(beTags.Text)) return; TagList.Add((String)beTags.Text); TagsDirty = true; lbcTags.Refresh(); beTags.Text = String.Empty; } }
protected void Properties_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Caption == FileButton.Caption) { if (OFDlg.ShowDialog() == DialogResult.OK) Text = OFDlg.FileName; } }
private void repositoryItemButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { var autoWidget = gridViewAutoWidgets.GetFocusedRow() as AutoWidget; if (autoWidget == null) return; switch (e.Button.Index) { case 0: Library.Settings.AutoWidgets.Remove(autoWidget); LoadData(); break; case 1: using (var form = new FormSelectWidget()) { form.laWidgetDescription.Text = autoWidget.Extension.ToUpper(); form.checkEditInvert.Checked = autoWidget.Inverted; form.pbSelectedWidget.Image = autoWidget.Widget; if (form.ShowDialog() != DialogResult.OK) return; autoWidget.Inverted = form.checkEditInvert.Checked; autoWidget.Widget = form.pbSelectedWidget.Image; gridViewAutoWidgets.UpdateCurrentRow(); gridViewAutoWidgets.RefreshData(); gridViewAutoWidgets.Focus(); } break; } }
private void pathEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Kind == ButtonPredefines.Close) SetPath(null); else if (e.Button.Kind == ButtonPredefines.Ellipsis) ChooseFile(); }
private void repositoryItemHyperLinkEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (advBandedGridViewData.FocusedRowHandle == GridControl.InvalidRowHandle) return; if (e.Button.Index != 0) return; var videoLinkInfo = advBandedGridViewData.GetFocusedRow() as VideoLinkInfo; if (videoLinkInfo == null) return; Clipboard.SetText(advBandedGridViewData.FocusedColumn == gridColumnMp4Url ? videoLinkInfo.mp4Url : videoLinkInfo.thumbUrl); }
private void gridLookUpEditProduct_ButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button.Index == 1) { var product = new FormInsertOrUpdateProduct(null); product.ShowDialog(); LoadProductForGridLookUp(); } }
private void OnSourceButtonClick(object sender, ButtonPressedEventArgs e) { using (var dialog = new FolderBrowserDialog()) { dialog.SelectedPath = buttonEditSource.EditValue as String; if (dialog.ShowDialog() != DialogResult.OK) return; buttonEditSource.EditValue = dialog.SelectedPath; } }
private void gridLookUpEdit1_Properties_ButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button.Index == 1) { var addArea = new FormAddArea(); addArea.ShowDialog(); LoadGirdLookUpArea(); Refresh(); } }
private void beOutputFile_ButtonClick(object sender, ButtonPressedEventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel CSV File(*.csv)|*.csv"; sfd.OverwritePrompt = true; sfd.Title = "������ʱ�����о���ֵΪCSV��ʽ"; if (sfd.ShowDialog() == DialogResult.OK) { beOutputFile.Text = sfd.FileName; } }
private void FolderPathButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Kind == ButtonPredefines.Right) { Process.Start(_folderPath.Text); } else { var dialog = new FolderBrowserDialog { Description = "Select folder..." }; if (dialog.ShowDialog() != DialogResult.Cancel) { _folderPath.Text = dialog.SelectedPath; } } }
private void beTitledFanArtPath_ButtonClick(object sender, ButtonPressedEventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = @"Titled FanArt Path"; fbd.SelectedPath = OMLSettings.TitledFanArtPath; if (fbd.ShowDialog() == DialogResult.OK) { beTitledFanArtPath.EditValue = fbd.SelectedPath; } }
private void buttonEditFolderSelector_ButtonClick(object sender, ButtonPressedEventArgs e) { var folderSelector = sender as ButtonEdit; if (folderSelector == null) return; using (var dialog = new FolderBrowserDialog()) { dialog.SelectedPath = folderSelector.EditValue as String; if (dialog.ShowDialog() != DialogResult.OK) return; folderSelector.EditValue = dialog.SelectedPath; } }
private void repositoryItemButtonEditFiles_ButtonClick(object sender, ButtonPressedEventArgs e) { var file = gridViewFiles.GetFocusedRow() as StateFile; if (file == null) return; if (PopupMessageHelper.Instance.ShowWarningQuestion("Are you sure want to delete this file?") != DialogResult.Yes) return; if (File.Exists(file.FilePath)) { try { File.Delete(file.FilePath); } catch { } } gridViewFiles.DeleteSelectedRows(); }
private void buttonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) { if (!string.IsNullOrEmpty(buttonEdit1.Text) && Directory.Exists(buttonEdit1.Text)) { fbdSlctFolderSiemens.SelectedPath = buttonEdit1.Text; } if (fbdSlctFolderSiemens.ShowDialog(this) == DialogResult.OK) { buttonEdit1.Text = fbdSlctFolderSiemens.SelectedPath; } }
private void personEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Caption == "Clear") { SelectedRow.Person = null; gridView.RefreshRow(gridView.FocusedRowHandle); gridView.FocusedColumn = null; try { changingRow = true; personSelector.SelectedPerson = null; } finally { changingRow = false; } } else if (SelectedRow.Person != null) new PersonDetails(SelectedRow.Person) { MdiParent = MdiParent }.Show(); }
private void ribCOD_SOCI_NEGO_ButtonClick(object sender, ButtonPressedEventArgs e) { var oxfs = new xfSearchPerson(SESSION_COMP) { NUM_ACCI = 8 }; if (oxfs.ShowDialog() == DialogResult.OK) { var row = (BEDocumentExpenses)gdvExpens.GetRow(gdvExpens.FocusedRowHandle); row.COD_SOCI_NEGO = oxfs.oBe.COD_SOCI_NEGO; row.ALF_NOMB_PROV = oxfs.oBe.ALF_NOMB; row.ALF_RUCC_PROV = oxfs.oBe.ALF_NUME_IDEN; gdvExpens.RefreshRow(gdvExpens.FocusedRowHandle); } }
private void comboBoxEditSlides_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Index == 1) { int selectedIndex = comboBoxEditSlides.SelectedIndex + 1; if (selectedIndex >= _previewImages.Count) selectedIndex = 0; comboBoxEditSlides.SelectedIndex = selectedIndex; } else if (e.Button.Index == 2) { int selectedIndex = comboBoxEditSlides.SelectedIndex - 1; if (selectedIndex < 0) selectedIndex = _previewImages.Count - 1; comboBoxEditSlides.SelectedIndex = selectedIndex; } }
private void repositoryItemButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { var page = gridViewPages.GetFocusedRow() as LibraryPage; if (page == null) return; var focusedRowHandle = gridViewPages.FocusedRowHandle; switch (e.Button.Index) { case 0: focusedRowHandle = gridViewPages.FocusedRowHandle > 0 ? gridViewPages.FocusedRowHandle - 1 : 0; Library.Pages.UpItem(page); break; case 1: focusedRowHandle = gridViewPages.FocusedRowHandle < gridViewPages.RowCount - 1 ? gridViewPages.FocusedRowHandle + 1 : gridViewPages.RowCount - 1; Library.Pages.DownItem(page); break; } LoadPages(); gridViewPages.FocusedRowHandle = focusedRowHandle; }
private void OnDetailViewButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button == DetailViewButton) { IObjectSpace objectSpace = base.Helper.Application.CreateObjectSpace(); if (this.ControlValue != null) { object @object = objectSpace.GetObject(this.ControlValue); View view = null; if (base.Model != null) { view = base.Helper.Application.CreateDetailView(objectSpace, @object); } ShowViewParameters showViewParameters = new ShowViewParameters(view); showViewParameters.TargetWindow = TargetWindow.Default; base.Helper.Application.ShowViewStrategy.ShowView(showViewParameters, new ShowViewSource(null, null)); } } }
/// <summary> /// Duyệt file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textEditPathFileExel_ButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button.Index == 0) { var theDialog = new OpenFileDialog { Title = Resources.TitleSelectedFileExcel, Filter = Resources.FilterFormartExel2003, //theDialog.InitialDirectory = @"C:\Destop"; }; if (theDialog.ShowDialog() == DialogResult.OK) { textEditPathFileExel.Text = theDialog.FileName; if (!string.IsNullOrEmpty(textEditPathFileExel.Text)) { ReadingDataFormExcels(textEditPathFileExel.Text); } } } }
private void buttonEditNewExtension_ButtonClick(object sender, ButtonPressedEventArgs e) { var newExtension = buttonEditNewExtension.EditValue as String; if (String.IsNullOrEmpty(newExtension)) { MainController.Instance.PopupMessages.ShowWarning("Extension not set"); return; } newExtension = newExtension.Trim().ToLower(); if (Library.Settings.AutoWidgets.Any(widget => widget.Extension.Equals(newExtension))) { MainController.Instance.PopupMessages.ShowWarning("Auto Widter is existed for this extension already"); return; } var autoWidget = new AutoWidget(); autoWidget.Extension = newExtension; Library.Settings.AutoWidgets.Add(autoWidget); buttonEditNewExtension.EditValue = null; LoadData(); }
private void RepositoryItem_OnButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Kind == ButtonPredefines.Delete) { if (MessageBox.Show("Delete current view?", null,MessageBoxButtons.YesNo)==DialogResult.Yes) { deleteView(sender); return; } } else if (e.Button.Kind==ButtonPredefines.Ellipsis) { var objectSpace = Application.CreateObjectSpace(); var viewCloner = new ViewCloner(objectSpace.Session){Caption = Frame.GetController<ChangeVariantController>().ChangeVariantAction.SelectedItem.Caption}; var detailView = Application.CreateDetailView(objectSpace, viewCloner); var parameters = new ShowViewParameters(detailView) {TargetWindow = TargetWindow.NewModalWindow}; var controller = new DialogController(); controller.AcceptAction.Execute+=EditViewActionOnExecute; parameters.Controllers.Add(controller); Application.ShowViewStrategy.ShowView(parameters, new ShowViewSource(null, null)); } }
private void ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { string propertyName = ( ( ButtonEdit ) sender ).Name; ButtonEdit buttonEdit = sender as ButtonEdit; switch ( e.Button.Kind ) { case ButtonPredefines.Ellipsis: if ( buttonEdit.Properties.ReadOnly ) { return; } DataBaseObjectSelecting(propertyName); break; case ButtonPredefines.Delete: if ( buttonEdit.Properties.ReadOnly ) { return; } DataBaseObjectSelecting(propertyName); break; } }
private static void Input_ButtonPressed(object sender, ButtonPressedEventArgs e) { try { Point CursorPos = e.Cursor.LegacyScreenPixels().AsAndroidCompatibleCursorPoint(); bool IsGamepadInput = e.Button.TryGetController(out Buttons GamepadButtons); if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemBagMenu IBM) { if (e.Button == SButton.MouseLeft || e.Button == SButton.MouseMiddle || e.Button == SButton.MouseRight) { try { IBM.OnMouseButtonPressed(e); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Mouse button pressed: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } else if (e.Button == SButton.LeftShift || e.Button == SButton.RightShift || e.Button == SButton.LeftControl || e.Button == SButton.RightControl) { try { IBM.OnModifierKeyPressed(e); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Modifier key pressed: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } else if (IsGamepadInput) { try { // Handle navigation buttons foreach (NavigationDirection Direction in Enum.GetValues(typeof(NavigationDirection)).Cast <NavigationDirection>()) { if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.NavigateSingleButtons[Direction])) { NavigationButtonsPressedTime[Direction] = DateTime.Now; } } IBM.OnGamepadButtonsPressed(GamepadButtons); } catch (Exception ex) { Monitor.Log(string.Format("Unhandled error while handling Gamepad button pressed: {0}\n\n{1}", ex.Message, ex.ToString()), LogLevel.Error); } } } else if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is GameMenu GM && GM.currentTab == GameMenu.inventoryTab) { InventoryPage InvPage = GM.pages.First(x => x is InventoryPage) as InventoryPage; InventoryMenu InvMenu = InvPage.inventory; int ClickedItemIndex = InvMenu.getInventoryPositionOfClick(CursorPos.X, CursorPos.Y); bool IsValidInventorySlot = ClickedItemIndex >= 0 && ClickedItemIndex < InvMenu.actualInventory.Count; if (IsValidInventorySlot) { Item ClickedItem = InvMenu.actualInventory[ClickedItemIndex]; // Double click an ItemBag to open it if (e.Button == SButton.MouseLeft) //SButtonExtensions.IsUseToolButton(e.Button)) { // The first time the user clicks an item in their inventory, Game1.player.CursorSlotItem is set to what they clicked (so it's like drag/drop, they're now holding the item to move it) // So to detect a double click, we can't just check if they clicked the bag twice in a row, since on the second click the item would no longer be in their inventory. // Instead, we need to check if they clicked the bag and then we need to check Game1.player.CursorSlotItem on the next click if (ClickedItem is ItemBag ClickedBag && Game1.player.CursorSlotItem == null) { LastClickedBagInventoryIndex = ClickedItemIndex; LastClickedBag = ClickedBag; LastClickedBagTime = DateTime.Now; } else if (ClickedItem == null && Game1.player.CursorSlotItem is ItemBag DraggedBag && LastClickedBag == DraggedBag && LastClickedBagInventoryIndex.HasValue && LastClickedBagInventoryIndex.Value == ClickedItemIndex && LastClickedBagTime.HasValue && DateTime.Now.Subtract(LastClickedBagTime.Value).TotalMilliseconds <= DoubleClickThresholdMS) { LastClickedBag = DraggedBag; LastClickedBagTime = DateTime.Now; // Put the item that's being dragged back into their inventory Game1.player.addItemToInventory(Game1.player.CursorSlotItem, ClickedItemIndex); Game1.player.CursorSlotItem = null; DraggedBag.OpenContents(Game1.player.Items, Game1.player.MaxItems); } } // Right-click an ItemBag to open it else if ((e.Button == SButton.MouseRight || (IsGamepadInput && GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.OpenBagFromInventory))) && ClickedItem is ItemBag ClickedBag && Game1.player.CursorSlotItem == null) { ClickedBag.OpenContents(Game1.player.Items, Game1.player.MaxItems); } // Handle dropping an item into a bag from the Inventory menu if (ClickedItem is ItemBag IB && Game1.player.CursorSlotItem != null && Game1.player.CursorSlotItem is Object Obj) { if (IB.IsValidBagItem(Obj) && (e.Button == SButton.MouseLeft || e.Button == SButton.MouseRight)) { int Qty = ItemBag.GetQuantityToTransfer(e, Obj); IB.MoveToBag(Obj, Qty, out int MovedQty, true, Game1.player.Items); if (e.Button == SButton.MouseLeft) // || (MovedQty > 0 && Obj.Stack == 0) // Handle moving the last quantity with a right-click { // Clicking the bag will have made it become the held CursorSlotItem, so queue up an action that will swap them back on next game tick QueueCursorSlotIndex = ClickedItemIndex; QueuePlaceCursorSlotItem = true; } } } } } else if (Game1.activeClickableMenu == null && (e.Button == SButton.MouseLeft || e.Button == SButton.MouseRight || (IsGamepadInput && GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.OpenBagFromToolbar)))) { // Check if they clicked a bag on the toolbar, open the bag if so Toolbar toolbar = Game1.onScreenMenus.FirstOrDefault(x => x is Toolbar) as Toolbar; if (toolbar != null) { try { List <ClickableComponent> toolbarButtons = typeof(Toolbar).GetField("buttons", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(toolbar) as List <ClickableComponent>; if (toolbarButtons != null) { // Find the slot on the toolbar that they clicked, if any for (int i = 0; i < toolbarButtons.Count; i++) { if (toolbarButtons[i].bounds.Contains(CursorPos) || (IsGamepadInput && toolbar.currentlySnappedComponent == toolbarButtons[i])) { int ActualIndex = i; if (Constants.TargetPlatform == GamePlatform.Android) { try { int StartIndex = Helper.Reflection.GetField <int>(toolbar, "_drawStartIndex").GetValue(); // This is completely untested ActualIndex = i + StartIndex; } catch (Exception) { } } // Get the corresponding Item from the player's inventory Item item = Game1.player.Items[ActualIndex]; if (item is ItemBag IB) { IB.OpenContents(Game1.player.Items, Game1.player.MaxItems); } break; } } } } catch (Exception) { } } } else if (Game1.activeClickableMenu is ItemGrabMenu IGM && IGM.context is Chest ChestSource && (e.Button == SButton.MouseRight || e.Button == SButton.MouseMiddle || (IsGamepadInput && GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.OpenBagFromChest)))) { // Check if they clicked a Bag in the inventory part of the chest interface bool Handled = false; for (int i = 0; i < IGM.inventory.inventory.Count; i++) { ClickableComponent Component = IGM.inventory.inventory[i]; if (Component != null && Component.bounds.Contains(CursorPos)) { Item ClickedInvItem = i < 0 || i >= IGM.inventory.actualInventory.Count ? null : IGM.inventory.actualInventory[i]; if (ClickedInvItem is ItemBag IB) { IB.OpenContents(IGM.inventory.actualInventory, Game1.player.MaxItems); } Handled = true; break; } } bool IsMegaStorageCompatibleWithCurrentChest = IGM.ItemsToGrabMenu.capacity == DefaultChestCapacity || MegaStorageInstalledVersion == null || MegaStorageInstalledVersion.IsNewerThan(new SemanticVersion(1, 4, 4)); if (!Handled && IsMegaStorageCompatibleWithCurrentChest) { // Check if they clicked a Bag in the chest part of the chest interface for (int i = 0; i < IGM.ItemsToGrabMenu.inventory.Count; i++) { ClickableComponent Component = IGM.ItemsToGrabMenu.inventory[i]; if (Component != null && Component.bounds.Contains(CursorPos)) { Item ClickedChestItem = i < 0 || i >= IGM.ItemsToGrabMenu.actualInventory.Count ? null : IGM.ItemsToGrabMenu.actualInventory[i]; if (ClickedChestItem is ItemBag IB) { IB.OpenContents(IGM.ItemsToGrabMenu.actualInventory, IGM.ItemsToGrabMenu.capacity); } Handled = true; break; } } } } }
private void rpiArticle_ButtonClick(object sender, ButtonPressedEventArgs e) { var oxf = new xfSearchArticle(); if (oxf.ShowDialog() == DialogResult.OK) { var olst = (List<BEDocumentLines>)gdvLines.DataSource; var exist = olst.Exists(item => item.COD_ARTI == oxf.rowsel.COD_ARTI); if (!exist) { decimal TIP_CAMB = 1; if (lkeCOD_MONE.ItemIndex == 1) { if (txtNUM_TIPO_CAMB.EditValue == null) TIP_CAMB = ((xfMain)MdiParent).SESSION_NUM_TIPO_CAMB_COMP; } var row = new BEDocumentLines() { COD_ARTI = oxf.rowsel.COD_ARTI, ALF_CODI_ARTI = oxf.rowsel.ALF_CODI_ARTI, ALF_ARTI = oxf.rowsel.ALF_ARTI, NUM_CANT = 1, NUM_PREC_UNIT_ORIG = oxf.rowsel.NUM_PREC, NUM_PREC_UNIT = Math.Round(oxf.rowsel.NUM_PREC * TIP_CAMB, 2), NUM_PORC_DESC = oxf.rowsel.NUM_DESC, COD_USUA_CREA = SESSION_USER }; row.NUM_DESC = Math.Round((row.NUM_PREC_UNIT * row.NUM_PORC_DESC) / 100, 2); row.NUM_PREC_DESC = row.NUM_PREC_UNIT - row.NUM_DESC; row.NUM_IMPO = row.NUM_CANT * row.NUM_PREC_DESC; gdvLines.DeleteRow(gdvLines.FocusedRowHandle); olst.Add(row); gdvLines.RefreshData(); gdvLines.MoveLast(); gdvLines.FocusedColumn = gcNUM_CANT; gdvLines.ShowEditor(); Set_Totals(); } else { XtraMessageBox.Show(_Message.MsgExistArticle, _Message.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void bteCOD_SOCI_NEGO_ButtonClick(object sender, ButtonPressedEventArgs e) { var oxfs = new xfSearchPerson(SESSION_COMP) { NUM_ACCI = 8 }; if (oxfs.ShowDialog() == DialogResult.OK) { bteCOD_SOCI_NEGO.Properties.Buttons[0].Caption = oxfs.oBe.COD_SOCI_NEGO.ToString(); bteCOD_SOCI_NEGO.Text = oxfs.oBe.ALF_NOMB; mmeALF_DIRE_FISC.Text = oxfs.oBe.ALF_DIRE_FISC; lkeCOD_COND_PAGO.EditValue = oxfs.oBe.COD_COND_PAGO; txtALF_NUM_RUCC.Text = oxfs.oBe.ALF_NUME_IDEN; var row = (BESVMC_COND_PAGO)lkeCOD_COND_PAGO.GetSelectedDataRow(); if (row != null) { var dpag = DateTime.Now.AddDays(row.NUM_DIAS); dteFEC_PAGO.EditValue = dpag; } } }
private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button == SButton.Escape || e.Button == SButton.E) { choosingAnimal = false; drawAnimal = false; } if (Game1.activeClickableMenu is PurchaseAnimalsMenu menu) { FarmAnimal animal = Helper.Reflection.GetField <FarmAnimal>(Game1.activeClickableMenu, "animalBeingPurchased").GetValue(); if (e.Button == SButton.MouseLeft) { if (menu.doneNamingButton.containsPoint((int)e.Cursor.ScreenPixels.X, (int)e.Cursor.ScreenPixels.Y) || menu.okButton.containsPoint((int)e.Cursor.ScreenPixels.X, (int)e.Cursor.ScreenPixels.Y)) { choosingAnimal = false; drawAnimal = false; } Building buildingAt = Game1.getFarm().getBuildingAt(new Vector2(e.Cursor.AbsolutePixels.X, e.Cursor.AbsolutePixels.Y) / 64); if (buildingAt != null && buildingAt.buildingType.Value.Contains(animal.buildingTypeILiveIn.Value) && !(buildingAt.indoors.Value as AnimalHouse).isFull()) { choosingAnimal = false; drawAnimal = false; } foreach (ClickableTextureComponent component in menu.animalsToPurchase) { if (component.containsPoint((int)e.Cursor.ScreenPixels.X, (int)e.Cursor.ScreenPixels.Y)) { if (Game1.player.Money >= component.item.salePrice()) { string type = component.item.Name; if (type != null) { choosingAnimal = true; if (type.Contains("Chicken")) { currentAnimalType = CHICKEN; } else if (type.Contains("Cow")) { currentAnimalType = COW; } else if (type.Contains("Pig")) { currentAnimalType = PIG; } else if (type.Contains("Goat")) { currentAnimalType = GOAT; } else if (type.Contains("Sheep")) { currentAnimalType = SHEEP; } else if (type.Contains("Rabbit")) { currentAnimalType = RABBIT; } else if (type.Contains("Duck")) { currentAnimalType = DUCK; } else if (type.Contains("Dinosaur")) { currentAnimalType = DINOSAUR; } else if (type.Contains("Ostrich")) { currentAnimalType = OSTRICH; } else { currentAnimalType = -1; choosingAnimal = false; } break; } } } } } if (currentAnimalType < 0) { return; } bool leftOrRight = false; int delta = 0; if (e.Button == SButton.Left) { delta = -1; leftOrRight = true; } else if (e.Button == SButton.Right) { delta = 1; leftOrRight = true; } if (leftOrRight) { switch (currentAnimalType) { case CHICKEN: chickenIndex = (delta + chickenIndex + chickens.Count) % chickens.Count; while (!IsChickenTypeUnlocked(chickenIndex)) { chickenIndex = (delta + chickenIndex + chickens.Count) % chickens.Count; } break; case DINOSAUR: dinosaurIndex = (delta + dinosaurIndex + dinosaurs.Count) % dinosaurs.Count; while (!IsDinosaurUnlocked(1)) { dinosaurIndex = (delta + dinosaurIndex + dinosaurs.Count) % dinosaurs.Count; } break; case COW: cowIndex = (delta + cowIndex + cows.Count) % cows.Count; break; } if (currentAnimalType == CHICKEN || currentAnimalType == COW) { animal.displayType = (currentAnimalType == CHICKEN) ? chickens[chickenIndex] : cows[cowIndex]; } } } }
/// <summary> /// INVOCAR A LA PANTALLA PARA AGREGAR SOCIO DE NEGOCIO /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void beALF_SOCI_NEGO_ButtonClick(object sender, ButtonPressedEventArgs e) { using (xfSearchPerson oForm = new xfSearchPerson(SESSION_COMP)) { if (oForm.ShowDialog() == DialogResult.OK) { txtCOD_SOCI_NEGO.Text = oForm.oBe.COD_SOCI_NEGO.ToString(); beALF_NOMB.Text = oForm.oBe.ALF_NOMB; txtALF_NUME_IDEN.Text = oForm.oBe.ALF_NUME_IDEN; LoadBranch(oForm.oBe.COD_SOCI_NEGO); } } }
private void buttonEditProgramManagerLocation_ButtonClick(object sender, ButtonPressedEventArgs e) { var library = MainController.Instance.WallbinViews.ActiveWallbin.DataStorage.Library; using (var dialog = new FolderBrowserDialog()) { dialog.SelectedPath = !String.IsNullOrEmpty(library.ProgramData.Path) ? library.ProgramData.Path : Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (dialog.ShowDialog() != DialogResult.OK) return; if (!Directory.Exists(dialog.SelectedPath)) return; MainController.Instance.MainForm.buttonEditProgramManagerLocation.EditValue = dialog.SelectedPath; library.ProgramData.Path = dialog.SelectedPath; MainController.Instance.WallbinViews.ActiveWallbin.IsDataChanged = true; } }
/// <summary> /// File select editor, drop down button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FileSelectEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { var mruEdit = sender as MRUEdit; if (mruEdit != null) if (mruEdit.Properties.Buttons.IndexOf(e.Button) == mruEdit.Properties.ActionButtonIndex) return; var dlg = new OpenFileDialog { Filter = Resources.ExcelImportWizard_FileSelectEdit_ButtonClick_Excel_Files___xlsx____xlsx }; if (dlg.ShowDialog() != DialogResult.OK) return; if (mruEdit == null) return; mruEdit.EditValue = new FileInfo(dlg.FileName).FullName; mruEdit.Properties.Items.Add(mruEdit.Text); }
private void Button(object sender, ButtonPressedEventArgs e) { if (!Context.IsWorldReady) { return; } if (e.IsDown(SButton.F4)) { GameLocation loc = Game1.currentLocation; loc.lastQuestionKey = "greenhouse_upgrade"; loc.createQuestionDialogue("Testing 1 2 3", loc.createYesNoResponses(), ConfirmUpgrade); } /* * if (e.IsDown(SButton.NumPad8)) * { * * * //Lets clean this up some * string question = Helper.Translation.Get("Wedding_Question"); * List<Response> options = new List<Response>() * { * new Response("On the Beach.",this.Helper.Translation.Get("Wedding_Beach")), * new Response("In the Forest, near the river.",this.Helper.Translation.Get("Wedding_Forest")), * new Response("In the Deep Woods.",this.Helper.Translation.Get("Wedding_Wood")), * new Response("Where the Flower Dance takes place!",this.Helper.Translation.Get("Wedding_Flower")) * }; * * Game1.player.currentLocation.createQuestionDialogue( * question, * options.ToArray(), * answer * ); * } * * if (e.IsDown(SButton.NumPad7)) * { * Chest c = new Chest(true); * if(Game1.currentLocation.isTileLocationTotallyClearAndPlaceable(Game1.player.getTileLocation())) * Game1.currentLocation.objects.Add(Game1.player.getTileLocation(), c); * else * Game1.showGlobalMessage("Couldnt place chest"); * } * * if (e.IsDown(SButton.NumPad6)) * { * Game1.mailbox.Add("birthDayMailWizard"); * } * * if (e.IsDown(SButton.NumPad5)) * { * ICursorPosition c = Helper.Input.GetCursorPosition(); * int x = Game1.getMouseX(); * int y = Game1.getMouseY(); * * //Try adding new monsters to the map. * //BigSlime bs = new BigSlime(new Vector2(x, y), 1); * int mineLevel = 1; * if (Game1.player.CombatLevel >= 10) * mineLevel = 140; * else if (Game1.player.CombatLevel >= 8) * mineLevel = 100; * else if (Game1.player.CombatLevel >= 4) * mineLevel = 41; * IList<NPC> characters = Game1.currentLocation.characters; * GreenSlime greenSlime = new GreenSlime(c.Tile * 64f, mineLevel) {wildernessFarmMonster = true}; * Bat bat = new Bat(c.Tile * 64f, mineLevel) {wildernessFarmMonster = true}; * BigSlime bs = new BigSlime(c.Tile * 64f, mineLevel) { wildernessFarmMonster = true }; ; * Bug bug = new Bug(c.Tile * 64f, mineLevel) { wildernessFarmMonster = true }; * Ghost ghost = new Ghost(c.Tile * 64f) { wildernessFarmMonster = true }; * MetalHead metal = new MetalHead(c.Tile * 64f, mineLevel) { wildernessFarmMonster = true }; * Mummy mum = new Mummy(c.Tile * 64f) { wildernessFarmMonster = true }; * //ShadowGirl sgirl = new ShadowGirl(c.Tile * 64f) { wildernessFarmMonster = true }; * //ShadowGuy sguy = new ShadowGuy(c.Tile * 64f) { wildernessFarmMonster = true }; * ShadowShaman ss = new ShadowShaman(c.Tile * 64f) { wildernessFarmMonster = true }; * Skeleton sk = new Skeleton(c.Tile * 64f) { wildernessFarmMonster = true }; * SquidKid skid = new SquidKid(c.Tile * 64f) { wildernessFarmMonster = true, Scale = 15f}; * characters.Add((NPC)greenSlime); * characters.Add((NPC)bat); * characters.Add((NPC)bs); * characters.Add((NPC)bug); * characters.Add((NPC)ghost); * characters.Add((NPC)metal); * characters.Add((NPC)mum); * //characters.Add((NPC)sgirl); * //characters.Add((NPC)sguy); * characters.Add((NPC)ss); * characters.Add((NPC)sk); * characters.Add((NPC)skid); * } * * if (e.IsDown(SButton.NumPad9)) * { * GameLocation location = Game1.getLocationFromName("BusStop"); * TileSheet tileSheet = location.map.GetTileSheet("spring_outdoorsTileSheet"); * TileSheet tileSheet = location.map.GetTileSheet(nameof(BusStop)); * * int tileX = 11; * int tileY = 23; * * string value = location.doesTileHaveProperty(tileX, tileY, "Diggable", "Back"); * * location.setTileProperty(tileX, tileY, "Back", "NoSpawn", "T"); * * Layer layer = location.map.GetLayer("Back"); * Tile tile = layer.PickTile(new xTile.Dimensions.Location(tileX, tileY) * Game1.tileSize, Game1.viewport.Size); * tile.Properties.Remove("Diggable"); * * } */ }
private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { // Ignore if player hasn't loaded a save yet if (!Context.IsWorldReady) { return; } // We only care about action buttons if (!e.Button.IsActionButton()) { return; } // We only care if the player is holding an object ... if (Game1.player.ActiveObject == null) { return; } // ... and that object is sort-of edible if (Game1.player.ActiveObject.Edibility <= CharacterTreat.InedibleThreshold) { return; } //Vector2 index = new Vector2((float)((Game1.getOldMouseX() + Game1.viewport.X) / 64), (float)((Game1.getOldMouseY() + Game1.viewport.Y) / 64)); var tileLocation = new Location((int)e.Cursor.GrabTile.X, (int)e.Cursor.GrabTile.Y); var rectangle = new Rectangle(tileLocation.X * 64, tileLocation.Y * 64, 64, 64); var intersected = false; switch (Game1.player.currentLocation) { case AnimalHouse _: { if (Game1.player.currentLocation is AnimalHouse animalHouse) { intersected = AttemptToGiveTreatToFarmAnimals(animalHouse.animals, rectangle); } break; } case Farm _: { if (Game1.player.currentLocation is Farm farm) { intersected = AttemptToGiveTreatToFarmAnimals(farm.animals, rectangle); } break; } } if (!intersected) { intersected = AttemptToGiveTreatToHorsesAndPets(rectangle); } // Always suppress the button if we intersected as an attempt to treat // Blocks weird behaviour of mounting if you meant to treat a horse that was already treated if (intersected) { Helper.Input.Suppress(e.Button); } }
/// <summary> /// Clear the MapsTo column Cell /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void repositoryItemGridLookUpEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Index != 1) return; ((GridLookUpEdit)sender).EditValue = null; ((GridControl)((GridLookUpEdit)sender).Parent).MainView.PostEditor(); ((GridControl)((GridLookUpEdit)sender).Parent).MainView.UpdateCurrentRow(); }
private void doGridLayoutRightClick(ButtonPressedEventArgs e) { var forSale = Helper.Reflection.GetField <List <ISalable> >(shop, "forSale").GetValue(); var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <ISalable, int[]> >(shop, "itemPriceAndStock").GetValue(); var currency = Helper.Reflection.GetField <int>(shop, "currency").GetValue(); var animations = Helper.Reflection.GetField <List <TemporaryAnimatedSprite> >(shop, "animations").GetValue(); var poof = Helper.Reflection.GetField <TemporaryAnimatedSprite>(shop, "poof").GetValue(); var heldItem = Helper.Reflection.GetField <ISalable>(shop, "heldItem").GetValue(); var currentItemIndex = Helper.Reflection.GetField <int>(shop, "currentItemIndex").GetValue(); var sellPercentage = Helper.Reflection.GetField <float>(shop, "sellPercentage").GetValue(); const int UNIT_WIDTH = 160; const int UNIT_HEIGHT = 144; int unitsWide = (shop.width - 32) / UNIT_WIDTH; int x = (int)e.Cursor.ScreenPixels.X; int y = (int)e.Cursor.ScreenPixels.Y; if (shop.upperRightCloseButton.containsPoint(x, y)) { shop.exitThisMenu(true); return; } // Copying a lot from right click code Vector2 clickableComponent = shop.inventory.snapToClickableComponent(x, y); if (heldItem == null) { Item obj = shop.inventory.rightClick(x, y, null, false); if (obj != null) { if (shop.onSell != null) { shop.onSell(obj); } else { ShopMenu.chargePlayer(Game1.player, currency, -((obj is StardewValley.Object ? (int)((double)(obj as StardewValley.Object).sellToStorePrice() * (double)sellPercentage) : (int)((double)(obj.salePrice() / 2) * (double)sellPercentage)) * obj.Stack)); Item obj2 = (Item)null; if (Game1.mouseClickPolling > 300) { Game1.playSound("purchaseRepeat"); } else { Game1.playSound("purchaseClick"); } animations.Add(new TemporaryAnimatedSprite("TileSheets\\debris", new Rectangle(Game1.random.Next(2) * 64, 256, 64, 64), 9999f, 1, 999, clickableComponent + new Vector2(32f, 32f), false, false) { alphaFade = 0.025f, motion = Utility.getVelocityTowardPoint(new Point((int)clickableComponent.X + 32, (int)clickableComponent.Y + 32), Game1.dayTimeMoneyBox.position + new Vector2(96f, 196f), 12f), acceleration = Utility.getVelocityTowardPoint(new Point((int)clickableComponent.X + 32, (int)clickableComponent.Y + 32), Game1.dayTimeMoneyBox.position + new Vector2(96f, 196f), 0.5f) }); if (obj is StardewValley.Object && (obj as StardewValley.Object).Edibility != -300) { (Game1.getLocationFromName("SeedShop") as StardewValley.Locations.SeedShop).itemsToStartSellingTomorrow.Add(obj.getOne()); } if (shop.inventory.getItemAt(x, y) == null) { Game1.playSound("sell"); animations.Add(new TemporaryAnimatedSprite(5, clickableComponent + new Vector2(32f, 32f), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0) { motion = new Vector2(0.0f, -0.5f) }); } } } } else { heldItem = shop.inventory.leftClick(x, y, (Item)heldItem, true); Helper.Reflection.GetField <ISalable>(shop, "heldItem").SetValue(heldItem); } for (int i = currentItemIndex * unitsWide; i < forSale.Count && i < currentItemIndex * unitsWide + unitsWide * 3; ++i) { int ix = i % unitsWide; int iy = i / unitsWide; Rectangle rect = new Rectangle(shop.xPositionOnScreen + 16 + ix * UNIT_WIDTH, shop.yPositionOnScreen + 16 + iy * UNIT_HEIGHT - currentItemIndex * UNIT_HEIGHT, UNIT_WIDTH, UNIT_HEIGHT); if (rect.Contains(x, y) && forSale[i] != null) { int index2 = i; if (forSale[index2] == null) { break; } int numberToBuy = Game1.oldKBState.IsKeyDown(Keys.LeftShift) ? Math.Min(Math.Min(5, ShopMenu.getPlayerCurrencyAmount(Game1.player, currency) / itemPriceAndStock[forSale[index2]][0]), itemPriceAndStock[forSale[index2]][1]) : 1; var tryToPurchaseItem = Helper.Reflection.GetMethod(shop, "tryToPurchaseItem"); if (numberToBuy > 0 && tryToPurchaseItem.Invoke <bool>(forSale[index2], heldItem, numberToBuy, x, y, index2)) { itemPriceAndStock.Remove(forSale[index2]); forSale.RemoveAt(index2); } if (heldItem == null || !Game1.options.SnappyMenus || (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is ShopMenu)) || !Game1.player.addItemToInventoryBool((Item)heldItem, false)) { break; } heldItem = (Item)null; Helper.Reflection.GetField <ISalable>(shop, "heldItem").SetValue(heldItem); DelayedAction.playSoundAfterDelay("coin", 100, (GameLocation)null); break; } } }
private void beALF_GUIA_REMI_STOR_ButtonClick(object sender, ButtonPressedEventArgs e) { }
private void doGridLayoutLeftClick(ButtonPressedEventArgs e) { var forSale = Helper.Reflection.GetField <List <ISalable> >(shop, "forSale").GetValue(); var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <ISalable, int[]> >(shop, "itemPriceAndStock").GetValue(); var currency = Helper.Reflection.GetField <int>(shop, "currency").GetValue(); var animations = Helper.Reflection.GetField <List <TemporaryAnimatedSprite> >(shop, "animations").GetValue(); var poof = Helper.Reflection.GetField <TemporaryAnimatedSprite>(shop, "poof").GetValue(); var heldItem = Helper.Reflection.GetField <ISalable>(shop, "heldItem").GetValue(); var currentItemIndex = Helper.Reflection.GetField <int>(shop, "currentItemIndex").GetValue(); var sellPercentage = Helper.Reflection.GetField <float>(shop, "sellPercentage").GetValue(); var scrollBar = Helper.Reflection.GetField <ClickableTextureComponent>(shop, "scrollBar").GetValue(); var scrollBarRunner = Helper.Reflection.GetField <Rectangle>(shop, "scrollBarRunner").GetValue(); var downArrow = Helper.Reflection.GetField <ClickableTextureComponent>(shop, "downArrow").GetValue(); var upArrow = Helper.Reflection.GetField <ClickableTextureComponent>(shop, "upArrow").GetValue(); const int UNIT_WIDTH = 160; const int UNIT_HEIGHT = 144; int unitsWide = (shop.width - 32) / UNIT_WIDTH; int x = (int)e.Cursor.ScreenPixels.X; int y = (int)e.Cursor.ScreenPixels.Y; if (shop.upperRightCloseButton.containsPoint(x, y)) { shop.exitThisMenu(true); return; } // Copying a lot from left click code if (downArrow.containsPoint(x, y) && currentItemIndex < Math.Max(0, forSale.Count - 18)) { downArrow.scale = downArrow.baseScale; Helper.Reflection.GetField <int>(shop, "currentItemIndex").SetValue(currentItemIndex += 1); if (forSale.Count > 0) { scrollBar.bounds.Y = scrollBarRunner.Height / Math.Max(1, (forSale.Count / 6) - 1 + 1) * currentItemIndex + upArrow.bounds.Bottom + 4; if (currentItemIndex == forSale.Count / 6 - 1) { scrollBar.bounds.Y = downArrow.bounds.Y - scrollBar.bounds.Height - 4; } } Game1.playSound("shwip"); } else if (upArrow.containsPoint(x, y) && currentItemIndex > 0) { upArrow.scale = upArrow.baseScale; Helper.Reflection.GetField <int>(shop, "currentItemIndex").SetValue(currentItemIndex -= 1); if (forSale.Count > 0) { scrollBar.bounds.Y = scrollBarRunner.Height / Math.Max(1, (forSale.Count / 6) - 1 + 1) * currentItemIndex + upArrow.bounds.Bottom + 4; if (currentItemIndex == forSale.Count / 6 - 1) { scrollBar.bounds.Y = downArrow.bounds.Y - scrollBar.bounds.Height - 4; } } Game1.playSound("shwip"); } else if (scrollBarRunner.Contains(x, y)) { int y1 = scrollBar.bounds.Y; scrollBar.bounds.Y = Math.Min(shop.yPositionOnScreen + shop.height - 64 - 12 - scrollBar.bounds.Height, Math.Max(y, shop.yPositionOnScreen + upArrow.bounds.Height + 20)); currentItemIndex = Math.Min(forSale.Count / 6 - 1, Math.Max(0, (int)((double)forSale.Count / 6 * (double)((float)(y - scrollBarRunner.Y) / (float)scrollBarRunner.Height)))); Helper.Reflection.GetField <int>(shop, "currentItemIndex").SetValue(currentItemIndex); if (forSale.Count > 0) { scrollBar.bounds.Y = scrollBarRunner.Height / Math.Max(1, (forSale.Count / 6) - 1 + 1) * currentItemIndex + upArrow.bounds.Bottom + 4; if (currentItemIndex == forSale.Count / 6 - 1) { scrollBar.bounds.Y = downArrow.bounds.Y - scrollBar.bounds.Height - 4; } } int y2 = scrollBar.bounds.Y; if (y1 == y2) { return; } Game1.playSound("shiny4"); } Vector2 clickableComponent = shop.inventory.snapToClickableComponent(x, y); if (heldItem == null) { Item obj = shop.inventory.leftClick(x, y, null, false); if (obj != null) { if (shop.onSell != null) { shop.onSell(obj); } else { ShopMenu.chargePlayer(Game1.player, currency, -((obj is StardewValley.Object ? (int)((double)(obj as StardewValley.Object).sellToStorePrice() * (double)sellPercentage) : (int)((double)(obj.salePrice() / 2) * (double)sellPercentage)) * obj.Stack)); int num = obj.Stack / 8 + 2; for (int index = 0; index < num; ++index) { animations.Add(new TemporaryAnimatedSprite("TileSheets\\debris", new Rectangle(Game1.random.Next(2) * 16, 64, 16, 16), 9999f, 1, 999, clickableComponent + new Vector2(32f, 32f), false, false) { alphaFade = 0.025f, motion = new Vector2((float)Game1.random.Next(-3, 4), -4f), acceleration = new Vector2(0.0f, 0.5f), delayBeforeAnimationStart = index * 25, scale = 2f }); animations.Add(new TemporaryAnimatedSprite("TileSheets\\debris", new Rectangle(Game1.random.Next(2) * 16, 64, 16, 16), 9999f, 1, 999, clickableComponent + new Vector2(32f, 32f), false, false) { scale = 4f, alphaFade = 0.025f, delayBeforeAnimationStart = index * 50, motion = Utility.getVelocityTowardPoint(new Point((int)clickableComponent.X + 32, (int)clickableComponent.Y + 32), new Vector2((float)(shop.xPositionOnScreen - 36), (float)(shop.yPositionOnScreen + shop.height - shop.inventory.height - 16)), 8f), acceleration = Utility.getVelocityTowardPoint(new Point((int)clickableComponent.X + 32, (int)clickableComponent.Y + 32), new Vector2((float)(shop.xPositionOnScreen - 36), (float)(shop.yPositionOnScreen + shop.height - shop.inventory.height - 16)), 0.5f) }); } if (obj is StardewValley.Object && (obj as StardewValley.Object).Edibility != -300) { Item one = obj.getOne(); one.Stack = obj.Stack; (Game1.getLocationFromName("SeedShop") as StardewValley.Locations.SeedShop).itemsToStartSellingTomorrow.Add(one); } Game1.playSound("sell"); Game1.playSound("purchase"); } } } else { heldItem = shop.inventory.leftClick(x, y, (Item)heldItem, true); Helper.Reflection.GetField <ISalable>(shop, "heldItem").SetValue(heldItem); } for (int i = currentItemIndex * unitsWide; i < forSale.Count && i < currentItemIndex * unitsWide + unitsWide * 3; ++i) { int ix = i % unitsWide; int iy = i / unitsWide; Rectangle rect = new Rectangle(shop.xPositionOnScreen + 16 + ix * UNIT_WIDTH, shop.yPositionOnScreen + 16 + iy * UNIT_HEIGHT - currentItemIndex * UNIT_HEIGHT, UNIT_WIDTH, UNIT_HEIGHT); if (rect.Contains(x, y) && forSale[i] != null) { int numberToBuy = Math.Min(Game1.oldKBState.IsKeyDown(Keys.LeftShift) ? Math.Min(Math.Min(5, ShopMenu.getPlayerCurrencyAmount(Game1.player, currency) / Math.Max(1, itemPriceAndStock[forSale[i]][0])), Math.Max(1, itemPriceAndStock[forSale[i]][1])) : 1, forSale[i].maximumStackSize()); if (numberToBuy == -1) { numberToBuy = 1; } var tryToPurchaseItem = Helper.Reflection.GetMethod(shop, "tryToPurchaseItem"); if (numberToBuy > 0 && tryToPurchaseItem.Invoke <bool>(forSale[i], heldItem, numberToBuy, x, y, i)) { itemPriceAndStock.Remove(forSale[i]); forSale.RemoveAt(i); } else if (numberToBuy <= 0) { Game1.dayTimeMoneyBox.moneyShakeTimer = 1000; Game1.playSound("cancel"); } if (heldItem != null && Game1.options.SnappyMenus && (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ShopMenu) && Game1.player.addItemToInventoryBool((Item)heldItem, false)) { heldItem = (Item)null; Helper.Reflection.GetField <ISalable>(shop, "heldItem").SetValue(heldItem); DelayedAction.playSoundAfterDelay("coin", 100, (GameLocation)null); } } } }
private void noPerintahBayarButtonEdit_ButtonClick( object sender, ButtonPressedEventArgs e) { ((PerintahBayar)PerintahBayarBindingSource.DataSource) .PilihPerintahBayar(); }
/// <summary> /// Event that runs when a button is pressed. /// </summary> /// <param name="sender">The event sender</param> /// <param name="e">The event args</param> private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if (!Context.IsWorldReady || !_modEnabled) { return; } if (Game1.activeClickableMenu != null) { return; } //Check to see if Action Key was pressed if (e.IsDown(_activationKey)) { //ProcessLiveStock(); HarvestCrops(); //CheckDogCat(); } //Check to see if Clear location key was pressed if (e.IsDown(_clearLocationKey)) { ClearCurrentLocation(Game1.currentLocation); } if (e.IsDown(_useToolKey)) { ICursorPosition cur = Helper.Input.GetCursorPosition(); UseTool(Game1.player.getTileLocation(), cur.Tile, Game1.currentLocation); } if (e.IsDown(_forageKey)) { DoForageHarvest(); //Lets try to get the spawns if (Game1.player.currentLocation is MineShaft shaft) { foreach (var i in shaft.Objects.Values) { if (i.IsSpawnedObject) { DoForageHarvest(i, shaft, Game1.player); i.performUseAction(shaft); } } } } if (e.IsDown(_singleKey)) { ICursorPosition cur = Helper.Input.GetCursorPosition(); SingleToolUse(cur.Tile, Game1.currentLocation); } if (e.IsDown(SButton.F3)) { ICursorPosition c = Helper.Input.GetCursorPosition(); Game1.player.position.Value = c.Tile * Game1.tileSize; } if (e.IsDown(SButton.NumPad8)) { GameLocation loc = Game1.currentLocation; if (loc is MineShaft shaft && shaft.mineLevel > 120) { shaft.enterMineShaft(); } else if (loc is MineShaft shaft1) { int curLev = (Game1.currentLocation as MineShaft)?.mineLevel ?? 0; Game1.enterMine(curLev + 1); } }