Compare commits

..

No commits in common. "8ccbc2bc14068c678ea8755a2388b8897d1b5291" and "343b2f59a6456fc7a4983610d18cc6c110c3cc55" have entirely different histories.

6 changed files with 24 additions and 87 deletions

View File

@ -4488,9 +4488,8 @@ MonoBehaviour:
panelContent: {fileID: 1145997501} panelContent: {fileID: 1145997501}
personItemPrefab: {fileID: 8573669611114071623, guid: d1942d5ee12cbec428172f221efb03cc, type: 3} personItemPrefab: {fileID: 8573669611114071623, guid: d1942d5ee12cbec428172f221efb03cc, type: 3}
scenePanelPrefab: {fileID: 6740850324693622957, guid: a15ee694d5f79864d816998fae77116d, type: 3} scenePanelPrefab: {fileID: 6740850324693622957, guid: a15ee694d5f79864d816998fae77116d, type: 3}
peopleWindowsPrefab: {fileID: 0}
sceneText: {fileID: 0}
scrollRect: {fileID: 1435623615} scrollRect: {fileID: 1435623615}
sceneText: {fileID: 0}
--- !u!1 &618256458 --- !u!1 &618256458
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -16533,7 +16532,6 @@ MonoBehaviour:
panel: {fileID: 618256462} panel: {fileID: 618256462}
personnelPrefabs: {fileID: 6013369223040019574, guid: f04ec64a2be229743b6f9e94c0082cea, type: 3} personnelPrefabs: {fileID: 6013369223040019574, guid: f04ec64a2be229743b6f9e94c0082cea, type: 3}
classPrefab: {fileID: 3487660197001363887, guid: e01c09bf4e995934e9ae95f586ed76e9, type: 3} classPrefab: {fileID: 3487660197001363887, guid: e01c09bf4e995934e9ae95f586ed76e9, type: 3}
content: {fileID: 311481292}
--- !u!1001 &1667194939 --- !u!1001 &1667194939
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -3451,9 +3451,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1068997307} - component: {fileID: 1068997307}
- component: {fileID: 1068997310}
- component: {fileID: 1068997306} - component: {fileID: 1068997306}
- component: {fileID: 1068997309}
- component: {fileID: 1068997305} - component: {fileID: 1068997305}
- component: {fileID: 1068997308} - component: {fileID: 1068997308}
m_Layer: 0 m_Layer: 0
@ -3549,35 +3547,6 @@ MonoBehaviour:
verticalAimingSpeed: 6 verticalAimingSpeed: 6
maxVerticalAngle: 30 maxVerticalAngle: 30
minVerticalAngle: -60 minVerticalAngle: -60
--- !u!114 &1068997309
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1068997304}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c68b1dcfbba61b44ca68572c16b16b95, type: 3}
m_Name:
m_EditorClassIdentifier:
token:
wEBScriptListener: {fileID: 1068997310}
--- !u!114 &1068997310
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1068997304}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44720823678ca7c42a08f4409ab025ff, type: 3}
m_Name:
m_EditorClassIdentifier:
serverIP: ws://124.221.149.22
serverPort: 38445
type:
--- !u!1 &1120021972 --- !u!1 &1120021972
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7945,4 +7914,3 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ea3c4e24ebc42194181651236cdf30f1, type: 3} m_Script: {fileID: 11500000, guid: ea3c4e24ebc42194181651236cdf30f1, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
nstate: 1

View File

@ -3,6 +3,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime; using Unity.VisualScripting.Antlr3.Runtime;
using UnityEditor.PackageManager;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using UnityEngine.UI; using UnityEngine.UI;
@ -47,7 +48,7 @@ public class LoginPanel : MonoBehaviour
string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(loginBody)); string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(loginBody));
Debug.Log("登录" + response); Debug.Log("登录" + response);
// 解析服务器返回的数据 // 解析服务器返回的数据
loginResponse serverData = JsonConvert.DeserializeObject<loginResponse>(response); server serverData = JsonConvert.DeserializeObject<server>(response);
//token = serverData.data.access_token; //token = serverData.data.access_token;
Debug.Log(serverData.data.access_token); Debug.Log(serverData.data.access_token);

View File

