2023-08-27 01:52:45 +08:00
|
|
|
# -------------------------------
|
|
|
|
# Difficult Rocket
|
|
|
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
|
|
|
# All rights reserved
|
|
|
|
# -------------------------------
|
|
|
|
|
2024-07-13 21:54:14 +08:00
|
|
|
# from typing import Optional, Tuple
|
2023-08-27 01:52:45 +08:00
|
|
|
from pyglet.graphics import Batch, Group
|
|
|
|
|
|
|
|
from Difficult_Rocket.client import ClientWindow
|
|
|
|
from Difficult_Rocket.api.screen import BaseScreen
|
2024-07-29 18:54:26 +08:00
|
|
|
|
2024-06-05 07:49:51 +08:00
|
|
|
# from Difficult_Rocket.main import Game
|
2024-05-22 23:58:14 +08:00
|
|
|
from Difficult_Rocket.gui.widget.button import (
|
|
|
|
PressTextButton,
|
|
|
|
MinecraftWikiButtonTheme,
|
2024-08-03 19:51:38 +08:00
|
|
|
OreuiButton,
|
|
|
|
OreuiButtonShape,
|
|
|
|
OreuiButtonStyles,
|
2024-05-22 23:58:14 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
from lib_not_dr import loggers
|
2024-01-20 00:38:32 +08:00
|
|
|
|
2024-07-13 21:54:14 +08:00
|
|
|
# from pyglet.text import Label
|
2024-07-02 00:16:16 +08:00
|
|
|
|
2023-08-27 01:52:45 +08:00
|
|
|
# from . import DR_mod_runtime
|
|
|
|
|
2024-05-22 23:58:14 +08:00
|
|
|
logger = loggers.config.get_logger_from_old("client.dr_game_menu", "client")
|
2023-08-27 01:52:45 +08:00
|
|
|
|
2024-07-29 18:54:26 +08:00
|
|
|
|
2023-08-27 01:52:45 +08:00
|
|
|
class Menu(BaseScreen):
|
|
|
|
"""
|
|
|
|
DR game 的 菜单
|
|
|
|
"""
|
|
|
|
|
2023-12-03 16:54:07 +08:00
|
|
|
name = "DR_game_menu"
|
|
|
|
|
|
|
|
def __init__(self, main_window: ClientWindow):
|
2023-08-27 01:52:45 +08:00
|
|
|
super().__init__(main_window)
|
|
|
|
self.main_batch = Batch()
|
|
|
|
self.main_group = Group(parent=main_window.main_group, order=1)
|
|
|
|
|
|
|
|
# 占位, 高二看看能不能咕出来点啥 (20230911)
|
|
|
|
# 欸呀, 正好是 911 纪念日哦
|
2024-01-20 00:38:32 +08:00
|
|
|
# 好, 高二 第一学期 期末都考完了, 我过来做测试了 (20240119)
|
2024-05-26 13:16:52 +08:00
|
|
|
# 高二, 马上要研学了, 似乎做了点啥, 但似乎又没做点啥 (20240526)
|
2024-01-20 00:38:32 +08:00
|
|
|
|
2024-05-22 23:58:14 +08:00
|
|
|
# self.wiki_button1 = PressTextButton(
|
|
|
|
# x=200,
|
|
|
|
# y=300,
|
|
|
|
# width=150,
|
|
|
|
# height=30,
|
|
|
|
# text="wiki button1",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# draw_theme=MinecraftWikiButtonTheme,
|
|
|
|
# dict_theme={"pop_out": True},
|
|
|
|
# )
|
|
|
|
# self.wiki_button2 = PressTextButton(
|
|
|
|
# x=400,
|
|
|
|
# y=300,
|
|
|
|
# width=150,
|
|
|
|
# height=30,
|
|
|
|
# text="wiki button2",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# draw_theme=MinecraftWikiButtonTheme,
|
|
|
|
# dict_theme={"pop_out": False},
|
|
|
|
# )
|
|
|
|
# self.wiki_button3 = PressTextButton(
|
|
|
|
# x=200,
|
|
|
|
# y=250,
|
|
|
|
# width=150,
|
|
|
|
# height=30,
|
|
|
|
# text="wiki button3",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# draw_theme=MinecraftWikiButtonTheme,
|
|
|
|
# dict_theme={"pop_out": True, "drag_list": True},
|
|
|
|
# )
|
|
|
|
# self.wiki_button4 = PressTextButton(
|
|
|
|
# x=400,
|
|
|
|
# y=250,
|
|
|
|
# width=150,
|
|
|
|
# height=30,
|
|
|
|
# text="wiki button4",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# draw_theme=MinecraftWikiButtonTheme,
|
|
|
|
# dict_theme={"pop_out": False, "drag_list": True},
|
|
|
|
# )
|
|
|
|
# self.button3 = PressTextButton(
|
|
|
|
# x=200,
|
|
|
|
# y=200,
|
|
|
|
# width=150,
|
|
|
|
# height=30,
|
|
|
|
# text="imgui button",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# )
|
2024-07-02 00:16:16 +08:00
|
|
|
|
|
|
|
# 16、20、24、32、40、48 64
|
|
|
|
# self.test_label = Label(
|
|
|
|
# x=20, y=200,
|
|
|
|
# font_name="Segoe Fluent Icons",
|
|
|
|
# font_size=32,
|
|
|
|
# text="\uE003 \uE005 \uE0A2
|
|
|
|
# \uE88B \uE88C \uE88D \uE985 \uE97E \uF7B5
|
|
|
|
# \uE971 \uE972 \uE973 \uE974",
|
|
|
|
# batch=self.main_batch,
|
|
|
|
# group=self.main_group,
|
|
|
|
# )
|
|
|
|
|
2024-06-05 07:42:57 +08:00
|
|
|
self.enter_ship_editor_button = PressTextButton(
|
2024-05-17 19:24:56 +08:00
|
|
|
x=100,
|
|
|
|
y=100,
|
|
|
|
width=150,
|
|
|
|
height=30,
|
|
|
|
text="进入编辑器",
|
|
|
|
batch=self.main_batch,
|
|
|
|
group=self.main_group,
|
2024-06-05 07:42:57 +08:00
|
|
|
draw_theme=MinecraftWikiButtonTheme,
|
2024-07-29 18:54:26 +08:00
|
|
|
dict_theme={"pop_out": True},
|
2024-05-17 19:24:56 +08:00
|
|
|
)
|
2024-06-05 07:42:57 +08:00
|
|
|
|
2024-08-03 19:51:38 +08:00
|
|
|
self.tester = OreuiButton(
|
2024-07-29 18:54:26 +08:00
|
|
|
x=100,
|
|
|
|
y=150,
|
|
|
|
width=150,
|
|
|
|
height=30,
|
|
|
|
batch=self.main_batch,
|
|
|
|
group=self.main_group,
|
2024-07-28 08:05:05 +08:00
|
|
|
)
|
|
|
|
|
2024-08-03 19:51:38 +08:00
|
|
|
self.wiki_shape1 = OreuiButtonShape(
|
2024-07-29 18:54:26 +08:00
|
|
|
x=100,
|
|
|
|
y=200,
|
|
|
|
width=150,
|
2024-07-31 19:04:55 +08:00
|
|
|
height=70,
|
|
|
|
pad=5,
|
|
|
|
down_pad=7,
|
2024-07-29 18:54:26 +08:00
|
|
|
batch=self.main_batch,
|
|
|
|
group=self.main_group,
|
2024-07-29 18:12:54 +08:00
|
|
|
)
|
2024-08-03 19:51:38 +08:00
|
|
|
self.wiki_shape2 = OreuiButtonShape(
|
2024-07-29 18:54:26 +08:00
|
|
|
x=300,
|
|
|
|
y=200,
|
|
|
|
width=150,
|
2024-07-31 19:04:55 +08:00
|
|
|
height=70,
|
|
|
|
pad=5,
|
|
|
|
down_pad=7,
|
2024-08-03 19:51:38 +08:00
|
|
|
colors=OreuiButtonStyles.wiki_press.value,
|
2024-07-29 18:54:26 +08:00
|
|
|
batch=self.main_batch,
|
|
|
|
group=self.main_group,
|
2024-07-29 18:12:54 +08:00
|
|
|
)
|
|
|
|
|
2024-06-05 07:42:57 +08:00
|
|
|
def on_release(button: PressTextButton, x, y):
|
2024-07-29 23:06:14 +08:00
|
|
|
self.wiki_shape1.highlight = not self.wiki_shape1.highlight
|
|
|
|
self.wiki_shape2.highlight = not self.wiki_shape2.highlight
|
2024-07-28 08:05:05 +08:00
|
|
|
# self.tester.clockwise = not self.tester.clockwise
|
|
|
|
# from .sr1_ship import SR1ShipEditor
|
|
|
|
# main_window.remove_sub_screen("DR_game_menu")
|
|
|
|
# main_window.add_sub_screen("SR1_ship", SR1ShipEditor)
|
|
|
|
# logger.info("added SR1_ship screen", tag="dr_game")
|
2024-06-05 07:42:57 +08:00
|
|
|
|
|
|
|
self.enter_ship_editor_button.set_handler("on_release", on_release)
|
2024-05-22 23:58:14 +08:00
|
|
|
# main_window.push_handlers(self.wiki_button1)
|
|
|
|
# main_window.push_handlers(self.wiki_button2)
|
|
|
|
# main_window.push_handlers(self.wiki_button3)
|
|
|
|
# main_window.push_handlers(self.wiki_button4)
|
|
|
|
# main_window.push_handlers(self.button3)
|
2024-05-17 19:24:56 +08:00
|
|
|
main_window.push_handlers(self.enter_ship_editor_button)
|
2024-01-20 00:38:32 +08:00
|
|
|
|
2024-07-29 18:54:26 +08:00
|
|
|
def on_mouse_press(
|
|
|
|
self, x: int, y: int, button: int, modifiers: int, window: ClientWindow
|
|
|
|
):
|
|
|
|
if (x, y) in self.wiki_shape1:
|
|
|
|
self.wiki_shape1.pop_out = not self.wiki_shape1.pop_out
|
2024-07-31 19:04:55 +08:00
|
|
|
|
|
|
|
if self.wiki_shape1.pop_out:
|
2024-08-03 19:51:38 +08:00
|
|
|
self.wiki_shape1.colors = OreuiButtonStyles.game1_normal.value
|
2024-07-31 19:04:55 +08:00
|
|
|
else:
|
2024-08-03 19:51:38 +08:00
|
|
|
self.wiki_shape1.colors = OreuiButtonStyles.game1_press.value
|
2024-07-29 18:54:26 +08:00
|
|
|
if (x, y) in self.wiki_shape2:
|
|
|
|
self.wiki_shape2.pop_out = not self.wiki_shape2.pop_out
|
|
|
|
|
2024-07-31 19:04:55 +08:00
|
|
|
def on_mouse_motion(self, x: int, y: int, dx: int, dy: int, window: ClientWindow):
|
|
|
|
self.wiki_shape1.highlight = (x, y) in self.wiki_shape1
|
|
|
|
self.wiki_shape2.highlight = (x, y) in self.wiki_shape2
|
|
|
|
|
2024-07-27 00:28:09 +08:00
|
|
|
# def on_draw(self, dt: float, window: ClientWindow): # TODO: wait for pyglet 2.1
|
|
|
|
def on_draw(self, window: ClientWindow):
|
2024-01-20 00:38:32 +08:00
|
|
|
self.main_batch.draw()
|