案例:Assets/Scripts/Example/3.UIFrame/ChangePanelByLanuage/Lanuagepanel.unity

1).UI脚本

请注意第三个参数要设置为true,否则不会添加AFStart中的LanuageSuffix

  1. [AFUI(500, "Assets/ResForAB/ABMain/Prefabs/Lanuage/LanuageTest", true)]
  2. public class LanuageUIScript : UIPanelParent
  3. {
  4. }

2).调用AFStart.Instance.ChangeLanuageSuffix切换语言后缀

  1. int SuffixIndex = 0;
  2. string[] SuffixStr = {"CHA","ENG" };
  3. string[] BtnStr = { "切换成英文UI", "切换成中文UI" };
  4. public Text btnText;
  5. public void ChangeLanuageBtn()
  6. {
  7. if(SuffixIndex == 1)
  8. {
  9. SuffixIndex = 0;
  10. }
  11. else
  12. {
  13. SuffixIndex = 1;
  14. }
  15. btnText.text = BtnStr[SuffixIndex];
  16. AFStart.Instance.ChangeLanuageSuffix(SuffixStr[SuffixIndex]);
  17. //关闭之前的UI
  18. lanuageUIScript.CloseSelf();
  19. lanuageUIScript = UIManager.Instance.OpenUI<LanuageUIScript>(500);
  20. }