public override void OnAwake() { if (CompatibilityChecker.IsWin64()) { return; } control = new ExBuildControl(this); }
public static void ShowGUI (ExBuildControl.IBuilder pad) { padInstance = pad; newName = pad.Name; gui_enabled = true; if (windowInstance != null) { windowInstance.enabled = true; } }
void Select_Pad(ExBuildControl selected_pad) { if (control != null && control != selected_pad) { control.builder.Highlight(false); } control = selected_pad; pad_list.SelectItem(launchpads.IndexOf(control)); UpdateGUIState(); }
public override void OnAwake() { if (CompatibilityChecker.IsWin64()) { Events["HideUI"].active = false; Events["ShowUI"].active = false; return; } control = new ExBuildControl(this); }
void BuildPadList(Vessel v) { launchpads = null; pad_list = null; var pads = new List <ExBuildControl.IBuilder> (); for (int i = 0; i < v.Parts.Count; i++) { var p = v.Parts[i]; pads.AddRange(p.Modules.OfType <ExBuildControl.IBuilder> ()); } if (pads.Count < 1) { control = null; } else { launchpads = new List <ExBuildControl> (); int control_index = -1; for (int i = 0; i < pads.Count; i++) { launchpads.Add(pads[i].control); if (control == pads[i].control) { control_index = i; } } if (control_index < 0) { control_index = 0; } var pad_names = new List <string> (); for (int ind = 0; ind < launchpads.Count; ind++) { var p = launchpads[ind]; if (p.builder.Name != "") { pad_names.Add(p.builder.Name); } else { pad_names.Add("pad-" + ind); } } pad_list = new DropDownList(pad_names); Select_Pad(launchpads[control_index]); } }
public static void SelectPad(ExBuildControl selected_pad) { instance.Select_Pad (selected_pad); }
public Vector3 ShiftBounds(Transform frame, Vector3 pos, ExBuildControl.Box box) { Vector3 shift = new Vector3 (-pos.x, -box.min.y, -pos.z); Vector3 mins = box.min - pos; Vector3 maxs = box.max - pos; Vector3 mid = (mins + maxs) / 2; if (bounds.ContainsKey ("+X")) { float max_x = Vector3.Dot (frame.right, bounds["+X"]); if (bounds.ContainsKey ("-X")) { float min_x = Vector3.Dot (frame.right, bounds["-X"]); shift.x += (max_x + min_x) / 2 - mid.x; } else { shift.x += max_x - maxs.x; } } else if (bounds.ContainsKey ("-X")) { float min_x = Vector3.Dot (frame.right, bounds["-X"]); shift.x += min_x - mins.x; } if (bounds.ContainsKey ("+Y")) { shift.y = -pos.y; float max_y = Vector3.Dot (frame.up, bounds["+Y"]); if (bounds.ContainsKey ("-Y")) { float min_y = Vector3.Dot (frame.up, bounds["-Y"]); shift.y += (max_y + min_y) / 2 - mid.y; } else { shift.y += max_y - maxs.y; } } else if (bounds.ContainsKey ("-Y")) { shift.y = -pos.y; float min_y = Vector3.Dot (frame.up, bounds["-Y"]); shift.y += min_y - mins.y; } if (bounds.ContainsKey ("+Z")) { float max_z = Vector3.Dot (frame.forward, bounds["+Z"]); if (bounds.ContainsKey ("-Z")) { float min_z = Vector3.Dot (frame.forward, bounds["-Z"]); shift.z += (max_z + min_z) / 2 - mid.z; } else { shift.z += max_z - maxs.z; } } else if (bounds.ContainsKey ("-Z")) { float min_z = Vector3.Dot (frame.forward, bounds["-Z"]); shift.z += min_z - mins.z; } return shift; }
public Transform PlaceShip(ShipConstruct ship, ExBuildControl.Box vessel_bounds) { if (site == null) { return part.transform; } Transform xform; xform = part.FindModelTransform ("EL launch pos"); var points = new Points (site); Transform t = part.transform; GameObject launchPos = new GameObject ("EL launch pos"); launchPos.transform.parent = t; launchPos.transform.position = t.position; launchPos.transform.position += points.center - part.vessel.GetWorldPos3D (); launchPos.transform.rotation = GetOrientation (points); xform = launchPos.transform; Debug.Log (String.Format ("[EL] launchPos {0} {1}", xform.position, xform.rotation)); float angle; Vector3 axis; xform.rotation.ToAngleAxis (out angle, out axis); Part rootPart = ship.parts[0].localRoot; Vector3 pos = rootPart.transform.position; Vector3 shift = points.ShiftBounds (xform, pos, vessel_bounds); shift += xform.position; rootPart.transform.Translate (shift, Space.World); rootPart.transform.RotateAround (xform.position, axis, angle); return xform; }
public override void OnAwake() { if (CompatibilityChecker.IsWin64 ()) { return; } control = new ExBuildControl (this); }
public static void SelectPad(ExBuildControl selected_pad) { instance.Select_Pad(selected_pad); }
public override void OnAwake() { control = new ExBuildControl (this); }
public override void OnAwake() { control = new ExBuildControl(this); }
public override void OnAwake () { if (CompatibilityChecker.IsWin64 ()) { Events["HideUI"].active = false; Events["ShowUI"].active = false; return; } control = new ExBuildControl (this); }
public Transform PlaceShip (ShipConstruct ship, ExBuildControl.Box vessel_bounds) { if (SpawnTransform != "") { launchTransform = part.FindModelTransform (SpawnTransform); //Debug.Log (String.Format ("[EL] launchTransform:{0}:{1}", // launchTransform, SpawnTransform)); } if (launchTransform == null) { launchTransform = part.FindModelTransform ("EL launch pos"); } if (launchTransform == null) { Vector3 offset = Vector3.up * (SpawnHeightOffset + spawnOffset); Transform t = part.transform; GameObject launchPos = new GameObject ("EL launch pos"); launchPos.transform.parent = t; launchPos.transform.position = t.position; launchPos.transform.rotation = t.rotation; launchPos.transform.position += t.TransformDirection (offset); launchTransform = launchPos.transform; //Debug.Log (String.Format ("[EL] launchPos {0}", // launchTransform)); } float angle; Vector3 axis; launchTransform.rotation.ToAngleAxis (out angle, out axis); Part rootPart = ship.parts[0].localRoot; Vector3 pos = rootPart.transform.position; Vector3 shift = new Vector3 (-pos.x, -vessel_bounds.min.y, -pos.z); //Debug.Log (String.Format ("[EL] pos: {0} shift: {1}", pos, shift)); shift += launchTransform.position; //Debug.Log (String.Format ("[EL] shift: {0}", shift)); rootPart.transform.Translate (shift, Space.World); rootPart.transform.RotateAround (launchTransform.position, axis, angle); return launchTransform; }
void BuildPadList(Vessel v) { launchpads = null; pad_list = null; var pads = new List<ExBuildControl.IBuilder> (); for (int i = 0; i < v.Parts.Count; i++) { var p = v.Parts[i]; pads.AddRange (p.Modules.OfType<ExBuildControl.IBuilder> ()); } if (pads.Count < 1) { control = null; } else { launchpads = new List<ExBuildControl> (); int control_index = -1; for (int i = 0; i < pads.Count; i++) { launchpads.Add (pads[i].control); if (control == pads[i].control) { control_index = i; } } if (control_index < 0) { control_index = 0; } var pad_names = new List<string> (); for (int ind = 0; ind < launchpads.Count; ind++) { var p = launchpads[ind]; if (p.builder.Name != "") { pad_names.Add (p.builder.Name); } else { pad_names.Add ("pad-" + ind); } } pad_list = new DropDownList (pad_names); Select_Pad (launchpads[control_index]); } }
void Select_Pad(ExBuildControl selected_pad) { if (control != null && control != selected_pad) { control.builder.Highlight (false); } control = selected_pad; pad_list.SelectItem (launchpads.IndexOf (control)); UpdateGUIState (); }
public AirstreamShield (ExBuildControl.IBuilder builder) { this.builder = builder; }