using System;
using UnityEngine;
public class AppConfig
{
    private AppConfig() { }
    private static readonly AppConfig singleInstance = new AppConfig();
    public static AppConfig Instance
    {
        get
        {
            return singleInstance;
        }
    }

    /// <summary>
    /// 获取设备信息
    /// 初始化公共参数
    /// </summary>
    /// </summary>
    /// <param name="IsShowLog">是否显示Log</param>
    public void InitProgect(bool IsShowLog)
    {
        //log日志
        Debug.unityLogger.logEnabled = IsShowLog;
        CallingNativeMethods.Instance.InitWxLogin();

        Constant.Instance.AppLs = "";
        Constant.Instance.Token = getToken();
        Constant.Instance.Uid = getUid();
        Constant.Instance.Pkg = Application.identifier;
        Constant.Instance.device = UnityPhoneUtils.Instance.GetDevice();
    }

    public string getToken()
    {
        return PlayerPrefs.GetString(token, "");
    }

    public string getUid()
    {
        return PlayerPrefs.GetString(uid, "");
    }

    // ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
    //                    设置参数                            ====
    // ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====

    private string token = "game_unity_token";
    private string uid = "game_unity_uid";

    public void setTokenAndUid(string t, string u)
    {
        PlayerPrefs.SetString(token, t);
        PlayerPrefs.SetString(uid, u);
        Constant.Instance.Uid = u;
        Constant.Instance.Token = t;
    }














}
