重新进入场景卡牌显示的bug,以及摄像机的改变,暂停返回主界面的修改

This commit is contained in:
liuliang 2024-12-14 00:14:40 +08:00
parent 58282af49f
commit 19e18177f7
17 changed files with 31 additions and 331 deletions

View File

@ -1,5 +1,7 @@
using UnityEditor;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
class SceneEditor
{
@ -22,4 +24,5 @@ class SceneEditor
if (activeScene != "")
EditorSceneManager.OpenScene(activeScene);
}
}
}
#endif

View File

@ -37,8 +37,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 462.18054, y: -1051.9258}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 462.18054, y: -1101.9258}
m_SizeDelta: {x: 725.2872, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5361498673185763723
MonoBehaviour:
@ -116,9 +116,9 @@ RectTransform:
m_Father: {fileID: 5361498674124843495}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427.415, y: -922.7216}
m_SizeDelta: {x: 854.83, y: 188.6848}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5361498673207345219
@ -1531,9 +1531,9 @@ RectTransform:
m_Father: {fileID: 5361498674124843495}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427.415, y: -718.12683}
m_SizeDelta: {x: 854.83, y: 188.6848}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5361498673906891575
@ -2143,9 +2143,9 @@ RectTransform:
m_Father: {fileID: 5361498674124843495}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427.415, y: -513.532}
m_SizeDelta: {x: 854.83, y: 188.6848}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5361498674189050916
@ -2610,9 +2610,9 @@ RectTransform:
m_Father: {fileID: 5361498674124843495}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427.415, y: -308.9372}
m_SizeDelta: {x: 854.83, y: 188.6848}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5361498674285022893
@ -3207,9 +3207,9 @@ RectTransform:
m_Father: {fileID: 5361498674124843495}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427.415, y: -104.3424}
m_SizeDelta: {x: 854.83, y: 188.6848}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5361498674635734889

View File

