This commit is contained in:
XgC2961 2025-08-29 10:18:17 +08:00
parent 70343caa0f
commit 4550f493ce
4 changed files with 987 additions and 89 deletions

View File

@ -1006,7 +1006,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 103809606}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -1014,8 +1014,8 @@ RectTransform:
- {fileID: 2094144141}
- {fileID: 1559875247}
- {fileID: 917741341}
m_Father: {fileID: 2109707624}
m_RootOrder: 4
m_Father: {fileID: 126639093}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1203,7 +1203,13 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 918998978}
- {fileID: 255454897}
- {fileID: 1993840782}
- {fileID: 103809607}
- {fileID: 2030878213}
- {fileID: 265220017}
m_Father: {fileID: 2109707624}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2422,7 +2428,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 255454896}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2430,8 +2436,8 @@ RectTransform:
- {fileID: 1821083429}
- {fileID: 222517197}
- {fileID: 147885631}
m_Father: {fileID: 2109707624}
m_RootOrder: 2
m_Father: {fileID: 126639093}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -2461,7 +2467,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265220016}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2469,8 +2475,8 @@ RectTransform:
- {fileID: 965406577}
- {fileID: 1438438951}
- {fileID: 1191381450}
m_Father: {fileID: 2109707624}
m_RootOrder: 6
m_Father: {fileID: 126639093}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -6503,15 +6509,15 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 918998977}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1578949422}
- {fileID: 622288557}
m_Father: {fileID: 2109707624}
m_RootOrder: 1
m_Father: {fileID: 126639093}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -12878,7 +12884,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1993840781}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -12886,8 +12892,8 @@ RectTransform:
- {fileID: 1847586697}
- {fileID: 1137592457}
- {fileID: 2048917857}
m_Father: {fileID: 2109707624}
m_RootOrder: 3
m_Father: {fileID: 126639093}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -12917,7 +12923,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2030878212}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -12925,8 +12931,8 @@ RectTransform:
- {fileID: 323632687}
- {fileID: 586078118}
- {fileID: 970197318}
m_Father: {fileID: 2109707624}
m_RootOrder: 5
m_Father: {fileID: 126639093}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -13645,6 +13651,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c93abc48ab9bcb246b7c914bc6b9a921, type: 3}
m_Name:
m_EditorClassIdentifier:
background: {fileID: 126639093}
--- !u!114 &2109707621
MonoBehaviour:
m_ObjectHideFlags: 0
@ -13720,12 +13727,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 126639093}
- {fileID: 918998978}
- {fileID: 255454897}
- {fileID: 1993840782}
- {fileID: 103809607}
- {fileID: 2030878213}
- {fileID: 265220017}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

File diff suppressed because it is too large Load Diff

View File

@ -10,16 +10,14 @@ public class DisplayServer : MonoBehaviour
private Thread listenThread;
private bool isRunning = true;
<<<<<<< HEAD
public Transform background;
private string latestMsg = "";//最新信息
private string latestMsg = "";
public Animator modelAnimator;//模型动画
=======
>>>>>>> 6d1a14ffd35fa4fa432a593073532c7106ac1d6d
public Animator modelAnimator;
void Start()
{
Screen.SetResolution(3328, 1352, false);
listener = new TcpListener(IPAddress.Any, 8888);
listener.Start();
@ -28,9 +26,11 @@ public class DisplayServer : MonoBehaviour
listenThread.Start();
Debug.Log("显示端服务器已启动,等待触摸端连接...");
ShowPage("Ê×Ò³");
}
private void ListenForClients()//连接触摸控制端
private void ListenForClients()
{
while (isRunning)
{
@ -42,7 +42,7 @@ public class DisplayServer : MonoBehaviour
}
}
private void HandleClientComm(object clientObj)//处理触摸端发送的信息
private void HandleClientComm(object clientObj)
{
TcpClient tcpClient = (TcpClient)clientObj;
NetworkStream clientStream = tcpClient.GetStream();
@ -66,12 +66,15 @@ public class DisplayServer : MonoBehaviour
string data = Encoding.UTF8.GetString(message, 0, bytesRead);
Debug.Log("收到指令: " + data);
latestMsg = data;
}
}
<<<<<<< HEAD
private void Update()
{
if (!string.IsNullOrEmpty(latestMsg))
{
// ÅжÏÏûÏ¢ÀàÐÍ
if (latestMsg.StartsWith("Page:"))
{
string pageName = latestMsg.Replace("Page:", "");
@ -87,7 +90,7 @@ public class DisplayServer : MonoBehaviour
}
}
private void ShowPage(string pageName)//
private void ShowPage(string pageName)
{
if (background == null)
{
@ -114,12 +117,6 @@ public class DisplayServer : MonoBehaviour
Debug.Log($"显示端播放动画:{animName}");
}
=======
}
}
>>>>>>> 6d1a14ffd35fa4fa432a593073532c7106ac1d6d
private void OnApplicationQuit()
{
isRunning = false;

View File

@ -14,14 +14,21 @@ public class TouchClient : MonoBehaviour
private UdpClient udpListener;
private Thread udpThread;
public Transform background;
private string currentPage = "Ê×Ò³";
void Start()
{
Screen.SetResolution(1920, 1080, false);
udpListener = new UdpClient(9999);
udpThread = new Thread(ListenForBroadcast);
udpThread.Start();
Debug.Log("´¥Ãþ¶ËµÈ´ýÏÔʾ¶Ë¹ã²¥...");
ShowPage("Ê×Ò³");
}
private void ListenForBroadcast()
@ -54,7 +61,7 @@ public class TouchClient : MonoBehaviour
}
}
void SendMessageToServer(string msg)
private void SendMessageToServer(string msg)
{
if (isConnected && stream != null)
{
@ -64,6 +71,27 @@ public class TouchClient : MonoBehaviour
}
}
public void OnButtonClick_Page(string pageName)
{
ShowPage(pageName);
SendMessageToServer("Page:" + pageName);
}
public void OnButtonClick_Anim(string animName)
{
SendMessageToServer("Anim:" + animName);
}
private void ShowPage(string pageName)
{
foreach (Transform child in background)
{
child.gameObject.SetActive(child.name == pageName);
}
currentPage = pageName;
Debug.Log($"Çл»µ½Ò³Ã棺{pageName}");
}
private void OnApplicationQuit()
{
udpListener?.Close();