@ -12,10 +12,9 @@ using UnityWebSocket;
/// </summary> /// </summary>
public class WEBScriptListener: MonoBehaviour public class WEBScriptListener: MonoBehaviour
{ {
//public string serverIP = "ws://192.168.3.110"; public string serverIP = "ws://192.168.3.110";
public string serverIP = "ws://124.221.149.22";
//·þÎñÆ÷¶Ë¿Ú //·þÎñÆ÷¶Ë¿Ú
public int serverPort = 38445; public int serverPort = 8445;
WebSocket socket; WebSocket socket;
public string type; // ÀàÐÍ public string type; // ÀàÐÍ
public delegate void MyCallback(byte[] data); public delegate void MyCallback(byte[] data);
@ -23,7 +22,6 @@ public class WEBScriptListener: MonoBehaviour
public void ConcatWEBSocket() public void ConcatWEBSocket()
{ {
socket = new WebSocket($"{serverIP}:{serverPort}/safety/cloud"); socket = new WebSocket($"{serverIP}:{serverPort}/safety/cloud");
Debug.Log($"{serverIP}:{serverPort}/safety/cloud");
socket.OnOpen += Socket_OnOpen; socket.OnOpen += Socket_OnOpen;
socket.OnMessage += Socket_OnMessage; socket.OnMessage += Socket_OnMessage;
socket.OnError += Socket_OnError; socket.OnError += Socket_OnError;
@ -52,7 +50,7 @@ public class WEBScriptListener: MonoBehaviour
{ {
if (socket != null) if (socket != null)
{ {
Debug.Log("发送信息"); Debug.Log("发送信息");
Debug.Log(string.Format("Error: {0}", message)); Debug.Log(string.Format("Error: {0}", message));
socket.SendAsync(message); socket.SendAsync(message);
} }

View File

@ -21,23 +21,23 @@ public class test : MonoBehaviour
public string username = "13699802230"; public string username = "13699802230";
public string password = "YYL2230!"; public string password = "YYL2230!";
} }
//public async void loging() public async void loging()
//{ {
// auth_login auth_Login = new auth_login(); auth_login auth_Login = new auth_login();
// string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(auth_Login)); string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(auth_Login));
// // 解析服务器返回的数据 // ½âÎö·þÎñÆ÷·µ»ØµÄÊý¾Ý
// server serverData = JsonConvert.DeserializeObject<server>(response); server serverData = JsonConvert.DeserializeObject<server>(response);
// token = serverData.data.access_token; token = serverData.data.access_token;
// //Debug.Log(setverData.msg); //Debug.Log(setverData.msg);
//} }
//登录 //登录
void lodingWebSocket() void lodingWebSocket()
{ {
LoginRequest data = new LoginRequest(); LoginRequest data = new LoginRequest();
data.UserId = "1845037177556934657"; data.UserId = "1846032755921199105";
data.Account = "17311259169"; data.Account = "13152628999";
WSMessage msg = new WSMessage(); WSMessage msg = new WSMessage();
@ -245,26 +245,9 @@ public class test : MonoBehaviour
wEBScriptListener.SendMessageByte(sendData); wEBScriptListener.SendMessageByte(sendData);
} }
void Location()
{
MoveResponse data = new MoveResponse();
data.RoomId = "168888";
WSMessage msg = new WSMessage();
msg.Module = "move";
msg.ServiceName = "Location";
msg.Data = ByteString.CopyFrom(ProtoBufffer.Serialize(data));
byte[] sendData = ProtoBufffer.Serialize(msg);
WSMessage deinfo = ProtoBufffer.DeSerialize<WSMessage>(sendData);
MoveResponse login = ProtoBufffer.DeSerialize<MoveResponse>(deinfo.Data.ToByteArray());
Debug.Log("推送npc和玩家的信息");
//BroadcastFrameMsg.FramesFieldNumber
wEBScriptListener.SendMessageByte(sendData);
}
@ -279,15 +262,14 @@ public class test : MonoBehaviour
if (wEBScriptListener != null) if (wEBScriptListener != null)
{ {
lodingWebSocket(); lodingWebSocket();
//JoinRoom(); JoinRoom();
//Heartbeat(); //Heartbeat();
//BroadcastMessage(); //BroadcastMessage();
//UpFps(); //UpFps();
//PickUpProp(); PickUpProp();
//StartUseProp(); StartUseProp();
//StopUseProp(); StopUseProp();
//RoomStartTime(); //RoomStartTime();
//Location();
} }
} }
@ -302,7 +284,6 @@ public class test : MonoBehaviour
//监听 //监听
//登录 //登录
case "hall.Login": case "hall.Login":
Debug.Log("-=====--");
LoginResponse user = ProtoBufffer.DeSerialize<LoginResponse>(bytes); LoginResponse user = ProtoBufffer.DeSerialize<LoginResponse>(bytes);
Debug.Log(user.Message); Debug.Log(user.Message);
break; break;
@ -320,7 +301,6 @@ public class test : MonoBehaviour
UserJoinResponse userJoinResponse = ProtoBufffer.DeSerialize<UserJoinResponse>(bytes); UserJoinResponse userJoinResponse = ProtoBufffer.DeSerialize<UserJoinResponse>(bytes);
Debug.Log("玩家昵称:" + userJoinResponse.NickName + ",房间:" + userJoinResponse.RoomId.ToString() + ",用户角色"+ userJoinResponse.RoleName); Debug.Log("玩家昵称:" + userJoinResponse.NickName + ",房间:" + userJoinResponse.RoomId.ToString() + ",用户角色"+ userJoinResponse.RoleName);
Debug.Log(userJoinResponse.IncidentPosition); Debug.Log(userJoinResponse.IncidentPosition);
Debug.Log(userJoinResponse);
break; break;
// //
@ -345,12 +325,6 @@ public class test : MonoBehaviour
Debug.Log("PropId:" + stopuseProp); Debug.Log("PropId:" + stopuseProp);
break; break;
case "move.Location":
Debug.Log("move.Location接受到了");
MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes);
Debug.Log(moveResponse.MoveData);
break;
//case "prop.CreateNpc": //case "prop.CreateNpc":
// MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes); // MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes);
@ -368,7 +342,6 @@ public class test : MonoBehaviour
// //Debug.Log("PropId:" + joinRoomRequest.RoomId); // //Debug.Log("PropId:" + joinRoomRequest.RoomId);
// break; // break;
} }
} }

View File

@ -13,7 +13,6 @@ using UnityEngine.Networking;
public class web : MonoBehaviour public class web : MonoBehaviour
{ {
public const string URL = "http://192.168.3.103:8089"; // 被注释掉的服务器地址(常量) public const string URL = "http://192.168.3.103:8089"; // 被注释掉的服务器地址(常量)
//public const string URL = "ws://124.221.149.22:38445/safety/cloud"; // 被注释掉的服务器地址(常量)
// 存储服务器返回的Cookie // 存储服务器返回的Cookie
private static Dictionary<string, string> cookieJar = new Dictionary<string, string>(); private static Dictionary<string, string> cookieJar = new Dictionary<string, string>();