protected void StopManagers(bool forced = false)
        {
            Logger.Info <SactaProxy>("Deteniendo Gestores.");

            Managers.ForEach(depEntry =>
            {
                if (forced)
                {
                    if (depEntry.IsMain)
                    {
                        (depEntry.Manager as PsiManager).EventActivity    -= OnPsiEventActivity;
                        (depEntry.Manager as PsiManager).EventSectRequest -= OnPsiEventSectorizationAsk;
                    }
                    else
                    {
                        (depEntry.Manager as ScvManager).EventActivity      -= OnScvEventActivity;
                        (depEntry.Manager as ScvManager).EventSectorization -= OnScvEventSectorization;
                    }
                }
                depEntry.Manager.Stop();
            });
            if (forced)
            {
                Managers.Clear();
            }

            PS.Set(ProcessStates.Stopped);
            Logger.Info <SactaProxy>("Gestores Detenidos.");
        }
Esempio n. 2
0
        /// <summary>
        /// Wrapper around the load method to ensure a transaction is active when called
        /// </summary>
        internal void LoadWrapper()
        {
            try
            {
                using (DocumentLock dl = AcDoc?.LockDocument())
                {
                    using (Transaction tr = AcCurDb.TransactionManager.StartTransaction())
                    {
                        Managers.Clear();

                        var mgrObjList = LoadBinary <List <object> >("Managers", _managerTypes);

                        foreach (IDrawingObjectManager drawingObjectManager in mgrObjList)
                        {
                            drawingObjectManager.SetDependencies(AcDoc, _log);
                            drawingObjectManager.ActivateObjects();
                            Managers.Add(drawingObjectManager);
                        }
                        Load();
                        PopulateLayers();
                        tr.Commit();
                    }
                }
            }
            catch (Exception e)
            {
                _log.LogException(e);
            }
        }
Esempio n. 3
0
 public void Clear()
 {
     Character.Clear();
     Map.Clear();
     Fight.Clear();
     Managers.Clear();
     Bid.Clear();
 }
Esempio n. 4
0
 public void LoadScene(Define.Scene type, bool init = true)
 {
     if (init)
     {
         Managers.Clear();
     }
     SceneManager.LoadScene(getSceneName(type));
 }
Esempio n. 5
0
 public void Load(string file)
 {
     if (!IsLoaded)
     {
         Managers.Clear();
         var listItems = JsonConvert.DeserializeObject <List <ManagerJsonData> >(Resources.Load <TextAsset>(file).text);
         listItems.ForEach(item => Managers.Add(item.id, new ManagerData(item)));
         IsLoaded = true;
     }
 }
 /// <summary>
 ///     Safely clean manager set
 /// </summary>
 public void Clean()
 {
     foreach (var manager in Managers)
     {
         if (manager is IDisposable disposable)
         {
             disposable.Dispose();
         }
     }
     Managers.Clear();
     GC.Collect();
 }
Esempio n. 7
0
        private IEnumerator LoadDefaultsImpl()
        {
            yield return(new WaitUntil(() => Services.ResourceService.IsLoaded));

            yield return(new WaitUntil(() => Services.GameModeService.IsLoaded));

            Managers.Clear();
            foreach (var data in Services.ResourceService.Managers.ManagerCollections)
            {
                GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(data.Id);
                Managers.Add(data.Id, new ManagerInfo(data, generatorData));
            }
            if (Services.GameModeService.IsFirstTimeLaunch)
            {
                SetCashOnHand(0, kFirstManagerCashOnHand);
            }

            ManagerEfficiencyRollbackLevels.Clear();

            IsLoaded = true;
        }
Esempio n. 8
0
        protected virtual void Dispose(bool disposing)
        {
            if (isDisposed)
            {
                return;
            }
            if (disposing)
            {
                //free unmanaged objects
                Managers.Dispose();
                //((IDisposable)_aetherContext).Dispose();
            }
            //clear managed objects
            Managers.Clear();
            Managers = null;
            //_moduleManager = null;
            //_aetherContext = null;

            isDisposed = true;
            return;
        }
