Exemplo n.º 1
0
        private void ScreenInsideTags()
        {
            var finalString = new StringBuilder(Markdown);

            for (var i = 0; i < Entries.Count; i += 2)
            {
                foreach (var symbol in allSpecialSymbols)
                {
                    var offset  = 0;
                    var regexpr = new Regex($@"(?<!\\|{symbol})({symbol})(?:[\p{{P}}\w\s-[{symbol}]])+?(?<!\\)({symbol})");
                    var results = regexpr.Matches(finalString.ToString(), Entries.ElementAt(i).Key);
                    foreach (var result in results)
                    {
                        var match = result as Match;
                        finalString.Insert(match.Groups[1].Index + offset, "\\");
                        finalString.Insert(match.Groups[2].Index + offset + 1, "\\");
                        offset += 2;
                    }
                }
            }
            Entries.Clear();
            Screens.Clear();
            Markdown           = finalString.ToString();
            insideTagsScreened = true;
            FillEntries();
        }
Exemplo n.º 2
0
        public MenuScreen(GraphicsDevice graphicsDevice, ContentManager content, ScreenManager screens, InputManager input)
            : base(graphicsDevice, content, screens, input)
        {
            // Load the background texture and coin animation.
            m_background = Content.Load <Texture2D>("Menu/Background");
            m_coinAnim   = new Animation(Content.Load <Texture2D>("Menu/CoinAnim"), (1 / 8f), 8, 1);

            // Load the tank 3D model and set its initial angle of rotation.
            m_tankModel = Content.Load <Model>("Splash/Tank");
            m_tankAngle = 0;

            // Create and load the menu buttons.
            m_startButton  = new Button(Content, "Menu/Buttons/Start", new Vector2(300, 600));
            m_editorButton = new Button(Content, "Menu/Buttons/Editor", new Vector2(500, 600));

            m_helpButton = new Button(Content, "Menu/Buttons/Help", new Vector2(700, 600), () => {
                // Load the help screen.
                Screens.Push(new HelpScreen(this));
            });

            m_exitButton = new Button(Content, "Menu/Buttons/Exit", new Vector2(900, 600), () => {
                // If all screens are removed, the game will exit.
                Screens.Clear();
            });

            // Set screen to be visible.
            m_visible           = true;
            m_backgroundVisible = true;
        }
