/// <summary> /// Configure the IR Server plugin. /// </summary> public void Configure(IWin32Window owner) { LoadSettings(); Configure config = new Configure(); config.CommPort = _serialPortName; config.BlasterMode = _blastMode; if (config.ShowDialog(owner) == DialogResult.OK) { _serialPortName = config.CommPort; _blastMode = config.BlasterMode; SaveSettings(); } }
void CheckPointer() { Debug.Log("Direction Magnitude " + joy.Direction.magnitude); if (joy.Direction.magnitude == 0f && !released && loading && blastMode != BlastMode.None) { planetManager.AddStatsBtnEnd(); released = true; loading = false; blast = null; blastMode = BlastMode.None; } else if (joy.Direction.magnitude > 0.001f && !loading && blastMode == BlastMode.None) { Debug.Log("We're here 1"); released = false; if (joy.Vertical > 0.5f && (joy.Horizontal < 0.5f && joy.Horizontal > -0.5f)) { blastMode = BlastMode.Green; blast = greenBlast; } else if (joy.Vertical < -0.5f && (joy.Horizontal < 0.5f && joy.Horizontal > -0.5f)) { blastMode = BlastMode.Hot; blast = hotBlast; } else if (joy.Horizontal > 0.5f && (joy.Vertical < 0.5f && joy.Vertical > -0.5f)) { blastMode = BlastMode.Earth; blast = earthBlast; } else if (joy.Horizontal < -0.5f && (joy.Vertical < 0.5f && joy.Vertical > -0.5f)) { blastMode = BlastMode.Water; blast = waterBlast; } if (blastMode != BlastMode.None) { Debug.Log("We're here"); loading = true; GameObject temp = Instantiate(blast, blastParent); planetManager.AddStatsBtnStart(temp); } } }
/// <summary> /// Loads the settings. /// </summary> private void LoadSettings() { try { XmlDocument doc = new XmlDocument(); doc.Load(ConfigurationFile); _serialPortName = doc.DocumentElement.Attributes["SerialPortName"].Value; _blastMode = (BlastMode)Enum.Parse(typeof(BlastMode), doc.DocumentElement.Attributes["BlastMode"].Value, true); } #if TRACE catch (Exception ex) { Trace.WriteLine(ex.ToString()); #else catch { #endif _serialPortName = "COM1"; _blastMode = BlastMode.Sky; } }
/// <summary> /// Loads the settings. /// </summary> private void LoadSettings() { try { XmlDocument doc = new XmlDocument(); doc.Load(ConfigurationFile); _serialPortName = doc.DocumentElement.Attributes["SerialPortName"].Value; _blastMode = (BlastMode) Enum.Parse(typeof (BlastMode), doc.DocumentElement.Attributes["BlastMode"].Value, true); } #if TRACE catch (Exception ex) { Trace.WriteLine(ex.ToString()); #else catch { #endif _serialPortName = "COM1"; _blastMode = BlastMode.Sky; } }