1
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
|
||||
/// <summary>
|
||||
/// 金币数量
|
||||
/// </summary>
|
||||
public int gold { get; set; }
|
||||
public long gold { get; set; }
|
||||
}
|
||||
[Serializable]
|
||||
/// <summary>
|
||||
@@ -82,7 +82,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
|
||||
/// <summary>
|
||||
/// 金币数量
|
||||
/// </summary>
|
||||
public int gold { get; set; }
|
||||
public long gold { get; set; }
|
||||
}
|
||||
[Serializable]
|
||||
/// <summary>
|
||||
@@ -171,7 +171,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
|
||||
/// <summary>
|
||||
/// 金币数量
|
||||
/// </summary>
|
||||
public int gold { get; set; }
|
||||
public long gold { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -190,6 +190,81 @@ namespace Assets.MyGame.Scripts.Net
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// ======== 新增缺失事件 ========
|
||||
|
||||
case "JoinRoom":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<ChessGameRoom>>(msg).arguments[0];
|
||||
// 调用者自身加入成功
|
||||
if (roomMainPanel != null) roomMainPanel.UpdateUserData(va);
|
||||
}
|
||||
break;
|
||||
|
||||
case "Reconnect":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<Dictionary<string, object>>>(msg).arguments[0];
|
||||
Debug.Log($"[Chess] 重连: userId={va["userId"]}, userName={va["userName"]}");
|
||||
}
|
||||
break;
|
||||
|
||||
case "AllBeginTime":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<ChessGameRoom>>(msg).arguments[0];
|
||||
Debug.Log("[Chess] 双方已准备,开始计时");
|
||||
}
|
||||
break;
|
||||
|
||||
case "GameEnd":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<Dictionary<string, object>>>(msg).arguments[0];
|
||||
string winUserId = va["winUserId"]?.ToString();
|
||||
if (string.IsNullOrEmpty(winUserId))
|
||||
roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQHe);
|
||||
else if (winUserId == GameManager.Instance.user.id)
|
||||
roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQWin);
|
||||
else
|
||||
roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQDefeated);
|
||||
}
|
||||
break;
|
||||
|
||||
case "EndGameRequestSent":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<string>>(msg).arguments[0];
|
||||
Debug.Log("[Chess] 结束请求已发送: " + va);
|
||||
}
|
||||
break;
|
||||
|
||||
case "OpponentRequestEnd":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<string>>(msg).arguments[0];
|
||||
Debug.Log("[Chess] 对手请求结束: " + va);
|
||||
}
|
||||
break;
|
||||
|
||||
case "RestartGameSuccess":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<ChessGameRoom>>(msg).arguments[0];
|
||||
if (roomMainPanel != null) roomMainPanel.StartGame(msg);
|
||||
}
|
||||
break;
|
||||
|
||||
case "RestartRoomNotice":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<ChessGameRoom>>(msg).arguments[0];
|
||||
var panel = roomMainPanel?.subUIManager.Get<UIChineseChessDistrict>(UIPanel.ZGXQDistrict);
|
||||
if (panel != null) panel.UpdataRoom(va);
|
||||
}
|
||||
break;
|
||||
|
||||
case "SyncGameData":
|
||||
{
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<Dictionary<string, object>>>(msg).arguments[0];
|
||||
string data = va["data"]?.ToString();
|
||||
Debug.Log("[Chess] 同步数据: " + data);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ public partial class WebSocketSendList
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"GetRoomList\",\"invocationId\":\"1\",\"arguments\":[" + district + "]}");
|
||||
}
|
||||
public static void SelectGlodChineseChess(string roomId,int gold,string userId)
|
||||
public static void SelectGlodChineseChess(string roomId, int gold, string userId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"GoldConfig\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId+ "\"," + gold + ",\"" + userId+ "\"]}");
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"GoldConfig\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId + "\"," + gold + ",\"" + userId + "\"]}");
|
||||
}
|
||||
public static void JoinGameChineseChess(string roomId, string pwd, string userId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"JoinGame\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId + "\",\"" + pwd + "\",\"" + userId+ "\"]}");
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"JoinGame\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId + "\",\"" + pwd + "\",\"" + userId + "\"]}");
|
||||
}
|
||||
public static void EndGameChineseChess(string roomId, string userId)
|
||||
{
|
||||
@@ -32,8 +32,31 @@ public partial class WebSocketSendList
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"ExitRoom\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId + "\",\"" + userId + "\"]}");
|
||||
}
|
||||
public static void GameOperationChineseChess(string roomId,int operateID, string userId)
|
||||
public static void GameOperationChineseChess(string roomId, int operateID, string userId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"GameOperation\",\"invocationId\":\"1\",\"arguments\":[\"" + roomId + "\"," + operateID + ",\"" + userId + "\"]}");
|
||||
}
|
||||
|
||||
// ======== 新增缺失方法 ========
|
||||
|
||||
public static void RestartGameChineseChess(string gameId, string userId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"RestartGame\",\"invocationId\":\"1\",\"arguments\":[\"" + gameId + "\",\"" + userId + "\"]}");
|
||||
}
|
||||
public static void RequestEndGameChineseChess(string gameId, string userId, string winUserId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"RequestEndGame\",\"invocationId\":\"1\",\"arguments\":[\"" + gameId + "\",\"" + userId + "\",\"" + winUserId + "\"]}");
|
||||
}
|
||||
public static void HeartbeatChineseChess(string gameId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"Heartbeat\",\"invocationId\":\"1\",\"arguments\":[\"" + gameId + "\"]}");
|
||||
}
|
||||
public static void CheckTimeoutChineseChess(string gameId)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"CheckTimeout\",\"invocationId\":\"1\",\"arguments\":[\"" + gameId + "\"]}");
|
||||
}
|
||||
public static void SyncGameDataChineseChess(string gameId, string data)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.chess, "{\"type\":1,\"target\":\"SyncGameData\",\"invocationId\":\"1\",\"arguments\":[\"" + gameId + "\",\"" + data + "\"]}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 17.2, y: 0.000015258789}
|
||||
m_AnchoredPosition: {x: 17.200012, y: 0}
|
||||
m_SizeDelta: {x: 10, y: 0.000030518}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &1593703873945028185
|
||||
@@ -310,12 +310,12 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5691158163707292857}
|
||||
m_Father: {fileID: 4753277349451623025}
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -7.384201, y: -225.86066}
|
||||
m_SizeDelta: {x: 267.2318, y: 15.059}
|
||||
m_AnchoredPosition: {x: 2.3428497, y: -86.89664}
|
||||
m_SizeDelta: {x: -37.934326, y: -358.871}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8185101483828963230
|
||||
CanvasRenderer:
|
||||
@@ -733,9 +733,6 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2452721543265757133}
|
||||
- {fileID: 4753277349451623025}
|
||||
- {fileID: 7153619786216737190}
|
||||
- {fileID: 1067440239942628159}
|
||||
- {fileID: 5516866319861866829}
|
||||
m_Father: {fileID: 637063591879029105}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -782,6 +779,47 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3728397867786278887
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6896806291991717909}
|
||||
m_Layer: 0
|
||||
m_Name: GameObject (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6896806291991717909
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3728397867786278887}
|
||||
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: 4753277349451623025}
|
||||
- {fileID: 5717051237685750207}
|
||||
- {fileID: 5954453927741369184}
|
||||
- {fileID: 6021110652675950714}
|
||||
- {fileID: 6739776062529950427}
|
||||
- {fileID: 6792088677481717206}
|
||||
m_Father: {fileID: 2452721543265757133}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: -258.72705, y: -43.96402}
|
||||
m_SizeDelta: {x: 437.16614, y: 505.93}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &4018108212576448195
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1175,6 +1213,9 @@ RectTransform:
|
||||
- {fileID: 3567225649961033879}
|
||||
- {fileID: 6243580878427620855}
|
||||
- {fileID: 3642374247339174411}
|
||||
- {fileID: 7153619786216737190}
|
||||
- {fileID: 1067440239942628159}
|
||||
- {fileID: 6896806291991717909}
|
||||
m_Father: {fileID: 8705393558480048997}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
@@ -1250,11 +1291,11 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2966479047085167094}
|
||||
m_Father: {fileID: 4753277349451623025}
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -68.419, y: -360}
|
||||
m_AnchoredPosition: {x: -58.691948, y: -221.03598}
|
||||
m_SizeDelta: {x: 200.5, y: 215}
|
||||
m_Pivot: {x: 0.1587596, y: -0.6164007}
|
||||
--- !u!222 &1542731926374498173
|
||||
@@ -1297,11 +1338,11 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 656894550777275764}
|
||||
m_Father: {fileID: 4753277349451623025}
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 7.5, y: -348}
|
||||
m_AnchoredPosition: {x: 17.22705, y: -209.03598}
|
||||
m_SizeDelta: {x: 177, y: 52}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7528522581336000001
|
||||
@@ -1704,12 +1745,12 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 2844680982660830248}
|
||||
- {fileID: 8073739421243990378}
|
||||
m_Father: {fileID: 8705393558480048997}
|
||||
m_Father: {fileID: 2452721543265757133}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -233, y: -54}
|
||||
m_SizeDelta: {x: -1072.8191, y: -264.1919}
|
||||
m_AnchorMin: {x: 0.027504588, y: 0.053535715}
|
||||
m_AnchorMax: {x: 0.544, y: 0.7795834}
|
||||
m_AnchoredPosition: {x: 0.5, y: 2}
|
||||
m_SizeDelta: {x: -11.819092, y: -2.1918945}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &230515214283631406
|
||||
CanvasRenderer:
|
||||
@@ -1926,7 +1967,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8705393558480048997}
|
||||
m_Father: {fileID: 2452721543265757133}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
@@ -2197,11 +2238,11 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3745647986926444549}
|
||||
m_Father: {fileID: 4753277349451623025}
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -2, y: 4}
|
||||
m_AnchoredPosition: {x: 7.727051, y: 142.96402}
|
||||
m_SizeDelta: {x: 126, y: 124}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3407689366061260396
|
||||
@@ -2419,11 +2460,11 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4753277349451623025}
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -3.0000305, y: -73}
|
||||
m_AnchoredPosition: {x: 6.7270203, y: 65.96402}
|
||||
m_SizeDelta: {x: 408, y: 396}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &794042802330726482
|
||||
@@ -3603,17 +3644,12 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5717051237685750207}
|
||||
- {fileID: 5954453927741369184}
|
||||
- {fileID: 6021110652675950714}
|
||||
- {fileID: 6739776062529950427}
|
||||
- {fileID: 6792088677481717206}
|
||||
m_Father: {fileID: 8705393558480048997}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6896806291991717909}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 296, y: 95}
|
||||
m_AnchoredPosition: {x: 9.727051, y: 138.96402}
|
||||
m_SizeDelta: {x: 132, y: 132}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6247628030385303764
|
||||
|
||||
Reference in New Issue
Block a user