Exemple #1
0
        public MainWindow(FuelBalanceController controller, Settings settings, SettingsWindow settingsWindow, HelpWindow helpWindow)
            : base("TAC Fuel Balancer", 500, 500)
        {
            this.controller     = controller;
            this.settings       = settings;
            this.settingsWindow = settingsWindow;
            this.helpWindow     = helpWindow;
            SetVisible(true);

            var settingstexture = TextureHelper.FromResource("Tac.icons.settings.png", 16, 16);

            settingsContent = (settingstexture != null) ? new GUIContent(settingstexture, "Settings window") : new GUIContent("S", "Settings window");

            var helptexture = TextureHelper.FromResource("Tac.icons.help.png", 16, 16);

            helpContent = (helptexture != null) ? new GUIContent(helptexture, "Help window") : new GUIContent("?", "Help window");

            var resettexture = TextureHelper.FromResource("Tac.icons.reset.png", 16, 16);

            resetContent = (resettexture != null) ? new GUIContent(resettexture, "Reset resource lists") : new GUIContent("?", "Reset resource lists");
        }
        protected Window(string windowTitle, float defaultWidth, float defaultHeight)
        {
            this.windowTitle = windowTitle;
            this.windowId    = windowTitle.GetHashCode() + new System.Random().Next(65536);

            configNodeName = windowTitle.Replace(" ", "");

            windowPos = new Rect((Screen.width - defaultWidth) / 2, (Screen.height - defaultHeight) / 2, defaultWidth, defaultHeight);
            mouseDown = false;
            visible   = false;

            var texture = TextureHelper.FromResource("Tac.icons.resize.png", 16, 16);

            resizeContent = (texture != null) ? new GUIContent(texture, "Drag to resize the window") : new GUIContent("R", "Drag to resize the window");

            var closetexture = TextureHelper.FromResource("Tac.icons.close.png", 16, 16);

            closeContent = (closetexture != null) ? new GUIContent(closetexture, "Close window") : new GUIContent("X", "Close window");


            Resizable       = true;
            HideCloseButton = false;
            HideWhenPaused  = true;
        }