Exemplo n.º 1
0
 // Init rabbit from first launch not on editor!
 // ReSharper disable once InconsistentNaming
 // ReSharper disable once UnusedMember.Local
 private void ReadStartUpSettings()
 {
     try
     {
         string[] args       = Environment.GetCommandLineArgs();
         string   amqpBase64 = args[1];
         string   amqpJson   = Base64Decode(amqpBase64);
         _logger.Info(amqpJson);    //currently it's somewhat the only way to debug client
         Rabbitmq rabbitmq = amqpJson.JsonDeserialize <Rabbitmq>();
         AMQPClient.Init(rabbitmq);
         LoaderAdapter.Init(new ApiLoader());
         LogManager.GetCurrentClassLogger().Info("RabbitMQ init settings = " + amqpJson);
     }
     catch (Exception e)
     {
         try
         {
             ReadStartUpFile();
         }
         catch (Exception exception)
         {
             string message = "Cant read AMQP settings! Trying to get file params";
             LogManager.GetCurrentClassLogger().Fatal(message + " stackTrace = " + e.StackTrace);
             LauncherErrorManager.Instance.ShowFatal(message, exception.StackTrace);
         }
     }
 }
Exemplo n.º 2
0
        private void Start()
        {
            PlayerNameInputField inputField = FindObjectOfType <PlayerNameInputField>();
            string userName = Environment.UserName;

            inputField.SetPlayerName(userName);
            LoaderAnime.gameObject.transform.position = new Vector3(0, (float)Screen.height / 1000 - 1, 0);
            LanguageManager.SetDontDestroyOnLoad();
            Contexts.sharedInstance.game.DestroyAllEntities();

#if !UNITY_EDITOR
            ReadStartUpSettings();
#else
            Settings.ReadTestSettings();

            Rabbitmq amqmSettings = new Rabbitmq
            {
                host     = Settings.Instance().RabbitMqHost + ":" + Settings.Instance().RabbitMqPort,
                login    = Settings.Instance().RabbitMqUserName,
                password = Settings.Instance().RabbitMqPass,
                key      = "debug"
            };

            AMQPClient.Init(amqmSettings);
#endif


#if UNITY_EDITOR
            if (LoadTarFile)
            {
                Settings.CreateStorageSettings(TarFilePath);
                StartLoadFile();

                return;
            }
#endif

            LoaderSystems loaderSystems = new LoaderSystems(Contexts.sharedInstance);
            loaderSystems.Initialize();
            ProjectDataListener.OnUpdate = () => loaderSystems.Execute();

            if (LoaderAdapter.LoaderType != typeof(ApiLoader))
            {
                return;
            }

            try
            {
                AMQPClient.ReadLaunchArgs();
            }
            catch (Exception e)
            {
                LauncherErrorManager.Instance.ShowFatalErrorKey(
                    ErrorHelper.GetErrorKeyByCode(Varwin.Errors.ErrorCode.RabbitNoArgsError),
                    e.StackTrace);
                _logger.Fatal("Can not read launch args in rabbitMq");
            }
        }