Jump to content

kspjrthom4444

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by kspjrthom4444

  1. I'm sure I'm just misunderstanding something fundamental, but I have a window that contains a textedit and a textarea.  When the window is rendered on the VAB, I can type into the textedit and area fields, when I am in flight mode I cannot.  Do I need to do anything special?

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using KSP.UI.Screens;
    using StatiK.Utils;
    using UnityEngine;
    
    namespace StatiK.Windows
    {
        public class MissionWindow : BaseWindow
        {
            private ILogger log = StatikLogManager.Instance.GetLogger(typeof(MissionWindow).Name);
    
            private ApplicationLauncherButton _appButton;
            private string _missionName = "";
            private string _missionDescription = "";
    
            public MissionWindow(WindowSettings settings) : base(settings) { }
    
            public static WindowSettings GetDefaultSettings()
            {
                return new WindowSettings
                {
                    Name = "MissionWindow",
                    Title = "Mission",
                    Dimensions = new GUIDimensions { Top = 500, Left = 800, Height = 600, Width = 400 }
                };
            }
    
            public override void ScrollableContent()
            {
                GUILayout.Label("Mission Name");
                _missionName = GUILayout.TextField(_missionName);
                GUILayout.Label("Mission Description");
                _missionDescription = GUILayout.TextArea(_missionDescription);
                if(GUILayout.Button("Save"))
                {
                    log.Info("Mission Saved: " + _missionName + "   " + _missionDescription);
                }
            }
    
            public override void InitializeAppLauncherButton()
            {
                ApplicationLauncher.AppScenes eligibleGameScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.VAB;
                if (_appButton == null)
                {
                    _appButton = ApplicationLauncher.Instance.AddModApplication(this.Show, this.Hide, null, null, null, null, eligibleGameScenes, ResourceUtil.Instance.StatiKIcon);
                }
            }
    
            public override void DestoryAppLauncherButton()
            {
                ApplicationLauncher.Instance.RemoveApplication(_appButton);
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;
    
    namespace StatiK.Windows
    {
        public abstract class BaseWindow
        {
            public Rect _container;
            public WindowSettings _settings;
            private Vector2 scrollPosition = Vector2.zero;
            private bool _shouldReDraw = false;
    
    
            public BaseWindow(WindowSettings settings)
            {
                _settings = settings;
                _container = _settings.Dimensions.GetRect();
            }
    
            public void OnGUI()
            {
                if (_shouldReDraw)
                {
                    _container = GUILayout.Window(_settings.Id, _container, DrawWindow, _settings.Title);
                }
            }
            
            void DrawWindow(int windowId)
            {
                
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(_settings.Dimensions.Width), GUILayout.Height(_settings.Dimensions.Height));
                ScrollableContent();
                GUILayout.EndScrollView();
                GUI.DragWindow();
            }
    
            public void Show()
            {
                _shouldReDraw = true;
            }
    
            public void Hide()
            {
                _shouldReDraw = false;
            }
    
            public abstract void InitializeAppLauncherButton();
            public abstract void DestoryAppLauncherButton();
            public abstract void ScrollableContent();
        }
    }

     

    Note that the window id is generated when setting the WindowSetting's Name property: _id = _name.GetHashCode();

  2. 11 hours ago, Crzyrndm said:

    Out of curiosity, why those particular types of scene loads?

    Probably, you want "GameEvents.onGameSceneSwitchRequested", and then add some checks to see if the game time went backwards (I believe that one fires before a scene change so you'll be saving current time and checking the saved value against current time on initialisation)

    So I think I may be thinking about it wrong.  I am trying to learn how data persistence works, and I think where I am going wrong is not hooking into the save and load scenario mechanism correctly such that the ConfigNodes overwrite "unofficial data" since the player reverted.  Thank you for the suggestion though, that does sound like it would work. 

  3. Maybe I'm just really missing it, but I can't seem to find an event that my addon can subscribe to that will notify me that the flight was reverted to either launch or VAB.    Does anyone know what the easiest way is to know that the player reverted their mission.  And for that matter, how about quick-loaded?

    Sorry if this is a dumb question, I've just been struggling to find an answer on this.

    Thanks!

  4. On 4/18/2016 at 8:28 AM, ShotgunNinja said:

    @aniron Every Shielding unit weight 2T. The player is supposed to compromise between mass and life expectancy due to radiation. You can tweak it like any resources, so you can have a pod with 0.2 Shielding amount for example. To give you an idea: under cosmic-level of radiation a Kerbal can survive 250d with a ShieldingFactor of 0.0 (eg: no shielding at all), and 5y 370d with a ShieldingFactor of 1.0 (eg: max amount of shielding). So to simplify, it cost 2T per-Kerbal to give a vessel the max amount of shielding possible.

    In the case of a surface colony, if the body has a magnetosphere then there is no need for shielding at all. Magnetospheres act as safe heavens for life.

     

    EDIT: during design i considered evaluating shielding for each individual container (that would be required for a proper 'storm cellar' implementation), but then I discarded it because I through the micromanaging could have become boring. Also, there is no incentive to keep kerbals outside of a 'storm cellar' and into normal pods when there is no radiation, so one would simply keep them in the storm cellar all the time.

    I apologize if someone already asked this question, but is the radiation setup in such a way that even with maximum shielding it would be impossible to perform a manned mission to Eeloo?  5 years doesn't seem long enough.

×
×
  • Create New...