Beispiel #1
0
        private void showFloatEditor(string text, ref WipValue wipValue, ref float value, ref GameConfig config, bool ownHoriztonal)
        {
            if (ownHoriztonal)
            {
                GUILayout.BeginHorizontal();
            }
            GUILayout.Label(text + " : " + ((!wipValue.valid && wipValue.value != null) ? "(" + value + ")" : ""));
            if (ownHoriztonal)
            {
                GUILayout.FlexibleSpace();
            }

            if (wipValue.value == null)
            {
                wipValue.value = value.ToString();
            }
            wipValue.value = GUILayout.TextField(wipValue.value, GUILayout.Width(40));

            float tempValue;

            wipValue.valid = float.TryParse(wipValue.value, out tempValue);

            if (ownHoriztonal)
            {
                GUILayout.EndHorizontal();
            }

            if (wipValue.valid)
            {
                value = tempValue;
                if (config.validate())
                {
                    wipValue.value = null;
                }
            }
        }
Beispiel #2
0
        internal override void DrawWindow(int id)
        {
            base.DrawWindow(id);

            GameConfig config = scenarioModule.GetGameConfig();

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Label("KeepFit v" + Statics.GetDllVersion(this) + " : " + (config.enabled ? "Enabled" : "Disabled"));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button((config.enabled ? "Disable" : "Enable"), GUILayout.Width(80)))
            {
                config.enabled = !config.enabled;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Choose a Skin");
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("KSP Style", "Sets the style to be the default KSPStyle")))
            {
                SkinsLibrary.SetCurrent(SkinsLibrary.DefSkinType.KSP);
            }
            if (GUILayout.Button(new GUIContent("Unity Style", "Sets the style to be the default Unity Style")))
            {
                SkinsLibrary.SetCurrent(SkinsLibrary.DefSkinType.Unity);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("WimpMode: " + (config.wimpMode ? "Enabled" : "Disabled"));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button((config.wimpMode ? "Disable" : "Enable"), GUILayout.Width(80)))
            {
                config.wimpMode = !config.wimpMode;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Min Gee For Exercising when Landed: " + config.minimumLandedGeeForExcercising);
            GUILayout.FlexibleSpace();
            // TODO - need a float editor widget here for minimumLandedGeeForExcercising
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Initial fitness level:" + config.initialFitnessLevel.ToString());
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+5", GUILayout.Width(80)))
            {
                config.initialFitnessLevel += 5;
                config.validate();
            }
            if (GUILayout.Button("-5", GUILayout.Width(80)))
            {
                config.initialFitnessLevel -= 5;
                config.validate();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Min fitness level:" + config.minFitnessLevel.ToString());
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+5", GUILayout.Width(80)))
            {
                config.minFitnessLevel += 5;
                config.validate();
            }
            if (GUILayout.Button("-5", GUILayout.Width(80)))
            {
                config.minFitnessLevel -= 5;
                config.validate();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Max fitness level:" + config.maxFitnessLevel.ToString());
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+5", GUILayout.Width(80)))
            {
                config.maxFitnessLevel += 5;
                config.validate();
            }
            if (GUILayout.Button("-5", GUILayout.Width(80)))
            {
                config.maxFitnessLevel -= 5;
                config.validate();
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
        private void showFloatEditor(string text, ref WipValue wipValue, ref float value, ref GameConfig config, bool ownHoriztonal)
        {
            if (ownHoriztonal) GUILayout.BeginHorizontal();
            GUILayout.Label(text + " : " + ((!wipValue.valid && wipValue.value != null) ? "(" + value + ")" : ""));
            if (ownHoriztonal) GUILayout.FlexibleSpace();

            if (wipValue.value == null)
            {
                wipValue.value = value.ToString();
            }
            wipValue.value = GUILayout.TextField(wipValue.value, GUILayout.Width(40));

            float tempValue;
            wipValue.valid = float.TryParse(wipValue.value, out tempValue);

            if (ownHoriztonal) GUILayout.EndHorizontal();

            if (wipValue.valid)
            {
                value = tempValue;
                if (config.validate())
                {
                    wipValue.value = null;
                }
            }
        }