Пример #1
0
        // called after resources are loaded
        public void Start()
        {
            // add toolbar-related callbacks
            GameEvents.onGUIApplicationLauncherReady.Add(this.init);

            // window style
            Color white = new Color(1.0f, 1.0f, 1.0f, 1.0f);

            window_style = new GUIStyle(HighLogic.Skin.window);
            window_style.normal.textColor  = white;
            window_style.focused.textColor = white;
            window_style.richText          = true;
            window_style.stretchWidth      = true;
            window_style.stretchHeight     = true;
            window_style.padding.top       = 0;
            window_style.padding.bottom    = 0;

            // tooltip style
            tooltip_style = new GUIStyle(HighLogic.Skin.label);
            tooltip_style.normal.background = Lib.GetTexture("black-background");
            tooltip_style.normal.textColor  = white;
            tooltip_style.stretchWidth      = true;
            tooltip_style.stretchHeight     = true;
            tooltip_style.fontSize          = 12;
            tooltip_style.border            = new RectOffset(0, 0, 0, 0);
            tooltip_style.padding           = new RectOffset(6, 6, 3, 3);
            tooltip_style.alignment         = TextAnchor.MiddleCenter;
        }
Пример #2
0
        internal static Sprite Get9SlicesSprite(string textureName, int width, int height, int borderSize)
        {
            // 9 slice sprites are self extending, they don't need to get scaled manually (I think...)
            Texture2D tex = Lib.GetTexture(textureName, width, height);

            return(Sprite.Create(tex, new Rect(0f, 0f, width, height), new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.Tight, new Vector4(borderSize, borderSize, borderSize, borderSize)));
        }
Пример #3
0
  // ctor
  public Planner()
  {
    // set default body index & situation
    body_index = FlightGlobals.GetHomeBodyIndex();
    situation_index = 1;

    // left menu style
    leftmenu_style = new GUIStyle(HighLogic.Skin.label);
    leftmenu_style.richText = true;
    leftmenu_style.normal.textColor = new Color(0.75f, 0.75f, 0.75f, 1.0f);
    leftmenu_style.fixedWidth = 120.0f;
    leftmenu_style.stretchHeight = true;
    leftmenu_style.fontSize = 10;
    leftmenu_style.alignment = TextAnchor.MiddleLeft;

    // mid menu style
    midmenu_style = new GUIStyle(leftmenu_style);
    midmenu_style.fixedWidth = 0.0f;
    midmenu_style.stretchWidth = true;
    midmenu_style.alignment = TextAnchor.MiddleCenter;

    // right menu style
    rightmenu_style = new GUIStyle(leftmenu_style);
    rightmenu_style.alignment = TextAnchor.MiddleRight;

    // row style
    row_style = new GUIStyle();
    row_style.stretchWidth = true;
    row_style.fixedHeight = 16.0f;

    // title style
    title_style = new GUIStyle(HighLogic.Skin.label);
    title_style.normal.background = Lib.GetTexture("black-background");
    title_style.normal.textColor = Color.white;
    title_style.stretchWidth = true;
    title_style.stretchHeight = false;
    title_style.fixedHeight = 16.0f;
    title_style.fontSize = 12;
    title_style.border = new RectOffset(0, 0, 0, 0);
    title_style.padding = new RectOffset(3, 4, 3, 4);
    title_style.alignment = TextAnchor.MiddleCenter;

    // content style
    content_style = new GUIStyle(HighLogic.Skin.label);
    content_style.richText = true;
    content_style.normal.textColor = Color.white;
    content_style.stretchWidth = true;
    content_style.stretchHeight = true;
    content_style.fontSize = 12;
    content_style.alignment = TextAnchor.MiddleLeft;

    // quote style
    quote_style = new GUIStyle(HighLogic.Skin.label);
    quote_style.richText = true;
    quote_style.normal.textColor = Color.white;
    quote_style.stretchWidth = true;
    quote_style.stretchHeight = true;
    quote_style.fontSize = 11;
    quote_style.alignment = TextAnchor.LowerCenter;
  }
Пример #4
0
        public static Texture2D GetUIScaledTexture(string name)
        {
            Texture2D texture = Lib.GetTexture(name);

            Lib.ScaleTexture(texture, ScaleInteger(texture.width), ScaleInteger(texture.height));

            return(texture);
        }
Пример #5
0
        public static Texture2D GetUIScaledTexture(string name, int width = 16, int height = 16, float prescalar = 1.0f)
        {
            Texture2D texture = Lib.GetTexture(name, width, height);

            Lib.ScaleTexture(texture, ScaleInteger((int)(texture.width / prescalar)), ScaleInteger((int)(texture.height / prescalar)));

            return(texture);
        }
Пример #6
0
 void addEditorCategory()
 {
     if (PartLoader.LoadedPartsList.Find(k => k.tags.IndexOf("_kerbalism", StringComparison.Ordinal) >= 0) != null)
     {
         var icon = new RUI.Icons.Selectable.Icon("Kerbalism", Lib.GetTexture("category_normal"), Lib.GetTexture("category_selected"));
         PartCategorizer.Category category = PartCategorizer.Instance.filters.Find(k => k.button.categoryName == "Filter by Function");
         PartCategorizer.AddCustomSubcategoryFilter(category, "", icon, k => k.tags.IndexOf("_kerbalism", StringComparison.Ordinal) >= 0);
     }
 }
