Пример #1
0
 private void Start()
 {
     if (TryInitLevel()) // jen pokud jsme úspěšně načetli data levelu, můžeme provádět další věci
     {
         SetVirtualCameraConfiner();
         PenguinsInLevel = fireController.Init(PlayerData.Instance.PenguinsManager.Penguins, levelSettings.SpawnAreas, levelSettings.StartPoint);
         InitGui();
         state = LevelStateType.InProgress;
         AnalyticsController.SendLevelStart(levelSettings.LevelName);
         OnStarting.Invoke();
         OnStartFinished.Invoke();
     }
     else
     {
         Debug.LogError("Nemám level, vracím se do Mapy!");
         SceneManager.LoadScene("Map");
     }
 }
Пример #2
0
        /// <summary>
        /// Start the WWCP importer.
        /// </summary>
        public WWCPImporter <T> Start()
        {
            //DebugX.Log("Starting WWCP importer '" + Id + "'!");

            if (Monitor.TryEnter(ImporterRunLock))
            {
                try
                {
                    if (!Started)
                    {
                        #region Debug info

                        _LastRunId = 0;

                        var StartTime = DateTime.UtcNow;

                        #if DEBUG
                        //DebugX.Log("WWCP importer '" + Id + "' Initital import started!");
                        #endif

                        OnStarted?.Invoke(StartTime,
                                          this,
                                          "Importer started");

                        #endregion

                        LoadForwardingDataFromFile();

                        var FirstData = GetData(DateTime.UtcNow,
                                                this,
                                                DateTime.UtcNow,
                                                _LastRunId,
                                                DNSClient);

                        if (FirstData != null)
                        {
                            AddOrUpdateForwardingInfos(CreateForwardingTable(this,
                                                                             FirstData.Result,
                                                                             AllChargingStationOperators,
                                                                             GetChargingStationOperators,
                                                                             GetDefaultChargingStationOperator));

                            OnStartup(this, FirstData);
                            OnEveryRun(this, FirstData);
                        }

                        #region Debug info

                        var EndTime = DateTime.UtcNow;

                        #if DEBUG
                        //DebugX.Log("WWCP importer '" + Id + "' Initital import finished after " + (EndTime - StartTime).TotalSeconds + " seconds!");
                        #endif

                        OnStartFinished?.Invoke(StartTime,
                                                this,
                                                "Importer finished its startup!");

                        #endregion

                        ImporterRunTimer.Change(TimeSpan.FromSeconds(1),
                                                ImportEvery);

                        Started = true;
                    }
                }
                catch (Exception e)
                {
                    DebugX.Log("Starting the WWCP Importer '" + Id + "' led to an exception: " + e.Message + Environment.NewLine + e.StackTrace);
                }

                finally
                {
                    Monitor.Exit(ImporterRunLock);
                }
            }

            SaveForwardingDataToFile();
            return(this);
        }