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.
Наследование: UnityEngine.MonoBehaviour
Пример #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));
 }
Пример #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;
 }
Пример #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));
        }
Пример #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;
 }
Пример #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);
        }
Пример #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;
        }
Пример #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;
        }
Пример #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;
        }
Пример #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>();
        }
Пример #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;
        }
Пример #11
0
 protected static void DelegateCancel(KOSTextEditPopup me)
 {
     // do nothing.
 }
Пример #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;
 }
Пример #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);
        }
Пример #14
0
 protected static void DelegateNoSaveExit(KOSTextEditPopup me)
 {
     me.Freeze(false);
     me.Close();
 }
Пример #15
0
 protected static void DelegateSaveExit(KOSTextEditPopup me)
 {
     me.SaveContents();
     me.Freeze(false);
     me.Close();
 }
Пример #16
0
 protected static void DelegateSaveThenLoad(KOSTextEditPopup me)
 {
     me.SaveContents();
     DelegateLoadContents(me);
 }
Пример #17
0
 protected static void DelegateSaveThenLoad(KOSTextEditPopup me)
 {
     me.SaveContents();
     DelegateLoadContents(me);
 }
Пример #18
0
 protected static void DelegateCancel(KOSTextEditPopup me)
 {
     // do nothing.
 }
Пример #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;
 }