@ -1,173 +0,0 @@
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine.SceneManagement;
using UnityEngine;
using UnityEngine.AI;
//navmesh导出数据
public class NavMeshExport : MonoBehaviour
{
private GameObject _testMap;
[MenuItem("Tools/Export NavMesh Data")]
private static void Export()
{
NavMeshTriangulation triangulatedNavMesh = NavMesh.CalculateTriangulation();
Mesh mesh = new Mesh();
mesh.name = "_NavMesh";
mesh.vertices = triangulatedNavMesh.vertices;
mesh.triangles = triangulatedNavMesh.indices;
string baseName = "navmesh_" + SceneManager.GetActiveScene().name;
string fileName = Application.dataPath + "/navmesh/" + baseName + ".obj";
ExportNavmesh(mesh, fileName);
AssetDatabase.Refresh();
string assetName = fileName.Replace(Application.dataPath, "Assets");
GameObject navMesh = Instantiate(AssetDatabase.LoadAssetAtPath<GameObject>(assetName));
navMesh.name = baseName;
ExportNavData(navMesh);
Debug.Log("导出完成:" + baseName);
AssetDatabase.Refresh();
}
[MenuItem("Tools/NavMesh Data Test")]
private static void Test()
{
GameObject obj = GameObject.Find("_NavMesh");
Vector3[] localVectors = obj.GetComponent<MeshFilter>().sharedMesh.vertices;
int[] triangles = obj.GetComponent<MeshFilter>().sharedMesh.triangles;
//把mesh的本地坐标转成世界坐标
Vector3[] worldVectors = new Vector3[localVectors.Length];
for (int i = 0; i < localVectors.Length; ++i)
{
Vector3 pos = obj.transform.TransformPoint(localVectors[i]);
worldVectors[i] = pos;
}
//检测点
Vector3 checkPoint = GameObject.Find("TestPoint").transform.position;
bool _isInside = false;
for (int i = 0; i < triangles.Length; i += 3)
{
//Debug.Log(string.Format("{0},{1},{2}", triangles[i], triangles[i + 1], triangles[i + 2]));
if (IsInside(worldVectors[triangles[i]], worldVectors[triangles[i + 1]], worldVectors[triangles[i + 2]], checkPoint))
{
_isInside = true;
break;
}
}
if (_isInside)
Debug.Log("该点合法");
else
Debug.Log("该点非法");
}
private static string ParseMesh(Mesh mesh)
{
StringBuilder sb = new StringBuilder();
sb.Append("g ").Append(mesh.name).Append("\n");
foreach (Vector3 v in mesh.vertices)
{
sb.Append(string.Format("v {0} {1} {2}\n", v.x, v.y, v.z));
}
sb.Append("\n");
foreach (Vector3 v in mesh.normals)
{
sb.Append(string.Format("vn {0} {1} {2}\n", v.x, v.y, v.z));
}
sb.Append("\n");
foreach (Vector3 v in mesh.uv)
{
sb.Append(string.Format("vt {0} {1}\n", v.x, v.y));
}
for (int m = 0; m < mesh.subMeshCount; m++)
{
sb.Append("\n");
int[] triangles = mesh.GetTriangles(m);
for (int i = 0; i < triangles.Length; i += 3)
{
sb.Append(string.Format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n", triangles[i] + 1, triangles[i + 1] + 1, triangles[i + 2] + 1));
}
}
return sb.ToString();
}
private static void ExportNavmesh(Mesh mesh, string filename)
{
using (StreamWriter sw = new StreamWriter(filename))
{
sw.Write(ParseMesh(mesh));
}
}
private static void ExportNavData(GameObject obj)
{
Vector3[] localVectors = obj.transform.Find("_NavMesh").GetComponent<MeshFilter>().sharedMesh.vertices;
int[] triangles = obj.transform.Find("_NavMesh").GetComponent<MeshFilter>().sharedMesh.triangles;
//把mesh的本地坐标转成世界坐标
Vector3[] worldVectors = new Vector3[localVectors.Length];
for (int i = 0; i < localVectors.Length; i++)
{
Vector3 pos = obj.transform.TransformPoint(localVectors[i]);
worldVectors[i] = pos;
}
StringBuilder sb = new StringBuilder();
sb.Append("local nav = {\n");
for (int i = 0; i < triangles.Length; i += 3)
{
sb.AppendFormat("\t{{{0},{1},{2}}},\n", _VectorToLua(worldVectors[triangles[i]]), _VectorToLua(worldVectors[triangles[i + 1]]), _VectorToLua(worldVectors[triangles[i + 2]]));
}
sb.Append("}\n");
sb.Append("return nav");
using (StreamWriter sw = new StreamWriter(Application.dataPath + "/navmesh/" + obj.name + ".lua"))
{
sw.Write(sb.ToString());
}
DestroyImmediate(obj);
}
private static string _VectorToLua(Vector3 vec)
{
return string.Format("{{{0},{1},{2}}}", vec.x, vec.y, vec.z);
}
//判断点是否在三角形内
public static bool IsInside(Vector3 A, Vector3 B, Vector3 C, Vector3 P)
{
Vector3 v0 = C - A;
Vector3 v1 = B - A;
Vector3 v2 = P - A;
float dot00 = Vector3.Dot(v0, v0);
float dot01 = Vector3.Dot(v0, v1);
float dot02 = Vector3.Dot(v0, v2);
float dot11 = Vector3.Dot(v1, v1);
float dot12 = Vector3.Dot(v1, v2);
float inverDeno = 1 / (dot00 * dot11 - dot01 * dot01);
float u = (dot11 * dot02 - dot01 * dot12) * inverDeno;
if (u < 0 || u > 1) // if u out of range, return directly
{
return false;
}
float v = (dot00 * dot12 - dot01 * dot02) * inverDeno;
if (v < 0 || v > 1) // if v out of range, return directly
{
return false;
}
return u + v <= 1;
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: ad2d5486e667e0747aa8e3e3086c5fcf
timeCreated: 1464239247
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,25 +0,0 @@
using UnityEngine;
using System.Collections;
using UnityEngine.AI;
public class demo : MonoBehaviour {
private NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
void Update()
{
RaycastHit hit;
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit))
agent.SetDestination(hit.point);
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 37b79eb08aca06b43a94c53660ba8f2b
timeCreated: 1470534199
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1847,7 +1847,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 10
orthographic size: 12
m_Depth: -1
m_CullingMask:
serializedVersion: 2

View File

@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Beat_ZanTing:BaseUI
{
[Header("关闭按钮,关闭的面板")] public GameObject panel;
@ -21,7 +21,7 @@ public class Beat_ZanTing:BaseUI
RegisterButton(BTNs[1], async() => {
gameGlobal.GameRecovery();
await ButtonClickAnimationAsync(BTNs[1].gameObject);
gameGlobal.GameExit();
SceneManager.LoadScene(1);
});
RegisterButton(BTNs[2], async () => {

View File

@ -120,7 +120,7 @@ public class cardBox : MonoBehaviour
{
// 获取 CarryCardId 列表
List<string> carryCardIdList = Base.GlobalObj.GetComponent<gameGlobal>().CarryCardId;
foreach (string id in carryCardIdList)
{
if (IDTomangyaoPrefab.TryGetValue(id, out GameObject prefab))
@ -142,6 +142,7 @@ public class cardBox : MonoBehaviour
Debug.LogWarning($"未找到ID为 '{id}' 的萌妖卡预制体!");
}
}
Base.GlobalObj.GetComponent<gameGlobal>().CarryCardId.Clear();
}
}

View File

@ -1,17 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Ai : MonoBehaviour
{
public NavMeshAgent agent;
public Transform target;
// Update is called once per frame
void Update()
{
agent.SetDestination(target.position);
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 190b43ee25bd28548a8b6e753445ca12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +0,0 @@
using UnityEditor;
using UnityEngine.AI;
using UnityEngine;
public class NavMeshBuilder
{
[MenuItem("Tools/Build NavMesh")]
public static void BuildNavMesh()
{
// 调用此方法生成导航网格
UnityEditor.AI.NavMeshBuilder.BuildNavMesh();
Debug.Log("NavMesh has been built!");
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 127b3c60bf4fcb34face4689489c789b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,20 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NavTest : MonoBehaviour
{
public Transform targetpos;
private UnityEngine.AI.NavMeshAgent nav;
void Start()
{
nav = GetComponent<UnityEngine.AI.NavMeshAgent>();
nav.SetDestination(targetpos.position);
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2810eac30a0aa7a4daab8015441da020
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -36,7 +36,9 @@ public class Battle_Selection : BaseUI
// Start is called before the first frame update
async void Start()
{
await showPanel(_panel);
await showPanel(_panel);
// 初始化:将所有卡牌添加到萌妖卡列表,并设置其父节点为萌妖卡生成点
foreach (Button btn in CardBTN)
{

View File

@ -175,7 +175,7 @@ public class Logo_in : mount
}
else
{
Debug.Log(apifox.message);
Promptmgr.Instance.PromptBubble(apifox.message);
}
//这里调用登录方法