// Renders the |BurnEditor|. Returns true if and only if the settings were // changed. public bool Render(bool enabled) { var old_skin = UnityEngine.GUI.skin; UnityEngine.GUI.skin = null; UnityEngine.GUILayout.BeginVertical(); var warning_style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.textArea); warning_style.normal.textColor = XKCDColors.Orange; bool changed = false; // When we are first rendered, the |initial_mass_in_tonnes_| will just have // been set. If we have fallen back to instant impulse, we should use this // mass to set the thrust. if (first_time_rendering) { first_time_rendering = false; changed = true; engine_warning_ = ""; ComputeEngineCharacteristics(); } if (enabled) { UnityEngine.GUILayout.BeginHorizontal(); if (UnityEngine.GUILayout.Button("Active Engines")) { engine_warning_ = ""; ComputeEngineCharacteristics(); changed = true; } else if (UnityEngine.GUILayout.Button("Active RCS")) { engine_warning_ = ""; ComputeRCSCharacteristics(); changed = true; } else if (UnityEngine.GUILayout.Button("Instant Impulse")) { engine_warning_ = ""; UseTheForceLuke(); changed = true; } UnityEngine.GUILayout.EndHorizontal(); UnityEngine.GUILayout.TextArea(engine_warning_, warning_style); reference_frame_selector_.RenderButton(); } else { reference_frame_selector_.Hide(); } string frame_warning = ""; if (!reference_frame_selector_.FrameParameters().Equals( adapter_.plotting_frame_selector_.get().FrameParameters())) { frame_warning = "Manœuvre frame differs from plotting frame"; } UnityEngine.GUILayout.TextArea(frame_warning, warning_style); changed |= Δv_tangent_.Render(enabled); changed |= Δv_normal_.Render(enabled); changed |= Δv_binormal_.Render(enabled); changed |= initial_time_.Render(enabled); changed |= changed_reference_frame_; UnityEngine.GUILayout.Label("Burn duration : " + duration_.ToString("0.0") + " s"); changed_reference_frame_ = false; UnityEngine.GUILayout.EndVertical(); UnityEngine.GUI.skin = old_skin; return changed && enabled; }
// Renders the |DifferentialSlider|. Returns true if and only if |value| // changed. public bool Render(bool enabled) { var old_skin = UnityEngine.GUI.skin; UnityEngine.GUI.skin = null; UnityEngine.GUILayout.BeginHorizontal(); var style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.label); if (text_colour_.HasValue) { style.normal.textColor = text_colour_.Value; } UnityEngine.GUILayout.Label( text : label_, options : UnityEngine.GUILayout.Width(75), style : style); var old_alignment = UnityEngine.GUI.skin.label.alignment; UnityEngine.GUI.skin.label.alignment = UnityEngine.TextAnchor.UpperRight; UnityEngine.GUILayout.Label( text : format_(value), options : UnityEngine.GUILayout.Width(125 + (unit_ == null ? 50 : 0))); UnityEngine.GUI.skin.label.alignment = old_alignment; UnityEngine.GUILayout.Label( text : unit_ ?? "", options : UnityEngine.GUILayout.Width(unit_ == null ? 0 : 50)); bool value_changed = false; if (enabled) { if (!UnityEngine.Input.GetMouseButton(0)) { slider_position_ = 0; } UnityEngine.GUI.skin.horizontalSlider.fixedHeight = 21; UnityEngine.GUI.skin.horizontalSliderThumb.fixedHeight = 21; slider_position_ = UnityEngine.GUILayout.HorizontalSlider( value : slider_position_, leftValue : -1, rightValue : 1, options : UnityEngine.GUILayout.ExpandWidth(true)); if (UnityEngine.GUILayout.Button("0", UnityEngine.GUILayout.Width(20))) { value_changed = true; value = 0; } if (slider_position_ != 0.0) { value_changed = true; value += Math.Sign(slider_position_) * Math.Pow(10, log10_lower_rate_ + (log10_upper_rate_ - log10_lower_rate_) * Math.Abs(slider_position_)) * (System.DateTime.Now - last_time_).TotalSeconds; value = Math.Min(Math.Max(min_value_, value), max_value_); } } else { slider_position_ = 0; } last_time_ = System.DateTime.Now; UnityEngine.GUILayout.EndHorizontal(); UnityEngine.GUI.skin = old_skin; return value_changed; }
public static void BeginVertical(UnityEngine.Texture image, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { UnityEngine.GUILayout.BeginVertical(image, style, options); }
public static void BeginHorizontal(UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { UnityEngine.GUILayout.BeginHorizontal(style, options); }
public static float HorizontalScrollbar(float value, float size, float leftValue, float rightValue, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.HorizontalScrollbar(value, size, leftValue, rightValue, style, options)); }
public static int SelectionGrid(int selected, UnityEngine.GUIContent[] contents, int xCount, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.SelectionGrid(selected, contents, xCount, style, options)); }
public static int SelectionGrid(int selected, System.String[] texts, int xCount, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.SelectionGrid(selected, texts, xCount, style, options)); }
public static int Toolbar(int selected, UnityEngine.Texture[] images, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toolbar(selected, images, style, options)); }
public static bool RepeatButton(UnityEngine.Texture image, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.RepeatButton(image, style, options)); }
public static System.String PasswordField(UnityEngine.Rect position, System.String password, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public static System.Boolean Foldout(UnityEngine.Rect position, System.Boolean foldout, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public static System.Int32 LayerField(UnityEngine.Rect position, UnityEngine.GUIContent label, System.Int32 layer, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public static System.Int32 IntPopup(UnityEngine.Rect position, UnityEngine.GUIContent label, System.Int32 selectedValue, UnityEngine.GUIContent[] displayedOptions, System.Int32[] optionValues, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public static System.Enum EnumPopup(UnityEngine.Rect position, UnityEngine.GUIContent label, System.Enum selected, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public static System.Int32 Popup(UnityEngine.Rect position, System.String label, System.Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUIStyle style) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
/// <summary> /// Presents the responsive GUI layout visually on the screen. /// </summary> /// <param name="VirtualScale">The scaling factor used to map virtual units to pixel units if component unit type is virtual.</param> /// <param name="Parent">The parent rect (in pixel units) that this object resides within.</param> public override void Present(float VirtualScale, UnityEngine.Rect Parent) { if (!visible || activePage == null) { return; } // Figure out which aspect ratio to mazimise the use of screen real estate float aspW = Parent.width / (float)rect.dim.x.value; float aspH = Parent.height / (float)rect.dim.y.value; float aspect = aspW < aspH ? aspW : aspH; float physW = (float)rect.dim.x.value * aspect; float physH = (float)rect.dim.y.value * aspect; float offsetX; float offsetY; // Horizontal alignment if (rect.hAlign.dir == Alignment.Direction.Left) { offsetX = 0; } else if (rect.hAlign.dir == Alignment.Direction.Center) { offsetX = (Parent.width - physW) * 0.5f; } else if (rect.hAlign.dir == Alignment.Direction.Right) { offsetX = Parent.width - physW; } else { offsetX = 0; } // Vertical alignment if (rect.vAlign.dir == Alignment.Direction.Top) { offsetY = 0; } else if (rect.vAlign.dir == Alignment.Direction.Center) { offsetY = (Parent.height - physH) * 0.5f; } else if (rect.vAlign.dir == Alignment.Direction.Bottom) { offsetY = Parent.height - physH; } else { offsetY = 0; } // The parent rect that all other GUI elements will be contained within UnityEngine.Rect parent = new UnityEngine.Rect(new UnityEngine.Vector2(offsetX, offsetY), new UnityEngine.Vector2((float)rect.dim.x.value * aspect, (float)rect.dim.y.value * aspect)); base.Present(aspect, parent); if (activeModal != null) { UnityEngine.GUI.WindowFunction draw = new UnityEngine.GUI.WindowFunction( delegate(int id) { //if (UnityEngine.GUI.Button(activeModal.rect.ToPixelRect(aspect, parent), "Hello World")) UnityEngine.Debug.Log("Got a click in window " + id); modalOverlay.Present(aspect, parent); activeModal.Present(aspect, parent); } ); UnityEngine.GUIStyle style = new UnityEngine.GUIStyle(); style.border.top = 0; UnityEngine.GUI.ModalWindow(0, new UnityEngine.Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height), draw, "", style); } }
public static int Toolbar(int selected, System.String[] texts, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toolbar(selected, texts, style, options)); }
public static bool RepeatButton(System.String text, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.RepeatButton(TranslationUtility.get(text), style, options)); }
public static int Toolbar(int selected, UnityEngine.GUIContent[] contents, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toolbar(selected, contents, style, options)); }
public static bool RepeatButton(UnityEngine.GUIContent content, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.RepeatButton(content, style, options)); }
public static int SelectionGrid(int selected, UnityEngine.Texture[] images, int xCount, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.SelectionGrid(selected, images, xCount, style, options)); }
public static System.String TextField(System.String text, int maxLength, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.TextField(text, maxLength, style, options)); }
public static float VerticalSlider(float value, float leftValue, float rightValue, UnityEngine.GUIStyle slider, UnityEngine.GUIStyle thumb, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.VerticalSlider(value, leftValue, rightValue, slider, thumb, options)); }
public static System.String PasswordField(System.String password, char maskChar, int maxLength, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.PasswordField(password, maskChar, maxLength, style, options)); }
public static float VerticalScrollbar(float value, float size, float topValue, float bottomValue, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.VerticalScrollbar(value, size, topValue, bottomValue, style, options)); }
public static System.String TextArea(System.String text, int maxLength, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.TextArea(TranslationUtility.get(text), maxLength, style, options)); }
public static void BeginVertical(System.String text, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { UnityEngine.GUILayout.BeginVertical(TranslationUtility.get(text), style, options); }
public static bool Toggle(bool value, UnityEngine.Texture image, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toggle(value, image, style, options)); }
public static void BeginVertical(UnityEngine.GUIContent content, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { UnityEngine.GUILayout.BeginVertical(content, style, options); }
public static bool Toggle(bool value, System.String text, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toggle(value, TranslationUtility.get(text), style, options)); }
public static bool Toggle(bool value, UnityEngine.GUIContent content, UnityEngine.GUIStyle style, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Toggle(value, content, style, options)); }
protected override void SetEmptyComponentName(ref string componentName, ref UnityEngine.GUIStyle style) { componentName = "None"; }