public void CompanyTag() { if (CompanyStructure.instance.GetCompanyStructure() != null) { Data.CompanyStructure company = CompanyStructure.instance.GetCompanyStructure(); companyName.text = company.name; companyLevel.text = "Lv." + company.level; companyEXP.text = company.exp.ToString("C0").Replace("$", "") + "/" + CompanyStructure.instance.GetCompanyMaxExp().ToString("C0").Replace("$", ""); //companyTier.text = company.tier; //companyPopular.text = company.popular + ""; companyMoney.text = company.money.ToString("C0").Replace("$", ""); } }
public void CheckLeveling() { Data.CompanyStructure companyStructure = CompanyStructure.instance.GetCompanyStructure(); if (companyStructure.exp == companyStructure.GetCompanyMaxExp()) { companyStructure.exp = 0; companyStructure.level++; companyStructure.point++; } else if (companyStructure.exp > companyStructure.GetCompanyMaxExp()) { companyStructure.exp = companyStructure.GetCompanyMaxExp() - companyStructure.exp; companyStructure.level++; companyStructure.point++; } }
public void SaveCompany(string fileName, Data.CompanyStructure companyStructure) { FileOut = Application.dataPath + "/SaveData"; if (!Directory.Exists(FileOut)) { Debug.Log("Create folder " + FileOut); Directory.CreateDirectory(FileOut); } FileOut = Application.dataPath + "/SaveData/" + fileName + ".json"; string json = JsonUtility.ToJson(companyStructure); File.WriteAllText(FileOut, json); Debug.Log("FileOut: " + FileOut); }
public void Set(string json) { companyStructure = JsonUtility.FromJson <Data.CompanyStructure>(json); set = true; }