Skip to content

Instantly share code, notes, and snippets.

@josephjaniga
Created December 10, 2014 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephjaniga/776191416b60267dd81c to your computer and use it in GitHub Desktop.
Save josephjaniga/776191416b60267dd81c to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
public class TooltipHover : UIBehaviour, IPointerEnterHandler, IPointerExitHandler {
public Container container;
public GameObject TT;
public GameObject TTStats;
public GameObject TTName;
public GameObject TTValue;
public GameObject TTType;
void Awake(){
container = gameObject.GetComponent<Container>();
//TT = GameObject.Find ("TooltipPanel");
TTStats = GameObject.Find ("TTStats");
TTName = GameObject.Find ("TTName");
TTValue = GameObject.Find ("TTValue");
TTType = GameObject.Find ("TTType");
}
// Use this for initialization
void Start () {
TT = GameObject.Find ("TooltipPanel");
//TT.SetActive(false);
}
void Update(){
}
public virtual void OnPointerEnter(PointerEventData eventData){
//TT.SetActive(true);
TTName.GetComponent<Text>().text = container.item.itemName;
TTValue.GetComponent<Text>().text = ""+container.item.value;
switch (container.item.type){
case 0:
default:
TTType.GetComponent<Text>().text = "Thing";
break;
}
TTStats.GetComponent<Text>().text = container.item.statText;
}
public virtual void OnPointerExit(PointerEventData eventData){
//TT.SetActive(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment