public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: // Reset from Resource System m_Resource = DefaultResource; reader.ReadString(); break; case 1: { m_Resource = (CraftResource)reader.ReadInt(); break; } case 0: { OreInfo info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString()); m_Resource = CraftResources.GetFromOreInfo(info); break; } } }
void OreInitInfo() { oreInfos.Clear(); // read from text panel.. //iff empty text panel, init for (int l = 0; l < aOres.Length; l++) { OreInfo oi = new OreInfo(); oi.oreID = l; oi.oreName = aOres[l]; oi.desireability = lOreDesirability[l]; oi.bFound = false; oi.localAmount = 0; oreInfos.Add(oi); } // write data back to text panel if changed. }
private void Deserialize(IGenericReader reader, int version) { switch (version) { case 1: { _resource = (CraftResource)reader.ReadInt(); break; } case 0: { var info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString()); _resource = CraftResources.GetFromOreInfo(info); break; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { m_Resource = (CraftResource)reader.ReadInt(); break; } case 0: { OreInfo info = new OreInfo( reader.ReadInt(), reader.ReadInt(), reader.ReadString() ); m_Resource = CraftResources.GetFromOreInfo( info ); break; } } }
public override void Deserialize(IGenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: { Resource = (CraftResource)reader.ReadInt(); break; } case 0: { OreInfo info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString()); Resource = CraftResources.GetFromOreInfo(info); break; } } }
void OreInitInfo(MyIni ini) { oreInfos.Clear(); bool bInfoChanged = false; bool bInforead = false; // read from text panel.. if (ini != null) { int iCount = 0; iCount = ini.Get(sOreDesirabilitySection, "count").ToInt32(); if (iCount >= lOreDesirability.Length) { bInforead = true; for (int j1 = 0; j1 < iCount; j1++) { int oreID = 0; string oreName = ""; long desireability = -1; bool bFound = false; double localAmount = 0; oreID = ini.Get(sOreDesirabilitySection, "oreId" + j1.ToString()).ToInt32(); // iniWicoCraftSave.GetValue(sOreDesirabilitySection, "oreId" + j1.ToString(), ref oreID); oreName = ini.Get(sOreDesirabilitySection, "oreName" + j1.ToString()).ToString(); // iniWicoCraftSave.GetValue(sOreDesirabilitySection, "oreName" + j1.ToString(), ref oreName); desireability = ini.Get(sOreDesirabilitySection, "desireability" + j1.ToString()).ToInt64(); // iniWicoCraftSave.GetValue(sOreDesirabilitySection, "desireability" + j1.ToString(), ref desireability); bFound = ini.Get(sOreDesirabilitySection, "bFound" + j1.ToString()).ToBoolean(); //iniWicoCraftSave.GetValue(sOreDesirabilitySection, "bFound" + j1.ToString(), ref bFound); localAmount = ini.Get(sOreDesirabilitySection, "localAmount" + j1.ToString()).ToDouble(); // iniWicoCraftSave.GetValue(sOreDesirabilitySection, "localAmount" + j1.ToString(), ref localAmount); OreInfo oi = new OreInfo(); oi.oreID = oreID; oi.oreName = oreName; oi.desireability = desireability; oi.bFound = bFound; oi.localAmount = localAmount; oreInfos.Add(oi); } } } if (!bInforead) { //iff empty text panel, init bInfoChanged = true; for (int l1 = 0; l1 < aOres.Length; l1++) { OreInfo oi = new OreInfo(); oi.oreID = l1; oi.oreName = aOres[l1]; oi.desireability = lOreDesirability[l1]; oi.bFound = false; oi.localAmount = 0; oreInfos.Add(oi); } } // write data back to text panel if changed. if (bInfoChanged) { // we need to write it back out _program.CustomDataChanged(); var count = oreInfos.Count; ini.Set(sOreDesirabilitySection, "count", count); for (int i1 = 0; i1 < oreInfos.Count; i1++) { ini.Set(sOreDesirabilitySection, "oreId" + i1.ToString(), oreInfos[i1].oreID); ini.Set(sOreDesirabilitySection, "oreName" + i1.ToString(), oreInfos[i1].oreName); ini.Set(sOreDesirabilitySection, "desireability" + i1.ToString(), oreInfos[i1].desireability); ini.Set(sOreDesirabilitySection, "bFound" + i1.ToString(), oreInfos[i1].bFound); ini.Set(sOreDesirabilitySection, "localAmount" + i1.ToString(), oreInfos[i1].localAmount); } } }
void OreInitInfo() { oreInfos.Clear(); bool bInfoChanged = false; bool bInforead = false; // read from text panel.. if (iniWicoCraftSave != null) { int iCount = 0; iniWicoCraftSave.GetValue(sOreDesirabilitySection, "count", ref iCount); if (iCount >= lOreDesirability.Length) { bInforead = true; for (int j1 = 0; j1 < iCount; j1++) { int oreID = 0; string oreName = ""; long desireability = -1; bool bFound = false; double localAmount = 0; iniWicoCraftSave.GetValue(sOreDesirabilitySection, "oreId" + j1.ToString(), ref oreID); iniWicoCraftSave.GetValue(sOreDesirabilitySection, "oreName" + j1.ToString(), ref oreName); iniWicoCraftSave.GetValue(sOreDesirabilitySection, "desireability" + j1.ToString(), ref desireability); iniWicoCraftSave.GetValue(sOreDesirabilitySection, "bFound" + j1.ToString(), ref bFound); iniWicoCraftSave.GetValue(sOreDesirabilitySection, "localAmount" + j1.ToString(), ref localAmount); OreInfo oi = new OreInfo(); oi.oreID = oreID; oi.oreName = oreName; oi.desireability = desireability; oi.bFound = bFound; oi.localAmount = localAmount; oreInfos.Add(oi); } } } if (!bInforead) { //iff empty text panel, init bInfoChanged = true; for (int l1 = 0; l1 < aOres.Length; l1++) { OreInfo oi = new OreInfo(); oi.oreID = l1; oi.oreName = aOres[l1]; oi.desireability = lOreDesirability[l1]; oi.bFound = false; oi.localAmount = 0; oreInfos.Add(oi); } } // write data back to text panel if changed. if (bInfoChanged) { // we need to write it back out if (iniWicoCraftSave == null) { sStartupError += "\nNo INI for saving on OreInit()"; return; } var count = oreInfos.Count; iniWicoCraftSave.SetValue(sOreDesirabilitySection, "count", count); for (int i1 = 0; i1 < oreInfos.Count; i1++) { iniWicoCraftSave.SetValue(sOreDesirabilitySection, "oreId" + i1.ToString(), oreInfos[i1].oreID); iniWicoCraftSave.SetValue(sOreDesirabilitySection, "oreName" + i1.ToString(), oreInfos[i1].oreName); iniWicoCraftSave.SetValue(sOreDesirabilitySection, "desireability" + i1.ToString(), oreInfos[i1].desireability); iniWicoCraftSave.SetValue(sOreDesirabilitySection, "bFound" + i1.ToString(), oreInfos[i1].bFound); iniWicoCraftSave.SetValue(sOreDesirabilitySection, "localAmount" + i1.ToString(), oreInfos[i1].localAmount); } } }