コード例 #1
0
    private void CreateGDCs()
    {
        Debug.Log("Start Creation of GDC's");
        foreach (SO_PackageData.gdc_data item in SO_PackageData.instance.gdcs)
        {
            GDC gdc = new GDC(item.name, item.description, item.latitude, item.longitude);

            foreach (SO_PackageData.gdc_element currElement in item.elements)
            {
                GDCElement newElement;
                //Convert string to enum
                Enum.TryParse(currElement.type, out ElementType type);

                switch (type)
                {
                case ElementType.Sample:
                    //Helper.UnzipFile(rootPath + currElement.relativePath);
                    newElement = new GDCElementSample(currElement, rootPath, gdc.ElementsContentTransform);
                    break;

                case ElementType.Panoramic:
                    newElement = new GDCElementPanoramic(currElement, rootPath, gdc.ElementsContentTransform);
                    break;

                case ElementType.File:
                    newElement = new GDCElementFile(currElement, rootPath, gdc.ElementsContentTransform);
                    //((GDCElementFile)newElement).GoFile.transform.SetParent(gdc.ElementsContentTransform);
                    break;

                default:
                    Debug.Log("Unknown element type detected. Type: " + type);
                    continue;
                }
                gdc.Elements.Add(newElement);
            }
            gdc.ConfigureGDCRootObject();

            AddInteractiveObjectToGDC(ref gdc);
            loadedGDCs.Add(gdc);
        }
    }