Jump to content

kspjrthom4444

Members
  • Posts

    4
  • Joined

  • Last visited

Everything 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. 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. 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...