private void initModelData() { m_bossTag = new bossTag(); m_bossTag.bossUse = new bool[20]; for (int i = 0; i < 20; i++) { m_bossTag.bossUse[i] = false; /* * bossUse tmpUse = new bossUse(); * tmpUse.id = i + 1; * tmpUse.canUse = false; * m_bossTag.bossUse.Add(tmpUse); */ } }
//加载所有数据 private void loadAllData() { if (File.Exists(m_ModelFileName)) { string jsonStr = File.ReadAllText(m_ModelFileName); m_bossTag = JsonUtility.FromJson <bossTag>(jsonStr); } else { initModelData(); saveModelData(); } if (File.Exists(m_RoleFileName)) { string jsonStr = File.ReadAllText(m_RoleFileName); m_roleData = JsonUtility.FromJson <roleData>(jsonStr); } else { initRoleData(); saveRoleData(); } }