Esempio n. 1
0
        private static void PositionAndSizeIcon()
        {
            Texture2D upTex    = Texture2D.Instantiate(_up);
            Texture2D hoverTex = Texture2D.Instantiate(_hover);

            int  offset         = 0;
            bool steamPresent   = AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name == "KSPSteamCtrlr");
            bool mechjebPresent = AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name == "MechJeb2");

            if (steamPresent)
            {
                offset = 46;
            }
            if (mechjebPresent)
            {
                offset = 140;
            }
            _scale = GameSettings.UI_SCALE;

            _rect = new Rect(Screen.width - (304 + offset) * _scale, 0, 42 * _scale, 38 * _scale);
            {
                TextureScale.Bilinear(upTex, (int)(_up.width * _scale), (int)(_up.height * _scale));
                TextureScale.Bilinear(hoverTex, (int)(_hover.width * _scale), (int)(_hover.height * _scale));
            }
            _upContent    = new GUIContent("", upTex, "");
            _hoverContent = new GUIContent("", hoverTex, "");
        }
Esempio n. 2
0
        private static void PositionAndSizeDevPartsIcon()
        {
            Texture2D onTex  = Texture2D.Instantiate(_devPartsOnTex);
            Texture2D offTex = Texture2D.Instantiate(_devPartsOffTex);

            bool steamPresent   = AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name == "KSPSteamCtrlr");
            bool mechjebPresent = AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name == "MechJeb2");

            if (steamPresent)
            {
                offset = 46;
            }
            if (mechjebPresent)
            {
                offset = 140;
            }
            _devPartsScale = GameSettings.UI_SCALE;

            _devPartsRect = new Rect(Screen.width - (260 + offset) * _scale, 0, 42 * _scale, 38 * _scale);
            {
                TextureScale.Bilinear(onTex, (int)(_devPartsOnTex.width * _scale), (int)(_devPartsOnTex.height * _scale));
                TextureScale.Bilinear(offTex, (int)(_devPartsOffTex.width * _scale), (int)(_devPartsOffTex.height * _scale));
            }
            _devPartsOnContent  = new GUIContent("", onTex, _tooltipOnText);
            _devPartsOffContent = new GUIContent("", offTex, _tooltipOffText);

            devPartsTooltipFrameCounter = 0;
        }