Exemplo n.º 1
0
    void ProcessProjectInfoFromServer(string inProjectid, string infoText)
    {
        //GlobalDebug.Clear();
        //GlobalDebug.Addline(t.text);

        projectInfoJsonFromServer      = infoText;
        projectRootInfo                = JsonUtility.FromJson <ProjectRootInfo>(infoText);
        projectRootInfo.data.projectid = inProjectid;
        //      Debug.Log(infoText);

        string log = "处理从服务获取的项目信息";

        GlobalDebug.Addline(log);
        Debug.Log(log);

        if (projectRootInfo.data.proName == null)
        {
            string debugStr = "服务器返回的项目数据为空!";
            Debug.Log(debugStr);
            Debug.LogWarning(debugStr);
            Debug.LogError(debugStr);
            GlobalDebug.Addline(debugStr);
            return;
        }

        PrcessProjectInfo(projectRootInfo);
    }
Exemplo n.º 2
0
    public void GetProjectInfoFromServer(string projectid)
    {
        Loading loading = loadingManager.AddALoading(0);

        netCtrlManager.WebRequest(
            "获取项目信息",
            pathAndURL.serverProjectInfoFinalUrl,
            loading.LoadingAnimation,
            (NetCtrlManager.RequestHandler r, UnityWebRequestAsyncOperation a, string info) =>
        {
            Debug.Log("ServerProjectInfo Load Failed!");
            //网络未连接且
            if (hasLocalCached)
            {
                projectRootInfo = JsonUtility.FromJson <ProjectRootInfo>(File.ReadAllText(pathAndURL.localProjectInfoPath));
                projectRootInfo.data.projectid = projectid;
                PrcessProjectInfo(projectRootInfo, true);
                loading.FinishLoading();
            }
            else
            {
                //                loading.displayInfo=""
            }
        },
            (DownloadHandler t) =>
        {
            ProcessProjectInfoText(projectid, t.text);
        },
            null,
            null
            );
    }
Exemplo n.º 3
0
    public void GetHXInfoFromServer(string projectid, HXInfo hXInfo)
    {
        ProjectRootInfo projectRootInfo = null;
        Loading         loading         = loadingManager.AddALoading(0);

        netCtrlManager.WebRequest(
            "获取项目信息",
            pathAndURL.serverProjectInfoFinalUrl,
            loading.LoadingAnimation,
            (NetCtrlManager.RequestHandler r, UnityWebRequestAsyncOperation a, string info) =>
        {
            //网络未连接且
            string log = "未能连接服务器";
            GlobalDebug.Addline(log);
            Debug.Log(log);
        },
            (DownloadHandler t) =>
        {
            string log4 = "已连上服务器";
            GlobalDebug.Addline(log4);
            Debug.Log(log4);

            projectRootInfo = JsonUtility.FromJson <ProjectRootInfo>(t.text);
            projectRootInfo.data.projectid = projectid;

            OnLoadHXinfoFromServer(projectRootInfo, hXInfo);
        },
            null,
            null
            );
    }
Exemplo n.º 4
0
    public void GetProjectInfoFromServer(string projectid)
    {
        Loading loading = loadingManager.AddALoading(0);

        netCtrlManager.WebRequest(
            "获取项目信息",
            pathAndURL.serverProjectInfoFinalUrl,
            loading.LoadingAnimation,
            (NetCtrlManager.RequestHandler r, UnityWebRequestAsyncOperation a, string info) =>
        {
            //网络未连接且
            string log = "未能连接服务器";
            GlobalDebug.Addline(log);
            Debug.Log(log);

            if (hasLocalCached)
            {
                string log2 = "未能连接服务器,但是有缓存";
                GlobalDebug.Addline(log2);
                Debug.Log(log2);

                loadSceneFromCache = true;

                projectRootInfo = JsonUtility.FromJson <ProjectRootInfo>(File.ReadAllText(pathAndURL.localProjectInfoPath));
                projectRootInfo.data.projectid = projectid;

//                      Debug.Log(File.ReadAllText(pathAndURL.localProjectInfoPath));
                PrcessProjectInfo(projectRootInfo, true);
                loading.FinishLoading();
            }
            else
            {
                string log3 = "未能连接服务器,且没有缓存";
                GlobalDebug.Addline(log3);
                Debug.Log(log3);
            }
        },
            (DownloadHandler t) =>
        {
            string log4 = "已连上服务器";
            GlobalDebug.Addline(log4);
            Debug.Log(log4);

            loadSceneFromCache = false;
            ProcessProjectInfoFromServer(projectid, t.text);
        },
            null,
            null
            );
    }
