A Unity window that contains the text editor for kOS inside it. It should only be popped into existence when you feed it a file using the AttachTo call.
Inheritance: UnityEngine.MonoBehaviour
Exemple #1
0
 public void Awake()
 {
     LoadTexture("GameData/kOS/GFX/font_sml.png", ref fontImage);
     LoadTexture("GameData/kOS/GFX/monitor_minimal.png", ref terminalImage);
     var gObj = new GameObject( "texteditPopup", typeof(KOSTextEditPopup) );
     DontDestroyOnLoad(gObj);
     popupEditor = (KOSTextEditPopup)gObj.GetComponent(typeof(KOSTextEditPopup));
 }
Exemple #2
0
 public void Invoke(KOSTextEditPopup parent, string message, List <string> options, List <DialogAction> actions)
 {
     this.parent = parent;
     this.parent.Freeze(true);
     this.message = message;
     this.options = options;
     this.actions = actions;
     invoked      = true;
 }
Exemple #3
0
        public void Awake()
        {
            LoadTexture("GameData/kOS/GFX/font_sml.png", ref fontImage);
            LoadTexture("GameData/kOS/GFX/monitor_minimal.png", ref terminalImage);
            var gObj = new GameObject("texteditPopup", typeof(KOSTextEditPopup));

            DontDestroyOnLoad(gObj);
            popupEditor = (KOSTextEditPopup)gObj.GetComponent(typeof(KOSTextEditPopup));
        }
Exemple #4
0
 public void Invoke( KOSTextEditPopup parent, string message, List<string> options, List<DialogAction> actions )
 {
     this.parent = parent;
     this.parent.Freeze(true);
     this.message = message;
     this.options = options;
     this.actions = actions;
     invoked = true;
 }
Exemple #5
0
        public void Awake()
        {
            LoadTexture("GameData/kOS/GFX/font_sml.png", ref fontImage);
            LoadTexture("GameData/kOS/GFX/monitor_minimal.png", ref terminalImage);
            LoadTexture("GameData/kOS/GFX/resize-button.png", ref resizeButtonImage);
            LoadTexture("GameData/kOS/GFX/network-zigzag.png", ref networkZigZagImage);

            var gObj = new GameObject("texteditPopup", typeof(KOSTextEditPopup));

            DontDestroyOnLoad(gObj);
            popupEditor = (KOSTextEditPopup)gObj.GetComponent(typeof(KOSTextEditPopup));
            popupEditor.SetUniqueId(UniqueId + 5);
        }
Exemple #6
0
        protected static void DelegateLoadContents(KOSTextEditPopup me)
        {
            me.volume   = me.loadingVolume;
            me.fileName = me.loadingFileName;
            ProgramFile file = me.volume.GetByName(me.fileName);

            if (file == null)
            {
                me.term.Print("[New File]");
                me.contents = "";
            }
            else
            {
                me.contents = file.Content;
            }
            me.isDirty = false;
        }
Exemple #7
0
        protected static void DelegateLoadContents(KOSTextEditPopup me)
        {
            me.volume   = me.loadingVolume;
            me.fileName = me.loadingFileName;
            VolumeFile file = me.volume.Open(me.fileName);

            if (file == null)
            {
                me.term.Print("[New File]");
                me.contents = "";
            }
            else
            {
                me.contents = file.ReadAll().String;
            }
            me.isDirty = false;
        }
Exemple #8
0
        protected static void DelegateLoadContents(KOSTextEditPopup me)
        {
            VolumeItem item = me.loadingVolume.Open(me.loadingPath);

            if (item == null)
            {
                me.term.Print("[New File]");
                me.contents = "";
            }
            else if (item is VolumeFile)
            {
                VolumeFile file = item as VolumeFile;
                me.loadingPath = GlobalPath.FromVolumePath(item.Path, me.loadingPath.VolumeId);
                me.contents    = file.ReadAll().String;
            }
            else
            {
                throw new KOSPersistenceException("Path '" + me.loadingPath + "' points to a directory");
            }

            me.volume  = me.loadingVolume;
            me.isDirty = false;
        }
