コード例 #1
0
        /// <summary>
        /// Opens the window as a full screen window that enters the menu gamestate
        /// </summary>
        public void OpenMenu(WindowGameMenu newWindow)
        {
            // Get rid of old menu context if there is one
            if (currentMenuContext != null && currentMenuContext != newWindow)
            {
                currentMenuContext.SetVisible(false);
                currentMenuContext.CleanupWindow();
                currentMenuContext = null;
            }

            currentMenuContext = newWindow;
            GotoState(EEngineState.Menu);
        }
コード例 #2
0
        public void DrawMenu(TCODConsole targetConsole, WindowGameMenu menu)
        {
            if (!menu.isVisible)
            {
                return;
            }

            // ask for sub menus, this is completely optional on the part of the menu
            List <Window> subMenus = menu.GetSubMenus();
            TCODConsole   console  = menu.GetUpdatedConsole();

            TCODConsole.blit(console, 0, 0, console.getWidth(), console.getHeight(),           // source
                             targetConsole, menu.origin.X, menu.origin.Y, 1);

            // handle dragdrops
            var dragdrop = menu.dragdrop;

            if (dragdrop.active)
            {
                DrawRect(targetConsole, dragdrop.x, dragdrop.y, dragdrop.text.Length + 1, Window.elementDark);
                DrawText(targetConsole, dragdrop.x + 1, dragdrop.y, dragdrop.text, Constants.COL_FRIENDLY);
                DrawText(targetConsole, dragdrop.x, dragdrop.y, "" + (char)(25), TCODColor.white);
            }

            // sub menus (if any)
            foreach (Window sub in subMenus)
            {
                if (!sub.isVisible)
                {
                    continue;
                }

                console = sub.GetUpdatedConsole();
                TCODConsole.blit(console, 0, 0, console.getWidth(), console.getHeight(),           // source
                                 targetConsole, sub.origin.X, sub.origin.Y, 1);
            }
        }