add game_layout
This commit is contained in:
parent
8c37cf694f
commit
2bc21266ab
37
mods/dr_game/game_layout.py
Normal file
37
mods/dr_game/game_layout.py
Normal file
@ -0,0 +1,37 @@
|
||||
# -------------------------------
|
||||
# Difficult Rocket
|
||||
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
||||
# All rights reserved
|
||||
# -------------------------------
|
||||
|
||||
from typing import Optional, Tuple
|
||||
from pyglet.graphics import Batch, Group
|
||||
|
||||
from Difficult_Rocket.client import ClientWindow
|
||||
from Difficult_Rocket.api.screen import BaseScreen
|
||||
# from Difficult_Rocket.main import Game
|
||||
from Difficult_Rocket.gui.widget.button import (
|
||||
PressTextButton,
|
||||
MinecraftWikiButtonTheme,
|
||||
)
|
||||
|
||||
from lib_not_dr import loggers
|
||||
|
||||
# from . import DR_mod_runtime
|
||||
|
||||
logger = loggers.config.get_logger_from_old("client.dr_game_layout", "client")
|
||||
|
||||
class GameLayout(BaseScreen):
|
||||
"""
|
||||
DR game 的 菜单
|
||||
"""
|
||||
|
||||
name = "Dr_game_layout"
|
||||
|
||||
def __init__(self, main_window: ClientWindow):
|
||||
super().__init__(main_window)
|
||||
self.main_batch = Batch()
|
||||
self.main_group = Group(parent=main_window.main_group, order=1)
|
||||
|
||||
def on_draw(self, dt: float, window: ClientWindow):
|
||||
self.main_batch.draw()
|
@ -172,6 +172,7 @@ class SR1ShipRender(BaseScreen):
|
||||
|
||||
self.enter_game_button = PressEnterGameButton(
|
||||
window=main_window,
|
||||
parent_window=main_window,
|
||||
x=500,
|
||||
y=100,
|
||||
width=150,
|
||||
@ -778,6 +779,7 @@ class PressEnterGameButton(PressTextButton):
|
||||
def __init__(
|
||||
self,
|
||||
window: ClientWindow,
|
||||
parent_window,
|
||||
x: int,
|
||||
y: int,
|
||||
width: int,
|
||||
@ -793,6 +795,7 @@ class PressEnterGameButton(PressTextButton):
|
||||
x, y, width, height, text, batch, group, theme, draw_theme, dict_theme
|
||||
)
|
||||
self.window = window
|
||||
self.parent_window = parent_window
|
||||
|
||||
def on_mouse_release(self, x, y, buttons, modifiers):
|
||||
if self.pressed and (x, y) in self:
|
||||
@ -802,6 +805,11 @@ class PressEnterGameButton(PressTextButton):
|
||||
self.back_rec.color = self.touched_color
|
||||
self.pressed = False
|
||||
|
||||
from .game_layout import GameLayout
|
||||
self.parent_window.remove_sub_screen("SR1_ship")
|
||||
self.parent_window.add_sub_screen("Dr_game_layout", GameLayout)
|
||||
logger.info("added Dr_game_layout screen", tag="dr_game")
|
||||
|
||||
logger.info("进入游戏")
|
||||
|
||||
class PressSelectShipButton(PressTextButton):
|
||||
|
Loading…
Reference in New Issue
Block a user