private void Awake() { image = GetComponent <Image>(); transform.Find("Text").GetComponent <TextMeshProUGUI>().text = level.ToString(); button = GetComponent <Button_UI>(); button.ClickFunc = () => { if (level + 1 < SceneManager.sceneCountInBuildSettings) { SceneManager.LoadScene(SceneHandler.GetSceneIndex(SceneHandler.Scenes.Game)); LevelLoader.i.LoadScene(level + 2); GameManager.currentLevel = level; } else { Debug.LogError("Level : " + level + " does not exist"); } }; if (!completed) { for (var i = 0; i < GameManager.i.completedLevels.Count; i++) { if (GameManager.i.completedLevels[i] == level) { image.sprite = altSprite; completed = true; return; } } } }
public void SetGraphVisualObjectInfo(Vector2 graphPosition, float graphPositionWidth, string tooltipText) { RectTransform rectTransform = dotGameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = graphPosition; UpdateDotConnection(); Button_UI dotButtonUI = dotGameObject.GetComponent <Button_UI>(); // Show Tooltip on Mouse Over dotButtonUI.MouseOverOnceFunc = () => { windowGraph.ShowTooltip(tooltipText, graphPosition); }; // Hide Tooltip on Mouse Out dotButtonUI.MouseOutOnceFunc = () => { windowGraph.HideTooltip(); }; if (OnChangedGraphVisualObjectInfo != null) { OnChangedGraphVisualObjectInfo(this, EventArgs.Empty); } }
private void DrugUpdateGraph(NodesStructure[] nodesStructures, LinksStructure[] links) { for (int i = 0; i < nodesStructures.Length; i++) { if (nodesStructures[i].name == dragNode) { float xPosition = (float)nodesStructures[i].x0; float yPosition = (float)nodesStructures[i].y0; float Width = (float)nodesStructures[i].x1 - xPosition; float barHight = (float)nodesStructures[i].y1 - yPosition; string Value = nodesStructures[i].value.ToString(); string name = nodesStructures[i].name; yPosition += barHight / 2; xPosition += Width / 2; updateBarAndLink(new Vector2(xPosition, yPosition), Width, barHight, nodesStructures[i], i, true); Button_UI barButtonUI = GameObjectList[i].gameObject.GetComponent <Button_UI>(); barButtonUI.MouseOverOnceFunc += () => { ShowTooltip_Static("name:" + name + "Value:" + Value, (new Vector2(xPosition, yPosition))); }; } } for (int i = 0; i < links.Length; i++) { if (links[i].TargetNode.name == dragNode || links[i].SourceNode.name == dragNode) { upDateLine("Value:" + (float)links[i].value, links[i], i, nodesStructures); } } }
public List <GameObject> AddGraphVisual(Vector2 graphPosition, float Width, float barHight, string tooltipText, NodesStructure a, int i) { GameObject barGameObject = CreateBar(graphPosition, Width, barHight, a, i); BarChartVisualObject barChartVisualObject = new BarChartVisualObject(barGameObject, Width, barHight); barChartVisualObject.SetGraphVisualObjectInfo(graphPosition, Width, barHight, tooltipText); Button_UI barButtonUI = barGameObject.AddComponent <Button_UI>(); barButtonUI.MouseOverOnceFunc += () => { /* ShowTooltip_Static(tooltipText, graphPosition);*/ }; // Hide Tooltip on Mouse Out barButtonUI.MouseOutOnceFunc += () => { HideTooltip_Static(); }; DragNode node = barGameObject.AddComponent <DragNode>(); node.setRectTransform(barGameObject.GetComponent <RectTransform>(), this.gameObject); node.setNodeStructure(a, Width, barHight); return(new List <GameObject>() { barGameObject }); }
private void Awake() { okBtn = transform.Find("okBtn").GetComponent <Button_UI>(); cancelBtn = transform.Find("cancelBtn").GetComponent <Button_UI>(); //titleText = transform.Find("titleText").GetComponent<TextMeshPro>(); inputField = transform.Find("inputField").GetComponent <InputField>(); }
private void Awake() { instance = this; okBtn = transform.Find("okBtn").GetComponent <Button_UI>(); cancelBtn = transform.Find("cancelBtn").GetComponent <Button_UI>(); Hide(); }
private void Awake() { instance = this; okBtn = transform.Find("okBtn").GetComponent <Button_UI>(); cancelBtn = transform.Find("cancelBtn").GetComponent <Button_UI>(); titleText = transform.Find("titleText").GetComponent <TextMeshProUGUI>(); inputField = transform.Find("inputField").GetComponent <TMP_InputField>(); Hide(); }
public void SetGraphVisualObjectInfo(Vector2 graphPos, float graphPosWidth, string toolTipTxt, bool isEnd = false) { GetGraphPos(); UpdateDotConnection(); Button_UI dotButton = dotGameObject.GetComponent <Button_UI>(); dotButton.MouseOverOnceFunc = () => { WindowGraph.ShowToolTipStatic(toolTipTxt, graphPos); }; dotButton.MouseOutOnceFunc = () => { WindowGraph.HideToolTipStatic(); }; OnChangedGraphVisualObject?.Invoke(this, EventArgs.Empty); }
public void SetGraphVisualObjectInfo(Vector2 graphPos, float graphPosWidth, string toolTipTxt, bool isEnd = false) { RectTransform rectTransform = barObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = new Vector2(graphPos.x, 0f); rectTransform.sizeDelta = new Vector2(graphPosWidth * barWidthMultiplier, graphPos.y); Button_UI buttonUi = barObject.GetComponent <Button_UI>(); buttonUi.MouseOverOnceFunc = () => { WindowGraph.ShowToolTipStatic(toolTipTxt, graphPos); }; buttonUi.MouseOutOnceFunc = WindowGraph.HideToolTipStatic; }
public void SetGraphVisualObjectInfo(Vector2 graphPosition, float graphPositionWidth, string tooltipText) { RectTransform rectTransform = barGameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = new Vector2(graphPosition.x, 0f); rectTransform.sizeDelta = new Vector2(graphPositionWidth * barWidthMultiplier, graphPosition.y); Button_UI barButtonUI = barGameObject.GetComponent <Button_UI>(); barButtonUI.MouseOverOnceFunc = () => { ShowTooltip_static(tooltipText, graphPosition); }; barButtonUI.MouseOutOnceFunc = () => { HideTooltip_static(); }; }
public void SetGraphVisualObjectInfo(Vector2 graphPosition, float graphPositionWidth) { RectTransform rectTransform = dotGameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = graphPosition; UpdateDotConnection(); Button_UI dotButtonUI = dotGameObject.GetComponent <Button_UI>(); if (OnChangedGraphVisualObjectInfo != null) { OnChangedGraphVisualObjectInfo(this, EventArgs.Empty); } }
private void Awake() { _overlay = transform.Find("overlay").GetComponent <Image>(); _border = transform.Find("border").GetComponent <Image>(); _skillSpriteHolder = transform.Find("skillSprite").GetComponent <Image>(); _levelText = transform.Find("levelText").GetComponent <TextMeshProUGUI>(); _buttonUI = GetComponent <Button_UI>(); _playerAbilitySystem = skillsManager.GetComponent <AbilitiesSystem>(); // Setting Hover UI Stuff _skillName = skillInfoHover.transform.Find("skillName").GetComponent <TextMeshProUGUI>(); _skillDescription = skillInfoHover.transform.Find("skillDescription").GetComponent <TextMeshProUGUI>(); _skillLevel = skillInfoHover.transform.Find("skillLevel").GetComponent <TextMeshProUGUI>(); _skillType = skillInfoHover.transform.Find("skillType").GetComponent <TextMeshProUGUI>(); _skillStats = skillInfoHover.transform.Find("skillStats").GetComponent <TextMeshProUGUI>(); _skillRequirements = skillInfoHover.transform.Find("skillRequirements").GetComponent <TextMeshProUGUI>(); }
private GameObject CreateBar(Vector2 graphPosition, float barWidth) { GameObject gameObject = new GameObject("bar", typeof(Image)); gameObject.transform.SetParent(graphContainer, false); gameObject.GetComponent <Image>().color = barColor; RectTransform rectTransform = gameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = new Vector2(graphPosition.x, 0f); rectTransform.sizeDelta = new Vector2(barWidth * barWidthMultiplier, graphPosition.y); rectTransform.anchorMin = new Vector2(0, 0); rectTransform.anchorMax = new Vector2(0, 0); rectTransform.pivot = new Vector2(.5f, 0f); Button_UI barButtonUI = gameObject.AddComponent <Button_UI>(); return(gameObject); }
private GameObject CreateDot(Vector2 anchoredPosition) { GameObject gameObject = new GameObject("dot", typeof(Image)); gameObject.transform.SetParent(graphContainer, false); gameObject.GetComponent <Image>().sprite = dotSprite; gameObject.GetComponent <Image>().color = dotColor; RectTransform rectTransform = gameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = anchoredPosition; rectTransform.sizeDelta = new Vector2(11, 11); rectTransform.anchorMin = new Vector2(0, 0); rectTransform.anchorMax = new Vector2(0, 0); Button_UI dotButtonUI = gameObject.AddComponent <Button_UI>(); return(gameObject); }
public void SetItem(InventorySlot inventorySlot) { this.inventorySlot = inventorySlot; this.image.sprite = inventorySlot.item.sprite; this.text.text = inventorySlot.item.itemName; this.button = GetComponent <Button_UI>(); if (inventorySlot.item.IsStackable()) { quantityText.enabled = true; quantityText.text = inventorySlot.quantity.ToString(); } equippedItem.enabled = inventorySlot.isEquipped; button.ClickFunc = () => { EquipItem(inventorySlot); }; }
public void SetGraphVisualObjectInfo(Vector2 graphPosition, float graphPositionWidth, string tooltipText) { RectTransform rectTransform = dotGameObject.GetComponent <RectTransform>(); rectTransform.anchoredPosition = graphPosition; UpdateDotConnection(); Button_UI dotButtonUI = dotGameObject.GetComponent <Button_UI>(); dotButtonUI.MouseOverOnceFunc += () => { ShowTooltip_static(tooltipText, graphPosition); }; dotButtonUI.MouseOutOnceFunc += () => { HideTooltip_static(); }; if (OnGraphChange != null) { OnGraphChange(this, EventArgs.Empty); } }
public static void ButtonBehaviour(Button_UI button, float sizeIncrease, Action onClick, bool useArrows) { float originalTextSize; Color originalColor; TextMeshProUGUI buttonTxt = button.transform.Find("Text").GetComponent <TextMeshProUGUI>(); originalColor = buttonTxt.color; originalTextSize = buttonTxt.fontSize; button.MouseOverOnceFunc = () => { AudioManager.instance.Play("Button Hover"); buttonTxt.fontSize = originalTextSize + sizeIncrease; buttonTxt.color = Color.white; if (useArrows) { button.transform.Find("Left Arrow").gameObject.SetActive(true); button.transform.Find("Right Arrow").gameObject.SetActive(true); } }; button.MouseOutOnceFunc = () => { buttonTxt.fontSize = originalTextSize; buttonTxt.color = originalColor; if (useArrows) { button.transform.Find("Left Arrow").gameObject.SetActive(false); button.transform.Find("Right Arrow").gameObject.SetActive(false); } }; button.ClickFunc = () => { AudioManager.instance.Play("Button Click"); onClick?.Invoke(); }; }
public static void AddButtonQuitSound(this Button_UI buttonUI) // dziweki do przyciskow { // odtworz dzwiek po najechaniu na przycisk buttonUI.MouseOverOnceFunc += () => SoundManager.PlaySound(SoundManager.Sound.ButtonMove); buttonUI.ClickFunc += () => SoundManager.PlaySound(SoundManager.Sound.ButtonQuit); }
private void Awake() { okBtn = transform.Find("okBtn").GetComponent <Button_UI>(); Hide(); }
private void Awake() { okBtn = transform.Find("okBtn").GetComponent <Button_UI>(); inputField = transform.Find("inputField").GetComponent <TMP_InputField>(); Hide(); }
public static void AddButtonSounds(this Button_UI buttonUI) { buttonUI.MouseOverOnceFunc += () => PlaySound(Sound.ButtonOver); buttonUI.ClickFunc += () => PlaySound(Sound.ButtonClick); }
public static void AddButtonSounds(this Button_UI buttonUI) { buttonUI.MouseDownOnceFunc += () => SoundManager.PlaySound(Sound.ButtonOver); buttonUI.ClickFunc += () => SoundManager.PlaySound(Sound.ButtonClick); }