|
|
@@ -306,91 +306,6 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //显示最后结果
|
|
|
- LayoutMarker.SetActive(false);
|
|
|
- LayoutSuccessful.SetActive(true);
|
|
|
-
|
|
|
- //设置两个线段
|
|
|
- QuadrilateralInCamera screenAuto = ScreenLocate.Main.ScreenIdentification.QuadAuto;
|
|
|
- QuadrilateralInCamera screenSemiAuto = ScreenLocate.Main.ScreenIdentification.QuadSemiAuto;
|
|
|
-
|
|
|
- var lo = new Vector2(-0.5f, -0.5f);
|
|
|
- if (screenAuto != null)
|
|
|
- {
|
|
|
- FirstUILineGenerator.Points = new Vector2[4] {
|
|
|
- 2 * (new Vector2(screenAuto.Quad[0].x/texSize.x,screenAuto.Quad[0].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenAuto.Quad[1].x/texSize.x,screenAuto.Quad[1].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenAuto.Quad[3].x/texSize.x,screenAuto.Quad[3].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenAuto.Quad[2].x/texSize.x,screenAuto.Quad[2].y/texSize.y) + lo) };
|
|
|
-
|
|
|
- // 打印 Points 的值,合并为一个字符串
|
|
|
- string pointsOutput = "1 Points: ";
|
|
|
- for (int i = 0; i < FirstUILineGenerator.Points.Length; i++)
|
|
|
- {
|
|
|
- pointsOutput += "[" + FirstUILineGenerator.Points[i].x + ", " + FirstUILineGenerator.Points[i].y + "]";
|
|
|
- if (i < FirstUILineGenerator.Points.Length - 1)
|
|
|
- {
|
|
|
- pointsOutput += ", "; // 添加逗号分隔符,最后一个元素后不加
|
|
|
- }
|
|
|
- }
|
|
|
- Debug.Log(pointsOutput);
|
|
|
-
|
|
|
- // 打印 Quad 的值,合并为一个字符串
|
|
|
- int[] customOrder = new int[] { 0, 1, 3, 2 };
|
|
|
- string quadOutput = "1 Quad Points: ";
|
|
|
- for (int i = 0; i < customOrder.Length; i++)
|
|
|
- {
|
|
|
- quadOutput += "[" + screenAuto.Quad[customOrder[i]].x + ", " + screenAuto.Quad[customOrder[i]].y + "]";
|
|
|
- if (i < customOrder.Length - 1)
|
|
|
- {
|
|
|
- quadOutput += ", "; // 添加逗号分隔符,最后一个元素后不加
|
|
|
- }
|
|
|
- }
|
|
|
- Debug.Log(quadOutput);
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- Debug.LogError("screenAuto 不存在!");
|
|
|
- }
|
|
|
- if (screenSemiAuto != null)
|
|
|
- {
|
|
|
- SecondUILineGenerator.Points = new Vector2[4] {
|
|
|
- 2 * (new Vector2(screenSemiAuto.Quad[0].x/texSize.x,screenSemiAuto.Quad[0].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenSemiAuto.Quad[1].x/texSize.x,screenSemiAuto.Quad[1].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenSemiAuto.Quad[3].x/texSize.x,screenSemiAuto.Quad[3].y/texSize.y) + lo),
|
|
|
- 2 * (new Vector2(screenSemiAuto.Quad[2].x/texSize.x,screenSemiAuto.Quad[2].y/texSize.y) + lo) };
|
|
|
-
|
|
|
- // 打印 Points 的值,合并为一个字符串
|
|
|
- string pointsOutput = "2 Points: ";
|
|
|
- for (int i = 0; i < SecondUILineGenerator.Points.Length; i++)
|
|
|
- {
|
|
|
- pointsOutput += "[" + SecondUILineGenerator.Points[i].x + ", " + SecondUILineGenerator.Points[i].y + "]";
|
|
|
- if (i < SecondUILineGenerator.Points.Length - 1)
|
|
|
- {
|
|
|
- pointsOutput += ", "; // 添加逗号分隔符,最后一个元素后不加
|
|
|
- }
|
|
|
- }
|
|
|
- Debug.Log(pointsOutput);
|
|
|
-
|
|
|
- // 打印 Quad 的值,合并为一个字符串
|
|
|
- int[] customOrder = new int[] { 0, 1, 3, 2 };
|
|
|
- string quadOutput = "2 Quad Points: ";
|
|
|
- for (int i = 0; i < customOrder.Length; i++)
|
|
|
- {
|
|
|
- quadOutput += "[" + screenSemiAuto.Quad[customOrder[i]].x + ", " + screenSemiAuto.Quad[customOrder[i]].y + "]";
|
|
|
- if (i < customOrder.Length - 1)
|
|
|
- {
|
|
|
- quadOutput += ", "; // 添加逗号分隔符,最后一个元素后不加
|
|
|
- }
|
|
|
- }
|
|
|
- Debug.Log(quadOutput);
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- Debug.LogError("screenSemiAuto 不存在!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -847,48 +762,7 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
#endregion
|
|
|
|
|
|
#region 最后选择算法处理UI
|
|
|
- void initSelectInfo() {
|
|
|
- for (int i = 0; i < 2; i++)
|
|
|
- {
|
|
|
- int currentIndex = i; // 将 i 赋值给局部变量
|
|
|
-
|
|
|
- ResultImagesButtons[currentIndex].onClick.AddListener(() => SelectImage(currentIndex));
|
|
|
-
|
|
|
- ResultButtons[currentIndex].onClick.AddListener(() =>
|
|
|
- {
|
|
|
- if (currentIndex == 0)
|
|
|
- {
|
|
|
- OnFirstResult();
|
|
|
- }
|
|
|
- else if (currentIndex == 1)
|
|
|
- {
|
|
|
- OnSecondResult();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- //默认选择1 自动
|
|
|
- SelectImage(0);
|
|
|
- }
|
|
|
- // 添加一个选择函数
|
|
|
- void SelectImage(int selectedIndex)
|
|
|
- {
|
|
|
- // 遍历所有图片
|
|
|
|
|
|
- for (int i = 0; i < ResultImages.Length; i++)
|
|
|
- {
|
|
|
- // 如果是选中的 index,赋值为 ResultLines[0],否则赋值为 ResultLines[1]
|
|
|
- if (i == selectedIndex)
|
|
|
- {
|
|
|
- ResultImages[i].sprite = ResultLines[0];
|
|
|
- ResultButtons[i].interactable = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ResultImages[i].sprite = ResultLines[1];
|
|
|
- ResultButtons[i].interactable = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
//选择全自动结果后进入游戏
|
|
|
void OnFirstResult()
|