Ejemplo n.º 1
0
        public MainWindow(FuelBalanceController controller, Settings settings, /* SettingsWindow settingsWindow,*/ HelpWindow helpWindow)
            : base("TAC Fuel Balancer", 500, 500)
        {
            Debug.Log("MainWindow");
            this.controller = controller;
            this.settings   = settings;
#if false
            this.settingsWindow = settingsWindow;
#endif
            this.helpWindow = helpWindow;
            //SetVisible(true);

#if false
            //var settingstexture = TextureHelper.FromResource("Tac.icons.settings.png", 16, 16);
            Texture2D settingstexture = null;
            try
            {
                settingstexture = TextureHelper.FromResource("icons.settings.png", 16, 16);
            }
            catch { }
            settingsContent = (settingstexture != null) ? new GUIContent(settingstexture, "Settings window") : new GUIContent("S", "Settings window");
#endif
            //var helptexture = TextureHelper.FromResource("Tac.icons.help.png", 16, 16);
            Texture2D helptexture = null;
            try
            {
                helptexture = TextureHelper.FromResource("icons.help.png", 16, 16);
            }
            catch (Exception ex)
            {
                Debug.Log("exception loading helptexture from resource: " + ex.Message);
                helptexture = new Texture2D(16, 16);
                if (!ToolbarControl.LoadImageFromFile(ref helptexture, "GameData/TacFuelBalancer/Icons/help.png"))
                {
                    helptexture = null;
                }
            }
            helpContent = (helptexture != null) ? new GUIContent(helptexture, "Help window") : new GUIContent("?", "Help window");

            //var resettexture = TextureHelper.FromResource("Tac.icons.reset.png", 16, 16);
            Texture2D resettexture;
            try
            {
                resettexture = TextureHelper.FromResource("icons.reset.png", 16, 16);
            }
            catch (Exception ex)
            {
                Debug.Log("exception loading resettexture from resource: " + ex.Message);
                resettexture = new Texture2D(16, 16);
                if (!ToolbarControl.LoadImageFromFile(ref resettexture, "GameData/TacFuelBalancer/Icons/reset.png"))
                {
                    resettexture = null;
                }
            }
            resetContent = (resettexture != null) ? new GUIContent(resettexture, "Reset resource lists") : new GUIContent("?", "Reset resource lists");
        }
Ejemplo n.º 2
0
        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);
            Texture2D texture = null;

            try
            {
                texture = TextureHelper.FromResource("icons.resize.png", 16, 16);
            }
            catch (Exception ex)
            {
                Debug.Log("exception loading resize texture from resource: " + ex.Message);
                texture = new Texture2D(16, 16);
                if (!ToolbarControl.LoadImageFromFile(ref texture, "GameData/TacFuelBalancer/Icons/resize.png"))
                {
                    texture = null;
                }
            }
            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);
            Texture2D closetexture = null;

            try
            {
                closetexture = TextureHelper.FromResource("icons.close.png", 16, 16);
            }
            catch (Exception ex)
            {
                Debug.Log("exception loading closetexture from resource: " + ex.Message);
                closetexture = new Texture2D(16, 16);
                if (!ToolbarControl.LoadImageFromFile(ref closetexture, "GameData/TacFuelBalancer/Icons/close.png"))
                {
                    closetexture = null;
                }
            }
            closeContent = (closetexture != null) ? new GUIContent(closetexture, "Close window") : new GUIContent("X", "Close window");


            Resizable       = true;
            HideCloseButton = false;
            HideWhenPaused  = true;
        }
        /// <summary>
        /// Add the buttons
        /// </summary>
        private void AddButtons( )
        {
            button = new UnifiedButton( );
            button.UseBlizzyIfPossible = true;

            if (BlizzysToolbarButton.IsAvailable)
            {
                var texturePath = "TacFuelBalancer/icon-tac-fuel-small.png";
                if (!GameDatabase.Instance.ExistsTexture(texturePath))
                {
                    var texture = TextureHelper.FromResource("Tac.icons.icon-tac-fuel-small.png", 24, 24);
                    var ti      = new GameDatabase.TextureInfo(null, texture, false, true, true);
                    ti.name = texturePath;
                    GameDatabase.Instance.databaseTexture.Add(ti);
                }
//				this.Log( "Load : Blizzy texture" );


                button.BlizzyNamespace   = "Tac";
                button.BlizzyButtonId    = "FB";
                button.BlizzyToolTip     = "TAC Fuel Balancer";
                button.BlizzyText        = "TAC Fuel Balancer";
                button.BlizzyTexturePath = texturePath;
                button.BlizzyVisibility  = new GameScenesVisibility(GameScenes.FLIGHT);
//				this.Log( "Load : Set Blizzy Stuff" );
            }



            var StockTexture = TextureHelper.FromResource("Tac.icons.icon-tac-fuel.png", 38, 38);

/*			if( StockTexture != null )
 *                              this.Log( "Load : Stock texture" );
 *                      else
 *                              this.Log( "Load : cant load texture" );*/
            button.LauncherTexture    = StockTexture;
            button.LauncherVisibility =
                ApplicationLauncher.AppScenes.FLIGHT |
                ApplicationLauncher.AppScenes.MAPVIEW;
//			this.Log( "Load : Set Stock Stuff" );


            button.ButtonOn  += OnIconOpen;
            button.ButtonOff += OnIconClose;
            button.Add( );
        }
Ejemplo n.º 4
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");
        }
Ejemplo n.º 5
0
        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;
        }