//creates options for character based on the number of sprites/characters available for him to choose private void CreateCharChoiceButtons() { for (int i = 1; i < playerScript.sprites.Count; i++) { Button choice = Instantiate(choiceButton, canvasTransform); Vector2 buttonPosition = choice.GetComponent <RectTransform>().anchoredPosition; buttonPosition.x += 40 * i; choice.GetComponent <RectTransform>().anchoredPosition = buttonPosition; choice.GetComponentInChildren <Text>().text = (i).ToString(); int temp = i; //keeps memory address to assign to setsprite, i=0 is the tombstone sprite choice.onClick.AddListener(delegate { playerScript.CmdSetChar(temp); }); choice.onClick.AddListener(SetChar); //creating a tooltip to display the stats when he hovers over the button EventTrigger trigger = choice.GetComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; PlayerStat ps = playerScript.statList[temp - 1]; string tooltipString = "Name: " + ps.name + "\nHealth: " + ps.health + "\nDamage: " + ps.damage + "\nAttack Range: " + ps.attackRange; entry.callback.AddListener(delegate { TooltipScript.ShowTooltip_Static(tooltipString); }); EventTrigger.Entry entry2 = new EventTrigger.Entry(); entry2.eventID = EventTriggerType.PointerExit; entry2.callback.AddListener(delegate { TooltipScript.HideTooltip_Static(); }); trigger.triggers.Add(entry); trigger.triggers.Add(entry2); //keep list of choicebuttons to destroy them when the game starts choiceButtonList.Add(choice); } }
// Start is called before the first frame update void Start() { instance = this; backgroundRectTransform = transform.Find("Background").GetComponent <RectTransform>(); tooltipText = transform.Find("Text").GetComponent <Text>(); HideTooltip_Static(); }
private void Awake() { selectedItemScript = GameObject.Find("SelectedItems").GetComponent <UIItemScript>(); tooltipScript = GameObject.Find("Tooltip").GetComponent <TooltipScript>(); spriteImage = GetComponent <Image>(); UpdateItemFunction(null); }
// Use this for initialization void Start() { bar = GetComponent <TooltipProgressbar>(); tooltip = GetComponent <TooltipScript>(); string time = "time"; time += requiredHitsPerDummy > 1 ? "s" : ""; tooltip.SetText("Hit each one " + requiredHitsPerDummy + " " + time + " to win!"); }
// Use this for initialization void Start() { btn1.onClick.AddListener(() => { activeTool = Tool.Shovel; txt.text = "Shovel"; }); btn2.onClick.AddListener(() => { activeTool = Tool.Move; txt.text = "Move"; }); btn3.onClick.AddListener(() => { activeTool = Tool.Delete; txt.text = "Destroy"; }); space = new Space(6, 6); blueprints = new BlueprintLibrary(); buildings = new BuildingLibrary(); materials = new MaterialLibrary(); toolTip = GameObject.FindGameObjectWithTag("ToolTip").GetComponent <TooltipScript>(); }
private void Awake() { //A: inicializa instancia (singleton) instance = this; //A: encontra componentes (texto e fundo) backgroundRectTransform = transform.Find("Fundo").GetComponent <RectTransform>(); tooltipText = transform.Find("TextoTooltip").GetComponent <Text>();// this.GetComponent<Text>(); //A: alternar qual metade da linha esta comentada para mudar entre mmostrar ou esconder background quando sem texto ShowTooltip(""); gameObject.SetActive(false); }
void Start() { inv = GameObject.Find("Inventory").GetComponent<Inventory>(); tooltip = inv.GetComponent<TooltipScript>(); }
void Update() { switch (classificacao) { case tipoTooltip.adversario: textoTooltip = this.GetComponent <CombateAtributos>().atributos.descricao; break; case tipoTooltip.player: CombateUnidade atribJogador = this.GetComponent <CombateAtributos>().atributos; textoTooltip = string.Format("Ataque: {0}\nDefesa: {1}", atribJogador.dano, atribJogador.defesa); break; case tipoTooltip.alinhamento: switch (alinhamentoSlider.value) { case 0: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano de ataques \nIncisivos super efetivos \nMUITO aumentado"; break; case 1: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano de ataques \nIncisivos e Diplomaticos \nsuper efetivos um pouco aumentado"; break; case 2: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano de ataques \nDiplomaticos super efetivos \nMUITO aumentado"; break; case 3: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano de ataques \nDiplomaticos e Questionadores \nsuper efetivos um pouco aumentado"; break; case 4: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano de ataques \nQuestionadores super efetivos \nMUITO aumentado"; break; default: textoTooltip = "Quanto mais dano você causa\n de um tipo de ataque,\n mais dano ele causa\n quando é super efetivo. \n\nBonus atual:\nBonus de dano normal para ataques super efetivos"; break; } break; case tipoTooltip.acao: /*switch(acaoAssociada.tipo) * { * case CombateAcao.tipoDano.Agressivo: * textoTooltip = string.Format("Tipo: Incisivo"); * break; * case CombateAcao.tipoDano.Diplomatico: * textoTooltip = string.Format("Tipo: Diplomatico"); * break; * case CombateAcao.tipoDano.Manipulador: * textoTooltip = string.Format("Tipo: Questionador"); * break; * default: * textoTooltip = string.Format("Tipo: Neutro"); * break; * }*/ break; case tipoTooltip.argumento: if (argumentoAssociado != null) { switch (argumentoAssociado.habilidade) { case CombateArgumento.tipoArgumento.Ataque: textoTooltip = string.Format("Aumentando dano causado.", argumentoAssociado.valor); break; case CombateArgumento.tipoArgumento.Defesa: textoTooltip = string.Format("Reduz dano recebido.", argumentoAssociado.valor); break; case CombateArgumento.tipoArgumento.Evasao: textoTooltip = string.Format("Ignora dano recebido.", argumentoAssociado.valor); break; case CombateArgumento.tipoArgumento.RoubaVida: textoTooltip = string.Format("Recupera parte do dano causado como vida.", argumentoAssociado.valor); break; default: textoTooltip = string.Format("Recuperando vida a cada turno.", argumentoAssociado.valor); break; } } else { textoTooltip = ""; } break; default: textoTooltip = ""; break; } if (exibindo) { TooltipScript.ExibirTooltip(textoTooltip); } }
public void OnPointerExit() { exibindo = false; TooltipScript.EsconderTooltip(); }
public void OnPointerEnter() { exibindo = true; TooltipScript.ExibirTooltip(textoTooltip); }
void OnMouseExit() { exibindo = false; TooltipScript.EsconderTooltip(); }
void OnMouseOver() { exibindo = true; TooltipScript.ExibirTooltip(textoTooltip); }