void listItem_Click(dfControl control, dfMouseEventArgs mouseEvent) { ListItemExtras parent = control.GetComponent <ListItemExtras>(); print("Name: " + parent.Player.Username); InvitePanel.InvitePlayer(parent.Player); }
private void GenerateNumber(int posX = -1, int posY = -1, int nums = 1, float tweenInDelayTime = 0) { int numberX = -1; int numberY = -1; if (posX == -1 || posY == -1) { int countOfEmptyNum = 0; //这俩是位置坐标 for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { if (numArray[x][y] == 0) { countOfEmptyNum++; } } } if (countOfEmptyNum == 0) { return; } int randomNum = Random.RandomRange(1, countOfEmptyNum + 1); int index = 0; for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { if (numArray[x][y] == 0) { index++; if (index == randomNum) { numberX = x; numberY = y; goto flag; } } } } } else { numberX = posX; numberY = posY; } flag: dfControl numdfControl = this.GetComponent <dfControl>().AddPrefab(numPrefab); Num num = numdfControl.GetComponent <Num>(); //num.num = 1 num.setDelayTime(tweenInDelayTime); num.nums = nums; num.x = numberX; num.y = numberY; numArray[numberX][numberY]++; numComponentArray[numberX][numberY] = num; }
protected internal override void OnMouseDown(dfMouseEventArgs args) { if (args.Buttons.IsSet(dfMouseButtons.Left)) { this.Focus(); } if (args.Source == incButton || args.Source == decButton) { return; } if ((args.Source != track && args.Source != thumb) || !args.Buttons.IsSet(dfMouseButtons.Left)) { base.OnMouseDown(args); return; } if (args.Source == this.thumb) { // Find the point where the ray intersects the thumb RaycastHit hitInfo; thumb.GetComponent <Collider>().Raycast(args.Ray, out hitInfo, 1000f); // Calculate the thumb's center in global space var thumbCenter = thumb.transform.position + thumb.Pivot.TransformToCenter(thumb.Size * PixelsToUnits()); // Calculate the offset between the intersect point and the // thumb's upper left corner so that the thumb can always // be positioned relative to the mouse while dragging this.thumbMouseOffset = (thumbCenter - hitInfo.point); } else { updateFromTrackClick(args); } args.Use(); Signal("OnMouseDown", this, args); }
private void checkForPopupClose() { // HACK: Since clicking on nothing doesn't remove a control's input focus, // we don't necessarily get any sort of automatic notification that the user // has clicked outside of all focusable controls. We have to poll for such // a condition manually. if (popup == null || !Input.GetMouseButtonDown(0)) { return; } var camera = GetCamera(); var ray = camera.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (triggerButton != null && triggerButton.GetComponent <Collider>().Raycast(ray, out hitInfo, camera.farClipPlane)) { return; } if (popup.GetComponent <Collider>().Raycast(ray, out hitInfo, camera.farClipPlane)) { return; } if (popup.Scrollbar != null && popup.Scrollbar.GetComponent <Collider>().Raycast(ray, out hitInfo, camera.farClipPlane)) { return; } if (this.GetComponent <Collider>().Raycast(ray, out hitInfo, camera.farClipPlane)) { return; } ClosePopup(); }
internal static IEnumerator CreateMenuEntryTextboxCoroutine(dfControl panel, dfControl parent, string text, bool localize = false) { Console.WriteLine($"XXXENTRY"); var inner_panel = panel.transform.GetChild(0); var label = inner_panel.GetChild(0).gameObject.GetComponent <dfLabel>(); label.IsLocalized = localize; label.Text = text; UnityEngine.Object.Destroy(inner_panel.GetChild(1)?.gameObject); UnityEngine.Object.Destroy(inner_panel.GetChild(2)?.gameObject); UnityEngine.Object.Destroy(inner_panel.GetChild(3)?.gameObject); Console.WriteLine($"XXXDESTROYED"); yield return(null); Console.WriteLine($"XXXNEXTFRAME"); var textbox = inner_panel.gameObject.GetComponent <dfPanel>().AddControl <dfTextbox>(); textbox.Font = GungeonFont; textbox.Color = Color.white; textbox.Width = 200; textbox.IsVisible = true; textbox.Height = 50; TestTest = textbox; var menu_item = panel.GetComponent <BraveOptionsMenuItem>(); menu_item.itemType = (BraveOptionsMenuItem.BraveOptionsMenuItemType)Patches.BraveOptionsMenuItem.BraveOptionsMenuItemTypeExtended.SemiTextbox; menu_item.optionType = BraveOptionsMenuItem.BraveOptionsOptionType.NONE; menu_item.selectedLabelControl = null; ((Patches.BraveOptionsMenuItem)menu_item).textboxControl = textbox; }