Esempio n. 1
0
        public void Draw()
        {
            if (StageSelector == null)
            {
                return;
            }

            var pd = m_blinkval > 0 ? m_stagefont1 : m_stagefont2;

            if (m_stageselected)
            {
                pd = m_stagedonefont;
            }

            var sp = CurrentStageIndex >= 0 && CurrentStageIndex < StageProfiles.Count ? StageProfiles[CurrentStageIndex] : null;

            m_stagedisplaybuilder.Length = 0;
            if (sp != null)
            {
                m_stagedisplaybuilder.AppendFormat("Stage {0}: {1}", CurrentStageIndex + 1, sp.Name);
            }
            else
            {
                m_stagedisplaybuilder.Append("Stage: Random");
            }

            SelectScreen.Print(pd, (Vector2)m_stageposition, m_stagedisplaybuilder.ToString(), null);
        }
Esempio n. 2
0
        public MenuSystem(SubSystems subsystems)
            : base(subsystems)
        {
            var textfile = GetSubSystem <FileSystem>().OpenTextFile(@"data/system.def");
            var info     = textfile.GetSection("info");
            var files    = textfile.GetSection("files");

            MotifName   = info.GetAttribute("name", string.Empty);
            MotifAuthor = info.GetAttribute("author", string.Empty);

            var fontmap = new Dictionary <int, Font>();

            var spritesystem = GetSubSystem <SpriteSystem>();

            var fontpath1 = files.GetAttribute <string>("font1", null);

            if (fontpath1 != null)
            {
                fontmap[1] = spritesystem.LoadFont(fontpath1);
            }

            var fontpath2 = files.GetAttribute <string>("font2", null);

            if (fontpath2 != null)
            {
                fontmap[2] = spritesystem.LoadFont(fontpath2);
            }

            var fontpath3 = files.GetAttribute <string>("font3", null);

            if (fontpath3 != null)
            {
                fontmap[3] = spritesystem.LoadFont(fontpath3);
            }

            FontMap = new FontMap(fontmap);

            var soundpath  = @"data/" + files.GetAttribute <string>("snd");
            var spritepath = @"data/" + files.GetAttribute <string>("spr");
            var animpath   = textfile.Filepath;

            TitleScreen = new TitleScreen(this, textfile.GetSection("Title Info"), spritepath, animpath, soundpath);
            TitleScreen.LoadBackgrounds("Title", textfile);

            VersusScreen = new VersusScreen(this, textfile.GetSection("VS Screen"), spritepath, animpath, soundpath);
            VersusScreen.LoadBackgrounds("Versus", textfile);

            SelectScreen = new SelectScreen(this, textfile.GetSection("Select Info"), spritepath, animpath, soundpath);
            SelectScreen.LoadBackgrounds("Select", textfile);

            CombatScreen     = new CombatScreen(this);
            ReplayScreen     = new RecordedCombatScreen(this);
            StoryboardScreen = new StoryboardScreen(this);

            CurrentScreen = null;
            m_newscreen   = null;
            m_fade        = 0;
            m_fadespeed   = 0;
            m_eventqueue  = new Queue <Events.Base>();
        }
