wangguan
2020-12-10 aea99467cb43d6647fa38b42344b56c466592f25
修改SKD相关
3 files modified
76 ■■■■■ changed files
Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs 64 ●●●●● patch | view | raw | blame | history
Assets/Scripts/GameSdk/SDKCallBack.cs 8 ●●●●● patch | view | raw | blame | history
Assets/Scripts/Manager/ManagerRoot.cs 4 ●●●● patch | view | raw | blame | history
Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
@@ -23,6 +23,7 @@
    private Text versionTxt;//版本号
    private Text resVersion;//资源版本号
    float waitTime;//加载等待时间
    // Start is called before the first frame update
    void Start()
@@ -51,45 +52,38 @@
            OnClickResetBtn();
        });
        //transform.Find("Panel/Button (1)").GetComponent<Button>().onClick.AddListener(OnClickResetBtn);
        if (!GameConfig.isFirstStart)//后续直接加载
        {
            waitTime = 2f;
            loginNext();
            LoadNextScene();
        }
        else
        {
            waitTime = 0f;
            //第一次启动,初始化并且埋点
            //TDAA_SDKManager.Ins.SDKInit(ChannelID.Gm.ToString());
            //TDAA_SDKManager.Ins.Statistics(1);//成功加载登陆界面的人数
            if (!GameConfig.useSDK)
            {
                TDAA_SDKManager.Ins.SDKInit(ChannelID.Gm.ToString());
                TDAA_SDKManager.Ins.Statistics(1);//成功加载登陆界面的人数
            }
        }
    }
    void loginNext()
    {
        //if (Application.platform == RuntimePlatform.Android)
        //{
        //    //GetetDeviceIMEI();//获取安卓手机IMEI
        //    imei0 = TDAA_SDKManager.Ins.GetDeviceId();//使用设备ID
        //}
        //else if (Application.platform == RuntimePlatform.WindowsEditor)
        //{
        //    imei0 = "MyTestGemBattle123";
        //}
        GameConfig.PlayerName = SDKManager.ins.sdk.uid;
        versionTxt.text = "版本号:" + Application.version;
        //resVersion.text 暂时没有使用
        transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + SDKManager.ins.sdk.uid;
        LoadNextScene();
    }
    private void LoadNextScene()
    {
        progressSlider.gameObject.SetActive(true);
        startBtn.gameObject.SetActive(false);
@@ -100,24 +94,14 @@
        StartCoroutine(loginMy());
    }
    float waitTime;
    // private void OnEnable()
    // {
    //     SocketEvent.Ins.Add<IMessage>((int)Opcode.LoginS2C, LoginS2C);
    // }
    // private void OnDestroy()
    // {
    //     SocketEvent.Ins.Remove<IMessage>((int)Opcode.LoginS2C, LoginS2C);
    // }
    #region 获得安卓手机上的IMEI号
    public string imei0 = "";
    public string imei1 = "";
    public string meid = "";
    /// <summary>
    /// 已弃用
    /// </summary>
    void GetetDeviceIMEI()
    {
        var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
@@ -144,18 +128,16 @@
    {
        if (!isLogining)
        {
            if (GameConfig.useSDK)
            {
            // CoderM: 在这里要使用SDK来进行登录了
            SDKCallBack.ins.setNextAction("login", loginNext);
            SDKManager.ins.sdk.login();
            //progressSlider.gameObject.SetActive(true);
            //startBtn.gameObject.SetActive(false);
            //AudioSourceManager.Ins.Play(AudioEnum.UI);
            //TDAA_SDKManager.Ins.Statistics(2);//埋点
            //GameConfig.isFirstStart = false;
            //StartCoroutine(loginMy());
            }
            else
            {
                LoadNextScene();
            }
        }
        else
        {
Assets/Scripts/GameSdk/SDKCallBack.cs
@@ -13,6 +13,12 @@
    public void Awake()
    {
        if (ins)
        {
            Destroy(gameObject);
        }
        else
        {
        DontDestroyOnLoad(this);
        ins = this;
        SDKManager.ins.sdk.setCallBackClazz("SDKCallBack", "AndroidCallBack");
@@ -20,6 +26,8 @@
        SDKManager.ins.sdk.initSdk();
    }
   
    }
    public void setNextAction(string act,Action func)
    {
Assets/Scripts/Manager/ManagerRoot.cs
@@ -18,8 +18,8 @@
                DOTween.Init(true, true, LogBehaviour.Verbose).SetCapacity(200, 10);
                root = new GameObject("ManagerRoot");
                if (GameConfig.useSDK)
                    root.AddComponent<SDKCallBack>();
                // if (GameConfig.useSDK)
                //     root.AddComponent<SDKCallBack>();
                root.AddComponent<DoNotDestory>();
                root.AddComponent<MasterSocket>();
                root.AddComponent<TDAA_SDKManager>();