2024-08-17 14:27:18 +08:00
|
|
|
|
using System;
|
2024-08-31 15:35:12 +08:00
|
|
|
|
using System.Collections.Generic;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
using Plugins.JNGame.Util;
|
|
|
|
|
|
|
|
|
|
namespace AppGame
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class TileServerInfo
|
|
|
|
|
{
|
2024-08-31 15:35:12 +08:00
|
|
|
|
public int tile;
|
2024-08-22 20:37:39 +08:00
|
|
|
|
public String server;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
public String ip;
|
|
|
|
|
public int port;
|
2024-08-31 15:35:12 +08:00
|
|
|
|
public bool master;
|
2024-08-17 14:27:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 游戏API
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class GAPI
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//获取ID
|
|
|
|
|
public UniTask<NewsContext<int>> NSyncTileId = App.API.GetNews<int>($"/sync/tile/id");
|
2024-08-23 10:48:19 +08:00
|
|
|
|
public UniTask<NewsContext<int>> NSyncTileRandomId = App.API.GetNews<int>($"/sync/tile/random/id");
|
2024-08-17 14:27:18 +08:00
|
|
|
|
//获取端口
|
|
|
|
|
public UniTask<NewsContext<int>> NSyncTilePort = App.API.GetNews<int>($"/sync/tile/port");
|
2024-08-31 15:35:12 +08:00
|
|
|
|
//获取主连接
|
2024-08-17 14:27:18 +08:00
|
|
|
|
public UniTask<NewsContext<TileServerInfo>> NSyncTileServer(int index) => App.API.GetNews<TileServerInfo>($"/sync/tile/server?index={index}");
|
2024-08-31 15:35:12 +08:00
|
|
|
|
//获取所有连接
|
|
|
|
|
public UniTask<NewsContext<List<TileServerInfo>>> NSyncTileListServer(int index) => App.API.GetNews<List<TileServerInfo>>($"/sync/tile/servers?index={index}");
|
2024-08-17 14:27:18 +08:00
|
|
|
|
//获取玩家Id
|
|
|
|
|
public UniTask<NewsContext<int>> NSyncTileClientId = App.API.GetNews<int>($"/sync/tile/client/id");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|