Пример #7
0
  // ctor
  public Console()
  {
    // enable global access
    instance = this;

    // generate unique id, hopefully
    win_id = Lib.RandomInt(int.MaxValue);

    // setup window geometry
    win_rect = new Rect((Screen.width - width) * 0.5f, (Screen.height - height) * 0.5f, width, height);

    // setup dragbox geometry
    drag_rect = new Rect(0.0f, 0.0f, width, top_height);

    // setup styles
    win_style = new GUIStyle();
    win_style.padding.left = 10;
    win_style.padding.right = 10;
    win_style.padding.top = 0;
    win_style.padding.bottom = 5;
    win_style.normal.background = Lib.GetTexture("black-background");
    top_style = new GUIStyle();
    top_style.fixedHeight = top_height;
    top_style.fontStyle = FontStyle.Bold;
    top_style.alignment = TextAnchor.MiddleCenter;
    top_style.normal.textColor = Color.white;
    top_style.stretchWidth = true;
    top_style.stretchHeight = true;
    txt_style = new GUIStyle();
    txt_style.fontSize = 12;
    txt_style.wordWrap = true;
    txt_style.normal.textColor = Color.white;
    desc_style = new GUIStyle(txt_style);
    desc_style.normal.textColor = Color.gray;
    desc_style.alignment = TextAnchor.MiddleRight;
    cmd_style = new GUIStyle();
    cmd_style.fixedHeight = cmd_height;
    cmd_style.fontSize = 12;
    cmd_style.normal.textColor = Color.white;
    cmd_style.padding.top = 5;
    cmd_style.richText = false;
    icon_left_style = new GUIStyle();
    icon_left_style.alignment = TextAnchor.MiddleLeft;
    icon_left_style.stretchWidth = false;
    icon_left_style.fixedWidth = 16;
    icon_right_style = new GUIStyle();
    icon_right_style.alignment = TextAnchor.MiddleRight;
    icon_right_style.stretchWidth = false;
    icon_right_style.fixedWidth = 16;
  }
Пример #8
0
 // pseudo-ctor
 public void Start()
 {
   style = new GUIStyle();
   style.normal.background = Lib.GetTexture("black-background");
   style.normal.textColor = new Color(0.66f, 0.66f, 0.66f, 1.0f);
   style.richText = true;
   style.stretchWidth = true;
   style.stretchHeight = true;
   style.fixedWidth = 0;
   style.fixedHeight = 0;
   style.fontSize = 12;
   style.alignment = TextAnchor.MiddleCenter;
   style.border = new RectOffset(0, 0, 0, 0);
   style.padding = new RectOffset(2, 2, 2, 2);
 }
Пример #9
0
  // ctor
  public Message()
  {
    // enable global access
    instance = this;

    // setup style
    style = new GUIStyle();
    style.normal.background = Lib.GetTexture("black-background");
    style.normal.textColor = new Color(0.66f, 0.66f, 0.66f, 1.0f);
    style.richText = true;
    style.stretchWidth = true;
    style.stretchHeight = true;
    style.fixedWidth = 0;
    style.fixedHeight = 0;
    style.fontSize = 12;
    style.alignment = TextAnchor.MiddleCenter;
    style.border = new RectOffset(0, 0, 0, 0);
    style.padding = new RectOffset(2, 2, 2, 2);
  }
Пример #10
0
        public static Texture2D GetUIScaledTexture(string name)
        {
            Texture2D unscaled = Lib.GetTexture(name);

            // Scale the texture to the desired size
            // TODO: Use high-resolution textures as starting point
            unscaled.filterMode = FilterMode.Bilinear;
            int           newWidth      = ScaleInteger(unscaled.width);
            int           newHeight     = ScaleInteger(unscaled.height);
            RenderTexture renderTexture = RenderTexture.GetTemporary(newWidth, newHeight);

            renderTexture.filterMode = FilterMode.Bilinear;
            RenderTexture.active     = renderTexture;
            Graphics.Blit(unscaled, renderTexture);
            Texture2D scaled = new Texture2D(newWidth, newHeight);

            scaled.ReadPixels(new Rect(0, 0, newWidth, newHeight), 0, 0);
            scaled.Apply();
            RenderTexture.active = null;
            // necessary because there is no garbage collection for render textures
            RenderTexture.ReleaseTemporary(renderTexture);
            return(scaled);
        }
Пример #11
0
		// ctor
		public Message()
		{
			// enable global access
			instance = this;

			// setup style
			style = new GUIStyle();
			style.normal.background = Lib.GetTexture("black-background");
			style.normal.textColor = new Color(0.66f, 0.66f, 0.66f, 1.0f);
			style.richText = true;
			style.stretchWidth = true;
			style.stretchHeight = true;
			style.fixedWidth = 0;
			style.fixedHeight = 0;
			style.fontSize = Styles.ScaleInteger(12);
			style.alignment = TextAnchor.MiddleCenter;
			style.border = new RectOffset(0, 0, 0, 0);
			style.padding = new RectOffset(Styles.ScaleInteger(2), Styles.ScaleInteger(2), Styles.ScaleInteger(2), Styles.ScaleInteger(2));

			if (all_logs == null)
			{
				all_logs = new List<MessageObject>();
			}
		}
