Пример #1
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
        }
    }