using Rokid.MRC;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Rokid.MRC
{
    //多语言
    public class LocalizationMgr : Singleton<LocalizationMgr>
    {
        public SystemLanguage curLanguage;

        public Dictionary<string, string> curLanguageTable;

        public void SetLanguage(SystemLanguage language)
        {
            //curLanguage = LanguageTable.LanguageTableConfigDic.ContainsKey(language) ? language : SystemLanguage.ChineseSimplified;
            //curLanguageTable = LanguageTable.LanguageTableConfigDic[SystemLanguage.ChineseSimplified];

            if(LanguageTable.LanguageTableConfigDic.ContainsKey(language))
            {
                curLanguage = language;
                curLanguageTable = LanguageTable.LanguageTableConfigDic[language];
            }
            else
            {
                curLanguage = SystemLanguage.ChineseSimplified;
                curLanguageTable = LanguageTable.LanguageTableConfigDic[SystemLanguage.ChineseSimplified];
            }
        }

        public string GetTextByKey(string langKey)
        {
            if(curLanguageTable != null)
            {
                if(curLanguageTable.ContainsKey(langKey))
                {
                    return curLanguageTable[langKey];
                }
                else
                {
                    return "NoKey";
                }
            }

            return "Null";
        }
    }

    public static class LanguageTable
    {
        private static Dictionary<string, string> ChineseLanguageConfig = new Dictionary<string, string>
    {
        //UIConnectPanel，连接界面
        {"PanelTitle","混合现实录制"},
        {"DeviceNameLabel","设备名称"},
        {"IpLabel","IP地址"},
        {"IpDesc","未连接无线局域网"},
        {"StatusLabel","设备状态"},
        {"Connected","已连接"},
        {"Disconnected","未连接"},
        {"BtnDisconnect","断开"},
        {"ButtonNetwork","网络"},
        {"NoWifi","未连接"},
        {"Description"," 1.下载手机端“Rokid MRC”应用 \n 2.确保手机与眼镜在同一无线网络环境下 \n 3.打开“Rokid MRC”应用。进行配对"},
        //UIConfirmPanel，弹窗界面
        {"ConfirmRecord","录制请求"},
        {"ButtonConfirm","确定"},
        {"ButtonCancel","取消"},
        {"RecordContent","{0}请求视频录制"},
        {"BuildTitle","校准请求"},
        {"BuildReq","{0}正在校准，请保持不动"},
        //UITipsPanel，提示
        {"TipsConnect","{0}请求连接"},
        {"TipsConnected","{0}已连接"},
        {"TipsTitle","提示"},
        {"WifiLabel","当前Wi-Fi:"},
    };

        private static Dictionary<string, string> EnglishLanguageConfig = new Dictionary<string, string>
    {
       //UIConnectPanel，连接界面
        {"PanelTitle","Mixed Reality Record"},
        {"DeviceNameLabel","DeviceName"},
        {"IpLabel","IP Address"},
        {"IpDesc","Wlan Not Connected"},
        {"StatusLabel","Device Status"},
        {"Connected","Connected"},
        {"Disconnected","DisConnected"},
        {"BtnDisconnect","DisConnect"},
        {"ButtonNetwork","Network"},
        {"NoWifi","No Wifi"},
        {"Description"," 1.下载手机端“Rokid MRC”应用 \n 2.确保手机与眼镜在同一无线网络环境下 \n 3.打开“Rokid MRC”应用。进行配对"},
        //UIConfirmPanel，弹窗界面
        {"ConfirmRecord","Record Requset"},
        {"ButtonConfirm","Confirm"},
        {"ButtonCancel","Cancel"},
        {"RecordContent","{0}Request Recording"},
        {"BuildTitle","校准请求"},
        {"BuildReq","{0}正在校准，请保持不动"},
        //UITipsPanel，提示
        {"TipsConnect","{0} Is Connecting"},
        {"TipsConnected","{0} Connected"},
        {"TipsTitle","Tips"},
        {"WifiLabel","Current Wi-Fi:"},
    };

        public static Dictionary<SystemLanguage, Dictionary<string, string>> LanguageTableConfigDic = new Dictionary<SystemLanguage, Dictionary<string, string>>() {
        { SystemLanguage.Chinese, ChineseLanguageConfig},
        { SystemLanguage.ChineseSimplified, ChineseLanguageConfig},
        { SystemLanguage.English, EnglishLanguageConfig}
    };
    }
}