예제 #1
0
        /// <summary>
        /// 根据语言的枚举类型
        /// </summary>
        /// <param name="languageContainer"></param>
        private void GetLanguageConfigureOnLanguageType(ref List <ImageConfige> languageConfigContainer)
        {
            if (languageConfigContainer == null)
            {
                languageConfigContainer = new List <ImageConfige>();
            }
            var          allLanguage    = System.Enum.GetValues(typeof(Language));
            ImageConfige firstConfigure = null;

            foreach (var language in allLanguage)
            {
                ImageConfige config       = null;
                Language     languageType = (Language)System.Enum.Parse(typeof(Language), language.ToString());
                if (languageConfigContainer.Count == 0)
                {
                    config = GetTargetImagePropertyOfLanguage(languageType);
                    //     GetSpritePathByLanguage(ref sptitePath,config.m_SourceImage, GameSettings.GetLanguageName(config.m_Language));
                    firstConfigure = config;
                }
                else
                {
                    config = new ImageConfige(languageType, firstConfigure.m_ImageProperty);
                }
                if (IsExitLanguageConfigure(config.m_Language, m_TotalImageConfigure.m_ImageLanguageConfige))
                {
                    continue;
                }
                languageConfigContainer.Add(config);
            }
        }
예제 #2
0
        /// <summary>
        /// 获取参数语言对应的配置 取当前脚本挂载对象上的属性
        /// </summary>
        /// <param name="firstLanguage"></param>
        /// <returns></returns>
        private ImageConfige GetTargetImagePropertyOfLanguage(Language firstLanguage)
        {
            ImageConfige _configure = new ImageConfige();

            _configure.m_Language = firstLanguage;
            ReadTargetImageProperty(ref _configure.m_ImageProperty);
            return(_configure);
        }
예제 #3
0
        /// <summary>
        /// 根据参数给定的语言切换图片
        /// </summary>
        /// <param name="language"></param>
        public void ShowImageViewBaseOnLanguage(Language language)
        {
            ImageConfige newImageConfige = GetLanguageConfigure(language);

            if (newImageConfige == null)
            {
                Debug.LogError(string.Format("当前图片{0  }没有配置对应的语言{1}  ", gameObject.name, language));
                return;
            }
            InitialedImageProperty(newImageConfige);
        }
예제 #4
0
        /// <summary>
        /// 切换设置Image 属性
        /// </summary>
        /// <param name="config"></param>
        private void InitialedImageProperty(ImageConfige config)
        {
            m_TargetImage.sprite = ResourcesMgr.Instance.LoadSpriteSync(Define_SpritePath.GetSpriteInfor(SpriteRelativePath, true), m_TargetImage);
            if (m_TargetImage.sprite == null)
            {
                Debug.LogInfor("当前语言" + config.m_Language + "  Name=" + gameObject.name + "  图片没有找到");
            }
            m_TargetImage.type           = config.m_ImageProperty.m_ImageType;
            m_TargetImage.color          = config.m_ImageProperty.m_ImageColor;
            m_TargetImage.preserveAspect = config.m_ImageProperty.m_IsPreserveAspect;
            if (m_TargetImage.type != Image.Type.Filled)
            {
                return;
            }

            m_TargetImage.fillMethod = config.m_ImageProperty.m_FillMethod;
            SetImageFillOriginProperty(ref config.m_ImageProperty);
            m_TargetImage.fillAmount = config.m_ImageProperty.m_FillAmount;
        }
예제 #5
0
        public void ApplyEditorProperty()
        {
            ImageConfige config          = GetTargetImagePropertyOfLanguage(m_CurrentEditorLanguage);
            bool         isExitConfigure = false;

            for (int dex = 0; dex < m_TotalImageConfigure.m_ImageLanguageConfige.Count; ++dex)
            {
                if (m_TotalImageConfigure.m_ImageLanguageConfige[dex].m_Language == config.m_Language)
                {
                    isExitConfigure = true;
                    m_TotalImageConfigure.m_ImageLanguageConfige[dex].m_ImageProperty = config.m_ImageProperty;
                    break;
                }
            }

            if (isExitConfigure == false)
            {
                m_TotalImageConfigure.m_ImageLanguageConfige.Add(config);
            }
            OnEditorConfigure();
        }