Пример #12
0
        static Styles()
        {
            // window container
            win = new GUIStyle(HighLogic.Skin.window);
            win.padding.left   = ScaleInteger(6);
            win.padding.right  = ScaleInteger(6);
            win.padding.top    = 0;
            win.padding.bottom = 0;

            // window title container
            title_container = new GUIStyle();
            title_container.stretchWidth  = true;
            title_container.fixedHeight   = ScaleFloat(16.0f);
            title_container.margin.bottom = ScaleInteger(2);
            title_container.margin.top    = ScaleInteger(2);

            // window title text
            title_text             = new GUIStyle();
            title_text.fontSize    = ScaleInteger(10);
            title_text.fixedHeight = ScaleFloat(16.0f);
            title_text.fontStyle   = FontStyle.Bold;
            title_text.alignment   = TextAnchor.MiddleCenter;

            // subsection title container
            section_container = new GUIStyle();
            section_container.stretchWidth      = true;
            section_container.fixedHeight       = ScaleFloat(16.0f);
            section_container.normal.background = Lib.GetTexture("black-background");
            section_container.margin.bottom     = ScaleInteger(4);
            section_container.margin.top        = ScaleInteger(4);

            // subsection title text
            section_text                  = new GUIStyle(HighLogic.Skin.label);
            section_text.fontSize         = ScaleInteger(12);
            section_text.alignment        = TextAnchor.MiddleCenter;
            section_text.normal.textColor = Color.white;
            section_text.stretchWidth     = true;
            section_text.stretchHeight    = true;

            // entry row container
            entry_container = new GUIStyle();
            entry_container.stretchWidth = true;
            entry_container.fixedHeight  = ScaleFloat(16.0f);

            // entry label text
            entry_label                  = new GUIStyle(HighLogic.Skin.label);
            entry_label.richText         = true;
            entry_label.normal.textColor = Color.white;
            entry_label.stretchWidth     = true;
            entry_label.stretchHeight    = true;
            entry_label.fontSize         = ScaleInteger(12);
            entry_label.alignment        = TextAnchor.MiddleLeft;

            entry_label_nowrap                  = new GUIStyle(HighLogic.Skin.label);
            entry_label_nowrap.richText         = true;
            entry_label_nowrap.normal.textColor = Color.white;
            entry_label_nowrap.stretchWidth     = true;
            entry_label_nowrap.stretchHeight    = true;
            entry_label_nowrap.fontSize         = ScaleInteger(12);
            entry_label_nowrap.alignment        = TextAnchor.MiddleLeft;
            entry_label_nowrap.wordWrap         = false;

            // entry value text
            entry_value                  = new GUIStyle(HighLogic.Skin.label);
            entry_value.richText         = true;
            entry_value.normal.textColor = Color.white;
            entry_value.stretchWidth     = true;
            entry_value.stretchHeight    = true;
            entry_value.fontSize         = ScaleInteger(12);
            entry_value.alignment        = TextAnchor.MiddleRight;
            entry_value.fontStyle        = FontStyle.Bold;

            // desc row container
            desc_container = new GUIStyle();
            desc_container.stretchWidth  = true;
            desc_container.stretchHeight = true;

            // entry multi-line description
            desc                = new GUIStyle(entry_label);
            desc.alignment      = TextAnchor.UpperLeft;
            desc.margin.top     = 0;
            desc.margin.bottom  = 0;
            desc.padding.top    = 0;
            desc.padding.bottom = ScaleInteger(10);
            desc.fontStyle      = FontStyle.Italic;

            // left icon
            left_icon            = new GUIStyle();
            left_icon.alignment  = TextAnchor.MiddleLeft;
            left_icon.fixedWidth = ScaleFloat(16.0f);

            // right icon
            right_icon             = new GUIStyle();
            right_icon.alignment   = TextAnchor.MiddleRight;
            right_icon.fixedWidth  = ScaleFloat(16.0f);
            right_icon.margin.left = ScaleInteger(8);

            // tooltip label style
            tooltip = new GUIStyle(HighLogic.Skin.label);
            tooltip.normal.background = Lib.GetTexture("black-background");
            tooltip.normal.textColor  = Color.white;
            tooltip.stretchWidth      = true;
            tooltip.stretchHeight     = true;
            tooltip.fontSize          = ScaleInteger(12);
            tooltip.border            = new RectOffset(0, 0, 0, 0);
            tooltip.padding           = new RectOffset(ScaleInteger(6), ScaleInteger(6), ScaleInteger(3), ScaleInteger(3));
            tooltip.margin            = new RectOffset(0, 0, 0, 0);
            tooltip.alignment         = TextAnchor.MiddleCenter;

            // tooltip container style
            tooltip_container = new GUIStyle();
            tooltip_container.stretchWidth  = true;
            tooltip_container.stretchHeight = true;

            smallStationHead = new GUIStyle(HighLogic.Skin.label)
            {
                fontSize = ScaleInteger(12)
            };

            smallStationText = new GUIStyle(HighLogic.Skin.label)
            {
                fontSize = ScaleInteger(12),
                normal   = { textColor = Color.white }
            };
        }
