48 lines
783 B
C#
48 lines
783 B
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
|
|||
|
|
|||
|
public class Gui_AbilityButton : MonoBehaviour{
|
|||
|
|
|||
|
public int spellID;
|
|||
|
public Sprite ico;
|
|||
|
|
|||
|
void Awake(){
|
|||
|
button = GetComponent<Button>();
|
|||
|
icon = GetComponent<Image>();
|
|||
|
}
|
|||
|
|
|||
|
void Start(){
|
|||
|
SetSpellID(spellID);
|
|||
|
}
|
|||
|
|
|||
|
void SetSpellID(int _spellID){
|
|||
|
Debug.Log("yolo");
|
|||
|
|
|||
|
//Set image, callback
|
|||
|
var st = Rdb.GetTable("spells");
|
|||
|
|
|||
|
string sIcon = st.GetValue<string>(_spellID, "icon");
|
|||
|
var iconImage = Resources.Load<Sprite>(sIcon);
|
|||
|
if(iconImage==null){
|
|||
|
Debug.LogError("Could not open "+sIcon);
|
|||
|
}
|
|||
|
else
|
|||
|
icon.sprite = iconImage;
|
|||
|
|
|||
|
i=0;
|
|||
|
//Execute 2da script
|
|||
|
button.onClick.AddListener(()=>{
|
|||
|
Debug.Log("Clicked");
|
|||
|
});
|
|||
|
|
|||
|
}
|
|||
|
private int i;
|
|||
|
|
|||
|
private Button button;
|
|||
|
private Image icon;
|
|||
|
|
|||
|
}
|
|||
|
|