Пример #1
0
    public static SendPacketAction Create(ServerSimple server_, int client_, Packet_Server packet_)
    {
        SendPacketAction a = new SendPacketAction();

        a.server = server_;
        a.client = client_;
        a.packet = packet_;
        return(a);
    }
Пример #2
0
 public void Start(ServerSimple serverSimple)
 {
     server = serverSimple;
 }
Пример #3
0
    void Connect(GamePlatform platform)
    {
        if (singleplayer)
        {
            if (platform.SinglePlayerServerAvailable())
            {
                platform.SinglePlayerServerStart(singleplayerSavePath);
            }
            else
            {
                serverSimple = new ServerSimple();
                DummyNetwork network = platform.SinglePlayerServerGetNetwork();
                network.Start(platform.MonitorCreate(), platform.MonitorCreate());
                DummyNetServer server = new DummyNetServer();
                server.network  = network;
                server.platform = platform;
                server.Start();
                serverSimple.Start(server, singleplayerSavePath, platform);

                serverSimpleMod        = new ModServerSimple();
                serverSimpleMod.server = serverSimple;
                game.AddMod(serverSimpleMod);
                platform.SinglePlayerServerGetNetwork().ServerReceiveBuffer.Enqueue(new ByteArray());
            }

            connectData          = new ConnectData();
            connectData.Username = "******";
            game.connectdata     = connectData;

            DummyNetClient netclient = new DummyNetClient();
            netclient.SetPlatform(platform);
            netclient.SetNetwork(platform.SinglePlayerServerGetNetwork());
            game.main = netclient;
        }
        else
        {
            game.connectdata = connectData;
            if (platform.EnetAvailable())
            {
                EnetNetClient client = new EnetNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.TcpAvailable())
            {
                TcpNetClient client = new TcpNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.WebSocketAvailable())
            {
                WebSocketClient client = new WebSocketClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else
            {
                platform.ThrowException("Network not implemented");
            }
        }
    }
Пример #4
0
    void Connect(GamePlatform platform)
    {
        if (singleplayer)
        {
            if (platform.SinglePlayerServerAvailable())
            {
                platform.SinglePlayerServerStart(singleplayerSavePath);
            }
            else
            {
                serverSimple = new ServerSimple();
                DummyNetwork network = platform.SinglePlayerServerGetNetwork();
                network.Start(platform.MonitorCreate(), platform.MonitorCreate());
                DummyNetServer server = new DummyNetServer();
                server.network = network;
                server.platform = platform;
                server.Start();
                serverSimple.Start(server, singleplayerSavePath, platform);

                serverSimpleMod = new ModServerSimple();
                serverSimpleMod.server = serverSimple;
                game.AddMod(serverSimpleMod);
                platform.SinglePlayerServerGetNetwork().ServerReceiveBuffer.Enqueue(new ByteArray());
            }

            connectData = new ConnectData();
            connectData.Username = "******";
            game.connectdata = connectData;

            DummyNetClient netclient = new DummyNetClient();
            netclient.SetPlatform(platform);
            netclient.SetNetwork(platform.SinglePlayerServerGetNetwork());
            game.main = netclient;
        }
        else
        {
            game.connectdata = connectData;
            if (platform.EnetAvailable())
            {
                EnetNetClient client = new EnetNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.TcpAvailable())
            {
                TcpNetClient client = new TcpNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.WebSocketAvailable())
            {
                WebSocketClient client = new WebSocketClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else
            {
                platform.ThrowException("Network not implemented");
            }
        }
    }
Пример #5
0
 public void Start(ServerSimple serverSimple)
 {
     server = serverSimple;
 }
Пример #6
0
 public static SendPacketAction Create(ServerSimple server_, int client_, Packet_Server packet_)
 {
     SendPacketAction a = new SendPacketAction();
     a.server = server_;
     a.client = client_;
     a.packet = packet_;
     return a;
 }