Пример #13
0
        ///<summary> Initializes the icons </summary>
        internal static void Init()
        {
            TexturePath = KSPUtil.ApplicationRootPath + "GameData/Kerbalism/Textures/";

            empty        = GetTexture("empty");                           // an empty icon to maintain alignment
            close        = GetTexture("close");                           // black close icon
            left_arrow   = GetTexture("left-arrow");                      // white left arrow
            right_arrow  = GetTexture("right-arrow");                     // white right arrow
            toggle_green = GetTexture("toggle-green");                    // green check mark
            toggle_red   = GetTexture("toggle-red");                      // red check mark

            send_black = GetTexture("send-black");                        // used by file man
            send_cyan  = GetTexture("send-cyan");
            lab_black  = GetTexture("lab-black");
            lab_cyan   = GetTexture("lab-cyan");

            applauncher_vessels  = GetTexture("applauncher-vessels", 38, 38);
            applauncher_database = GetTexture("applauncher-database", 38, 38);

            small_info    = GetTexture("small-info");
            small_folder  = GetTexture("small-folder");
            small_console = GetTexture("small-console");
            small_config  = GetTexture("small-config");
            small_search  = GetTexture("small-search");
            small_notes   = GetTexture("small-notes");
            small_wrench  = GetTexture("small-wrench");

            file_scicolor   = GetTexture("icons8-file-scicolor");
            sample_scicolor = GetTexture("icons8-sample-scicolor");

            category_normal   = GetTexture("category-normal");
            category_selected = GetTexture("category-selected");

            sun_black   = GetTexture("sun-black");
            sun_white   = GetTexture("sun-white");
            solar_panel = GetTexture("solar-panel");

            battery_white  = GetTexture("battery-white");
            battery_yellow = GetTexture("battery-yellow");
            battery_red    = GetTexture("battery-red");

            box_white  = GetTexture("box-white");
            box_yellow = GetTexture("box-yellow");
            box_red    = GetTexture("box-red");

            wrench_white  = GetTexture("wrench-white");
            wrench_yellow = GetTexture("wrench-yellow");
            wrench_red    = GetTexture("wrench-red");

            signal_white  = GetTexture("signal-white");
            signal_yellow = GetTexture("signal-yellow");
            signal_red    = GetTexture("signal-red");

            recycle_yellow = GetTexture("recycle-yellow");
            recycle_red    = GetTexture("recycle-red");

            radiation_yellow = GetTexture("radiation-yellow");
            radiation_red    = GetTexture("radiation-red");

            health_white  = GetTexture("health-white");
            health_yellow = GetTexture("health-yellow");
            health_red    = GetTexture("health-red");

            brain_white  = GetTexture("brain-white");
            brain_yellow = GetTexture("brain-yellow");
            brain_red    = GetTexture("brain-red");

            storm_yellow = GetTexture("storm-yellow");
            storm_red    = GetTexture("storm-red");

            plant_white  = GetTexture("plant-white");
            plant_yellow = GetTexture("plant-yellow");

            station_black = GetTexture("vessels/station-black", 80, 80, 4f);
            station_white = GetTexture("vessels/station-white", 80, 80, 4f);

            base_black = GetTexture("vessels/base-black", 80, 80, 4f);
            base_white = GetTexture("vessels/base-white", 80, 80, 4f);

            ship_black = GetTexture("vessels/ship-black", 80, 80, 4f);
            ship_white = GetTexture("vessels/ship-white", 80, 80, 4f);

            probe_black = GetTexture("vessels/probe-black", 80, 80, 4f);
            probe_white = GetTexture("vessels/probe-white", 80, 80, 4f);

            relay_black = GetTexture("vessels/relay-black", 40, 40, 1.75f);
            relay_white = GetTexture("vessels/relay-white", 40, 40, 1.75f);

            rover_black = GetTexture("vessels/rover-black", 80, 80, 4f);
            rover_white = GetTexture("vessels/rover-white", 80, 80, 4f);

            lander_black = GetTexture("vessels/lander-black", 80, 80, 4f);
            lander_white = GetTexture("vessels/lander-white", 80, 80, 4f);

            eva_black = GetTexture("vessels/eva-black", 80, 80, 4f);
            eva_white = GetTexture("vessels/eva-white", 80, 80, 4f);

            plane_black = GetTexture("vessels/plane-black", 40, 40, 2.25f);
            plane_white = GetTexture("vessels/plane-white", 40, 40, 2.25f);

            controller_black = GetTexture("vessels/controller-black", 80, 80, 4f);
            controller_white = GetTexture("vessels/controller-white", 80, 80, 4f);

            // ksmGui

            KsmGuiSpriteBackground = Get9SlicesSprite("ksm-gui/background-64-5", 64, 64, 5);

            KsmGuiSpriteBtnNormal    = Get9SlicesSprite("ksm-gui/btn-black-64-5", 64, 64, 5);
            KsmGuiSpriteBtnHighlight = Get9SlicesSprite("ksm-gui/btn-black-highlight-64-5", 64, 64, 5);
            KsmGuiSpriteBtnDisabled  = Get9SlicesSprite("ksm-gui/btn-black-disabled-64-5", 64, 64, 5);

            KsmGuiTexCheckmark = Lib.GetTexture("ksm-gui/checkmark-20", 20, 20);

            KsmGuiTexHeaderClose       = Lib.GetTexture("ksm-gui/i8-header-close-32", 32, 32);
            KsmGuiTexHeaderArrowsLeft  = Lib.GetTexture("ksm-gui/arrows-left-32", 32, 32);
            KsmGuiTexHeaderArrowsRight = Lib.GetTexture("ksm-gui/arrows-right-32", 32, 32);
            KsmGuiTexHeaderArrowsUp    = Lib.GetTexture("ksm-gui/arrows-up-32", 32, 32);
            KsmGuiTexHeaderArrowsDown  = Lib.GetTexture("ksm-gui/arrows-down-32", 32, 32);



            KsmGuiTexHeaderClose = Lib.GetTexture("ksm-gui/i8-header-close-32", 32, 32);
            KsmGuiTexHeaderInfo  = Lib.GetTexture("ksm-gui/info-32", 32, 32);
            KsmGuiTexHeaderRnD   = Lib.GetTexture("ksm-gui/i8-rnd-32", 32, 32);

            //Texture2D winBg = Lib.GetTexture("ui-core/window-background", 64, 64);
            //// inspecting pixelPerUnit gives 92.75362, but 100f is the default value and seems to work fine
            //window_background = Sprite.Create(winBg, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.Tight, new Vector4(4.6f, 4.6f, 4.6f, 4.6f));

            //close_btn_tex = Lib.GetTexture("ui-core/icons8-cancel-24", 24, 24);
            //close_btn = Sprite.Create(close_btn_tex, new Rect(0f, 0f, 24f, 24f), new Vector2(0.5f, 0.5f), 100f);
        }
