public void SavePlayerSettings() { string filePath = Application.persistentDataPath + "/gamesetting/user/"; string fileName = "user_config.tab"; if (System.IO.File.Exists(filePath + fileName)) { System.IO.File.Delete(filePath + fileName); } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } FileStream fs = System.IO.File.Create(filePath + fileName); StreamWriter sw = new StreamWriter(fs); string str = "Name" + '\t' + "Age" + "\t" + "WaveNo" + '\t' + "HeroId" + '\t' + '\r' + '\n'; // string str = "Lvl" + '\t' + "Exp" + '\t' + "WaveNo" + '\t' + "LeftTime" + '\t' + "CompletedTask" + "\t" + '\r' + '\n'; sw.Flush(); sw.Write(str); sw.Close(); fs.Close(); VTabFile tabFile = VTabFile.LoadFromFile(filePath + fileName); tabFile.SetValue <string>(2, 1, _BaseDada.Name); tabFile.SetValue <int>(2, 2, _BaseDada.Age); tabFile.SetValue <float>(2, 3, 13.0f); tabFile.Save("/gamesetting/user/user_config.tab"); }
public static VTabFile LoadFromFile(string fileFullPath) { VTabFile tabFile = new VTabFile(); if (tabFile.LoadByIO(fileFullPath)) { return(tabFile); } else { return(null); } }
public void Load() { VTabFile tab = new VTabFile(Main.StageDataPath); int height = tab.GetHeight(); for (int row = 2; row <= height; row++) { VStageInfo info = new VStageInfo(); info.Id = tab.GetInteger(row, "Id"); info.Name = tab.GetString(row, "Name"); info.MapId = tab.GetInteger(row, "MapId"); _StageSetting.Add(info.Id, info); } }
public void Load() { VTabFile tab = new VTabFile(Main.MapDataPath); int height = tab.GetHeight(); for (int row = 2; row <= height; row++) { MapInfo info = new MapInfo(); info.Id = tab.GetInteger(row, "Id"); info.Ground = tab.GetInteger(row, "Ground"); info.Monster = tab.GetInteger(row, "Monster"); info.Desk = tab.GetInteger(row, "Desk"); MapSetting.Add(info.Id, info); } }
public void Init() { UIRootCamera = GameObject.Find("UI Root/Camera").transform; VTabFile tabFile = new VTabFile("gamesetting/ui/uisetting.tab"); for (int i = 2; i <= tabFile.GetHeight(); ++i) { VUISetting uiSetting = new VUISetting(); string uiName = tabFile.GetString(i, "UIName"); uiSetting.UIName = uiName; uiSetting.Side = tabFile.GetString(i, "AnchorSide"); uiSetting.OffsetX = tabFile.GetFloat(i, "OffsetX"); uiSetting.OffsetY = tabFile.GetFloat(i, "OffsetY"); uiSetting.OffsetZ = tabFile.GetFloat(i, "OffsetZ"); UISettings[uiName] = uiSetting; } }
public void LoadPlayerSetting() { if (!System.IO.File.Exists(Application.persistentDataPath + "/gamesetting/user/user_config.tab")) { _BaseDada.Name = string.Empty; _BaseDada.Age = -1; return; } VTabFile tab = new VTabFile(Main.ClientPlayerDataPath); //int height = tab.GetHeight(); //string test = tab.GetString(2, "Age"); _BaseDada.Name = tab.GetString(2, "Name"); _BaseDada.Age = tab.GetInteger(2, "Age"); _BaseDada.HeroId = tab.GetInteger(2, "HeroId"); }
public void Load() { VTabFile tab = new VTabFile(Main.WeaponDataPath); int height = tab.GetHeight(); for (int row = 2; row <= height; row++) { VWeaponInfo info = new VWeaponInfo(); info.Id = tab.GetInteger(row, "Id"); info.ResName = tab.GetString(row, "ResName"); info.Type = (WeaponType)tab.GetInteger(row, "Type");; info.HurtId = tab.GetInteger(row, "HurtId"); info.AddHp = tab.GetFloat(row, "AddHp"); info.AddDefense = tab.GetFloat(row, "AddDefense"); info.AttackPhysic = tab.GetFloat(row, "AttackPhysic"); info.AddAttackCriticalPossibility = tab.GetFloat(row, "AddAttackCriticalPossibility"); info.AddMoveSpeed = tab.GetFloat(row, "AddMoveSpeed"); _WeaponSetting.Add(info.Id, info); } }
public void Load(Dictionary <int, VAnimalInfo> setting, string path) { setting.Clear(); VTabFile tab = new VTabFile(path); int height = tab.GetHeight(); for (int row = 2; row <= height; row++) { VAnimalInfo info = new VAnimalInfo(); info.Id = tab.GetInteger(row, "Id"); info.Path = tab.GetString(row, "Path"); info.Name = tab.GetString(row, "Name"); info.Level = tab.GetInteger(row, "Level"); info.Hp = tab.GetFloat(row, "Hp"); info.Defense = tab.GetFloat(row, "Defense"); info.AttackPhysic = tab.GetFloat(row, "AttackPhysic"); info.AttackCriticalPossibility = tab.GetFloat(row, "AttackCriticalPossibility"); info.MoveSpeed = tab.GetFloat(row, "MoveSpeed"); setting.Add(info.Id, info); } }