Esempio n. 3
0
        public MenuSystem(SubSystems subsystems)
            : base(subsystems)
        {
            TextFile    textfile = GetSubSystem <IO.FileSystem>().OpenTextFile(@"data/system.def");
            TextSection info     = textfile.GetSection("info");
            TextSection files    = textfile.GetSection("files");

            m_motifname   = info.GetAttribute <String>("name", String.Empty);
            m_motifauthor = info.GetAttribute <String>("author", String.Empty);

            Dictionary <Int32, Font> fontmap = new Dictionary <Int32, Font>();

            Drawing.SpriteSystem spritesystem = GetSubSystem <Drawing.SpriteSystem>();

            String fontpath1 = files.GetAttribute <String>("font1", null);

            if (fontpath1 != null)
            {
                fontmap[1] = spritesystem.LoadFont(fontpath1);
            }

            String fontpath2 = files.GetAttribute <String>("font2", null);

            if (fontpath2 != null)
            {
                fontmap[2] = spritesystem.LoadFont(fontpath2);
            }

            String fontpath3 = files.GetAttribute <String>("font3", null);

            if (fontpath3 != null)
            {
                fontmap[3] = spritesystem.LoadFont(fontpath3);
            }

            m_fontmap = new Drawing.FontMap(fontmap);

            String soundpath  = @"data/" + files.GetAttribute <String>("snd");
            String spritepath = @"data/" + files.GetAttribute <String>("spr");
            String animpath   = textfile.Filepath;

            m_titlescreen = new TitleScreen(this, textfile.GetSection("Title Info"), spritepath, animpath, soundpath);
            m_titlescreen.LoadBackgrounds("Title", textfile);

            m_versusscreen = new VersusScreen(this, textfile.GetSection("VS Screen"), spritepath, animpath, soundpath);
            m_versusscreen.LoadBackgrounds("Versus", textfile);

            m_selectscreen = new SelectScreen(this, textfile.GetSection("Select Info"), spritepath, animpath, soundpath);
            m_selectscreen.LoadBackgrounds("Select", textfile);

            m_combatscreen = new CombatScreen(this);
            m_replayscreen = new RecordedCombatScreen(this);

            m_currentscreen = null;
            m_newscreen     = null;
            m_fade          = 0;
            m_fadespeed     = 0;
            m_eventqueue    = new Queue <Events.Base>();
        }
        public void Draw(bool debugdraw)
        {
            Grid.Draw();
            Grid.DrawCursorGrid(m_p1info, null);
            DrawFace(m_p1info);

            m_stageSelect.Draw();
            SelectScreen.Print(m_titlefont, (Vector2)m_titlelocation, VersusMode, null);
        }
Esempio n. 5
0
 public StageSelect(SelectScreen selectScreen, TextSection textsection)
 {
     SelectScreen          = selectScreen;
     m_stageposition       = textsection.GetAttribute <Point>("stage.pos");
     m_soundstagemove      = textsection.GetAttribute <SoundId>("stage.move.snd");
     m_soundstageselect    = textsection.GetAttribute <SoundId>("stage.done.snd");
     m_stagefont1          = textsection.GetAttribute <PrintData>("stage.active.font");
     m_stagefont2          = textsection.GetAttribute <PrintData>("stage.active2.font");
     m_stagedonefont       = textsection.GetAttribute <PrintData>("stage.done.font");
     m_stagedisplaybuilder = new StringBuilder();
 }
        public ArcadeSelectScreenBehavior(SelectScreen selectScreen, TextSection textsection)
        {
            SelectScreen = selectScreen;

            m_stageSelect = new StageSelect(selectScreen, textsection);

            m_soundcancel   = textsection.GetAttribute <SoundId>("cancel.snd");
            m_titlelocation = textsection.GetAttribute <Point>("title.offset");
            m_titlefont     = textsection.GetAttribute <PrintData>("title.font");

            m_p1info = new SelectData(selectScreen, selectScreen.MenuSystem.GetSubSystem <Input.InputSystem>().CurrentInput[1], textsection, "p1", Grid.MoveOverEmptyBoxes);
        }
Esempio n. 7
0
        public void Draw(bool debugdraw)
        {
            Grid.Draw();
            var p1 = GetSelectData(m_p1TeamInfo);
            var p2 = GetSelectData(m_p2TeamInfo);

            Grid.DrawCursorGrid(p1, p2);
            DrawFace(p1);
            DrawFace(p2);
            m_stageSelect.Draw();
            SelectScreen.Print(m_titlefont, (Vector2)m_titlelocation, VersusMode, null);
            m_p1TeamInfo.Draw();
            m_p2TeamInfo.Draw();
        }
