コード例 #1
0
        private static void Initialize()
        {
            //Debug.Log("Initializing EventDispatcherComponent");

            _mappers = new Dictionary <string, EventDispatcherComponent>();

            UnityEngine.Object[] mappers = FindObjectsOfType(typeof(EventDispatcherComponent));

            foreach (UnityEngine.Object o in mappers)
            {
                EventDispatcherComponent mapper = (EventDispatcherComponent)o;

                if (mapper.Default)
                {
                    if (null != _defaultMapper)
                    {
                        Debug.LogWarning("Duplicated default mapper");
                    }

                    _defaultMapper = mapper;
                }

                if (!string.IsNullOrEmpty(mapper.Id))
                {
                    if (_mappers.ContainsKey(mapper.Id))
                    {
                        Debug.LogWarning("Duplicated mapper for: " + mapper.Id);
                    }

                    _mappers.Add(mapper.Id, mapper);
                }
            }

            _initialized = true;
        }
コード例 #2
0
        private static void Initialize()
        {
            //Debug.Log("Initializing EventDispatcherComponent");

            _mappers = new Dictionary<string, EventDispatcherComponent>();

            UnityEngine.Object[] mappers = FindObjectsOfType(typeof(EventDispatcherComponent));

            foreach (UnityEngine.Object o in mappers)
            {
                EventDispatcherComponent mapper = (EventDispatcherComponent)o;

                if (mapper.Default)
                {
                    if (null != _defaultMapper)
                        Debug.LogWarning("Duplicated default mapper");

                    _defaultMapper = mapper;
                }

                if (!string.IsNullOrEmpty(mapper.Id)){

                    if (_mappers.ContainsKey(mapper.Id))
                        Debug.LogWarning("Duplicated mapper for: " + mapper.Id);

                    _mappers.Add(mapper.Id, mapper);
                }
            }

            _initialized = true;
        }