public StratagemInfo Clone() { StratagemInfo clone = new StratagemInfo(); CopyTo(clone); return(clone); }
private void SetUI(int id, bool b = false) { StratagemInfo info = GameData.Instance.StratagemTable[id]; string s = (b) ? "_gray" : ""; m_Item.sprite = ResourceManager.m_Instance.LoadSprite(typeof(Sprite), HELLDIVERS.UI.UIHelper.StratagemIconFolder, "icon_" + id + s, false); }
private static bool _LoadDataBase(string tablePath, ref Dictionary <int, StratagemInfo> table) { table.Clear(); TextAsset datas = Resources.Load <TextAsset>(tablePath); if (datas != null) { string[] line = datas.text.Split('\n'); for (int i = 1; i < line.Length - 1; i++) { string[] colum = line[i].Split(','); StratagemInfo data = new StratagemInfo(); FieldInfo[] infos = data.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); infos[0].SetValue(data, int.Parse(colum[0])); infos[1].SetValue(data, int.Parse(colum[1])); infos[2].SetValue(data, colum[2]); infos[3].SetValue(data, (StratagemInfo.eType)Enum.Parse(typeof(StratagemInfo.eType), colum[3])); infos[4].SetValue(data, _GetCodes(colum[4])); infos[5].SetValue(data, int.Parse(colum[5])); infos[6].SetValue(data, float.Parse(colum[6])); infos[7].SetValue(data, float.Parse(colum[7])); infos[8].SetValue(data, colum[8]); infos[9].SetValue(data, int.Parse(colum[9])); table.Add(data.ID, data); } return(true); } return(false); }
/*-------------------------------------------------------------------------- * Get stratagem info by id key which is in the gamedata.stratagem tables. * * If it does not exist return null. * * ---------------------------------------------------------------------------*/ private bool TryGetInfoFromGameData(int id, out StratagemInfo getInfo) { if (GameData.Instance.StratagemTable.ContainsKey(id) == false) { Debug.LogErrorFormat("Stratagem Error : Can't found ID : [{0}] from game data", id); getInfo = null; return(false); } getInfo = GameData.Instance.StratagemTable[id]; return(true); }
public void CopyTo(StratagemInfo info) { info.id = this.id; info.rank = this.rank; info.title = this.title; info.type = this.type; info.codes = this.codes; info.uses = this.uses; info.cooldown = this.cooldown; info.activation = this.activation; info.displayId = this.displayId; info.resultId = this.resultId; }
public void SetStratagemUI(int id, bool b = false) { m_ID = id; if (m_ID == 0) { SetNull(); this.name = m_ID.ToString(); return; } StratagemInfo m_StratagemInfo = GameData.Instance.StratagemTable[m_ID]; string s = (b)? "_gray" : ""; Sprite sprite = ResourceManager.m_Instance.LoadSprite(typeof(Sprite), HELLDIVERS.UI.UIHelper.StratagemIconFolder, "icon_" + m_ID + s, false); m_StratagemTexture.sprite = sprite; m_StratagemTexture.color = m_SpritBright; this.name = m_ID.ToString(); }
private void Awake() { m_Info = new StratagemInfo(); m_SoundManager = this.GetComponent <SoundManager>(); }