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