2023-07-28 03:24:00 +03:00
|
|
|
|
using BattleBitAPI;
|
2023-03-03 23:00:54 +03:00
|
|
|
|
using BattleBitAPI.Server;
|
2023-08-10 13:31:19 +03:00
|
|
|
|
using System.Net;
|
2023-03-03 15:15:17 +03:00
|
|
|
|
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
2023-08-11 11:04:47 +03:00
|
|
|
|
var listener = new ServerListener<MyPlayer, MyGameServer>();
|
2023-08-10 13:31:19 +03:00
|
|
|
|
listener.Start(29294);
|
2023-08-11 11:04:47 +03:00
|
|
|
|
listener.OnGameServerConnecting += OnGameServerConnecting;
|
2023-08-10 13:31:19 +03:00
|
|
|
|
|
2023-07-28 03:24:00 +03:00
|
|
|
|
Thread.Sleep(-1);
|
2023-03-03 15:15:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-11 11:04:47 +03:00
|
|
|
|
private static async Task<bool> OnGameServerConnecting(IPAddress ip)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-07-28 03:24:00 +03:00
|
|
|
|
}
|
2023-08-11 11:04:47 +03:00
|
|
|
|
class MyPlayer : Player<MyPlayer>
|
2023-07-28 03:24:00 +03:00
|
|
|
|
{
|
2023-08-11 11:04:47 +03:00
|
|
|
|
public int NumberOfSpawns = 0;
|
2023-08-11 01:38:29 +03:00
|
|
|
|
|
2023-08-11 11:04:47 +03:00
|
|
|
|
public override async Task OnSpawned()
|
|
|
|
|
{
|
|
|
|
|
this.NumberOfSpawns++;
|
|
|
|
|
base.GameServer.CloseConnection();
|
|
|
|
|
|
|
|
|
|
await Console.Out.WriteLineAsync("Spawn: " + this.NumberOfSpawns);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class MyGameServer : GameServer<MyPlayer>
|
|
|
|
|
{
|
|
|
|
|
public override async Task OnConnected()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(base.GameIP + " connected");
|
|
|
|
|
}
|
|
|
|
|
}
|