/// <summary> /// 更换语言 /// </summary> /// <param name="languageID"></param> private void ChangeLanguage(int languageID) { //更换语言,设置文本 _text.text = UIConfigurationManager.GetInstance(). GetTextStringByLanguageID( textString, languageID); }
/// <summary> /// 加载模块 /// </summary> /// <param name="moduleName"></param> private void LoadModule(string moduleName, Vector2 anchoredPosition) { //如果字典中根本没有该模块,或字典里该模块的值为空 if (!_uiModules.ContainsKey(moduleName) || _uiModules[moduleName] == null) { //通过模块名称获取对应的资源路径 string panelPath = UIConfigurationManager.GetInstance().GetPanelPrefabPathByName(moduleName); //加载预设体,并生成对应的对象 GameObject module = PrefabManager.GetInstance().CreateGameObjectByPrefab(panelPath, _canvas, anchoredPosition); //修改模块的名称,去掉(Clone) module.name = moduleName; //获取模块组件 UIModuleBase moduleBase = module.GetComponent <UIModuleBase>(); //添加到字典里 _uiModules[moduleName] = moduleBase; } }