Esempio n. 9
0
        public int InsertManagers()
        {
            Dictionary <string, Type> ManagerAttributes = new Dictionary <string, Type>();

            PropertyInfo[] managerProperties = typeof(Manager).GetProperties();
            foreach (PropertyInfo prop in managerProperties)
            {
                ManagerAttributes.Add(prop.Name, prop.PropertyType);
            }

            int totalInserted = QuickImport <Manager>(
                Managers,
                ConnectionString,
                AddManagersBulkImportProcedure,
                AddManagerParameterName,
                "Managers",
                ManagerAttributes);

            // Clear data from stack
            Managers.Clear();

            return(totalInserted);
        }
Esempio n. 10
0
        public override void LoadSave(object obj)
        {
            ManagerServiceSave save = obj as ManagerServiceSave;

            if (save != null)
            {
                if (save.managers != null)
                {
                    Managers.Clear();
                    foreach (var kvp in save.managers)
                    {
                        var           managerData   = Services.ResourceService.Managers.GetManagerData(kvp.Key);
                        GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(kvp.Key);
                        ManagerInfo   manager       = new ManagerInfo(managerData, generatorData, kvp.Value);
                        Managers.Add(manager.Id, manager);
                    }

                    save.Validate();
                    ManagerEfficiencyRollbackLevels.Clear();
                    foreach (var me in save.efficiencyRollbackImproveLevels)
                    {
                        ManagerEfficiencyRollbackLevels.Add(me.Key, new ManagerEfficiencyRollbackLevel(me.Value));
                    }

                    IsLoaded = true;
                }
                else
                {
                    LoadDefaults();
                }
            }
            else
            {
                LoadDefaults();
            }
        }
Esempio n. 11
0
        private void BaseReset()
        {
            Dictionary <int, ManagerInfo> newManagers = new Dictionary <int, ManagerInfo>();

            foreach (var kvp in Managers)
            {
                ManagerData   managerData   = Services.ResourceService.Managers.GetManagerData(kvp.Key);
                GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(kvp.Key);

                ManagerInfo newValue = new ManagerInfo(managerData, generatorData);
                newValue.SetHasKickBacks(kvp.Value.HasKickBacks);
                newManagers.Add(newValue.Id, newValue);
            }
            Managers.Clear();
            foreach (var kvp in newManagers)
            {
                Managers.Add(kvp.Key, kvp.Value);
            }

            if (Services.GameModeService.IsFirstTimeLaunch)
            {
                SetCashOnHand(0, kFirstManagerCashOnHand);
            }
        }
Esempio n. 12
0
 public void LoadScene(string str)
 {
     Managers.Clear();
     SceneManager.LoadScene(str);
 }
Esempio n. 13
0
    //public BaseScene CurrentScene { get { return GameObject.FindObjectOfType<BaseScene>(); } }

    public void LoadScene(Define.Scene type)
    {
        Managers.Clear();

        SceneManager.LoadScene(GetSceneName(type));
    }
