Esempio n. 1
0
        public UISetupBackground()
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            if (File.Exists(LoadingScreens.CustomLoadingScreen))
            {
                using (var logostrm = File.Open(LoadingScreens.CustomLoadingScreen, FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            // In the future servers should be allowed to have their own custom holiday splash screens
            else if (DateTime.UtcNow.Month == 12 && File.Exists(LoadingScreens.XmasLoadingScreen) &&
                     GlobalSettings.Default.HolidayLoadingScreens == true)
            {
                using (var logostrm = File.Open(LoadingScreens.XmasLoadingScreen, FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else
            {
                setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            }

            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.Open("Content/Textures/splashSeg.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            BgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0, BgEdge);
            BgEdge.Y = -1;
            BgEdge.X = Background.X - 64;
            BgEdge.SetSize(Background.Width + 64 * 2, ScreenHeight + 2);

            Add(BackgroundCtnr);
        }
Esempio n. 2
0
        public UISetupBackground()
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            string[] splashes;
            if (Directory.Exists("Content/SplashScreens") && (splashes = Directory.GetFiles("Content/SplashScreens")).Length > 0)
            {
                Random rng = new Random();
                using (var logostrm = File.Open(splashes[rng.Next(splashes.Length)], FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else if (File.Exists("Content/setup.png")) //Compatible with the previous version
            {
                using (var logostrm = File.Open("Content/setup.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else
            {
                setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            }
            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.Open("Content/Textures/splashSeg.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            BgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0, BgEdge);
            BgEdge.Y = -1;
            BgEdge.X = Background.X - 64;
            BgEdge.SetSize(Background.Width + 64 * 2, ScreenHeight + 2);

            Add(BackgroundCtnr);
        }
Esempio n. 3
0
        public void RemoveScreen(UIScreen Screen)
        {
            if (Screen == currentScreen)
            {
                currentScreen = null;
            }
            Screen.OnHide();
            mainUI.Remove(Screen);
            m_Screens.Remove(Screen);

            /** Put the previous screen back into the UI **/
            if (m_Screens.Count > 0)
            {
                currentScreen = m_Screens.Last();
                mainUI.AddAt(0, currentScreen);
            }
        }
        public LoadingScreen() : base()
        {
            HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop);

            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            setupTex   = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.OpenRead(Path.Combine(FSOEnvironment.ContentDir, "Textures/splashSeg.png")))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            var bgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);

            BackgroundCtnr.AddAt(0, bgEdge);
            bgEdge.Y = -1;
            bgEdge.X = Background.X - 64;
            bgEdge.SetSize(Background.Width + 64 * 2, Background.Height + 2);

            //TODO: Letter spacing is a bit wrong on this label
            var lbl = new UILabel();

            lbl.Caption = GameFacade.Strings.GetString("154", "5");
            lbl.X       = 0;
            lbl.Size    = new Microsoft.Xna.Framework.Vector2(800, 100);
            lbl.Y       = 508;
            var style = lbl.CaptionStyle.Clone();

            style.Size       = 17;
            lbl.CaptionStyle = style;
            BackgroundCtnr.Add(lbl);
            this.Add(BackgroundCtnr);

            ProgressLabel1 = new UILabel
            {
                X            = 0,
                Y            = 550,
                Size         = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            ProgressLabel2 = new UILabel
            {
                X            = 0,
                Y            = 550,
                Size         = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            BackgroundCtnr.Add(ProgressLabel1);
            BackgroundCtnr.Add(ProgressLabel2);

            PreloadLabels = new string[] {
                GameFacade.Strings.GetString("155", "6"),
                GameFacade.Strings.GetString("155", "7"),
                GameFacade.Strings.GetString("155", "8"),
                GameFacade.Strings.GetString("155", "9")
            };

            CurrentPreloadLabel = 0;
            AnimateLabel("", PreloadLabels[0]);

            CheckProgressTimer          = new Timer();
            CheckProgressTimer.Interval = 5;
            CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed);
            CheckProgressTimer.Start();

            //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() {
            //    {"X", 500.0f}
            //}, TweenQuad.EaseInOut);
        }
Esempio n. 5
0
        public UISetupBackground()
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            string[] splashes = null;

            try
            {
                splashes = File.ReadAllLines("Content/SplashScreens/list.txt");

                // Validate that the listed splash screens exist.
                for (int i = 0; i < splashes.Length; i++)
                {
                    string path = Path.Combine("Content/SplashScreens/", splashes[i]);

                    if (File.Exists(path))
                    {
                        splashes[i] = path;
                    }
                    else
                    {
                        // The list is not valid.
                        splashes = null;
                        break;
                    }
                }
            }
            catch (FileNotFoundException)
            {
                // Just attempt to load the regular setup.png.
            }
            catch (DirectoryNotFoundException)
            {
                // Just attempt to load the regular setup.png.
            }

            if (splashes != null && splashes.Length > 0)
            {
                Random rng = new Random();
                using (var logostrm = File.Open(splashes[rng.Next(splashes.Length)], FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else if (File.Exists("Content/setup.png")) //Compatible with the previous version
            {
                using (var logostrm = File.Open("Content/setup.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }

            else
            {
                setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            }
            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.Open("Content/Textures/splashSeg.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            BgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0, BgEdge);
            BgEdge.Y = -1;
            BgEdge.X = Background.X - 64;
            BgEdge.SetSize(Background.Width + 64 * 2, ScreenHeight + 2);

            Add(BackgroundCtnr);
        }