public void RegisterVessel(Guid vesselID) { if (vessel_register.ContainsKey(vesselID)) { return; } vessel_register[vesselID] = new kPMVesselMonitors(vesselID); }
public void Initialize(int screenWidth, int screenHeight) { //Set Processor Installed Flag processorIsInstalled = false; //Set Current Processor to 0 current_processor_id = 0; //Unlock if locked if (isLocked) { ToggleLock(); } //Register kOSProcessors processors = GetProcessorList(); //Get SharedObjects processor_shares = new List <SharedObjects>(); foreach (kOSProcessor processor in processors) { //Set Processor Installed Flag processorIsInstalled = true; //Register the kOSProcessor's SharedObjects processor_shares.Add(GetProcessorShare(processor)); } //Return Early If No Processor if (!processorIsInstalled) { return; } //Register Vessel kPMCore.fetch.RegisterVessel(this.vessel.id); //Get Vessel Track vt = kPMCore.fetch.GetVesselMonitors(this.vessel.id); //Set Vessel Part Cound lastPartCount = this.vessel.parts.Count; //Single-Init Actions if (!initialized) { //Set Index monitorIndex = vt.monitors.Count; //Create or Get GUID if (vt.registeredMonitors.Count > monitorIndex) { guid = vt.registeredMonitors[monitorIndex]; } else { guid = Guid.NewGuid(); } //Register Monitor vt.RegisterMonitor(guid); //Split Multi-Function Buttons String multiFunctionButtonsPOS = new List <int>(); foreach (string id in multiFunctionButtons.Split(delimiterChars)) { int id_int; if (Int32.TryParse(id, out id_int)) { multiFunctionButtonsPOS.Add(id_int); } } //Register Buttons and Flags if (!vt.buttonLabels.ContainsKey(monitorIndex)) { vt.buttonLabels[monitorIndex] = new Dictionary <int, string>(); vt.buttonStates[monitorIndex] = new Dictionary <int, bool>(); vt.flagLabels[monitorIndex] = new Dictionary <int, string>(); vt.flagStates[monitorIndex] = new Dictionary <int, bool>(); for (int i = vt.buttonLabels[monitorIndex].Count; i < multiFunctionButtonsPOS.Count; i++) { vt.buttonLabels[monitorIndex][i] = buttonEmptyLabel; vt.buttonStates[monitorIndex][i] = false; } for (int i = vt.flagLabels[monitorIndex].Count; i < flagCount; i++) { vt.flagLabels[monitorIndex][i] = flagEmptyLabel; vt.flagStates[monitorIndex][i] = false; } } //Format Dictionaries response_formats = new Dictionary <string, string>(); replacement_formats = new Dictionary <string, object>(); ReadTemplate(); ReadReplacements(); //Register monitor and Keyboard Delegate kPMCore.fetch.RegisterMonitor(this, guid); initialized = true; } Debug.Log("kPM: kOSMonitor Initialized!"); }