Beispiel #1
0
    private void New(VCESceneSetting setting)
    {
        m_Setting = setting;
        m_IsoData = new VCIsoData();
        m_IsoData.Init(VCIsoData.ISO_VERSION, setting, new VCIsoOption(true));
        m_IsoData.m_HeadInfo.Category = setting.m_Category;
        m_Stencil = new VCIsoData();
        m_Stencil.Init(VCIsoData.ISO_VERSION, setting, new VCIsoOption(true));
        m_TempIsoMat.Init();
        m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled" + VCConfig.s_IsoFileExt;
        int i = 2;

        while (File.Exists(VCConfig.s_IsoPath + m_DocumentPath))
        {
            m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled (" + i.ToString() + ")" + VCConfig.s_IsoFileExt;
            ++i;
        }
        VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
        m_MeshComputer = new VCMCComputer();
        m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
        m_CreationAttr = new CreationAttr();
#if false
        this.GenSomeVoxelForTest();
#endif
    }
Beispiel #2
0
    public VCEScene(string iso_path)
    {
        m_IsoData = new VCIsoData();
        if (!LoadIso(iso_path))
        {
            Destroy();
            throw new Exception("Load ISO error");
        }

        VCESceneSetting isosetting = m_IsoData.m_HeadInfo.FindSceneSetting();

        if (isosetting != null)
        {
            m_Setting = isosetting;
            m_Stencil = new VCIsoData();
            m_Stencil.Init(VCIsoData.ISO_VERSION, m_Setting, new VCIsoOption(true));
            m_TempIsoMat.Init();
            m_DocumentPath = iso_path;
            VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
            m_MeshComputer = new VCMCComputer();
            m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
            m_CreationAttr = new CreationAttr();
        }
        else
        {
            Destroy();
            throw new Exception("Scene setting error");
        }
    }
Beispiel #3
0
 void OnDestroy()
 {
     StopAllCoroutines();
     m_Loading = false;
     if (m_Computer != null)
     {
         m_Computer.Destroy();
         m_Computer = null;
     }
 }
Beispiel #4
0
    public VCEScene(VCESceneSetting setting, int template)
    {
        TextAsset asset = Resources.Load <TextAsset>("Isos/" + setting.m_Id.ToString() + "/" + template.ToString());

        if (asset == null)
        {
            New(setting);
            return;
        }

        m_IsoData = new VCIsoData();
        if (!m_IsoData.Import(asset.bytes, new VCIsoOption(true)))
        {
            Destroy();
            throw new Exception("Load Template ISO error");
        }

        VCESceneSetting isosetting = m_IsoData.m_HeadInfo.FindSceneSetting();

        if (isosetting != null)
        {
            m_Setting = isosetting;
            m_Stencil = new VCIsoData();
            m_Stencil.Init(VCIsoData.ISO_VERSION, m_Setting, new VCIsoOption(true));
            m_TempIsoMat.Init();
            m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled" + VCConfig.s_IsoFileExt;
            int i = 2;
            while (File.Exists(VCConfig.s_IsoPath + m_DocumentPath))
            {
                m_DocumentPath = VCConfig.s_Categories[setting.m_Category].m_DefaultPath + "/Untitled (" + i.ToString() + ")" + VCConfig.s_IsoFileExt;
                ++i;
            }
            VCEditor.Instance.m_MeshMgr.m_ColorMap = m_IsoData.m_Colors;
            m_MeshComputer = new VCMCComputer();
            m_MeshComputer.Init(m_Setting.m_EditorSize, VCEditor.Instance.m_MeshMgr);
            m_CreationAttr = new CreationAttr();
        }
        else
        {
            Destroy();
            throw new Exception("Scene setting error");
        }
    }
Beispiel #5
0
    void  InitCreationID(int creationId)
    {
        if (m_Computer != null)
        {
            m_Computer.Destroy();
        }

        CreationData crd = CreationMgr.GetCreation(creationId);

        if (crd != null)
        {
            m_CreationID   = creationId;
            m_CreationData = crd;

            m_MeshMgr  = GetComponent <VCMeshMgr>();
            m_Computer = new VCMCComputer();
            m_Computer.Init(new IntVector3(crd.m_IsoData.m_HeadInfo.xSize,
                                           crd.m_IsoData.m_HeadInfo.ySize,
                                           crd.m_IsoData.m_HeadInfo.zSize),
                            m_MeshMgr, false);

            // [VCCase] - Create box collider
            if (crd.m_Attribute.m_Type == ECreation.Vehicle ||
                crd.m_Attribute.m_Type == ECreation.Aircraft ||
                crd.m_Attribute.m_Type == ECreation.Boat ||
                crd.m_Attribute.m_Type == ECreation.SimpleObject ||
                crd.m_Attribute.m_Type == ECreation.AITurret)
            {
                m_Computer.m_CreateBoxCollider = true;
            }
        }
        else
        {
            m_CreationID   = 0;
            m_CreationData = null;
            m_Computer     = null;
            m_MeshMgr      = null;
        }
    }
Beispiel #6
0
    void InitCreationIDClone(int creationId, VFCreationDataSource dataSource, VCMeshMgr mesh_mgr)
    {
        if (m_Computer != null)
        {
            m_Computer.Destroy();
        }

        CreationData crd = CreationMgr.GetCreation(creationId);

        if (crd != null)
        {
            m_CreationID   = creationId;
            m_CreationData = crd;

            m_MeshMgr = mesh_mgr;
            m_MeshMgr.m_LeftSidePos = !mesh_mgr.m_LeftSidePos;
            m_Computer = new VCMCComputer();
            m_Computer.InitClone(dataSource, m_MeshMgr, false);

            if (crd.m_Attribute.m_Type == ECreation.Vehicle ||
                crd.m_Attribute.m_Type == ECreation.Aircraft ||
                crd.m_Attribute.m_Type == ECreation.Boat ||
                crd.m_Attribute.m_Type == ECreation.SimpleObject ||
                crd.m_Attribute.m_Type == ECreation.AITurret)
            {
                m_Computer.m_CreateBoxCollider = true;
            }
        }
        else
        {
            m_CreationID   = 0;
            m_CreationData = null;
            m_Computer     = null;
            m_MeshMgr      = null;
        }
    }