Пример #14
0
        static Styles()
        {
            // window container
            win = new GUIStyle(HighLogic.Skin.window);
            win.padding.left   = 6;
            win.padding.right  = 6;
            win.padding.top    = 0;
            win.padding.bottom = 0;

            // window title container
            title_container = new GUIStyle();
            title_container.stretchWidth  = true;
            title_container.fixedHeight   = 16.0f;
            title_container.margin.bottom = 2;
            title_container.margin.top    = 2;

            // window title text
            title_text             = new GUIStyle();
            title_text.fontSize    = 10;
            title_text.fixedHeight = 16.0f;
            title_text.fontStyle   = FontStyle.Bold;
            title_text.alignment   = TextAnchor.MiddleCenter;

            // subsection title container
            section_container = new GUIStyle();
            section_container.stretchWidth      = true;
            section_container.fixedHeight       = 16.0f;
            section_container.normal.background = Lib.GetTexture("black-background");
            section_container.margin.bottom     = 4;
            section_container.margin.top        = 4;

            // subsection title text
            section_text                  = new GUIStyle(HighLogic.Skin.label);
            section_text.fontSize         = 12;
            section_text.alignment        = TextAnchor.MiddleCenter;
            section_text.normal.textColor = Color.white;
            section_text.stretchWidth     = true;
            section_text.stretchHeight    = true;

            // entry row container
            entry_container = new GUIStyle();
            entry_container.stretchWidth = true;
            entry_container.fixedHeight  = 16.0f;

            // entry label text
            entry_label                  = new GUIStyle(HighLogic.Skin.label);
            entry_label.richText         = true;
            entry_label.normal.textColor = Color.white;
            entry_label.stretchWidth     = true;
            entry_label.stretchHeight    = true;
            entry_label.fontSize         = 12;
            entry_label.alignment        = TextAnchor.MiddleLeft;

            // entry value text
            entry_value                  = new GUIStyle(HighLogic.Skin.label);
            entry_value.richText         = true;
            entry_value.normal.textColor = Color.white;
            entry_value.stretchWidth     = true;
            entry_value.stretchHeight    = true;
            entry_value.fontSize         = 12;
            entry_value.alignment        = TextAnchor.MiddleRight;
            entry_value.fontStyle        = FontStyle.Bold;

            // desc row container
            desc_container = new GUIStyle();
            desc_container.stretchWidth  = true;
            desc_container.stretchHeight = true;

            // entry multi-line description
            desc                = new GUIStyle(entry_label);
            desc.alignment      = TextAnchor.UpperLeft;
            desc.margin.top     = 0;
            desc.margin.bottom  = 0;
            desc.padding.top    = 0;
            desc.padding.bottom = 10;
            desc.fontStyle      = FontStyle.Italic;

            // left icon
            left_icon            = new GUIStyle();
            left_icon.alignment  = TextAnchor.MiddleLeft;
            left_icon.fixedWidth = 16.0f;

            // right icon
            right_icon             = new GUIStyle();
            right_icon.alignment   = TextAnchor.MiddleRight;
            right_icon.fixedWidth  = 16.0f;
            right_icon.margin.left = 8;

            // tooltip label style
            tooltip = new GUIStyle(HighLogic.Skin.label);
            tooltip.normal.background = Lib.GetTexture("black-background");
            tooltip.normal.textColor  = Color.white;
            tooltip.stretchWidth      = true;
            tooltip.stretchHeight     = true;
            tooltip.fontSize          = 12;
            tooltip.border            = new RectOffset(0, 0, 0, 0);
            tooltip.padding           = new RectOffset(6, 6, 3, 3);
            tooltip.margin            = new RectOffset(0, 0, 0, 0);
            tooltip.alignment         = TextAnchor.MiddleCenter;

            // tooltip container style
            tooltip_container = new GUIStyle();
            tooltip_container.stretchWidth  = true;
            tooltip_container.stretchHeight = true;

            // tooltip label style
            frequency = new GUIStyle(HighLogic.Skin.label);
            frequency.normal.textColor = Color.white;
            frequency.stretchWidth     = false;
            frequency.stretchHeight    = true;
            frequency.fixedWidth       = 20.0f;
            frequency.fontSize         = 12;
            frequency.alignment        = TextAnchor.MiddleCenter;
        }
