Player class impr
This commit is contained in:
parent
ee5b086c87
commit
366994d156
|
@ -1,39 +1,43 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
public class Player {
|
public class Player : MonoBehaviour {
|
||||||
|
|
||||||
public Player(int _charID, int _roleID){
|
public Player(int _charID, int _roleID){
|
||||||
|
SetCharacter(_charID);
|
||||||
|
SetRole(_roleID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void DebugInfo() {
|
||||||
|
Debug.Log(charname+" is a "+GetRoleName()+" with "+hp.ToString()+" hit points");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCharacter(int _charID){
|
||||||
charID = _charID;
|
charID = _charID;
|
||||||
roleID = _roleID;
|
|
||||||
|
|
||||||
var ct = Rdb.GetTable("characters");
|
var ct = Rdb.GetTable("characters");
|
||||||
charname = ct.GetValue<string>(charID, "name");
|
charname = ct.GetValue<string>(charID, "name");
|
||||||
spellID = ct.GetValue<int>(charID, "spell");
|
spellID = ct.GetValue<int>(charID, "spell");
|
||||||
hp = ct.GetValue<int>(charID, "hp");
|
hp = ct.GetValue<int>(charID, "hp");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetRole(int _roleID){
|
||||||
|
roleID = _roleID;
|
||||||
|
|
||||||
var rt = Rdb.GetTable("roles");
|
var rt = Rdb.GetTable("roles");
|
||||||
rolename = rt.GetValue<string>(roleID, "name");
|
rolename_strref = rt.GetValue<int>(roleID, "name_strref");
|
||||||
ultiID = rt.GetValue<int>(roleID, "ulti");
|
ultiID = rt.GetValue<int>(roleID, "ulti");
|
||||||
align = rt.GetValue<string>(roleID, "alignment");
|
align = rt.GetValue<string>(roleID, "alignment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void DebugInfo() {
|
|
||||||
Debug.Log(charname+" is a "+rolename+" with "+hp.ToString()+" hit points");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int charID;
|
public int charID;
|
||||||
public int roleID;
|
|
||||||
|
|
||||||
public string charname;
|
public string charname;
|
||||||
public int spellID;
|
public int spellID;
|
||||||
public int hp;
|
public int hp;
|
||||||
public string rolename;
|
|
||||||
|
public int roleID;
|
||||||
|
public int rolename_strref;
|
||||||
public int ultiID;
|
public int ultiID;
|
||||||
public string align;
|
public string align;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,11 @@ public class Rdb {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetLocale(string lang) {
|
public static void SetLocale(string lang) {
|
||||||
m_inst.m_strref = GetTable("locale_"+lang);
|
Get().m_strref = GetTable("locale_"+lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetStrRef(int strref) {
|
public static string GetStrRef(int strref) {
|
||||||
Rdb inst = Get();
|
return Get().m_strref.GetValue<string>(strref, "text");
|
||||||
|
|
||||||
return inst.m_strref.GetValue<string>(strref, "text");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue