public void Load()
        {
            this.allWatchers = new Dictionary <NumericType, List <INumericWatcher> >();

            Type[] types = DllHelper.GetMonoTypes();
            foreach (Type type in types)
            {
                object[] attrs = type.GetCustomAttributes(typeof(NumericWatcherAttribute), false);

                foreach (object attr in attrs)
                {
                    NumericWatcherAttribute numericWatcherAttribute = (NumericWatcherAttribute)attr;
                    INumericWatcher         obj = (INumericWatcher)Activator.CreateInstance(type);
                    if (!this.allWatchers.ContainsKey(numericWatcherAttribute.NumericType))
                    {
                        this.allWatchers.Add(numericWatcherAttribute.NumericType, new List <INumericWatcher>());
                    }
                    this.allWatchers[numericWatcherAttribute.NumericType].Add(obj);
                }
            }
        }
Beispiel #2
0
        public void Load()
        {
            this.allWatchers = new Dictionary <int, List <INumericWatcher> >();

            HashSet <Type> types = Game.EventSystem.GetTypes(typeof(NumericWatcherAttribute));

            foreach (Type type in types)
            {
                object[] attrs = type.GetCustomAttributes(typeof(NumericWatcherAttribute), false);

                foreach (object attr in attrs)
                {
                    NumericWatcherAttribute numericWatcherAttribute = (NumericWatcherAttribute)attr;
                    INumericWatcher         obj = (INumericWatcher)Activator.CreateInstance(type);
                    if (!this.allWatchers.ContainsKey(numericWatcherAttribute.NumericType))
                    {
                        this.allWatchers.Add(numericWatcherAttribute.NumericType, new List <INumericWatcher>());
                    }
                    this.allWatchers[numericWatcherAttribute.NumericType].Add(obj);
                }
            }
        }
        private static void Init(this NumericWatcherComponent self)
        {
            self.allWatchers = new Dictionary <int, List <INumericWatcher> >();

            List <Type> types = Game.EventSystem.GetTypes(typeof(NumericWatcherAttribute));

            foreach (Type type in types)
            {
                object[] attrs = type.GetCustomAttributes(typeof(NumericWatcherAttribute), false);

                foreach (object attr in attrs)
                {
                    NumericWatcherAttribute numericWatcherAttribute = (NumericWatcherAttribute)attr;
                    INumericWatcher         obj = (INumericWatcher)Activator.CreateInstance(type);
                    if (!self.allWatchers.ContainsKey(numericWatcherAttribute.NumericType))
                    {
                        self.allWatchers.Add(numericWatcherAttribute.NumericType, new List <INumericWatcher>());
                    }
                    self.allWatchers[numericWatcherAttribute.NumericType].Add(obj);
                }
            }
        }
Beispiel #4
0
 public NumericWatcherInfo(SceneType sceneType, INumericWatcher numericWatcher)
 {
     this.SceneType       = sceneType;
     this.INumericWatcher = numericWatcher;
 }