Пример #15
0
        static Styles()
        {
            blackBackground = Lib.GetTexture("black-background");

            // window container
            win = new GUIStyle(HighLogic.Skin.window)
            {
                padding =
                {
                    left   = ScaleInteger(6),
                    right  = ScaleInteger(6),
                    top    =               0,
                    bottom = 0
                }
            };

            // window title container
            title_container = new GUIStyle
            {
                stretchWidth = true,
                fixedHeight  = ScaleFloat(16.0f),
                margin       =
                {
                    bottom = ScaleInteger(2),
                    top    = ScaleInteger(2)
                }
            };

            // window title text
            title_text = new GUIStyle
            {
                fontStyle   = FontStyle.Bold,
                fontSize    = ScaleInteger(10),
                fixedHeight = ScaleFloat(16.0f),
                alignment   = TextAnchor.MiddleCenter
            };

            // subsection title container
            section_container = new GUIStyle
            {
                stretchWidth = true,
                fixedHeight  = ScaleFloat(16.0f),
                normal       = { background = blackBackground },
                margin       =
                {
                    bottom = ScaleInteger(4),
                    top    = ScaleInteger(4)
                }
            };

            // subsection title text
            section_text = new GUIStyle(HighLogic.Skin.label)
            {
                stretchWidth  = true,
                stretchHeight = true,
                fontSize      = ScaleInteger(12),
                alignment     = TextAnchor.MiddleCenter,
                normal        = { textColor = Color.white }
            };

            // entry row container
            entry_container = new GUIStyle
            {
                stretchWidth = true,
                fixedHeight  = ScaleFloat(16.0f)
            };

            // entry label text
            entry_label = new GUIStyle(HighLogic.Skin.label)
            {
                richText      = true,
                stretchWidth  = true,
                stretchHeight = true,
                fontSize      = ScaleInteger(12),
                alignment     = TextAnchor.MiddleLeft,
                normal        = { textColor = Color.white }
            };

            entry_label_nowrap = new GUIStyle(HighLogic.Skin.label)
            {
                richText      = true,
                wordWrap      = false,
                stretchWidth  = true,
                stretchHeight = true,
                fontSize      = ScaleInteger(12),
                alignment     = TextAnchor.MiddleLeft,
                normal        = { textColor = Color.white }
            };

            // entry value text
            entry_value = new GUIStyle(HighLogic.Skin.label)
            {
                richText      = true,
                stretchWidth  = true,
                stretchHeight = true,
                fontStyle     = FontStyle.Bold,
                fontSize      = ScaleInteger(12),
                alignment     = TextAnchor.MiddleRight,
                normal        = { textColor = Color.white }
            };

            // desc row container
            desc_container = new GUIStyle
            {
                stretchWidth  = true,
                stretchHeight = true
            };

            // entry multi-line description
            desc = new GUIStyle(entry_label)
            {
                fontStyle = FontStyle.Italic,
                alignment = TextAnchor.UpperLeft,
                margin    =
                {
                    top    = 0,
                    bottom = 0
                },
                padding =
                {
                    top    = 0,
                    bottom = ScaleInteger(10)
                }
            };

            // left icon
            left_icon = new GUIStyle
            {
                stretchWidth  = true,
                stretchHeight = true,
                fixedWidth    = ScaleFloat(16.0f),
                alignment     = TextAnchor.MiddleLeft
            };

            // right icon
            right_icon = new GUIStyle
            {
                stretchWidth  = true,
                stretchHeight = true,
                margin        = { left = ScaleInteger(8) },
                fixedWidth    = ScaleFloat(16.0f),
                alignment     = TextAnchor.MiddleRight
            };

            // tooltip label style
            tooltip = new GUIStyle(HighLogic.Skin.label)
            {
                stretchWidth  = true,
                stretchHeight = true,
                fontSize      = ScaleInteger(12),
                alignment     = TextAnchor.MiddleCenter,
                border        = new RectOffset(0, 0, 0, 0),
                normal        =
                {
                    textColor  = Color.white,
                    background = blackBackground
                },
                margin  = new RectOffset(0, 0, 0, 0),
                padding = new RectOffset(ScaleInteger(6), ScaleInteger(6), ScaleInteger(3), ScaleInteger(3))
            };

            tooltip.normal.background.wrapMode = TextureWrapMode.Repeat;

            // tooltip container style
            tooltip_container = new GUIStyle
            {
                stretchWidth  = true,
                stretchHeight = true
            };

            smallStationHead = new GUIStyle(HighLogic.Skin.label)
            {
                fontSize = ScaleInteger(12)
            };

            smallStationText = new GUIStyle(HighLogic.Skin.label)
            {
                fontSize = ScaleInteger(12),
                normal   = { textColor = Color.white }
            };

            message = new GUIStyle()
            {
                normal =
                {
                    background = blackBackground,
                    textColor  = new Color(0.66f, 0.66f, 0.66f, 1.0f)
                },
                richText      = true,
                stretchWidth  = true,
                stretchHeight = true,
                fixedWidth    = 0,
                fixedHeight   = 0,
                fontSize      = Styles.ScaleInteger(12),
                alignment     = TextAnchor.MiddleCenter,
                border        = new RectOffset(0, 0, 0, 0),
                padding       = new RectOffset(Styles.ScaleInteger(2), Styles.ScaleInteger(2), Styles.ScaleInteger(2), Styles.ScaleInteger(2))
            };
        }
Пример #16
0
  // ctor
  public Info()
  {
    // enable global access
    instance = this;

    // generate unique id
    win_id = Lib.RandomInt(int.MaxValue);

    // setup window geometry
    win_rect = new Rect(80.0f, 80.0f, width, 0.0f);

    // setup dragbox geometry
    drag_rect = new Rect(0.0f, 0.0f, width, top_height);

    // setup styles
    win_style = new GUIStyle(HighLogic.Skin.window);
    win_style.padding.top = 0;
    win_style.padding.bottom = 0;
    top_style = new GUIStyle();
    top_style.fixedHeight = top_height;
    top_style.fontStyle = FontStyle.Bold;
    top_style.alignment = TextAnchor.MiddleCenter;
    bot_style = new GUIStyle();
    bot_style.fixedHeight = bot_height;
    bot_style.fontSize = 11;
    bot_style.fontStyle = FontStyle.Italic;
    bot_style.alignment = TextAnchor.MiddleRight;
    bot_style.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);

    // title container
    title_container_style = new GUIStyle();
    title_container_style.stretchWidth = true;
    title_container_style.fixedHeight = 16.0f;
    title_container_style.normal.background = Lib.GetTexture("black-background");
    title_container_style.margin.bottom = 4;
    title_container_style.margin.top = 4;

    // title label
    title_label_style = new GUIStyle(HighLogic.Skin.label);
    title_label_style.fontSize = 12;
    title_label_style.alignment = TextAnchor.MiddleCenter;
    title_label_style.normal.textColor = Color.white;
    title_label_style.stretchWidth = true;
    title_label_style.stretchHeight = true;

    // title icons
    title_icon_left_style = new GUIStyle();
    title_icon_left_style.alignment = TextAnchor.MiddleLeft;
    title_icon_right_style = new GUIStyle();
    title_icon_right_style.alignment = TextAnchor.MiddleRight;

    // row style
    row_style = new GUIStyle();
    row_style.stretchWidth = true;
    row_style.fixedHeight = 16.0f;

    // label style
    label_style = new GUIStyle(HighLogic.Skin.label);
    label_style.richText = true;
    label_style.normal.textColor = Color.white;
    label_style.stretchWidth = true;
    label_style.stretchHeight = true;
    label_style.fontSize = 12;
    label_style.alignment = TextAnchor.MiddleLeft;

    // value style
    value_style = new GUIStyle(HighLogic.Skin.label);
    value_style.richText = true;
    value_style.normal.textColor = Color.white;
    value_style.stretchWidth = true;
    value_style.stretchHeight = true;
    value_style.fontSize = 12;
    value_style.alignment = TextAnchor.MiddleRight;
    value_style.fontStyle = FontStyle.Bold;
  }
