Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
e0e7539a
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e0e7539a
编写于
4月 02, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
a8205024
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
4 deletion
+19
-4
sim_scenes/solar_system/earth_moon.py
sim_scenes/solar_system/earth_moon.py
+1
-1
simulators/ursina/entities/planet.py
simulators/ursina/entities/planet.py
+5
-3
simulators/ursina/ui/control_handler.py
simulators/ursina/ui/control_handler.py
+1
-0
simulators/ursina/ui_component.py
simulators/ursina/ui_component.py
+1
-0
simulators/ursina/ursina_event.py
simulators/ursina/ursina_event.py
+11
-0
未找到文件。
sim_scenes/solar_system/earth_moon.py
浏览文件 @
e0e7539a
...
...
@@ -29,4 +29,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_
DAY
,
position
=
(
-
300000
,
200000
,
-
1300000
),
show_trail
=
True
)
ursina_run
(
bodies
,
SECONDS_PER_
MONTH
,
position
=
(
-
300000
,
200000
,
-
1300000
),
show_trail
=
True
)
simulators/ursina/entities/planet.py
浏览文件 @
e0e7539a
...
...
@@ -65,6 +65,7 @@ class Planet(Entity):
rotation
=
(
0
,
0
,
0
)
UrsinaEvent
.
on_reset_subscription
(
self
.
on_reset
)
UrsinaEvent
.
on_body_size_changed_subscription
(
self
.
change_body_scale
)
super
().
__init__
(
# model="sphere",
...
...
@@ -100,16 +101,18 @@ class Planet(Entity):
# 创建行星环(目前只有土星环)
create_rings
(
self
)
def
updat
e
(
self
):
def
change_body_scal
e
(
self
):
if
hasattr
(
self
.
body
,
"torus_stars"
):
# 星环小天体群(主要模拟小行星群,非一个天体)不受 body_size_factor 影响
self
.
scale
=
self
.
init_scale
else
:
self
.
scale
=
self
.
init_scale
*
UrsinaConfig
.
body_size_factor
def
update
(
self
):
self
.
change_body_scale
()
pos
=
self
.
body_view
.
position
*
UrsinaConfig
.
SCALE_FACTOR
if
self
.
body
.
parent
is
None
:
# TODO: ????????
# self.x = -pos[1]
# self.y = pos[2]
# self.z = pos[0]
...
...
@@ -180,7 +183,6 @@ class Planet(Entity):
self
.
f_parent
=
b
break
pos
=
self
.
f_parent
.
position
*
UrsinaConfig
.
SCALE_FACTOR
# TODO: ????????
# self.x = -pos[1]
# self.y = pos[2]
# self.z = pos[0]
...
...
simulators/ursina/ui/control_handler.py
浏览文件 @
e0e7539a
...
...
@@ -205,6 +205,7 @@ class ControlHandler(EventHandler):
def
on_slider_body_size_changed
(
self
):
UrsinaConfig
.
body_size_factor
=
self
.
ui
.
slider_body_size_factor
.
value
UrsinaEvent
.
on_body_size_changed
()
def
on_slider_run_speed_changed
(
self
):
UrsinaConfig
.
run_speed_factor
=
self
.
ui
.
slider_run_speed_factor
.
value
...
...
simulators/ursina/ui_component.py
浏览文件 @
e0e7539a
...
...
@@ -33,6 +33,7 @@ class UiSlider(Slider):
dynamic
=
True
)
# self.label.scale *= 8/10
self
.
label
.
font
=
UrsinaConfig
.
CN_FONT
self
.
knob
.
ignore_paused
=
True
# self.knob.text_entity.font = ""
# self.knob.text_entity.scale *= 8/10
# self.height *= 8/10
...
...
simulators/ursina/ursina_event.py
浏览文件 @
e0e7539a
...
...
@@ -24,6 +24,17 @@ class UrsinaEvent:
UrsinaEvent
.
on_searching_bodies_funcs
=
[]
# 应用运行的订阅事件
UrsinaEvent
.
on_application_run_callback
=
[]
#
UrsinaEvent
.
on_body_size_changed_callback
=
[]
@
staticmethod
def
on_body_size_changed_subscription
(
fun
):
UrsinaEvent
.
on_body_size_changed_callback
.
append
(
fun
)
@
staticmethod
def
on_body_size_changed
():
for
f
in
UrsinaEvent
.
on_body_size_changed_callback
:
f
()
@
staticmethod
def
on_application_run_callback_subscription
(
fun
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录