Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
太阳系三体模拟器
提交
7dc0f86b
太阳系三体模拟器
项目概览
Python_超人
/
太阳系三体模拟器
通知
1073
Star
131
Fork
128
代码
文件
提交
分支
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看板
提交
7dc0f86b
编写于
3月 23, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
太阳系三体模拟器
上级
f95351fe
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
9 deletion
+24
-9
simulators/ursina/ui/control_handler.py
simulators/ursina/ui/control_handler.py
+11
-4
simulators/ursina/ui/control_ui.py
simulators/ursina/ui/control_ui.py
+3
-2
simulators/views/ursina_view.py
simulators/views/ursina_view.py
+10
-3
未找到文件。
simulators/ursina/ui/control_handler.py
浏览文件 @
7dc0f86b
...
...
@@ -227,10 +227,17 @@ class ControlHandler(EventHandler):
elif
key
==
'-'
or
key
==
"- up"
:
self
.
slider_decrease
(
self
.
ui
.
slider_run_speed_factor
)
elif
key
==
'n'
:
import
math
# min=0.01, max=20
# # ', up' < > '. up' n m
self
.
slider_decrease
(
self
.
ui
.
slider_control_speed_factor
,
10
)
self
.
ui
.
slider_control_speed_factor
.
current_step
=
self
.
ui
.
slider_control_speed_factor
.
value
/
2
self
.
slider_decrease
(
self
.
ui
.
slider_control_speed_factor
,
self
.
ui
.
slider_control_speed_factor
.
current_step
)
print
(
self
.
ui
.
slider_control_speed_factor
.
current_step
)
elif
key
==
'm'
:
self
.
slider_increase
(
self
.
ui
.
slider_control_speed_factor
,
10
)
self
.
ui
.
slider_control_speed_factor
.
current_step
=
self
.
ui
.
slider_control_speed_factor
.
value
self
.
slider_increase
(
self
.
ui
.
slider_control_speed_factor
,
self
.
ui
.
slider_control_speed_factor
.
current_step
)
print
(
self
.
ui
.
slider_control_speed_factor
.
current_step
)
def
slider_increase
(
self
,
slider
,
step
=
50
):
"""
...
...
@@ -239,7 +246,7 @@ class ControlHandler(EventHandler):
@param step:
@return:
"""
run_speed_factor
=
slider
.
value
+
s
lider
.
step
*
s
tep
run_speed_factor
=
slider
.
value
+
step
if
run_speed_factor
>
slider
.
max
:
run_speed_factor
=
slider
.
max
slider
.
value
=
run_speed_factor
...
...
@@ -252,7 +259,7 @@ class ControlHandler(EventHandler):
@param step:
@return:
"""
value
=
slider
.
value
-
s
lider
.
step
*
s
tep
value
=
slider
.
value
-
step
if
value
<
slider
.
min
:
value
=
slider
.
min
slider
.
value
=
value
...
...
simulators/ursina/ui/control_ui.py
浏览文件 @
7dc0f86b
...
...
@@ -30,10 +30,11 @@ class ControlUI(UiPanel):
self
.
no_trail_button_text
=
"○ "
self
.
trail_button_text
=
"○--"
self
.
slider_body_spin_factor
=
UiSlider
(
text
=
'自转速度'
,
min
=
0.01
,
max
=
30
,
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
=
100
,
step
=
0.1
,
default
=
1
)
self
.
slider_run_speed_factor
=
UiSlider
(
text
=
"运行速度"
,
min
=
0.01
,
max
=
80
,
default
=
1
)
self
.
slider_control_speed_factor
=
UiSlider
(
text
=
"控制速度"
,
min
=
0.01
,
max
=
20
,
default
=
application
.
time_scale
)
self
.
slider_control_speed_factor
=
UiSlider
(
text
=
"控制速度"
,
min
=
0.01
,
max
=
20
,
step
=
0.1
,
default
=
application
.
time_scale
)
self
.
slider_trail_length
=
UiSlider
(
text
=
"拖尾长度"
,
min
=
30
,
max
=
500
,
step
=
10
,
default
=
UrsinaConfig
.
trail_length
)
self
.
on_off_switch
=
SwithButton
((
self
.
pause_button_text
,
...
...
simulators/views/ursina_view.py
浏览文件 @
7dc0f86b
...
...
@@ -285,9 +285,16 @@ class Planet(Entity):
self
.
clear_trails
()
if
hasattr
(
self
,
"name_text"
):
# 计算相机和实体之间的距离
distance
=
(
camera
.
world_position
-
self
.
world_position
).
length
()
# 根据距离设置文本缩放比例
d
=
(
camera
.
world_position
-
self
.
name_text
.
world_position
).
length
()
if
d
<
self
.
scale_x
*
1.22
:
self
.
name_text
.
visible
=
False
else
:
self
.
name_text
.
visible
=
True
# print(d, self.name_text.text, self.scale_x ,self.scale_x*1.23)
# # 计算相机和实体之间的距离
# distance = (camera.world_position - self.world_position).length()
# # 根据距离设置文本缩放比例
# self.name_text.scale = distance / 10
def
follow_parent
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录