象棋基础
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public partial class WebSocketSendList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取房间信息
|
||||
/// </summary>
|
||||
/// <param name="leave"></param>
|
||||
/// <param name="sit"></param>
|
||||
public static void GetRoomListFish(int leave,int district)
|
||||
{
|
||||
WebSocketManager.Instance.Send(SocketType.room, "{\"type\":1,\"target\":\"GetRoomList\",\"invocationId\":\"1\",\"arguments\":[\"" + GameManager.Instance.user.id + "\"," + (int)GameManager.Instance.gameData.currGameType + "," + leave + ","+ district + "]}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打中鱼
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="fishNumber">配置id</param>
|
||||
/// <param name="fishId">唯一id</param>
|
||||
public static void KillFish(string roomId, string userId, string fishNumber, string fishId,int paoBei)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("KillFish", roomId, userId, fishNumber, fishId, paoBei, DateTimeOffset.UtcNow.ToUnixTimeSeconds());
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 发射子弹
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="gold">单价</param>
|
||||
/// <param name="count">数量</param>
|
||||
public static void ShootBullet(string roomId, string userId, int gold, int count)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("ShootBullet", roomId, userId, gold, count);
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 链接登录界面ws
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void Bind(string userId)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("Bind", userId);
|
||||
WebSocketManager.Instance.Send(SocketType.login, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 加入房间
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="level">房间等级</param>
|
||||
public static void JoinRoom(string roomId, string userId, int level)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("JoinRoom", roomId, userId, level);
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 使用道具
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="propNumber">道具id</param>
|
||||
/// <param name="diamond">道具消耗</param>
|
||||
public static void UseProp(string roomId, string userId, string propNumber, int diamond)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("UseProp", roomId, userId, propNumber, diamond);
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 离开房间
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
public static void LeaveRoom(string roomId, string userId)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("LeaveRoom", roomId, userId);
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 更改炮倍
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="multiple"></param>
|
||||
public static void ChangeGunMultiple(string roomId, string userId,int multiple)
|
||||
{
|
||||
var sendObj = new WebSocketSendList("ChangeGunMultiple", roomId, userId, multiple);
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user