예제 #1
0
        public void Install()
        {
            _allRegisterUIDict  = new Dictionary <string, string>();
            _stackCurrentUI     = new Stack <BaseUI>();
            _dictLoadedAllUIs   = new Dictionary <string, BaseUI>();
            _dictCurrentShowUIs = new Dictionary <string, BaseUI>();

            TransRoot   = GameObject.FindGameObjectWithTag(UISysDefine.SYS_TAG_ROOTCANVAS).transform;
            TransNormal = UnityHelper.FindTheChildNode(TransRoot, UISysDefine.SYS_TAG_NORMALCANVAS);
            TransFixed  = UnityHelper.FindTheChildNode(TransRoot, UISysDefine.SYS_TAG_FIXEDCANVAS);
            TransPopUp  = UnityHelper.FindTheChildNode(TransRoot, UISysDefine.SYS_TAG_POPUPCANVAS);
            TransGlobal = UnityHelper.FindTheChildNode(TransRoot, UISysDefine.SYS_TAG_GLOBALCANVAS);

            RectransRoot   = TransRoot.GetComponent <RectTransform>();
            RectransNormal = TransNormal.GetComponent <RectTransform>();
            RectransFixed  = TransFixed.GetComponent <RectTransform>();
            RectransPopUp  = TransPopUp.GetComponent <RectTransform>();
            RectransGlobal = TransGlobal.GetComponent <RectTransform>();

            _fadeImage = UnityHelper.FindTheChildNode(TransGlobal, "Image_fadeBG").GetComponent <Image>();

            try
            {
                if (_fadeImage == null)
                {
                    LDebug.LogWarning("Image_fadeBG 未定义");
                }
                else if (!_fadeImage.gameObject.activeInHierarchy)
                {
                    LDebug.LogWarning("Image_fadeBG 未启用");
                }

                _fadeImage.raycastTarget = false;
                _fadeImage.gameObject.SetActive(true);
            }
            catch (Exception e)
            {
                LDebug.LogError("Image_fadeBG 错误");
            }

            //Mask蒙版初始化
            var ss = UIMaskManager.Instance;

            UICam        = UnityHelper.FindTheChildNode(TransRoot, "UICamera").GetComponent <Camera>();
            CanvasScaler = TransRoot.GetComponent <CanvasScaler>();
            GameObject.DontDestroyOnLoad(TransRoot.gameObject);

            AssemblyReflection();
        }
예제 #2
0
        public static List <TranslatorTextList> BaiduTranslatorTextLists(EntityModel entity)
        {
            List <TranslatorTextList> list = new List <TranslatorTextList>();
            TranslatorTextList        translatorTextList = new TranslatorTextList
            {
                CultureDisplayName = "中文",
                CultureSortName    = "zh-Hans",
                TransTestList      = new List <KeyValuePair <string, string> >()
            };

            foreach (EntityFieldModel entityFieldModel in entity.Properties)
            {
                if (entityFieldModel.EditChecked || entityFieldModel.ListChecked)
                {
                    if (entityFieldModel.FieldTypeStr == "string")
                    {
                        translatorTextList.TransTestList.Add(new KeyValuePair <string, string>(entityFieldModel.FieldName, entityFieldModel.FieldDisplayName));
                        translatorTextList.TransTestList.Add(new KeyValuePair <string, string>(entity.Name + entityFieldModel.FieldName, "请输入" + entityFieldModel.FieldDisplayName));
                    }
                    else
                    {
                        translatorTextList.TransTestList.Add(new KeyValuePair <string, string>(entityFieldModel.FieldName, entityFieldModel.FieldDisplayName));
                    }
                }
            }
            list.Add(translatorTextList);
            TranslatorTextList translatorTextList2 = new TranslatorTextList
            {
                CultureSortName    = "zh-Hant",
                CultureDisplayName = "繁体中文",
                TransTestList      = new List <KeyValuePair <string, string> >()
            };
            TranslatorTextList translatorTextList3 = new TranslatorTextList
            {
                CultureSortName    = "viet",
                CultureDisplayName = "越南文",
                TransTestList      = new List <KeyValuePair <string, string> >()
            };
            TranslatorTextList translatorTextList4 = new TranslatorTextList
            {
                CultureSortName    = "en",
                CultureDisplayName = "英语",
                TransTestList      = new List <KeyValuePair <string, string> >()
            };

            foreach (KeyValuePair <string, string> keyValuePair in translatorTextList.TransTestList)
            {
                TransRoot translate = BaiduTranslateService.GetTranslate(keyValuePair.Value, BaiduTrranslateEnum.auto, BaiduTrranslateEnum.cht);
                if (translate == null)
                {
                    break;
                }
                string dst = translate.trans_result[0].dst;
                translatorTextList2.TransTestList.Add(new KeyValuePair <string, string>(keyValuePair.Key, dst));
                string dst2 = BaiduTranslateService.GetTranslate(keyValuePair.Value, BaiduTrranslateEnum.auto, BaiduTrranslateEnum.vie).trans_result[0].dst;
                translatorTextList3.TransTestList.Add(new KeyValuePair <string, string>(keyValuePair.Key, dst2));
                string dst3 = BaiduTranslateService.GetTranslate(keyValuePair.Value, BaiduTrranslateEnum.auto, BaiduTrranslateEnum.en).trans_result[0].dst;
                translatorTextList4.TransTestList.Add(new KeyValuePair <string, string>(keyValuePair.Key, dst3));
            }
            list.Add(translatorTextList2);
            list.Add(translatorTextList3);
            list.Add(translatorTextList4);
            return(list);
        }