Example #1
0
        internal static void UpdateMockCounters()
        {
            foreach (KeyValuePair <MockCounterGroup, ConfigModel> kvp in MockCounter.loadedMockCounters)
            {
                Destroy(kvp.Key.CounterName);
                Destroy(kvp.Key.CounterData);
            }
            if (TextHelper.CounterCanvas != null)
            {
                Destroy(TextHelper.CounterCanvas.gameObject);
            }
            TextHelper.CounterCanvas = null;
            List <ConfigModel> loadedModels = TypesUtility.GetListOfType <ConfigModel>();

            loadedModels = loadedModels.Where(x => !(x is CustomConfigModel)).ToList();
            loadedModels.ForEach(x => x = ConfigLoader.DeserializeFromConfig(x, x.DisplayName) as ConfigModel);
            foreach (CustomCounter potential in CustomCounterCreator.LoadedCustomCounters)
            {
                loadedModels.Add(potential.ConfigModel);
            }
            loadedModels.RemoveAll(x => x is null);

            foreach (ConfigModel counter in loadedModels)
            {
                MockCounter.Update(counter);
            }
        }
Example #2
0
        private static IEnumerator UpdateMockCountersRoutine()
        {
            bool allCountersActive = false;

            while (!allCountersActive)
            {
                int loaded = 0;
                foreach (SettingsInfo counter in CountersPlusHorizontalSettingsListViewController.Instance.counterInfos)
                {
                    try
                    {
                        MockCounter.Update(counter.Model);
                        loaded++;
                    }
                    catch { } //Mainly from custom counters, no biggie.
                }
                if (loaded == CountersPlusHorizontalSettingsListViewController.Instance.counterInfos.Count)
                {
                    allCountersActive = true;
                }
                yield return(new WaitForEndOfFrame());
            }
        }