Exemplo n.º 1
0
    public void UpdateServer(ServerConfigInfo info)
    {
        if (info == null)
        {
            return;
        }

        m_host = info.host;
        m_port = info.port;

        Logger.LogInfo("<b><color=#FFFFFF>[{0}]</color></b> Server info update: [id: {1}, host: {2}, port: {3}, isHttp: {4}]", m_typeName, info.ID, host, port, info.isHttp);
    }
Exemplo n.º 2
0
    public void Connect(int id, Action <Session> onConnect = null)
    {
        var info = ServerConfigInfo.Get(id);

        if (info == null)
        {
            Logger.LogWarning("<b><color=#FFFFFF>[{0}]</color></b> Could not find server [{1}] from config.", m_typeName, id);
            return;
        }

        UpdateServer(info);
        Connect(onConnect);
    }
Exemplo n.º 3
0
    public static void UpdateServerInfo()
    {
        if (m_server == null)
        {
            m_server = new ServerConfigInfo();
        }

        var si = ServerConfigInfo.Get(m_defaultServer);

        m_server.CopyFrom(si ?? ServerConfigInfo.defaultServer);
        m_server.ID = m_defaultServer;

        Logger.LogDetail("Set default server to <color=#00DDFF><b>[{0}]</b></color>", m_server);
    }
Exemplo n.º 4
0
    public void CopyFrom(ServerConfigInfo other)
    {
        if (other == null)
        {
            return;
        }

        ID       = other.ID;
        host     = other.host;
        port     = other.port;
        alias    = other.alias;
        comment  = other.comment;
        fullHost = other.fullHost;
        isHttp   = other.isHttp;
    }
Exemplo n.º 5
0
        void LunchProgram(ServerConfigInfo configInfo)
        {
            if (configInfo.type == EServerType.DaemonServer)
            {
                return;
            }
            var     path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, configInfo.path);
            Process proc = Process.Start(path);

            if (proc != null)
            {
                proc.EnableRaisingEvents = true;
                proc.Exited += new EventHandler(OnProcExited);
            }
        }
Exemplo n.º 6
0
    protected override void Awake()
    {
        base.Awake();

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Time.timeScale      = 1.0f;

#if SHADOW_PACK
        if (string.IsNullOrEmpty(m_shadowAppName))
        {
            Logger.LogWarning("Shadow app name can not be null! Use default name from config.");
            m_shadowAppName = null;
        }
#endif

#if !DEVELOPMENT_BUILD && !UNITY_EDITOR
        Debug.unityLogger.logEnabled = false;
#else
        m_loggerTimeTest    = e_LoggerTimeTest;
        m_disableLoggerTime = e_DisableLoggerTime;
        UpdateLoggerState();
#if !UNITY_EDITOR
        this.GetComponentDefault <DebugLogger>();
#endif
#endif

        m_defaultServer = __defaultServer;
        ServerConfigInfo.LoadServerInfos();

        var n = SDKManager.GetSafeInsets();
        m_safeInset = Util.ParseString <float>(n, false);
        if (m_safeInset.Length != 2)
        {
            m_safeInset = new float[2] {
                0, 0
            }
        }
        ;

        hasNotch = m_safeInset[0] > 0 || m_safeInset[1] > 0;

        Logger.LogDetail("Safe Inset: <color=#00FF00><b>[top:{0:F2},bottom:{1:F2}]</b></color>", m_safeInset[0], m_safeInset[1]);
    }
Exemplo n.º 7
0
    private void OnSetCommand(string[] subcommands, CommandInfo info)
    {
        if (subcommands.Length < 3)
        {
            m_sb.Append(info.usage); return;
        }

        var t = subcommands[1];
        var v = subcommands[2];

        switch (t)
        {
        case "server":
        {
            var vi = Util.Parse <int>(v);
            if (vi != 0)
            {
                var si = ServerConfigInfo.Get(vi);
                if (si != null)
                {
                    Root.defaultServer = vi;
                }
                else
                {
                    m_sb.AppendFormat("Could not find server [{0}] from config", vi);
                    return;
                }
            }
            var p = subcommands.Length > 3 ? Util.Parse <int>(subcommands[3]) : 12345;
            if (p == 0)
            {
                p = 12345;
            }
            session.UpdateServer(v, p); break;
        }

        case "log": Logger.enabled = v == "on"; break;

        default: m_sb.Append(info.usage); break;
        }
    }
Exemplo n.º 8
0
 void LunchProgram(ServerConfigInfo configInfo)
 {
     if (configInfo.type == EServerType.DaemonServer)
     {
         return;
     }
     if (_allConfig.isDebugMode)
     {
         Debug.Log("Add Server Thread " + configInfo.type);
         ServerUtil.RunServer(GetType().Assembly, configInfo.type, _allConfig);
     }
     else
     {
         var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Server.Servers.exe");
         Debug.Log("Add Server Process " + configInfo.type.ToString());
         Process proc = Process.Start(path, configInfo.type.ToString());
         if (proc != null)
         {
             proc.EnableRaisingEvents = true;
             proc.Exited += new EventHandler(OnProcExited);
         }
     }
 }
Exemplo n.º 9
0
 public override void DoAwake(ServerConfigInfo info)
 {
     base.DoAwake(info);
     _authDb     = new AuthDbLdb(new LiteDatabase(@"auth.db"));
     _profilesDb = new ProfilesDatabaseLdb(new LiteDatabase(@"profiles.db"));
 }
Exemplo n.º 10
0
 public void UpdateServer(int id)
 {
     UpdateServer(ServerConfigInfo.Get(id));
 }