费劲.png
This commit is contained in:
parent
85a84cc1df
commit
d6179422d5
@ -477,7 +477,6 @@ class PressTextButton(widgets.WidgetBase):
|
|||||||
self.draw_theme.on_disable(self)
|
self.draw_theme.on_disable(self)
|
||||||
else:
|
else:
|
||||||
self.back_rec.color = self.untouched_color
|
self.back_rec.color = self.untouched_color
|
||||||
self.dispatch_event("on_release", x, y)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_mouse_release(self, x, y, buttons, modifiers):
|
def on_mouse_release(self, x, y, buttons, modifiers):
|
||||||
@ -487,6 +486,7 @@ class PressTextButton(widgets.WidgetBase):
|
|||||||
else:
|
else:
|
||||||
self.back_rec.color = self.touched_color
|
self.back_rec.color = self.touched_color
|
||||||
self.pressed = False
|
self.pressed = False
|
||||||
|
self.dispatch_event("on_release", self, x, y)
|
||||||
|
|
||||||
def _update_position(self):
|
def _update_position(self):
|
||||||
self.text_label.position = self._x, self._y, 0
|
self.text_label.position = self._x, self._y, 0
|
||||||
|
@ -12,7 +12,7 @@ package_path = "Difficult_Rocket_rs"
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="Difficult_Rocket_rs",
|
name="Difficult_Rocket_rs",
|
||||||
version="0.3.1",
|
version="0.3.5",
|
||||||
author="shenjackyuanjie",
|
author="shenjackyuanjie",
|
||||||
author_email="3695888@qq.com",
|
author_email="3695888@qq.com",
|
||||||
rust_extensions=[
|
rust_extensions=[
|
||||||
|
@ -728,7 +728,7 @@ impl SR1Ship {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_parts(parts: &Vec<SR1PartData>, writer: &mut Writer<Cursor<Vec<u8>>>, save_status: &SaveStatus) {
|
fn write_parts(parts: &[SR1PartData], writer: &mut Writer<Cursor<Vec<u8>>>, save_status: &SaveStatus) {
|
||||||
writer.write_event(Event::Start(BytesStart::new("Parts"))).unwrap();
|
writer.write_event(Event::Start(BytesStart::new("Parts"))).unwrap();
|
||||||
for part in parts.iter() {
|
for part in parts.iter() {
|
||||||
let mut part_attr = BytesStart::new("Part");
|
let mut part_attr = BytesStart::new("Part");
|
||||||
|
@ -93,8 +93,7 @@ class Menu(BaseScreen):
|
|||||||
# batch=self.main_batch,
|
# batch=self.main_batch,
|
||||||
# group=self.main_group,
|
# group=self.main_group,
|
||||||
# )
|
# )
|
||||||
self.enter_ship_editor_button = PressEnterShipEditorButton(
|
self.enter_ship_editor_button = PressTextButton(
|
||||||
window=main_window,
|
|
||||||
x=100,
|
x=100,
|
||||||
y=100,
|
y=100,
|
||||||
width=150,
|
width=150,
|
||||||
@ -102,8 +101,18 @@ class Menu(BaseScreen):
|
|||||||
text="进入编辑器",
|
text="进入编辑器",
|
||||||
batch=self.main_batch,
|
batch=self.main_batch,
|
||||||
group=self.main_group,
|
group=self.main_group,
|
||||||
draw_theme=MinecraftWikiButtonTheme
|
draw_theme=MinecraftWikiButtonTheme,
|
||||||
|
dict_theme={"pop_out": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def on_release(button: PressTextButton, x, y):
|
||||||
|
logger.info("on_mouse_release", x, y, button, tag="dr_game")
|
||||||
|
from .sr1_ship import SR1ShipRender
|
||||||
|
main_window.remove_sub_screen("DR_game_menu")
|
||||||
|
main_window.add_sub_screen("SR1_ship", SR1ShipRender)
|
||||||
|
logger.info("added SR1_ship screen", tag="dr_game")
|
||||||
|
|
||||||
|
self.enter_ship_editor_button.set_handler("on_release", on_release)
|
||||||
# main_window.push_handlers(self.wiki_button1)
|
# main_window.push_handlers(self.wiki_button1)
|
||||||
# main_window.push_handlers(self.wiki_button2)
|
# main_window.push_handlers(self.wiki_button2)
|
||||||
# main_window.push_handlers(self.wiki_button3)
|
# main_window.push_handlers(self.wiki_button3)
|
||||||
@ -115,37 +124,37 @@ class Menu(BaseScreen):
|
|||||||
self.main_batch.draw()
|
self.main_batch.draw()
|
||||||
|
|
||||||
|
|
||||||
class PressEnterShipEditorButton(PressTextButton):
|
# class PressEnterShipEditorButton(PressTextButton):
|
||||||
def __init__(
|
# def __init__(
|
||||||
self,
|
# self,
|
||||||
window: ClientWindow,
|
# window: ClientWindow,
|
||||||
x: int,
|
# x: int,
|
||||||
y: int,
|
# y: int,
|
||||||
width: int,
|
# width: int,
|
||||||
height: int,
|
# height: int,
|
||||||
text: str,
|
# text: str,
|
||||||
batch: Optional[Batch] = None,
|
# batch: Optional[Batch] = None,
|
||||||
group: Optional[Group] = None,
|
# group: Optional[Group] = None,
|
||||||
theme: Optional[ButtonThemeOptions] = None,
|
# theme: Optional[ButtonThemeOptions] = None,
|
||||||
draw_theme: Optional[BaseButtonTheme] = None,
|
# draw_theme: Optional[BaseButtonTheme] = None,
|
||||||
dict_theme: Optional[dict] = None,
|
# dict_theme: Optional[dict] = None,
|
||||||
):
|
# ):
|
||||||
super().__init__(
|
# super().__init__(
|
||||||
x, y, width, height, text, batch, group, theme, draw_theme, dict_theme
|
# x, y, width, height, text, batch, group, theme, draw_theme, dict_theme
|
||||||
)
|
# )
|
||||||
self.window = window
|
# self.window = window
|
||||||
|
|
||||||
|
|
||||||
def on_mouse_release(self, x, y, buttons, modifiers):
|
# def on_mouse_release(self, x, y, buttons, modifiers):
|
||||||
if self.pressed and (x, y) in self:
|
# if self.pressed and (x, y) in self:
|
||||||
if self.draw_theme:
|
# if self.draw_theme:
|
||||||
self.draw_theme.on_disable(self)
|
# self.draw_theme.on_disable(self)
|
||||||
else:
|
# else:
|
||||||
self.back_rec.color = self.touched_color
|
# self.back_rec.color = self.touched_color
|
||||||
self.pressed = False
|
# self.pressed = False
|
||||||
|
|
||||||
from .sr1_ship import SR1ShipRender
|
# from .sr1_ship import SR1ShipRender
|
||||||
|
|
||||||
self.window.remove_sub_screen("DR_game_menu")
|
# self.window.remove_sub_screen("DR_game_menu")
|
||||||
self.window.add_sub_screen("SR1_ship", SR1ShipRender)
|
# self.window.add_sub_screen("SR1_ship", SR1ShipRender)
|
||||||
logger.info("added SR1_ship screen", tag="dr_game")
|
# logger.info("added SR1_ship screen", tag="dr_game")
|
||||||
|
Loading…
Reference in New Issue
Block a user