Пример #17
0
  // ctor
  Info()
  {
    // enable global access
    instance = this;

    // keep it alive
    DontDestroyOnLoad(this);

    // generate unique id, hopefully
    win_id = Lib.RandomInt(int.MaxValue);

    // setup window geometry
    win_rect = new Rect(80.0f, (Screen.height - height) * 0.5f, width, height);

    // setup dragbox geometry
    drag_rect = new Rect(0.0f, 0.0f, width, top_height);

    // setup styles
    win_style = new GUIStyle(HighLogic.Skin.window);
    win_style.padding.top = 0;
    win_style.padding.bottom = 0;
    top_style = new GUIStyle();
    top_style.fixedHeight = top_height;
    top_style.fontStyle = FontStyle.Bold;
    top_style.alignment = TextAnchor.MiddleCenter;
    bot_style = new GUIStyle();
    bot_style.fixedHeight = bot_height;
    bot_style.fontSize = 11;
    bot_style.fontStyle = FontStyle.Italic;
    bot_style.alignment = TextAnchor.MiddleRight;
    bot_style.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
    txt_style = new GUIStyle();
    txt_style.fontSize = 11;
    txt_style.wordWrap = true;
    txt_options = new []{GUILayout.MaxWidth(width - margin - spacing), GUILayout.MinHeight(height - top_height - bot_height - margin - spacing)};

    // row style
    row_style = new GUIStyle();
    row_style.stretchWidth = true;
    row_style.fixedHeight = 16.0f;

    // title style
    title_style = new GUIStyle(HighLogic.Skin.label);
    title_style.normal.background = Lib.GetTexture("black-background");
    title_style.normal.textColor = Color.white;
    title_style.stretchWidth = true;
    title_style.stretchHeight = false;
    title_style.fixedHeight = 16.0f;
    title_style.fontSize = 12;
    title_style.border = new RectOffset(0, 0, 0, 0);
    title_style.padding = new RectOffset(3, 4, 3, 4);
    title_style.alignment = TextAnchor.MiddleCenter;

    // content style
    content_style = new GUIStyle(HighLogic.Skin.label);
    content_style.richText = true;
    content_style.normal.textColor = Color.white;
    content_style.stretchWidth = true;
    content_style.stretchHeight = true;
    content_style.fontSize = 12;
    content_style.alignment = TextAnchor.MiddleLeft;
  }