Esempio n. 14
0
        protected bool ConfigureService()
        {
            Logger.Info <SactaProxy>("Configurando Servicio");
            cfgManager.Get((cfg =>
            {
                // Se utiliza 'siempre' version 0 para CD30 y version 1 para ULISES.
                cfg.ProtocolVersion = Properties.Settings.Default.ScvType;
                History.Configure(cfg.General.HistoryMaxDays, cfg.General.HistoryMaxItems);
                Managers.Clear();
                cfg.Psi.Sectorization.Positions = "";
                cfg.Psi.Sectorization.Sectors = "";
                cfg.Psi.Sectorization.Virtuals = "";

                var manager = new PsiManager(cfg.ProtocolVersion, cfg.Psi, () => History);
                manager.EventActivity += OnPsiEventActivity;
                manager.EventSectRequest += OnPsiEventSectorizationAsk;
                Managers.Add(new DependencyControl(cfg.Psi.Id)
                {
                    IsMain = true,
                    Cfg = cfg.Psi,
                    Manager = manager
                });
                cfg.Dependencies.ForEach(dep =>
                {
                    var dependency = new ScvManager(cfg.ProtocolVersion, dep, () => History);
                    dependency.EventActivity += OnScvEventActivity;
                    dependency.EventSectorization += OnScvEventSectorization;

                    /** Construyendo la configuracion de Sectorizacion general */
                    var sectorsMap = dep.Sectorization.SectorsMap.Split(',')
                                     .Where(i => Configuration.MapOfSectorsEntryValid(i))
                                     .ToDictionary(k => int.Parse(k.Split(':')[0]), v => int.Parse(v.Split(':')[1]));
                    var positionsMap = dep.Sectorization.PositionsMap.Split(',')
                                       .Where(i => Configuration.MapOfSectorsEntryValid(i))
                                       .ToDictionary(k => int.Parse(k.Split(':')[0]), v => int.Parse(v.Split(':')[1]));
                    var virtuals = Configuration.ListString2String(
                        dep.Sectorization.VirtualsList()
                        .Select(v => sectorsMap.Keys.Contains(v) ? sectorsMap[v].ToString() : v.ToString())
                        .ToList());
                    var reals = String.Join(",", dep.Sectorization.SectorsList()
                                            .Select(r => sectorsMap.Keys.Contains(r) ? sectorsMap[r].ToString() : r.ToString())
                                            .ToList());
                    //.Aggregate((i, j) => i + "," + j.ToString());
                    var positions = String.Join(",", dep.Sectorization.PositionsList()
                                                .Select(p => positionsMap.Keys.Contains(p) ? positionsMap[p].ToString() : p.ToString())
                                                .ToList());
                    //.Aggregate((i, j) => i + "," + j.ToString());

                    cfg.Psi.Sectorization.Positions = Configuration.AgreggateString(cfg.Psi.Sectorization.Positions, positions);
                    cfg.Psi.Sectorization.Virtuals = Configuration.AgreggateString(cfg.Psi.Sectorization.Virtuals, virtuals);
                    cfg.Psi.Sectorization.Sectors = Configuration.AgreggateString(cfg.Psi.Sectorization.Sectors, reals);

                    Managers.Add(new DependencyControl(dep.Id)
                    {
                        IsMain = false,
                        Cfg = dep,
                        Manager = dependency,
                        SectorsMap = sectorsMap,
                        PositionsMap = positionsMap
                    });
                });
                /** Test de la configuracion que maneja la PSI, que debe coincidir con la configurada en BD */
                SectorizationHelper.CompareWithDb(cfg.Psi.Sectorization.Positions,
                                                  cfg.Psi.Sectorization.Sectors, cfg.Psi.Sectorization.Virtuals, (error) =>
                {
                    // Marcar el Warning...
                    PS.SignalWarning <SactaProxy>($"Incoherencia de Configuración con Base de Datos: {error}", History);
                });
                /** */
                var ids = cfg.Dependencies.Select(d => d.Id).ToList();
                ids.Add(cfg.Psi.Id);
                SectorizationPersistence.Sanitize(ids);
                Cfg = cfg;
                cfgManager.Write(Cfg);
                Logger.Info <SactaProxy>("Servicio Configurado...");
            }));
            return(true);
        }
 //씬 로드
 public void LoadScene(Define.Scene type)
 {
     Managers.Clear();
     //CurrentScene.Clear(); //현재 씬을 클리어 후에
     SceneManager.LoadScene(GetSceneName(type)); //새로 원하는 씬 로드
 }
Esempio n. 16
0
 public void LoadScene(Define.Scene type)//Scene을 넘어갈때 현재 씬 정보 Clear해주고 넘어갈거임.
 {
     Managers.Clear();
     SceneManager.LoadScene(GetSceneName(type));
 }