Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
9d686b8f
宇宙模拟器
项目概览
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看板
提交
9d686b8f
编写于
4月 09, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
b005ca6e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
5 deletion
+45
-5
sim_scenes/solar_system/speed_of_light_init.py
sim_scenes/solar_system/speed_of_light_init.py
+12
-3
simulators/ursina/ui/control_ui.py
simulators/ursina/ui/control_ui.py
+1
-1
simulators/ursina/ursina_event.py
simulators/ursina/ursina_event.py
+32
-1
未找到文件。
sim_scenes/solar_system/speed_of_light_init.py
浏览文件 @
9d686b8f
...
@@ -99,6 +99,8 @@ class SpeedOfLightInit:
...
@@ -99,6 +99,8 @@ class SpeedOfLightInit:
if
self
.
bodies
is
None
:
if
self
.
bodies
is
None
:
raise
Exception
(
"请指定 SpeedOfLightInit.bodies"
)
raise
Exception
(
"请指定 SpeedOfLightInit.bodies"
)
# 订阅重新开始事件
# 订阅重新开始事件
UrsinaEvent
.
on_reset_subscription
(
self
.
on_reset
)
UrsinaEvent
.
on_reset_subscription
(
self
.
on_reset
)
UrsinaEvent
.
on_ready_subscription
(
self
.
on_ready
)
UrsinaEvent
.
on_ready_subscription
(
self
.
on_ready
)
...
@@ -128,6 +130,7 @@ class SpeedOfLightInit:
...
@@ -128,6 +130,7 @@ class SpeedOfLightInit:
模拟器开始运行前触发
模拟器开始运行前触发
@return:
@return:
"""
"""
# self.__light_body.planet_scale = self.__light_body.planet.scale
self
.
text_panel
=
create_text_panel
()
self
.
text_panel
=
create_text_panel
()
self
.
text_panel
.
text
=
self
.
arrived_info
.
replace
(
"${distance}"
,
"0 AU"
)
self
.
text_panel
.
text
=
self
.
arrived_info
.
replace
(
"${distance}"
,
"0 AU"
)
...
@@ -140,9 +143,15 @@ class SpeedOfLightInit:
...
@@ -140,9 +143,15 @@ class SpeedOfLightInit:
self
.
light_body
.
planet
.
input
=
self
.
light_body_input
self
.
light_body
.
planet
.
input
=
self
.
light_body_input
camera
.
rotation_y
=
-
15
camera
.
rotation_y
=
-
15
# 取消订阅(防止 光体 的大小进行变化影响摄像机的视角)
UrsinaEvent
.
on_body_size_changed_unsubscription
(
self
.
light_body
.
planet
.
change_body_scale
)
# def on_body_size(self):
# self.light_body.planet.scale = self.light_body.planet_scale
def
auto_run_speed
(
self
):
def
auto_run_speed
(
self
):
#
if self.__camera_follow_light != "SideViewActualSize":
if
self
.
__camera_follow_light
!=
"SideViewActualSize"
:
#
return
return
run_speed_maps
=
[
run_speed_maps
=
[
{
"au"
:
0.008
,
"secs"
:
1
},
{
"au"
:
0.008
,
"secs"
:
1
},
...
@@ -169,7 +178,7 @@ class SpeedOfLightInit:
...
@@ -169,7 +178,7 @@ class SpeedOfLightInit:
{
"au"
:
30.692
,
"secs"
:
SECONDS_PER_MINUTE
},
{
"au"
:
30.692
,
"secs"
:
SECONDS_PER_MINUTE
},
{
"au"
:
30.702
,
"secs"
:
1
},
# [04:15:19] 到达 [海王星] 30.7 AU
{
"au"
:
30.702
,
"secs"
:
1
},
# [04:15:19] 到达 [海王星] 30.7 AU
{
"au"
:
39.52
,
"secs"
:
SECONDS_PER_HOUR
*
1.2
},
{
"au"
:
39.52
,
"secs"
:
SECONDS_PER_HOUR
*
1.2
},
{
"au"
:
39.5
3
,
"secs"
:
SECONDS_PER_MINUTE
},
{
"au"
:
39.5
4
,
"secs"
:
SECONDS_PER_MINUTE
},
{
"au"
:
1000
,
"secs"
:
1
}
# [05:28:55] 到达 [冥王星] 39.55 AU
{
"au"
:
1000
,
"secs"
:
1
}
# [05:28:55] 到达 [冥王星] 39.55 AU
]
]
light_distance
=
self
.
light_body
.
position
[
2
]
light_distance
=
self
.
light_body
.
position
[
2
]
...
...
simulators/ursina/ui/control_ui.py
浏览文件 @
9d686b8f
...
@@ -31,7 +31,7 @@ class ControlUI(UiPanel):
...
@@ -31,7 +31,7 @@ class ControlUI(UiPanel):
self
.
trail_button_text
=
"○--"
self
.
trail_button_text
=
"○--"
self
.
slider_body_spin_factor
=
UiSlider
(
text
=
'自转速度'
,
min
=
0.01
,
max
=
5
,
default
=
1
)
self
.
slider_body_spin_factor
=
UiSlider
(
text
=
'自转速度'
,
min
=
0.01
,
max
=
5
,
default
=
1
)
self
.
slider_body_size_factor
=
UiSlider
(
text
=
'天体缩放'
,
min
=
0.1
,
max
=
1
0
,
step
=
0.1
,
default
=
1
)
self
.
slider_body_size_factor
=
UiSlider
(
text
=
'天体缩放'
,
min
=
0.1
,
max
=
2
0
,
step
=
0.1
,
default
=
1
)
self
.
slider_run_speed_factor
=
UiSlider
(
text
=
"运行速度"
,
min
=
0.01
,
max
=
20
,
default
=
1
)
self
.
slider_run_speed_factor
=
UiSlider
(
text
=
"运行速度"
,
min
=
0.01
,
max
=
20
,
default
=
1
)
self
.
slider_control_speed_factor
=
UiSlider
(
text
=
"控制速度"
,
min
=
0.01
,
max
=
10
,
self
.
slider_control_speed_factor
=
UiSlider
(
text
=
"控制速度"
,
min
=
0.01
,
max
=
10
,
step
=
0.1
,
default
=
application
.
time_scale
)
step
=
0.1
,
default
=
application
.
time_scale
)
...
...
simulators/ursina/ursina_event.py
浏览文件 @
9d686b8f
...
@@ -42,6 +42,10 @@ class UrsinaEvent:
...
@@ -42,6 +42,10 @@ class UrsinaEvent:
def
on_body_size_changed_subscription
(
fun
):
def
on_body_size_changed_subscription
(
fun
):
UrsinaEvent
.
on_body_size_changed_callback
.
append
(
fun
)
UrsinaEvent
.
on_body_size_changed_callback
.
append
(
fun
)
@
staticmethod
def
on_body_size_changed_unsubscription
(
fun
):
UrsinaEvent
.
on_body_size_changed_callback
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_body_size_changed
():
def
on_body_size_changed
():
for
f
in
UrsinaEvent
.
on_body_size_changed_callback
:
for
f
in
UrsinaEvent
.
on_body_size_changed_callback
:
...
@@ -51,6 +55,10 @@ class UrsinaEvent:
...
@@ -51,6 +55,10 @@ class UrsinaEvent:
def
on_timer_changed_subscription
(
fun
):
def
on_timer_changed_subscription
(
fun
):
UrsinaEvent
.
on_timer_changed_callback
.
append
(
fun
)
UrsinaEvent
.
on_timer_changed_callback
.
append
(
fun
)
@
staticmethod
def
on_timer_changed_unsubscription
(
fun
):
UrsinaEvent
.
on_timer_changed_callback
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_timer_changed
(
time_data
):
def
on_timer_changed
(
time_data
):
for
f
in
UrsinaEvent
.
on_timer_changed_callback
:
for
f
in
UrsinaEvent
.
on_timer_changed_callback
:
...
@@ -60,6 +68,10 @@ class UrsinaEvent:
...
@@ -60,6 +68,10 @@ class UrsinaEvent:
def
on_evolving_subscription
(
fun
):
def
on_evolving_subscription
(
fun
):
UrsinaEvent
.
on_evolving_callback
.
append
(
fun
)
UrsinaEvent
.
on_evolving_callback
.
append
(
fun
)
@
staticmethod
def
on_evolving_unsubscription
(
fun
):
UrsinaEvent
.
on_evolving_callback
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_evolving
(
evolve_dt
):
def
on_evolving
(
evolve_dt
):
for
f
in
UrsinaEvent
.
on_evolving_callback
:
for
f
in
UrsinaEvent
.
on_evolving_callback
:
...
@@ -69,6 +81,10 @@ class UrsinaEvent:
...
@@ -69,6 +81,10 @@ class UrsinaEvent:
def
on_application_run_callback_subscription
(
fun
):
def
on_application_run_callback_subscription
(
fun
):
UrsinaEvent
.
on_application_run_callback
.
append
(
fun
)
UrsinaEvent
.
on_application_run_callback
.
append
(
fun
)
@
staticmethod
def
on_application_run_callback_unsubscription
(
fun
):
UrsinaEvent
.
on_application_run_callback
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_searching_bodies_subscription
(
subscription_name
,
fun
):
def
on_searching_bodies_subscription
(
subscription_name
,
fun
):
UrsinaEvent
.
on_searching_bodies_funcs
.
append
((
subscription_name
,
fun
))
UrsinaEvent
.
on_searching_bodies_funcs
.
append
((
subscription_name
,
fun
))
...
@@ -77,6 +93,10 @@ class UrsinaEvent:
...
@@ -77,6 +93,10 @@ class UrsinaEvent:
def
on_reset_subscription
(
fun
):
def
on_reset_subscription
(
fun
):
UrsinaEvent
.
on_reset_funcs
.
append
(
fun
)
UrsinaEvent
.
on_reset_funcs
.
append
(
fun
)
@
staticmethod
def
on_reset_unsubscription
(
fun
):
UrsinaEvent
.
on_reset_funcs
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_reset
():
def
on_reset
():
for
f
in
UrsinaEvent
.
on_reset_funcs
:
for
f
in
UrsinaEvent
.
on_reset_funcs
:
...
@@ -86,6 +106,10 @@ class UrsinaEvent:
...
@@ -86,6 +106,10 @@ class UrsinaEvent:
def
on_ready_subscription
(
fun
):
def
on_ready_subscription
(
fun
):
UrsinaEvent
.
on_ready_funcs
.
append
(
fun
)
UrsinaEvent
.
on_ready_funcs
.
append
(
fun
)
@
staticmethod
def
on_ready_unsubscription
(
fun
):
UrsinaEvent
.
on_ready_funcs
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_ready
():
def
on_ready
():
for
f
in
UrsinaEvent
.
on_ready_funcs
:
for
f
in
UrsinaEvent
.
on_ready_funcs
:
...
@@ -95,6 +119,10 @@ class UrsinaEvent:
...
@@ -95,6 +119,10 @@ class UrsinaEvent:
def
on_start_subscription
(
fun
):
def
on_start_subscription
(
fun
):
UrsinaEvent
.
on_start_funcs
.
append
(
fun
)
UrsinaEvent
.
on_start_funcs
.
append
(
fun
)
@
staticmethod
def
on_start_unsubscription
(
fun
):
UrsinaEvent
.
on_start_funcs
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_start
():
def
on_start
():
for
f
in
UrsinaEvent
.
on_start_funcs
:
for
f
in
UrsinaEvent
.
on_start_funcs
:
...
@@ -104,12 +132,15 @@ class UrsinaEvent:
...
@@ -104,12 +132,15 @@ class UrsinaEvent:
def
on_pause_subscription
(
fun
):
def
on_pause_subscription
(
fun
):
UrsinaEvent
.
on_pause_funcs
.
append
(
fun
)
UrsinaEvent
.
on_pause_funcs
.
append
(
fun
)
@
staticmethod
def
on_pause_unsubscription
(
fun
):
UrsinaEvent
.
on_pause_funcs
.
remove
(
fun
)
@
staticmethod
@
staticmethod
def
on_pause
():
def
on_pause
():
for
f
in
UrsinaEvent
.
on_pause_funcs
:
for
f
in
UrsinaEvent
.
on_pause_funcs
:
f
()
f
()
@
staticmethod
@
staticmethod
def
on_application_run
():
def
on_application_run
():
if
len
(
UrsinaEvent
.
on_application_run_callback
)
==
0
:
if
len
(
UrsinaEvent
.
on_application_run_callback
)
==
0
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录