Пример #18
0
        ///<summary> Initializes the icons </summary>
        internal static void Initialize()
        {
            TexturePath = KSPUtil.ApplicationRootPath + "GameData/Kerbalism/Textures/";

            empty        = Styles.GetUIScaledTexture("empty");                           // an empty icon to maintain alignment
            close        = Styles.GetUIScaledTexture("close");                           // black close icon
            left_arrow   = Styles.GetUIScaledTexture("left-arrow");                      // white left arrow
            right_arrow  = Styles.GetUIScaledTexture("right-arrow");                     // white right arrow
            toggle_green = Styles.GetUIScaledTexture("toggle-green");                    // green check mark
            toggle_red   = Styles.GetUIScaledTexture("toggle-red");                      // red check mark

            send_black = Styles.GetUIScaledTexture("send-black");                        // used by file man
            send_cyan  = Styles.GetUIScaledTexture("send-cyan");
            lab_black  = Styles.GetUIScaledTexture("lab-black");
            lab_cyan   = Styles.GetUIScaledTexture("lab-cyan");

            applauncher = Lib.GetTexture("applauncher", 32, 32);

            small_info    = Styles.GetUIScaledTexture("small-info");
            small_folder  = Styles.GetUIScaledTexture("small-folder");
            small_console = Styles.GetUIScaledTexture("small-console");
            small_config  = Styles.GetUIScaledTexture("small-config");
            small_search  = Styles.GetUIScaledTexture("small-search");
            small_notes   = Styles.GetUIScaledTexture("small-notes");

            category_normal   = Styles.GetUIScaledTexture("category-normal");
            category_selected = Styles.GetUIScaledTexture("category-selected");

            sun_black = Styles.GetUIScaledTexture("sun-black");
            sun_white = Styles.GetUIScaledTexture("sun-white");

            battery_white  = Styles.GetUIScaledTexture("battery-white");
            battery_yellow = Styles.GetUIScaledTexture("battery-yellow");
            battery_red    = Styles.GetUIScaledTexture("battery-red");

            box_white  = Styles.GetUIScaledTexture("box-white");
            box_yellow = Styles.GetUIScaledTexture("box-yellow");
            box_red    = Styles.GetUIScaledTexture("box-red");

            wrench_white  = Styles.GetUIScaledTexture("wrench-white");
            wrench_yellow = Styles.GetUIScaledTexture("wrench-yellow");
            wrench_red    = Styles.GetUIScaledTexture("wrench-red");

            signal_white  = Styles.GetUIScaledTexture("signal-white");
            signal_yellow = Styles.GetUIScaledTexture("signal-yellow");
            signal_red    = Styles.GetUIScaledTexture("signal-red");

            recycle_yellow = Styles.GetUIScaledTexture("recycle-yellow");
            recycle_red    = Styles.GetUIScaledTexture("recycle-red");

            radiation_yellow = Styles.GetUIScaledTexture("radiation-yellow");
            radiation_red    = Styles.GetUIScaledTexture("radiation-red");

            health_white  = Styles.GetUIScaledTexture("health-white");
            health_yellow = Styles.GetUIScaledTexture("health-yellow");
            health_red    = Styles.GetUIScaledTexture("health-red");

            brain_white  = Styles.GetUIScaledTexture("brain-white");
            brain_yellow = Styles.GetUIScaledTexture("brain-yellow");
            brain_red    = Styles.GetUIScaledTexture("brain-red");

            storm_yellow = Styles.GetUIScaledTexture("storm-yellow");
            storm_red    = Styles.GetUIScaledTexture("storm-red");

            plant_white  = Styles.GetUIScaledTexture("plant-white");
            plant_yellow = Styles.GetUIScaledTexture("plant-yellow");

            station_black = Styles.GetUIScaledTexture("vessels/station-black", 80, 80, 4);
            station_white = Styles.GetUIScaledTexture("vessels/station-white", 80, 80, 4);

            base_black = Styles.GetUIScaledTexture("vessels/base-black", 80, 80, 4);
            base_white = Styles.GetUIScaledTexture("vessels/base-white", 80, 80, 4);

            ship_black = Styles.GetUIScaledTexture("vessels/ship-black", 80, 80, 4);
            ship_white = Styles.GetUIScaledTexture("vessels/ship-white", 80, 80, 4);

            probe_black = Styles.GetUIScaledTexture("vessels/probe-black", 80, 80, 4);
            probe_white = Styles.GetUIScaledTexture("vessels/probe-white", 80, 80, 4);

            relay_black = Styles.GetUIScaledTexture("vessels/relay-black", 40, 40, 1.75f);
            relay_white = Styles.GetUIScaledTexture("vessels/relay-white", 40, 40, 1.75f);

            rover_black = Styles.GetUIScaledTexture("vessels/rover-black", 80, 80, 4);
            rover_white = Styles.GetUIScaledTexture("vessels/rover-white", 80, 80, 4);

            lander_black = Styles.GetUIScaledTexture("vessels/lander-black", 80, 80, 4);
            lander_white = Styles.GetUIScaledTexture("vessels/lander-white", 80, 80, 4);

            eva_black = Styles.GetUIScaledTexture("vessels/eva-black", 80, 80, 4);
            eva_white = Styles.GetUIScaledTexture("vessels/eva-white", 80, 80, 4);

            plane_black = Styles.GetUIScaledTexture("vessels/plane-black", 40, 40, 2.25f);
            plane_white = Styles.GetUIScaledTexture("vessels/plane-white", 40, 40, 2.25f);
        }
Пример #19
0
        public PanelWindow(string title, uint left = 300u, uint top = 150u)
        {
            // set title
            this.title = title;

            // initialize sections storage
            sections = new List <PanelSection>(4);
            clicks   = new List <Action <int> >(4);

            // generate unique id
            win_id = Lib.RandomInt(int.MaxValue);

            // setup window geometry
            win_rect = new Rect((float)left, (float)top, width, 0.0f);

            // setup dragbox geometry
            drag_rect = new Rect(0.0f, 0.0f, width, top_height);

            // setup styles
            win_style                = new GUIStyle(HighLogic.Skin.window);
            win_style.padding.top    = 0;
            win_style.padding.bottom = 0;
            top_style                = new GUIStyle();
            top_style.fixedHeight    = top_height;
            top_style.fontStyle      = FontStyle.Bold;
            top_style.alignment      = TextAnchor.MiddleCenter;

            // title container
            title_container_style = new GUIStyle();
            title_container_style.stretchWidth      = true;
            title_container_style.fixedHeight       = 16.0f;
            title_container_style.normal.background = Lib.GetTexture("black-background");
            title_container_style.margin.bottom     = 4;
            title_container_style.margin.top        = 4;

            // title label
            title_label_style                  = new GUIStyle(HighLogic.Skin.label);
            title_label_style.fontSize         = 12;
            title_label_style.alignment        = TextAnchor.MiddleCenter;
            title_label_style.normal.textColor = Color.white;
            title_label_style.stretchWidth     = true;
            title_label_style.stretchHeight    = true;

            // title icons
            title_icon_left_style            = new GUIStyle();
            title_icon_left_style.alignment  = TextAnchor.MiddleLeft;
            title_icon_right_style           = new GUIStyle();
            title_icon_right_style.alignment = TextAnchor.MiddleRight;

            // row style
            row_style = new GUIStyle();
            row_style.stretchWidth = true;
            row_style.fixedHeight  = 16.0f;

            // label style
            label_style                  = new GUIStyle(HighLogic.Skin.label);
            label_style.richText         = true;
            label_style.normal.textColor = Color.white;
            label_style.stretchWidth     = true;
            label_style.stretchHeight    = true;
            label_style.fontSize         = 12;
            label_style.alignment        = TextAnchor.MiddleLeft;

            // value style
            value_style                  = new GUIStyle(HighLogic.Skin.label);
            value_style.richText         = true;
            value_style.normal.textColor = Color.white;
            value_style.stretchWidth     = true;
            value_style.stretchHeight    = true;
            value_style.fontSize         = 12;
            value_style.alignment        = TextAnchor.MiddleRight;
            value_style.fontStyle        = FontStyle.Bold;
        }