using Newtonsoft.Json.Linq;
using SC.XR.Unity;
using UnityEngine;

public class UserManager : SingletonMono<UserManager>
{
    public void loginBack(bool isLogin)
    {
        if (isLogin)
        {
            UserSceneManager.Instance.callback += (bool b) => { 
            
                //初始化场景结束
                if(b)
                {
                    GameScene.Instance.ShowScenes();
                }
            
            };
            UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.getMaterialValue);
            HttpTool.Instance.GetAllMaterials(HttpAction.material_init, "", (string msgMater)=> {

                Debug.Log("/material/init===>" + msgMater);
                ModelManager.Instance.init(msgMater);

                UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.getAllScene);
                HttpTool.Instance.Get(HttpAction.project_init, (string msg) => {
                    Debug.Log("/project/index===>" + msg);
                   StartCoroutine( UserSceneManager.Instance.initScene(msg));
                    // GameScene.Instance.ShowScenes();
                });
            });
            /*
            HttpTool.Instance.Get(HttpAction.viewpoint_init, (string msg) => {

                Debug.Log("/project/viewpoint_init===>" + msg);

            });*/

        }

    }
}