Пример #1
0
        public override void SetStyles()
        {
            WindowRect = new Rect(Screen.width * 0.9f - WindowWidth, Screen.height / 2f - WindowHeight / 2f, WindowWidth,
                                  WindowHeight);
            MinWindowRect = new Rect(float.NegativeInfinity, float.NegativeInfinity, 0, 0);
            MoveRect      = new Rect(0, 0, 10000, 20);

            WindowStyle    = new GUIStyle(GUI.skin.window);
            ButtonStyle    = new GUIStyle(GUI.skin.button);
            HighlightStyle = new GUIStyle(GUI.skin.button)
            {
                normal = { textColor = Color.red },
                active = { textColor = Color.red },
                hover  = { textColor = Color.red }
            };
            ScrollStyle   = new GUIStyle(GUI.skin.scrollView);
            SubspaceStyle = new GUIStyle {
                normal = { background = new Texture2D(1, 1) }
            };
            SubspaceStyle.normal.background.SetPixel(0, 0, Color.black);
            SubspaceStyle.normal.background.Apply();

            LayoutOptions    = new GUILayoutOption[4];
            LayoutOptions[0] = GUILayout.MinWidth(WindowWidth);
            LayoutOptions[1] = GUILayout.MaxWidth(WindowWidth);
            LayoutOptions[2] = GUILayout.MinHeight(WindowHeight);
            LayoutOptions[3] = GUILayout.MaxHeight(WindowHeight);

            MinLayoutOptions    = new GUILayoutOption[4];
            MinLayoutOptions[0] = GUILayout.MinWidth(0);
            MinLayoutOptions[1] = GUILayout.MinHeight(0);
            MinLayoutOptions[2] = GUILayout.ExpandHeight(true);
            MinLayoutOptions[3] = GUILayout.ExpandWidth(true);

            //Adapted from KMP.
            PlayerNameStyle = new Dictionary <string, GUIStyle>();

            VesselNameStyle = new GUIStyle(GUI.skin.label)
            {
                normal = { textColor = Color.white }
            };
            VesselNameStyle.hover.textColor  = VesselNameStyle.normal.textColor;
            VesselNameStyle.active.textColor = VesselNameStyle.normal.textColor;
            VesselNameStyle.fontStyle        = FontStyle.Normal;
            VesselNameStyle.fontSize         = 12;
            VesselNameStyle.stretchWidth     = true;

            StateTextStyle = new GUIStyle(GUI.skin.label)
            {
                normal = { textColor = new Color(0.75f, 0.75f, 0.75f) }
            };
            StateTextStyle.hover.textColor  = StateTextStyle.normal.textColor;
            StateTextStyle.active.textColor = StateTextStyle.normal.textColor;
            StateTextStyle.fontStyle        = FontStyle.Normal;
            StateTextStyle.fontSize         = 12;
            StateTextStyle.stretchWidth     = true;

            SubspaceDisplay = new SubspaceDisplayEntry[0];
        }
Пример #2
0
        public static string GetTimeLabel(SubspaceDisplayEntry currentEntry)
        {
            StringBuilder.Length = 0;

            var subspaceTime = WarpSystem.Singleton.GetSubspaceTime(currentEntry.SubspaceId);

            StringBuilder.Append(KSPUtil.PrintDateCompact(subspaceTime, true, true));

            if (WarpSystem.Singleton.CurrentSubspace != currentEntry.SubspaceId)
            {
                AppendDeltaTime(subspaceTime);
            }

            return(StringBuilder.ToString());
        }
Пример #3
0
 public static string GetTimeLabel(SubspaceDisplayEntry currentEntry)
 {
     return($"T: +{KSPUtil.PrintTimeCompact(SystemsContainer.Get<WarpSystem>().GetSubspaceTime(currentEntry.SubspaceId), false)}");
 }
Пример #4
0
 public static string GetTimeLabel(SubspaceDisplayEntry currentEntry)
 {
     return($"T: +{KSPUtil.PrintTimeCompact(WarpSystem.Singleton.GetSubspaceTime(currentEntry.SubspaceId), false)}");
 }