Exemplo n.º 5
0
    void OnLoadHXinfoFromServer(ProjectRootInfo p, HXInfo hXInfo)
    {
        if (p != null)
        {
            for (int i = 0; i < p.data.hxInfo.Length; i++)
            {
                if (p.data.hxInfo[i].modeName == hXInfo.modeName)
                {
                    p.data.hxInfo[i].modeName          = hXInfo.modeName;
                    p.data.hxInfo[i].hxAssetBundleName = hXInfo.hxAssetBundleName;
                    p.data.hxInfo[i].hxSenePath        = hXInfo.hxSenePath;
                    p.data.hxInfo[i].hash                 = hXInfo.hash;
                    p.data.hxInfo[i].crc                  = hXInfo.crc;
                    p.data.hxInfo[i].projectID            = hXInfo.projectID;
                    p.data.hxInfo[i].senceInteractiveInfo = hXInfo.senceInteractiveInfo;

//                    p.data.hxInfo[i].mode3Ddisplay = p.data.hxInfo[i].mode3Ddisplay;

                    hXInfo = p.data.hxInfo[i];

                    hXInfo.senceInteractiveInfo.huXingType.introduction = hXInfo.discr;
                    hXInfo.senceInteractiveInfo.huXingType.normalArea   = float.Parse(hXInfo.area);
                    hXInfo.senceInteractiveInfo.huXingType.fangXing     = hXInfo.modeFormat;

                    foreach (HuXingType.floor f in hXInfo.senceInteractiveInfo.huXingType.allFloor)
                    {
                        if (f.fczMesh != null)
                        {
                            f.fczMesh.gameObject.SetActive(false);
                        }
                    }

                    hasLoadedHXinfo.Add(hXInfo);

//                    assetBundleManager.sceneInteractiveManger.arManager.CheckCurrentState();

                    return;
                }
            }
        }
        Debug.LogError("未找到项目" + p.data.projectid + "得户型" + hXInfo.modeName);
    }