Esempio n. 8
0
        public TeamSelectData(SelectScreen selectscreen, ButtonMap buttonmap, TextSection textsection, string prefix, bool moveoverempty, bool self = true)
        {
            if (selectscreen == null)
            {
                throw new ArgumentNullException(nameof(selectscreen));
            }
            if (buttonmap == null)
            {
                throw new ArgumentNullException(nameof(buttonmap));
            }
            if (textsection == null)
            {
                throw new ArgumentNullException(nameof(textsection));
            }
            if (prefix == null)
            {
                throw new ArgumentNullException(nameof(prefix));
            }

            m_self            = self;
            P1SelectData      = new SelectData(selectscreen, buttonmap, textsection, prefix, moveoverempty);
            P2SelectData      = new SelectData(selectscreen, buttonmap, textsection, prefix, moveoverempty);
            m_selectscreen    = selectscreen;
            ButtonMap         = buttonmap;
            m_elements        = new Collection(selectscreen.SpriteManager, selectscreen.AnimationManager, selectscreen.SoundManager, selectscreen.MenuSystem.FontMap);
            m_moveWrapping    = textsection.GetAttribute("teammenu.move.wrapping", true);
            m_position        = textsection.GetAttribute <Point>(prefix + ".teammenu.pos");
            m_itemLocation    = textsection.GetAttribute <Point>(prefix + ".teammenu.item.offset");
            m_itemSpacing     = textsection.GetAttribute <Point>(prefix + ".teammenu.item.spacing");
            m_itemFont        = textsection.GetAttribute <PrintData>(prefix + ".teammenu.item.font");
            m_itemActiveFont  = textsection.GetAttribute <PrintData>(prefix + ".teammenu.item.active.font");
            m_itemActive2Font = textsection.GetAttribute <PrintData>(prefix + ".teammenu.item.active2.font");
            m_spacing         = textsection.GetAttribute <Point>(prefix + ".teammenu.value.spacing");
            m_cursorSpriteId  = textsection.GetAttribute <SpriteId>(prefix + ".teammenu.item.cursor.anim");
            m_cursorOffset    = textsection.GetAttribute <Point>(prefix + ".teammenu.item.cursor.offset");

            m_elements.Build("selfTitle", textsection, prefix + ".teammenu.selftitle");
            m_elements.Build("enemytitle", textsection, prefix + ".teammenu.enemytitle");
            m_elements.Build("move", textsection, prefix + ".teammenu.move");
            m_elements.Build("value", textsection, prefix + ".teammenu.value");
            m_elements.Build("done", textsection, prefix + ".teammenu.done");
            m_elements.Build("value.icon", textsection, prefix + ".teammenu.value.icon");
            m_elements.Build("empty.icon", textsection, prefix + ".teammenu.value.empty.icon");
        }
Esempio n. 9
0
        public void DrawProfile(PlayerProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }

            Elements.Base face = m_elements.GetElement("player.face");
            if (face != null)
            {
                profile.SpriteManager.Draw(SpriteId.LargePortrait, face.DataMap.Offset, Vector2.Zero, face.DataMap.Scale, face.DataMap.Flip);
            }

            Elements.Text name = m_elements.GetElement("player.name") as Elements.Text;
            if (name != null)
            {
                SelectScreen.Print(name.DataMap.FontData, name.DataMap.Offset, profile.DisplayName, null);
            }
        }
