Cleaned spell button & text added
This commit is contained in:
parent
c7a7ddbe65
commit
7ee7a5b6f0
1 changed files with 9 additions and 5 deletions
|
@ -6,11 +6,11 @@ using System.Collections;
|
|||
public class Gui_AbilityButton : MonoBehaviour{
|
||||
|
||||
public int spellID;
|
||||
public Sprite ico;
|
||||
|
||||
void Awake(){
|
||||
button = GetComponent<Button>();
|
||||
icon = GetComponent<Image>();
|
||||
name = GetComponentInChildren<Text>();
|
||||
}
|
||||
|
||||
void Start(){
|
||||
|
@ -18,12 +18,13 @@ public class Gui_AbilityButton : MonoBehaviour{
|
|||
}
|
||||
|
||||
void SetSpellID(int _spellID){
|
||||
Debug.Log("yolo");
|
||||
spellID = _spellID;
|
||||
|
||||
//Set image, callback
|
||||
var st = Rdb.GetTable("spells");
|
||||
|
||||
string sIcon = st.GetValue<string>(_spellID, "icon");
|
||||
//Set icon
|
||||
string sIcon = st.GetValue<string>(spellID, "icon");
|
||||
var iconImage = Resources.Load<Sprite>(sIcon);
|
||||
if(iconImage==null){
|
||||
Debug.LogError("Could not open "+sIcon);
|
||||
|
@ -31,8 +32,10 @@ public class Gui_AbilityButton : MonoBehaviour{
|
|||
else
|
||||
icon.sprite = iconImage;
|
||||
|
||||
i=0;
|
||||
//Execute 2da script
|
||||
//Set name
|
||||
name.text = Rdb.GetStrRef(st.GetValue<int>(spellID, "name_strref"));
|
||||
|
||||
//Execute script
|
||||
button.onClick.AddListener(()=>{
|
||||
Debug.Log("Clicked");
|
||||
});
|
||||
|
@ -42,6 +45,7 @@ public class Gui_AbilityButton : MonoBehaviour{
|
|||
|
||||
private Button button;
|
||||
private Image icon;
|
||||
private Text name;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue