public void Init(uint uid, string title, PanelType panelInstanceType) { this.uid = uid; tmpTitle.text = title; this.panelInstanceType = panelInstanceType; UIHelperLibrary.SetUpPanel(titleBoxRectTransform, tmpTitle, mainBoxRectTransform, new Vector2(300, 300)); titleBoxRectTransform.transform.SetParent(mainBoxRectTransform); }
public bool TestWorldClickButtons() { foreach (RectTransform button in buttonInstances) { if (UIHelperLibrary.QueryScreenPosInUIRectTransform(button, Input.mousePosition)) { return(true); } } return(false); }
public static void SetUpPanel(RectTransform titleBoxRectTransform, TextMeshProUGUI tmpTitle, RectTransform panelRectTransform, Vector2 mainPanelDimensions) { // Set the size of title bar UIHelperLibrary.SetPanelTitle(titleBoxRectTransform, tmpTitle, mainPanelDimensions); // Clamp window size min float minW = titleBoxRectTransform.rect.width + titleBoxMinPadding; float adjW = Mathf.Clamp(mainPanelDimensions.x, minW, mainPanelDimensions.x); float deltaX = adjW - mainPanelDimensions.x; deltaX = Mathf.Clamp(deltaX, 0, deltaX); mainPanelDimensions.x = adjW; panelRectTransform.sizeDelta = mainPanelDimensions; titleBoxRectTransform.position += new Vector3(-deltaX / 2.0f, 0, 0); }
// Scale window and lay out item frames public void InitDetailsPanel(int itemIndex, Transform targetParent) { ItemProfile itemProfile = ItemDatabaseInterface.Instance.items[itemIndex]; tmpDescription.text = itemProfile.Description; tmpValue.text = itemProfile.Value.ToString() + "C"; tmpDescription.ForceMeshUpdate(); float height = tmpDescription.GetRenderedValues().y + 100f; tmpTitle.text = itemProfile.Name; Vector2 newDims = new Vector2(rectTransform.rect.width, height); rectTransform.sizeDelta = newDims; UIHelperLibrary.SetPanelTitle(titleBoxRectTransform, tmpTitle, newDims); halfDimensions = new Vector3(newDims.x, -newDims.y, 0) / 2.0f; transform.position = Input.mousePosition + halfDimensions + new Vector3(0, -titleBoxRectTransform.rect.height, 0); selectedObjectVisualizerInstance = Instantiate(selectedObjectPrefab, targetParent); selectedObjectVisualizerInstance.transform.localPosition = Vector2.zero; }
// Straight bool query public bool QueryMouseOverPanel() { bool overPanel = UIHelperLibrary.QueryScreenPosInUIRectTransform(mainBoxRectTransform, Input.mousePosition); return(overPanel); }
public bool TestDragWindow() { return(UIHelperLibrary.QueryScreenPosInUIRectTransform(titleBoxRectTransform, Input.mousePosition)); }
public void ResizePanelSafe(Vector2 newDimensions) { titleBoxRectTransform.transform.SetParent(transform); UIHelperLibrary.SetUpPanel(titleBoxRectTransform, tmpTitle, mainBoxRectTransform, newDimensions); titleBoxRectTransform.transform.SetParent(mainBoxRectTransform); }
public bool TestMouseOver() { return(UIHelperLibrary.QueryScreenPosInUIRectTransform(itemObjectRT, Input.mousePosition)); }
public bool TestSelectionButtons() { return(UIHelperLibrary.QueryScreenPosInUIRectTransform(bagButton, Input.mousePosition)); }