Esempio n. 10
0
        public SelectData(SelectScreen selectscreen, Input.ButtonMap buttonmap, TextSection textsection, String prefix, Boolean moveoverempty)
        {
            if (selectscreen == null)
            {
                throw new ArgumentNullException("selectscreen");
            }
            if (buttonmap == null)
            {
                throw new ArgumentNullException("buttonmap");
            }
            if (textsection == null)
            {
                throw new ArgumentNullException("textsection");
            }
            if (prefix == null)
            {
                throw new ArgumentNullException("prefix");
            }

            m_selectscreen  = selectscreen;
            m_buttonmap     = buttonmap;
            m_moveoverempty = moveoverempty;

            m_elements = new Elements.Collection(SelectScreen.SpriteManager, SelectScreen.AnimationManager, SelectScreen.SoundManager, SelectScreen.MenuSystem.FontMap);
            m_elements.Build("cursor.active", textsection, prefix + ".cursor.active");
            m_elements.Build("cursor.done", textsection, prefix + ".cursor.done");
            m_elements.Build("cursor.move", textsection, prefix + ".cursor.move");
            m_elements.Build("random.move", textsection, prefix + ".random.move");
            m_elements.Build("player.face", textsection, prefix + ".face");
            m_elements.Build("player.name", textsection, prefix + ".name");

            m_startcell = textsection.GetAttribute <Point>(prefix + ".cursor.startcell");

            // X & Y seem to be reversed for this
            m_startcell = new Point(m_startcell.Y, m_startcell.X);

            Reset();
        }
Esempio n. 11
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (TitleScreen != null)
                {
                    TitleScreen.Dispose();
                }

                if (VersusScreen != null)
                {
                    VersusScreen.Dispose();
                }

                SelectScreen?.Dispose();

                if (FontMap != null)
                {
                    FontMap.Dispose();
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 12
0
        Point GetNewLocation(Point location, CursorDirection direction, Point gridsize, Boolean wrapping)
        {
            if (direction == CursorDirection.Down)
            {
                Point newlocation = location + new Point(0, 1);
                if (newlocation.Y > gridsize.Y - 1)
                {
                    if (wrapping == false)
                    {
                        return(location);
                    }
                    newlocation.Y = 0;
                }

                for (Int32 i = newlocation.Y; i < gridsize.Y; ++i)
                {
                    newlocation.Y = i;
                    PlayerSelect selection = SelectScreen.GetSelection(newlocation, true);
                    if (selection != null || m_moveoverempty == true)
                    {
                        return(newlocation);
                    }
                }
            }

            if (direction == CursorDirection.Up)
            {
                Point newlocation = location + new Point(0, -1);
                if (newlocation.Y < 0)
                {
                    if (wrapping == false)
                    {
                        return(location);
                    }
                    newlocation.Y = gridsize.Y - 1;
                }

                for (Int32 i = newlocation.Y; i >= 0; --i)
                {
                    newlocation.Y = i;
                    PlayerSelect selection = SelectScreen.GetSelection(newlocation, true);
                    if (selection != null || m_moveoverempty == true)
                    {
                        return(newlocation);
                    }
                }
            }

            if (direction == CursorDirection.Left)
            {
                Point newlocation = location + new Point(-1, 0);
                if (newlocation.X < 0)
                {
                    if (wrapping == false)
                    {
                        return(location);
                    }
                    newlocation.X = gridsize.X - 1;
                }

                for (Int32 i = newlocation.X; i >= 0; --i)
                {
                    newlocation.X = i;
                    PlayerSelect selection = SelectScreen.GetSelection(newlocation, true);
                    if (selection != null || m_moveoverempty == true)
                    {
                        return(newlocation);
                    }
                }
            }

            if (direction == CursorDirection.Right)
            {
                Point newlocation = location + new Point(1, 0);
                if (newlocation.X > gridsize.X - 1)
                {
                    if (wrapping == false)
                    {
                        return(location);
                    }
                    newlocation.X = 0;
                }

                for (Int32 i = newlocation.X; i < gridsize.X; ++i)
                {
                    newlocation.X = i;
                    PlayerSelect selection = SelectScreen.GetSelection(newlocation, true);
                    if (selection != null || m_moveoverempty == true)
                    {
                        return(newlocation);
                    }
                }
            }

            return(location);
        }