public void addReturnedData(Notes_ReceivedData n) { if (!returnedData.ContainsKey(n.ID)) returnedData.Add(n.ID, n); else returnedData[n.ID].updateData(n); }
private Notes_DataContainer loadData(ConfigNode node) { Notes_DataContainer d = new Notes_DataContainer(); for (int k = 0; k < node.GetNodes("COMPLETED_DATA").Length; k++) { ConfigNode s = node.GetNodes("COMPLETED_DATA")[k]; if (s == null) continue; ScienceSubject sub = s.parse("SCIENCE_ID", (ScienceSubject)null); if (sub == null) continue; float value = s.parse("SCIENCE_VALUE", 0f); int time = s.parse("TIME_RECEIVED", (int)0); Notes_ReceivedData o = new Notes_ReceivedData(sub, value, time, d); d.addReturnedData(o); } return d; }
private void onScienceTransmit(float value, ScienceSubject sub, ProtoVessel pV, bool b) { if (pV == null) return; if (pV.vesselID == null) return; Notes_Container n = getNotes(pV.vesselID); if (n == null) return; if (n.Data == null) return; double time = Planetarium.GetUniversalTime(); Notes_ReceivedData o = new Notes_ReceivedData(sub, value, (int)time, n.Data); n.Data.addReturnedData(o); }
public void updateData(Notes_ReceivedData d) { scienceValue += d.scienceValue; receivedTime = d.receivedTime; date = KSPUtil.PrintDateCompact(receivedTime, false, false); remainingValue = Math.Min(sub.scienceCap, Math.Max(0f, sub.scienceCap * sub.scientificValue)); }