Exemple #9
0
        public void Awake()
        {
            LoadTexture("GameData/kOS/GFX/monitor_minimal.png", ref terminalImage);
            LoadTexture("GameData/kOS/GFX/monitor_minimal_frame.png", ref terminalFrameImage);
            LoadTexture("GameData/kOS/GFX/monitor_minimal_frame_active.png", ref terminalFrameActiveImage);
            LoadTexture("GameData/kOS/GFX/resize-button.png", ref resizeButtonImage);
            LoadTexture("GameData/kOS/GFX/network-zigzag.png", ref networkZigZagImage);
            LoadTexture("GameData/kOS/GFX/brightness-button.png", ref brightnessButtonImage);
            LoadTexture("GameData/kOS/GFX/font-width-button.png", ref fontWidthButtonImage);
            LoadTexture("GameData/kOS/GFX/font-height-button.png", ref fontHeightButtonImage);
            LoadTexture("GameData/kOS/GFX/font_sml.png", ref fontImage);

            LoadFontArray();

            LoadAudio();

            tinyToggleStyle = new GUIStyle(HighLogic.Skin.toggle)
            {
                fontSize = 10
            };

            var gObj = new GameObject( "texteditPopup", typeof(KOSTextEditPopup) );
            DontDestroyOnLoad(gObj);
            popupEditor = (KOSTextEditPopup)gObj.GetComponent(typeof(KOSTextEditPopup));
            popupEditor.SetUniqueId(UniqueId + 5);

            customSkin = BuildPanelSkin();

            GameEvents.onHideUI.Add (OnHideUI);
            GameEvents.onShowUI.Add (OnShowUI);

            soundMaker = gameObject.AddComponent<Sound.SoundMaker>();
        }
Exemple #10
0
        protected static void DelegateLoadContents(KOSTextEditPopup me)
        {
            VolumeItem item = me.loadingVolume.Open(me.loadingPath);
            if (item == null)
            {
                me.term.Print("[New File]");
                me.contents = "";
            }
            else if (item is VolumeFile)
            {
                VolumeFile file = item as VolumeFile;
                me.loadingPath = GlobalPath.FromVolumePath(item.Path, me.loadingPath.VolumeId);
                me.contents = file.ReadAll().String;
            }
            else
            {
                throw new KOSPersistenceException("Path '" + me.loadingPath + "' points to a directory");
            }

            me.volume = me.loadingVolume;
            me.isDirty = false;
        }
Exemple #11
0
 protected static void DelegateCancel(KOSTextEditPopup me)
 {
     // do nothing.
 }
Exemple #12
0
 protected static void DelegateLoadContents( KOSTextEditPopup me )
 {
     me.volume = me.loadingVolume;
     me.fileName = me.loadingFileName;
     ProgramFile file = me.volume.GetByName( me.fileName );
     if ( file == null )
     {
         me.term.Print("[New File]");
         me.contents = "";
     }
     else
     {
         me.contents = file.Content;
     }
     me.isDirty = false;
 }
Exemple #13
0
        public void Awake()
        {
            LoadTexture("GameData/kOS/GFX/font_sml.png", ref fontImage);
            LoadTexture("GameData/kOS/GFX/monitor_minimal.png", ref terminalImage);
            LoadTexture("GameData/kOS/GFX/resize-button.png", ref resizeButtonImage);
            LoadTexture("GameData/kOS/GFX/network-zigzag.png", ref networkZigZagImage);

            LoadAudio();
            
            tinyToggleStyle = new GUIStyle(HighLogic.Skin.toggle)
            {
                fontSize = 10
            };

            var gObj = new GameObject( "texteditPopup", typeof(KOSTextEditPopup) );
            DontDestroyOnLoad(gObj);
            popupEditor = (KOSTextEditPopup)gObj.GetComponent(typeof(KOSTextEditPopup));
            popupEditor.SetUniqueId(UniqueId + 5);
        }
Exemple #14
0
 protected static void DelegateNoSaveExit(KOSTextEditPopup me)
 {
     me.Freeze(false);
     me.Close();
 }
Exemple #15
0
 protected static void DelegateSaveExit(KOSTextEditPopup me)
 {
     me.SaveContents();
     me.Freeze(false);
     me.Close();
 }
Exemple #16
0
 protected static void DelegateSaveThenLoad(KOSTextEditPopup me)
 {
     me.SaveContents();
     DelegateLoadContents(me);
 }
Exemple #17
0
 protected static void DelegateSaveThenLoad(KOSTextEditPopup me)
 {
     me.SaveContents();
     DelegateLoadContents(me);
 }
Exemple #18
0
 protected static void DelegateCancel(KOSTextEditPopup me)
 {
     // do nothing.
 }
Exemple #19
0
 protected static void DelegateLoadContents(KOSTextEditPopup me)
 {
     me.volume = me.loadingVolume;
     me.fileName = me.loadingFileName;
     VolumeFile file = me.volume.Open(me.fileName);
     if (file == null)
     {
         me.term.Print("[New File]");
         me.contents = "";
     }
     else
     {
         me.contents = file.ReadAll().String;
     }
     me.isDirty = false;
 }