コード例 #1
0
        // START UP /////////////////////////
        protected PurpleServer()
        {
            stdServerConfig = new ServerConfig ();
            currentServerConfig = stdServerConfig;
            stdNotificationIntervalList = new List<int> (
                new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 60, 300, 600, 900, 1800});
            userList = new List<PurpleNetworkUser> ();
            serverLaunchDate = DateTime.MinValue;

            try{
                notificationPlaceholder = PurpleConfig.Network.Message.Placeholder;
                stdServerdelay = PurpleConfig.Network.Server.Delay;

                shutdownNotificationMessage = PurpleI18n.Get("SHUTDOWN");
                shutdownNotificationDoneMessage = PurpleI18n.Get("SHUTDOWNNOW");
                restartNotificationMessage = PurpleI18n.Get("RESTART");
                restartNotificationDoneMessage = PurpleI18n.Get("RESTARTNOW");
            } catch(Exception e){
                notificationPlaceholder = "!!time!!";
                stdServerdelay = 10;

                shutdownNotificationMessage = "Server shutdown in !!time!!!";
                shutdownNotificationDoneMessage = "The server will be shut down now!";
                restartNotificationMessage = "Server restart in !!time!!!";
                restartNotificationDoneMessage = "The server will be restarted now!";

                PurpleDebug.LogError("Can not read Purple Config! " + e.ToString(), 1);
            }
        }
コード例 #2
0
    private void launch_server()
    {
        PurpleDebug.Log("Start Server!");
        Entities.PurpleNetwork.Server.ServerConfig psc = new Entities.PurpleNetwork.Server.ServerConfig();
        psc.ServerMaxClients = numberOfPlayers;
        psc.ServerPassword = connectionPassword;
        psc.ServerPort = connectionPort;
        PurpleNetwork.Server.PurpleServer.LaunchServer(psc);

        PurpleDebug.Log(numberOfPlayers + " - - " + connectionPassword + " - - " + connectionPort);
    }
コード例 #3
0
 private void initialize_database_connection(ServerConfig config)
 {
     PurpleDatabase.PurpleDatabase.Setup(config.DatabaseHost, config.DatabaseName,
                                         config.DatabaseUser, config.DatabasePassword, config.DatabasePort);
 }
コード例 #4
0
        private void launch_server(ServerConfig config)
        {
            currentServerConfig = config;
            initialize_database_connection (currentServerConfig);

            PurpleNetwork.LaunchLocalServer(config.ServerMaxClients, config.ServerPassword, config.ServerPort);
            initialize_server_details ();
        }
コード例 #5
0
 public static void LaunchServer(ServerConfig config)
 {
     Instance.launch_server (config);
 }