示例#1
0
        void AddBuildingPanelControls(WorldInfoPanel infoPanel, out UILabel assetNameLabel,
                                      out UIButton showExplorerButton, Vector3 showExplorerButtonOffset,
                                      out UIButton dumpMeshTextureButton, Vector3 dumpMeshTextureButtonOffset)
        {
            infoPanel.component.Find <UILabel>("AllGood").isVisible       = false;
            infoPanel.component.Find <UIPanel>("ProblemsPanel").isVisible = false;

            assetNameLabel = CreateLabel
                             (
                "AssetName: <>", 160, 24,
                infoPanel.component,
                new Vector3(8.0f, 48.0f, 0.0f),
                UIAlignAnchor.TopLeft
                             );

            showExplorerButton = CreateButton
                                 (
                "Find in SceneExplorer", 160, 24,
                infoPanel.component,
                showExplorerButtonOffset,
                UIAlignAnchor.TopRight,
                (component, param) =>
            {
                InstanceID instance = ReflectionUtil.GetPrivate <InstanceID>(infoPanel, "m_InstanceID");
                sceneExplorer.ExpandFromRefChain(buildingsBufferRefChain.Add(instance.Building));
                sceneExplorer.visible = true;
            }
                                 );

            dumpMeshTextureButton = CreateButton
                                    (
                "Dump asset", 160, 24,
                infoPanel.component,
                dumpMeshTextureButtonOffset,
                UIAlignAnchor.TopRight,
                (component, param) =>
            {
                var instance  = ReflectionUtil.GetPrivate <InstanceID>(infoPanel, "m_InstanceID");
                var building  = BuildingManager.instance.m_buildings.m_buffer[instance.Building];
                var assetName = building.Info.name;
                DumpUtil.DumpAsset(assetName, building.Info.m_mesh, building.Info.m_material, building.Info.m_lodMesh, building.Info.m_lodMaterial);
            }
                                    );
        }
        void AddZonedBuildingPanelControls()
        {
            zonedBuildingInfoPanel.component.Find <UILabel>("AllGood").isVisible       = false;
            zonedBuildingInfoPanel.component.Find <UIPanel>("ProblemsPanel").isVisible = false;

            zonedBuildingAssetNameLabel = CreateLabel
                                          (
                "AssetName: <>", 160, 24,
                zonedBuildingInfoPanel.component,
                new Vector3(8.0f, 48.0f, 0.0f),
                UIAlignAnchor.TopLeft
                                          );

            zonedBuildingShowExplorerButton = CreateButton
                                              (
                "Find in SceneExplorer", 160, 24,
                zonedBuildingInfoPanel.component,
                new Vector3(-8.0f, 100.0f, 0.0f),
                UIAlignAnchor.TopRight,
                (component, param) =>
            {
                InstanceID instance = Util.GetPrivate <InstanceID>(zonedBuildingInfoPanel, "m_InstanceID");
                sceneExplorer.ExpandFromRefChain(buildingsBufferRefChain.Add(instance.Building));
                sceneExplorer.visible = true;
            }
                                              );

            zonedBuildingDumpMeshTextureButton = CreateButton
                                                 (
                "Dump mesh+texture", 160, 24,
                zonedBuildingInfoPanel.component,
                new Vector3(-8.0f, 132.0f, 0.0f),
                UIAlignAnchor.TopRight,
                (component, param) =>
            {
                InstanceID instance = Util.GetPrivate <InstanceID>(zonedBuildingInfoPanel, "m_InstanceID");
                var building        = BuildingManager.instance.m_buildings.m_buffer[instance.Building];
                var material        = building.Info.m_material;
                var mesh            = building.Info.m_mesh;

                var assetName = building.Info.name;

                Log.Warning(String.Format("Dumping asset \"{0}\"", assetName));
                Util.DumpMeshToOBJ(mesh, String.Format("{0}.obj", assetName));
                Util.DumpTextureToPNG(material.GetTexture("_MainTex"), String.Format("{0}_MainTex.png", assetName));
                Util.DumpTextureToPNG(material.GetTexture("_XYSMap"), String.Format("{0}_xyz.png", assetName));
                Util.DumpTextureToPNG(material.GetTexture("_ACIMap"), String.Format("{0}_aci.png", assetName));
                Log.Warning("Done!");
            }
                                                 );
        }