Exemplo n.º 6
0
    void PrcessProjectInfo(ProjectRootInfo inProjectRootInfo, bool isLoadFromCache = false)
    {
        //判断是否有外部全景图链接
        if (projectRootInfo.data.panoramaSwitch.isShow == 1)
        {
            Trigger_ToPanoramaBtn.AlphaPlayForward();
        }

        string log = "是否加载本地缓存ProjectInfo.txt:" + isLoadFromCache;

        GlobalDebug.Addline(log);
        Debug.Log(log);

        //声明信息
        if (inProjectRootInfo.data.declareSwitch == "1")
        {
            string[] infoGroup = inProjectRootInfo.data.declareContent.Split('#');
            if (infoGroup.Length == 2)
            {
                string infoFinal = infoGroup[0] + "\n" + infoGroup[1];
                warningLabel.text  = infoFinal;
                warningLabel2.text = infoFinal;
            }
        }
        else
        {
            warningLabel2.text = "";
        }

        proInfoTextTable.SetString(inProjectRootInfo.data.proName, inProjectRootInfo.data.proDiscr);



        imageCache.allNetTextrue2D = new List <NetTexture2D>();

        defaultGUI.quweiImagePlayer.netTexture2DGroup = new List <NetTexture2D>();

        for (int i = 0; i < inProjectRootInfo.data.qwInfo.Length; i++)
        {
            QwImage q = inProjectRootInfo.data.qwInfo[i];

            string modiferTime = q.modifyTime.Replace(" ", "").Replace("-", "").Replace(":", "");
            string qwImageUrl  = "downloadId=" + inProjectRootInfo.data.projectid + "&downloadType=10&mediaType=2&fileName=" + q.quweiImg;
            string qwImageName = modiferTime + q.quweiImg;

            List <NetTexture2D> tempFindGroup = imageCache.allNetTextrue2D.Where(n => n.texName == qwImageName).Select(n => n).ToList();

            if (tempFindGroup.Count == 0)
            {
                NetTexture2D temp = new NetTexture2D(qwImageName, qwImageUrl, imageCache);
                defaultGUI.quweiImagePlayer.netTexture2DGroup.Add(temp);
                imageCache.allNetTextrue2D.Add(temp);
            }
            else if (tempFindGroup.Count > 0)
            {
                defaultGUI.quweiImagePlayer.netTexture2DGroup.Add(tempFindGroup[0]);
            }
        }

        HXInfo[] hx = inProjectRootInfo.data.hxInfo;
        hxGUI.hxSceneHuXingTypeFinal = new HuXingType[hx.Length];

        for (int i = 0; i < hx.Length; i++)
        {
            hxGUI.hxSceneHuXingTypeFinal[i]                 = new HuXingType();
            hxGUI.hxSceneHuXingTypeFinal[i].hxName          = hx[i].modeName;
            hxGUI.hxSceneHuXingTypeFinal[i].viewDisplayMode = hx[i].mode3Ddisplay == null?"1":hx[i].mode3Ddisplay;
//            Debug.Log(hx[i].mode3Ddisplay);
            hxGUI.hxSceneHuXingTypeFinal[i].displayName = hx[i].display;
            //hxGUI.hxSceneHuXingTypeFinal[i].huXingID = hx[i].id;
            hxGUI.hxSceneHuXingTypeFinal[i].normalPrice  = -1;
            hxGUI.hxSceneHuXingTypeFinal[i].normalArea   = float.Parse(hx[i].area);
            hxGUI.hxSceneHuXingTypeFinal[i].fangXing     = hx[i].modeFormat;
            hxGUI.hxSceneHuXingTypeFinal[i].leiXing      = "";
            hxGUI.hxSceneHuXingTypeFinal[i].introduction = hx[i].discr;
            //hxGUI.hxSceneHuXingTypeFinal[i].pmtUrl = "";
            hxGUI.hxSceneHuXingTypeFinal[i].allFloor          = new HuXingType.floor[hx[i].floorData.Length];
            hxGUI.hxSceneHuXingTypeFinal[i].netTexture2DGroup = new List <NetTexture2D>();

            for (int j = 0; j < hxGUI.hxSceneHuXingTypeFinal[i].allFloor.Length; j++)
            {
                hxGUI.hxSceneHuXingTypeFinal[i].huXingID = hx[i].modeId;


//                Debug.Log(hx[i].floorData[j].modeFloor);
                //服务器上的modeFloor表示的意思是Unity中floorName的意思
                hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].floorName   = hx[i].floorData[j].modeFloor;
                hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].displayName = hx[i].floorData[j].floorName;

                string modiferTime = hx[i].floorData[j].modifyTime.Replace(" ", "").Replace("-", "").Replace(":", "");
                hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtUrl  = "downloadId=" + hx[i].floorData[j].modeId + "&downloadType=3&mediaType=2&fileName=" + hx[i].floorData[j].fileName;
                hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtName = modiferTime + hx[i].floorData[j].fileName;

                if (hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtName != "")
                {
//                  hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtName = "A" + (j+1) + ".jpg";
                    List <NetTexture2D> tempFindGroup = imageCache.allNetTextrue2D.Where(n => n.texName == hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtName).Select(n => n).ToList();

                    if (tempFindGroup.Count == 0)
                    {
                        //测试用
                        //NetTexture2D temp = new NetTexture2D("A" + (j + 1) + ".jpg", "A" + (j + 1) + ".jpg", imageCache);
                        //服务器用
                        NetTexture2D temp = new NetTexture2D(hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtName, hxGUI.hxSceneHuXingTypeFinal[i].allFloor[j].pmtUrl, imageCache);

                        hxGUI.hxSceneHuXingTypeFinal[i].netTexture2DGroup.Add(temp);
                        imageCache.allNetTextrue2D.Add(temp);
                    }
                    else if (tempFindGroup.Count > 0)
                    {
                        hxGUI.hxSceneHuXingTypeFinal[i].netTexture2DGroup.Add(tempFindGroup[0]);
                    }
                }
            }
        }

        if (isLoadFromCache)
        {
            assetBundleManager.serverProjectAssetBundlesInfo = JsonUtility.FromJson <ProjectAssetBundlesInfo>(File.ReadAllText(pathAndURL.localProjectAssetBundlesInfoPath));
            assetBundleManager.StartLoadAssetBundle(assetBundleManager.serverProjectAssetBundlesInfo);
        }
        else
        {
            onServerProjectInfoLoaded.Invoke(inProjectRootInfo.data.projectid);

//            assetBundleManager.LoadProjcetAssetBundles
        }
    }