コード例 #1
0
        public void OnLanguageChange(Entity component)
        {
            List <object> iI18NSystems = this.typeSystems.GetSystems(component.GetType(), typeof(II18NSystem));

            if (iI18NSystems == null)
            {
                return;
            }

            for (int i = 0; i < iI18NSystems.Count; i++)
            {
                II18NSystem aI18NSystem = (II18NSystem)iI18NSystems[i];
                if (aI18NSystem == null)
                {
                    continue;
                }

                try
                {
                    aI18NSystem.Run(component);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            }
        }
コード例 #2
0
        public bool CheckIsI18N(Entity component)
        {
            var type = component.GetType();

            if (I18NCheckRes.ContainsKey(type))
            {
                return(I18NCheckRes[type]);
            }
            if (!(component is II18N))
            {
                I18NCheckRes[type] = false;
                return(false);
            }
            List <object> iI18NSystems = this.typeSystems.GetSystems(type, typeof(II18NSystem));

            if (iI18NSystems == null)
            {
                I18NCheckRes[type] = false;
                return(false);
            }
            for (int i = 0; i < iI18NSystems.Count; i++)
            {
                II18NSystem aI18NSystem = (II18NSystem)iI18NSystems[i];
                if (aI18NSystem != null)
                {
                    I18NCheckRes[type] = true;
                    return(true);
                }
            }
            I18NCheckRes[type] = false;
            return(false);
        }