Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hex
ygopro2
Commits
a4e1c2ca
Commit
a4e1c2ca
authored
Aug 06, 2025
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust UI
parent
6798e693
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
261 deletions
+137
-261
Assets/SibylSystem/CardDescription/CardDescription.cs
Assets/SibylSystem/CardDescription/CardDescription.cs
+71
-71
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+4
-2
Assets/SibylSystem/Servant.cs
Assets/SibylSystem/Servant.cs
+2
-3
UserSettings/Layouts/default-2021.dwlt
UserSettings/Layouts/default-2021.dwlt
+60
-185
No files found.
Assets/SibylSystem/CardDescription/CardDescription.cs
View file @
a4e1c2ca
...
@@ -117,59 +117,11 @@ public class CardDescription : Servant
...
@@ -117,59 +117,11 @@ public class CardDescription : Servant
public
override
void
applyShowArrangement
()
public
override
void
applyShowArrangement
()
{
{
// if (gameObject != null)
if
(
gameObject
!=
null
)
// {
// underSprite.height = Screen.height + 4;
// int offset = 0;
// // 暴力适配 ios 刘海屏
// if (Screen.safeArea.x > 0)
// {
// offset = (global::System.Object)Screen.width switch
// {
// 1366 => 52,
// 1600 => 63,
// 1920 => 70,
// 2560 => 110,
// _ => 66,
// };
// }
// // 计算目标世界坐标
// Vector3 showPosition = Program.camera_main_2d.ScreenToWorldPoint(
// new Vector3(offset, Screen.height / 2, 0)
// );
// // 执行显示动画
// gameObject.transform.DOMove(showPosition, 1.2f).SetEase(Ease.OutCubic);
// resizer.gameObject.GetComponent<BoxCollider>().enabled = true;
// }
if
(
gameObject
==
null
)
{
{
return
;
underSprite
.
height
=
Screen
.
height
+
4
;
}
// --- 1. 获取安全区域 ---
Rect
safeArea
=
Screen
.
safeArea
;
// --- 2. 核心逻辑:根据屏幕边缘进行对称布局 ---
// 步骤 A: 计算面板的【最终高度】。
// 高度 = (屏幕总高度 - 顶部要求的间距 - 底部要求的间距)
// 两个间距都等于 safeArea.y
float
newHeight
=
Screen
.
height
-
(
safeArea
.
y
*
2
);
// 增加一个健壮性保护,防止在极端屏幕比例下高度过小或为负。
// 这里的最小值可以根据您的UI设计微调。
newHeight
=
Mathf
.
Max
(
300
,
newHeight
);
// 步骤 B: 将计算出的新高度应用到背景 Sprite 上。
underSprite
.
height
=
(
int
)
newHeight
;
// --- 3. 定位这个尺寸调整好的面板 ---
// 步骤 C: 【保留】原有的X轴偏移逻辑,以适配刘海屏
int
offset
=
0
;
int
offset
=
0
;
// 暴力适配 ios 刘海屏
if
(
Screen
.
safeArea
.
x
>
0
)
if
(
Screen
.
safeArea
.
x
>
0
)
{
{
offset
=
(
global
::
System
.
Object
)
Screen
.
width
switch
offset
=
(
global
::
System
.
Object
)
Screen
.
width
switch
...
@@ -181,24 +133,72 @@ public class CardDescription : Servant
...
@@ -181,24 +133,72 @@ public class CardDescription : Servant
_
=>
66
,
_
=>
66
,
};
};
}
}
float
targetScreenX
=
offset
;
// 目标X坐标使用原有的offset
// 步骤 D: 计算【最终的中心点Y坐标】。
// 计算目标世界坐标
// 目标:让面板的【底部】正好落在 safeArea.y 上。
// 因此,中心点Y = 底部Y位置 + (高度的一半)
// 注意:这里使用 underSprite.height,因为它已经是整数,可以避免浮点误差。
float
targetScreenY
=
safeArea
.
y
+
(
underSprite
.
height
/
2f
);
// --- 4. 执行动画 ---
// 使用计算出的新坐标来确定最终的世界坐标
Vector3
showPosition
=
Program
.
camera_main_2d
.
ScreenToWorldPoint
(
Vector3
showPosition
=
Program
.
camera_main_2d
.
ScreenToWorldPoint
(
new
Vector3
(
targetScreenX
,
targetScreenY
,
0
)
new
Vector3
(
offset
,
Screen
.
height
/
2
,
0
)
);
);
// 执行显示动画
gameObject
.
transform
.
DOMove
(
showPosition
,
1.2f
).
SetEase
(
Ease
.
OutCubic
);
gameObject
.
transform
.
DOMove
(
showPosition
,
1.2f
).
SetEase
(
Ease
.
OutCubic
);
// 启用碰撞器
resizer
.
gameObject
.
GetComponent
<
BoxCollider
>().
enabled
=
true
;
resizer
.
gameObject
.
GetComponent
<
BoxCollider
>().
enabled
=
true
;
}
}
// if (gameObject == null)
// {
// return;
// }
// // --- 1. 获取安全区域 ---
// Rect safeArea = Screen.safeArea;
// // --- 2. 核心逻辑:根据屏幕边缘进行对称布局 ---
// // 步骤 A: 计算面板的【最终高度】。
// // 高度 = (屏幕总高度 - 顶部要求的间距 - 底部要求的间距)
// // 两个间距都等于 safeArea.y
// float newHeight = Screen.height - (safeArea.y * 2);
// // 增加一个健壮性保护,防止在极端屏幕比例下高度过小或为负。
// // 这里的最小值可以根据您的UI设计微调。
// newHeight = Mathf.Max(300, newHeight);
// // 步骤 B: 将计算出的新高度应用到背景 Sprite 上。
// underSprite.height = (int)newHeight;
// // --- 3. 定位这个尺寸调整好的面板 ---
// // 步骤 C: 【保留】原有的X轴偏移逻辑,以适配刘海屏
// int offset = 0;
// if (Screen.safeArea.x > 0)
// {
// offset = (global::System.Object)Screen.width switch
// {
// 1366 => 52,
// 1600 => 63,
// 1920 => 70,
// 2560 => 110,
// _ => 66,
// };
// }
// float targetScreenX = offset; // 目标X坐标使用原有的offset
// // 步骤 D: 计算【最终的中心点Y坐标】。
// // 目标:让面板的【底部】正好落在 safeArea.y 上。
// // 因此,中心点Y = 底部Y位置 + (高度的一半)
// // 注意:这里使用 underSprite.height,因为它已经是整数,可以避免浮点误差。
// float targetScreenY = safeArea.y + (underSprite.height / 2f);
// // --- 4. 执行动画 ---
// // 使用计算出的新坐标来确定最终的世界坐标
// Vector3 showPosition = Program.camera_main_2d.ScreenToWorldPoint(
// new Vector3(targetScreenX, targetScreenY, 0)
// );
// gameObject.transform.DOMove(showPosition, 1.2f).SetEase(Ease.OutCubic);
// // 启用碰撞器
// resizer.gameObject.GetComponent<BoxCollider>().enabled = true;
}
public
void
read
()
public
void
read
()
{
{
...
...
Assets/SibylSystem/Program.cs
View file @
a4e1c2ca
...
@@ -1032,13 +1032,15 @@ public class Program : MonoBehaviour
...
@@ -1032,13 +1032,15 @@ public class Program : MonoBehaviour
// 4. 计算视图的起始X坐标 (像素单位)
// 4. 计算视图的起始X坐标 (像素单位)
// 视图的左边缘 = 目标中心点 - 视图宽度的一半
// 视图的左边缘 = 目标中心点 - 视图宽度的一半
float
viewX_pixels
=
targetCenterX_pixels
-
(
viewWidth_pixels
/
2f
);
float
viewX_pixels
=
targetCenterX_pixels
-
(
viewWidth_pixels
/
2f
);
// 基于安全区域计算目标屏幕坐标,让 finalViewport 往下移一点
float
verticalOffset
=
safeArea
.
height
*
0.02f
;
// 5. 将计算出的像素坐标转换为标准化的 Rect(0-1范围)
// 5. 将计算出的像素坐标转换为标准化的 Rect(0-1范围)
Rect
finalViewport
=
new
Rect
(
Rect
finalViewport
=
new
Rect
(
viewX_pixels
/
Screen
.
width
+
fixedRightOffset
,
// 整理向右偏移一点点
viewX_pixels
/
Screen
.
width
+
fixedRightOffset
,
// 整理向右偏移一点点
safeArea
.
y
/
Screen
.
height
,
// Y和Height直接使用安全区的值,往上一点点给 toolbar 位置
(
safeArea
.
y
-
verticalOffset
)
/
Screen
.
height
,
// Y和Height直接使用安全区的值
viewWidth_pixels
/
Screen
.
width
,
viewWidth_pixels
/
Screen
.
width
,
safeArea
.
height
/
Screen
.
height
(
safeArea
.
height
+
verticalOffset
)
/
Screen
.
height
);
);
// 6. 应用到所有相关的3D相机
// 6. 应用到所有相关的3D相机
...
...
Assets/SibylSystem/Servant.cs
View file @
a4e1c2ca
...
@@ -106,9 +106,8 @@ public class Servant
...
@@ -106,9 +106,8 @@ public class Servant
// 1. 获取安全区域
// 1. 获取安全区域
Rect
safeArea
=
Screen
.
safeArea
;
Rect
safeArea
=
Screen
.
safeArea
;
// 2. 基于安全区域计算目标屏幕坐标
// 2. 基于安全区域计算目标屏幕坐标,让 toolbar 往下移一点
// float verticalOffset = safeArea.height * 0.03f;
float
verticalOffset
=
safeArea
.
height
*
0.02f
;
float
verticalOffset
=
safeArea
.
height
*
0.01f
;
float
targetScreenX
=
Screen
.
width
-
RightToScreen
;
float
targetScreenX
=
Screen
.
width
-
RightToScreen
;
float
targetScreenY
=
safeArea
.
y
+
buttomToScreen
-
verticalOffset
;
float
targetScreenY
=
safeArea
.
y
+
buttomToScreen
-
verticalOffset
;
...
...
UserSettings/Layouts/default-2021.dwlt
View file @
a4e1c2ca
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment