public void initFromSavaData(LocalSaveData savedata) { table = new DungeonParameter[savedata.LocalDgData.DgParamTable.Length]; for (int i = 0; i < table.Length; i++) { table[i] = savedata.LocalDgData.DgParamTable[i].toDgParameter(); } CurrentIndex = Array.IndexOf(table, GameController.DungeonInformation.CurrentDungeonParameter); }
public static void doneConvert(LocalSaveData savedata) { DataConvert(savedata); }
public void dataConvert(LocalSaveData savedata) { PlayerData data = savedata.Player; CharacterParameterData paramdata = data.ParameterData; CurrentBuffs = StatusBuffBasis.convert(Controller,data.ParameterData.CurrentBuffs); this.initFromSavedata(paramdata); foreach (ItemBasis item in Inventory.toArray()) { Debug.logger.Log("PlayerInventory", item.Name); if (!(item is EquipmentItemBasis)) continue; EquipmentItemBasis equip = item as EquipmentItemBasis; if (equip.IsEquipping) this.equip(equip,false,true); } this.MaxHunger = data.MaxHunger; this.CurrentHunger = data.CurrentHunger; this.CurrentHungerSpeed = data.CurrentHungerSpeed; this.NextHungerCount = data.NextHungerCount; this.AutoHealSpeed = data.AutoHealSpeed; this.NextAutoHealCount = data.NextAutoHealCount; this.Name = data.PlayerName; this.Pocket = data.Pocket; this.WareHouseLevel = data.WareHouseLevel; this.WareHouseInventory = ItemInventory.convert(WareHouseInventorySize, data.WareHouseInventory); this.Deposit = data.Deposit; this.ObjectClairvoyant = data.ObjectCrairvoyant; this.InvalidateCursing = data.InvalidateCursing; setLelelAtk(); }
public void dataConvert(LocalSaveData savedata) { //this.gameObject.transform.position = savedata.Player.Position; initFromSavedata(savedata.Player); }
public SaveDataHeadder(LocalSaveData savedata) { PlayerName = savedata.Player.PlayerName; TimeStamp = savedata.TimeStamp; TotalPlayingTime = savedata.GlobalGameInfo.TotalPlayingTime; }
private static bool saveFile(uint filenumber,PlayerController player,DungeonInformation dginfo, DungeonParameterTable dgpramtable) { if (filenumber >= filename.Length) throw new ArgumentOutOfRangeException(); string savepath = savedir + @"\" + filename[filenumber]; LocalSaveData lcs = new LocalSaveData(); lcs.setPlayerData(player); lcs.setDungeonData(dginfo,dgpramtable); lcs.setGlobalGameInformation(GameController.GlobalGameInformation); string json = JsonUtility.ToJson(lcs,true); Debug.Log(json); using (FileStream fs = new FileStream(savepath, FileMode.Create, FileAccess.Write)){ BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, json); return true; } return false; }
public static void testWrite() { if (!Directory.Exists(savedir)) { Debug.LogError("Save Directory is None!"); Directory.CreateDirectory(savedir); } LocalSaveData test = new LocalSaveData(); test.Player.Position = new Vector2(3, 7); test.Player.PlayerName = "たかし"; var ken = new IronSword(); ken.init(3); var arrow = new WoodArrow(); arrow.init(12); var tubo = new HOZON(); tubo.init(4); tubo.putinItem(arrow); Debug.Log("Pot: "+tubo.showInventory()); ItemInventory inv = new ItemInventory(10); inv.add(ken,tubo,arrow); test.Player.ParameterData.Inventory = ItemData.convert(inv); test.Player.ParameterData.InventorySize = inv.InventorySize; string json = JsonUtility.ToJson(test,true); Debug.Log(json); string savepath = savedir + @"\saveTest"; using (FileStream fs = new FileStream(savepath,FileMode.Create,FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, json); } testLoad(); }
public void dataConvert(LocalSaveData savedata) { GlobalGameInformation.removeEvent(); GlobalGameInformation = savedata.GlobalGameInfo; //GlobalGameInformation.init(); LocalDungeonData dgdata = savedata.LocalDgData; DungeonInformation.initFromSaveData(savedata.LocalDgData.DgInfo,savedata.Player); DgParameterTable.initFromSavaData(savedata); }