Ejemplo n.º 1
0
    private void Init()
    {
        Logger.Log("Init RconManager", Category.Rcon);
        DontDestroyOnLoad(rconManager.gameObject);
        fpsMonitor = GetComponent <FPSMonitor>();

        if (ServerData.ServerConfig == null)
        {
            Logger.Log("No server config found: rcon", Category.Rcon);
            Destroy(gameObject);
        }
        else
        {
            config = ServerData.ServerConfig;
            if (string.IsNullOrEmpty(config.RconPass) || config.RconPort == 0)
            {
                Logger.Log("Invalid Rcon config, please check your RconPass and RconPort values", Category.Rcon);
                Destroy(gameObject);
            }
            else
            {
                StartServer();
            }
        }
    }
Ejemplo n.º 2
0
    private void Init()
    {
        Logger.Log("Init RconManager", Category.Rcon);
        DontDestroyOnLoad(rconManager.gameObject);
        fpsMonitor = GetComponent <FPSMonitor>();
        string filePath = Application.streamingAssetsPath + "/config/config.json";

        try
        {
            string result = System.IO.File.ReadAllText(filePath);
            if (string.IsNullOrEmpty(result))
            {
                Logger.Log("No server config found: rcon", Category.Rcon);
                Destroy(gameObject);
            }

            config = JsonUtility.FromJson <ServerConfig>(result);
            StartServer();
        }
        catch
        {
            Logger.Log("config failed to load", Category.Rcon);
            Destroy(gameObject);
        }
    }
Ejemplo n.º 3
0
        private void glControl1_Load(object sender, EventArgs e)
        {
            /* OpenGL stuff */
            OpenGLHelpers.Initialization.SetDefaults();

            /* QuickFont stuff */
            GLText = new QuickFontWrapper(new Font("Verdana", 10.0f, FontStyle.Bold));

            /* Program stuff */
            Cam = new Camera();
            TexCache = new TextureCache();
            FPSMonitor = new FPSMonitor();

            /* Ready */
            GLReady = true;
        }
Ejemplo n.º 4
0
 public FPSAvgMonitor()
 {
     // FPS监测报警
     m_fpsAlert = new FPSMonitor(GameLogicAPI.getFPSInterVal());
     FpsList    = new Queue <float>();
 }