private bool ActivateModule(DisplayModule new_active_mod, ref DisplayModule change_active_mod, ref DisplayModule other_active_mod) { /* * if (((other_active_mod == change_active_mod.companion_mod && new_active_mod.companion_mod.GetType() == other_active_mod.GetType()) || * new_active_mod.companion_mod.GetType() == other_active_mod.GetType()) && * new_active_mod.companion_mod != null * ) * { * other_active_mod.Deactivate(); * other_active_mod = new_active_mod.companion_mod; * } */ change_active_mod.Deactivate(); change_active_mod = new_active_mod; change_active_mod.Activate(); other_active_mod.Activate(); return(true); }
public DisplayModule(Device argdev) { dev = argdev; name = "INVALID"; selectable = false; active = false; curfont = null; modid = 0; font_pt = dev.font_pt; companion_mod = null; fmt_left.Alignment = StringAlignment.Near; fmt_left.LineAlignment = StringAlignment.Center; fmt_center.Alignment = StringAlignment.Center; fmt_center.LineAlignment = StringAlignment.Center; fmt_right.Alignment = StringAlignment.Far; fmt_right.LineAlignment = StringAlignment.Center; }
private void CycleModules(ref List <DisplayModule> changelist, ref List <DisplayModule> otherlist, ref DisplayModule change_active_mod, ref DisplayModule other_active_mod, bool activate_first) { bool activate_next = false; bool activated = false; if (activate_first) { ActivateModule(changelist[0], ref change_active_mod, ref other_active_mod); return; } foreach (DisplayModule mod in changelist) { if (activate_next) { if (mod.modid == other_active_mod.modid) { continue; } ActivateModule(mod, ref change_active_mod, ref other_active_mod); activate_next = false; activated = true; } else { if (mod.active) { activate_next = true; } } } if (!activated) { // Activate the first module since we were at the end of the list CycleModules(ref changelist, ref otherlist, ref change_active_mod, ref other_active_mod, true); } }
public VesselInfo(Device dev) : base(dev) { name = "Vessel"; selectable = true; active = false; width = dev.width; height = dev.height; xoff = 0; yoff = 0; orbitinfo = new OrbitInfo(dev, "✈", System.Drawing.Color.FromArgb(0xee, 0xee, 0x00), System.Drawing.Color.FromArgb(0xaa, 0xaa, 0x44)); target_orbitinfo = new OrbitInfo(dev, "+", System.Drawing.Color.LightBlue, System.Drawing.Color.MediumPurple); orbitgraph = new OrbitGraph(dev, System.Drawing.Color.Yellow, "✈"); target_orbitgraph = new OrbitGraph(dev, System.Drawing.Color.LightBlue, "+"); orbitgraph.companion_mod = orbitinfo; orbitinfo.companion_mod = orbitgraph; target_orbitinfo.is_target_type_module = true; target_orbitgraph.is_target_type_module = true; target_orbitinfo.companion_mod = target_orbitgraph; target_orbitgraph.companion_mod = target_orbitinfo; orbitinfo.Activate(); active_top_mod = orbitinfo; orbitgraph.Activate(); active_bottom_mod = orbitgraph; orbitinfo.modid = 1; target_orbitinfo.modid = 2; orbitgraph.modid = 3; target_orbitgraph.modid = 4; top_modules.Add(orbitinfo); top_modules.Add(target_orbitinfo); bottom_modules.Add(orbitgraph); bottom_modules.Add(target_orbitgraph); orbitinfo = new OrbitInfo(dev, "✈", System.Drawing.Color.FromArgb(0xee, 0xee, 0x00), System.Drawing.Color.FromArgb(0xaa, 0xaa, 0x44)); target_orbitinfo = new OrbitInfo(dev, "+", System.Drawing.Color.LightBlue, System.Drawing.Color.MediumPurple); orbitgraph = new OrbitGraph(dev, System.Drawing.Color.Yellow, "✈"); target_orbitgraph = new OrbitGraph(dev, System.Drawing.Color.LightBlue, "+"); orbitgraph.companion_mod = orbitinfo; orbitinfo.companion_mod = orbitgraph; target_orbitinfo.is_target_type_module = true; target_orbitgraph.is_target_type_module = true; target_orbitinfo.companion_mod = target_orbitgraph; target_orbitgraph.companion_mod = target_orbitinfo; orbitinfo.modid = 1; target_orbitinfo.modid = 2; orbitgraph.modid = 3; target_orbitgraph.modid = 4; bottom_modules.Add(orbitinfo); bottom_modules.Add(target_orbitinfo); top_modules.Add(orbitgraph); top_modules.Add(target_orbitgraph); if(dev.use_backdrops) background = Image.FromFile("stars.gif"); colmatrix = new System.Drawing.Imaging.ColorMatrix(); colmatrix.Matrix33 = 0.7F; img_attr = new System.Drawing.Imaging.ImageAttributes(); img_attr.SetColorMatrix(colmatrix, System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap); dev.ButtonUP += new Device.ButtonHandler(ButtonUp); dev.ButtonDOWN += new Device.ButtonHandler(ButtonDown); }
private void CycleModules(ref List<DisplayModule> changelist, ref List<DisplayModule> otherlist, ref DisplayModule change_active_mod, ref DisplayModule other_active_mod, bool activate_first) { bool activate_next = false; bool activated = false; if (activate_first) { ActivateModule(changelist[0], ref change_active_mod, ref other_active_mod); return; } foreach (DisplayModule mod in changelist) { if (activate_next) { if (mod.modid == other_active_mod.modid) continue; ActivateModule(mod, ref change_active_mod, ref other_active_mod); activate_next = false; activated = true; } else { if (mod.active) { activate_next = true; } } } if (!activated) { // Activate the first module since we were at the end of the list CycleModules(ref changelist, ref otherlist, ref change_active_mod, ref other_active_mod, true); } }
private bool ActivateModule(DisplayModule new_active_mod, ref DisplayModule change_active_mod, ref DisplayModule other_active_mod) { /* if (((other_active_mod == change_active_mod.companion_mod && new_active_mod.companion_mod.GetType() == other_active_mod.GetType()) || new_active_mod.companion_mod.GetType() == other_active_mod.GetType()) && new_active_mod.companion_mod != null ) { other_active_mod.Deactivate(); other_active_mod = new_active_mod.companion_mod; } */ change_active_mod.Deactivate(); change_active_mod = new_active_mod; change_active_mod.Activate(); other_active_mod.Activate(); return true; }
public VesselInfo(Device dev) : base(dev) { name = "Vessel"; selectable = true; active = false; width = dev.width; height = dev.height; xoff = 0; yoff = 0; orbitinfo = new OrbitInfo(dev, "✈", System.Drawing.Color.FromArgb(0xee, 0xee, 0x00), System.Drawing.Color.FromArgb(0xaa, 0xaa, 0x44)); target_orbitinfo = new OrbitInfo(dev, "+", System.Drawing.Color.LightBlue, System.Drawing.Color.MediumPurple); orbitgraph = new OrbitGraph(dev, System.Drawing.Color.Yellow, "✈"); target_orbitgraph = new OrbitGraph(dev, System.Drawing.Color.LightBlue, "+"); orbitgraph.companion_mod = orbitinfo; orbitinfo.companion_mod = orbitgraph; target_orbitinfo.is_target_type_module = true; target_orbitgraph.is_target_type_module = true; target_orbitinfo.companion_mod = target_orbitgraph; target_orbitgraph.companion_mod = target_orbitinfo; orbitinfo.Activate(); active_top_mod = orbitinfo; orbitgraph.Activate(); active_bottom_mod = orbitgraph; orbitinfo.modid = 1; target_orbitinfo.modid = 2; orbitgraph.modid = 3; target_orbitgraph.modid = 4; top_modules.Add(orbitinfo); top_modules.Add(target_orbitinfo); bottom_modules.Add(orbitgraph); bottom_modules.Add(target_orbitgraph); orbitinfo = new OrbitInfo(dev, "✈", System.Drawing.Color.FromArgb(0xee, 0xee, 0x00), System.Drawing.Color.FromArgb(0xaa, 0xaa, 0x44)); target_orbitinfo = new OrbitInfo(dev, "+", System.Drawing.Color.LightBlue, System.Drawing.Color.MediumPurple); orbitgraph = new OrbitGraph(dev, System.Drawing.Color.Yellow, "✈"); target_orbitgraph = new OrbitGraph(dev, System.Drawing.Color.LightBlue, "+"); orbitgraph.companion_mod = orbitinfo; orbitinfo.companion_mod = orbitgraph; target_orbitinfo.is_target_type_module = true; target_orbitgraph.is_target_type_module = true; target_orbitinfo.companion_mod = target_orbitgraph; target_orbitgraph.companion_mod = target_orbitinfo; orbitinfo.modid = 1; target_orbitinfo.modid = 2; orbitgraph.modid = 3; target_orbitgraph.modid = 4; bottom_modules.Add(orbitinfo); bottom_modules.Add(target_orbitinfo); top_modules.Add(orbitgraph); top_modules.Add(target_orbitgraph); if (dev.use_backdrops) { background = Image.FromFile("stars.gif"); } colmatrix = new System.Drawing.Imaging.ColorMatrix(); colmatrix.Matrix33 = 0.7F; img_attr = new System.Drawing.Imaging.ImageAttributes(); img_attr.SetColorMatrix(colmatrix, System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap); dev.ButtonUP += new Device.ButtonHandler(ButtonUp); dev.ButtonDOWN += new Device.ButtonHandler(ButtonDown); }