Exemplo n.º 3
0
        private void PopulateElementSavesFromReferences(string projectRootDirectory, out string errors)
        {
            errors = "";

            Screens.Clear();
            Components.Clear();
            StandardElements.Clear();

            foreach (ElementReference reference in ScreenReferences)
            {
                ScreenSave toAdd = null;
                try
                {
                    toAdd = reference.ToElementSave <ScreenSave>(projectRootDirectory, ScreenExtension, ref errors);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    Screens.Add(toAdd);
                }
            }

            foreach (ElementReference reference in ComponentReferences)
            {
                ComponentSave toAdd = null;

                try
                {
                    toAdd = reference.ToElementSave <ComponentSave>(projectRootDirectory, ComponentExtension, ref errors);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    Components.Add(toAdd);
                }
            }

            foreach (ElementReference reference in StandardElementReferences)
            {
                StandardElementSave toAdd = null;
                try
                {
                    toAdd = reference.ToElementSave <StandardElementSave>(projectRootDirectory, StandardExtension, ref errors);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    StandardElements.Add(toAdd);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Tell all the current screens to fade out
        /// </summary>
        public void ClearScreens()
        {
            foreach (GameScreenBase screen in GetScreens())
            {
                screen.OnLeave();
                screen.ExitScreen();
            }

            Screens.Clear();
        }
        protected virtual void ConfigScreens()
        {
            if (InternalItems == null || InternalItems.Length == 0)
            {
                return;
            }

            Screens.Clear();
            Screens.AddRange(InternalItems.Select(item =>
            {
                item.Value.Side = item.Metadata.Side;
                item.Value.Type = item.Metadata.Type;
                return(item.Value);
            }));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Ruft die Update ()-Methode des aktuellen Screens auf.
        /// </summary>
        protected override void Update(GameTime time)
        {
            if (Screens == null)
            {
                InitializeScreens();
            }

            try {
                updateResolution();
                // falls der Screen gewechselt werden soll...
                IScreen current = Screens.Peek();
                IScreen next    = current.NextScreen;
                if (current != next && !(current is ErrorScreen))
                {
                    if (ScreenTransitionEffect != null && !SkipNextScreenEffect)
                    {
                        next.PostProcessingEffect = ScreenTransitionEffect(current, next);
                    }
                    SkipNextScreenEffect = false;
                    current.BeforeExit(next, time);
                    current.NextScreen = current;
                    next.NextScreen    = next;
                    if (next.ClearScreenHistory)
                    {
                        Screens.Clear();
                    }
                    Screens.Push(next);
                    next.Entered(current, time);
                }

                // Rufe Update () auf dem aktuellen Screen auf
                Screens.Peek().Update(time);

                // base method
                base.Update(time);
            } catch (Exception ex) {
                if (ErrorScreenEnabled)
                {
                    // Error Screen
                    ShowError(ex);
                }
                else
                {
                    throw;
                }
            }
        }
Exemplo n.º 7
0
        private bool LoadScreens()
        {
            try
            {
                Screens.Clear();

                var screenFiles = packageFiles
                                  .Where(pf => pf.Name.IsMatch($"^{ScreenPackageFile.Path}/.+"));

                foreach (PackageFile file in screenFiles)
                {
                    string name   = Path.GetFileNameWithoutExtension(file.Name);
                    var    reader = new ObjectXmlReader(file.Stream);

                    object model = reader.ReadObject();

                    if (model is PContentPage page)
                    {
                        if (string.IsNullOrEmpty(name))
                        {
                            name = LayoutExtension.CreatePageName(page, "Screen");
                        }

                        // Name Setting
                        LayoutExtension.SetPageName(page, name);

                        Screens.Add(page);

                        CachingBinder(page.Binder);

                        foreach (var node in ObjectContentTreeHelper.FindContentChildrens <PVisual, PVisual>(page))
                        {
                            CachingBinder(node.Child.Binder);
                        }
                    }
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Exemplo n.º 8
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                Game = null;
                Screens.Clear();
                Screens       = null;
                Active        = null;
                LoadingScreen = null;
            }

            disposed = true;
        }
Exemplo n.º 9
0
 public void Clear()
 {
     Screens.Clear();
     Joins.Clear();
     Tileset = null;
 }
Exemplo n.º 10
0
 public static void CloseAllWindows()
 {
     Screens.Clear();
 }
Exemplo n.º 11
0
 private void StopServer()
 {
     Screens.Clear();
     server.Dispose();
     server = null;
 }
Exemplo n.º 12
0
        private void PopulateElementSavesFromReferences(string projectRootDirectory, LinkLoadingPreference linkLoadingPreference, GumLoadResult result)
        {
            string errors = "";

            Screens.Clear();
            Components.Clear();
            StandardElements.Clear();
            Behaviors.Clear();

            foreach (ElementReference reference in ScreenReferences)
            {
                ScreenSave toAdd = null;
                try
                {
                    toAdd = reference.ToElementSave <ScreenSave>(projectRootDirectory, ScreenExtension, result);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    Screens.Add(toAdd);
                }
            }

            foreach (ElementReference reference in ComponentReferences)
            {
                ComponentSave toAdd = null;

                try
                {
                    toAdd = reference.ToElementSave <ComponentSave>(projectRootDirectory, ComponentExtension, result);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    Components.Add(toAdd);
                }
            }

            foreach (ElementReference reference in StandardElementReferences)
            {
                StandardElementSave toAdd = null;
                try
                {
                    toAdd = reference.ToElementSave <StandardElementSave>(projectRootDirectory, StandardExtension, result);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    StandardElements.Add(toAdd);
                }
            }

            foreach (var reference in BehaviorReferences)
            {
                BehaviorSave toAdd = null;

                try
                {
                    toAdd = reference.ToBehaviorSave(projectRootDirectory);
                }
                catch (Exception e)
                {
                    errors += "\nError loading " + reference.Name + ":\n" + e.Message;
                }
                if (toAdd != null)
                {
                    Behaviors.Add(toAdd);
                }
            }

            result.ErrorMessage += errors;
        }