public void AddScorePartwise(ScorePartwiseMusicXML scorePartXML)
        {
            if (scorePartXML == null)
            {
                throw new NullReferenceException("null scorePart object"); //! temp
            }
            IsBlank         = false;
            partwise        = scorePartXML;
            PagesCollection = new ObservableCollection <UIElement>();
            PartProperties pp = ViewModelLocator.Instance.Main.PartsProperties[scorePartXML.Part[0].Id];
            bool           autoLayoutSupport = ViewModelLocator.Instance.Main.CurrentScoreProperties.AutoLayoutSupportByScore;

            //autoLayoutSupport = false;
            if (autoLayoutSupport)
            {
                foreach (var pages in pp.PartSysemsInPages)
                {
                    AddPageToCollection(scorePartXML);
                }
            }
            else
            {
                advancedLayout  = new AdvancedMeasureLayout(partwise);
                PagesCollection = advancedLayout.PagesCollection;
            }
        }
    //Directly reading from text file and returning it to main load method
    private static PartCollection LoadParts(string path)
    {
        StreamReader reader = new StreamReader(path);
        string       s      = reader.ReadLine();

        while (s != null)
        {
            char[]         delimiter = { ' ' };
            string[]       fields    = s.Split(delimiter);
            PartProperties p         = new PartProperties
            {
                partName = fields[0],
                posX     = float.Parse(fields[1]),
                posY     = float.Parse(fields[2]),
                posZ     = float.Parse(fields[3]),
                rotX     = float.Parse(fields[4]),
                rotY     = float.Parse(fields[5]),
                rotZ     = float.Parse(fields[6])
            };
            partCollection.parts.Add(p);
            s = reader.ReadLine();
        }
        reader.Close();
        return(partCollection);
    }
Exemple #3
0
 public void SpawnCD()
 {
     Instantiate(prefabCD, SpawnPoint.position, Quaternion.identity);
     propz          = prefabCD.GetComponent <PartProperties>();
     propz.partName = "CDDrive";
     propz.fitment  = "All";
     RNG();
 }
Exemple #4
0
 public void SpawnRAM()
 {
     Instantiate(prefabRAM, SpawnPoint.position, Quaternion.identity);
     propz          = prefabRAM.GetComponent <PartProperties>();
     propz.partName = "RAM";
     propz.fitment  = "All";
     RNG();
 }
Exemple #5
0
 public void SpawnM()
 {
     Instantiate(prefabM, SpawnPoint.position, Quaternion.identity);
     propz          = prefabCPU.GetComponent <PartProperties>();
     propz.partName = "Motherboard";
     propz.fitment  = "All";
     RNG();
 }
Exemple #6
0
 public void SpawnKBD()
 {
     Instantiate(prefabKBD, SpawnPoint.position, Quaternion.identity);
     propz          = prefabKBD.GetComponent <PartProperties>();
     propz.partName = "Keyboard";
     propz.fitment  = "All";
     RNG();
 }
Exemple #7
0
                public static PartProperties Get(SldWorks swApp, ModelDoc2 childDoc, string configuration)
                {
                    swApp.ActivateDoc(childDoc.GetTitle());
                    var swCustProp = childDoc.Extension.CustomPropertyManager[configuration];

                    var configProps = new PartProperties
                    {
                        Config       = configuration,
                        Наименование = GetProperty(swCustProp, "Наименование"),
                        Обозначение  = GetProperty(swCustProp, "Обозначение"),
                        Материал     = GetProperty(swCustProp, "Материал"),
                    };

                    return(configProps);
                }
Exemple #8
0
 public void CopyProperties()
 {
     try
     {
         parentDoc = (IModelDoc2)swApp.IActiveDoc;
         var parentItem = ExternalFileReferences.Get(swApp);
         childDoc = swApp.OpenDoc6(parentItem.ModelPathName, (int)swDocumentTypes_e.swDocPART,
                                   (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0);
         swApp.ActivateDoc(parentDoc.GetTitle());
         parentDoc.SelectByName(0, parentItem.ModelPathName);
         parentItem = ExternalFileReferences.Get(swApp);
         PartProperties.AddAll(swApp, (ModelDoc2)parentDoc, PartProperties.GetAll(swApp, childDoc, ExternalFileReferences.Get(swApp).ConfigName));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #9
0
            public void CopyProperties()
            {
                try
                {
                    parentDoc = (IModelDoc2)swApp.IActiveDoc;
                    var parentItem = ExternalFileReferences.Get(swApp);

                    childDoc = swApp.OpenDoc6(parentItem.ModelPathName, (int)swDocumentTypes_e.swDocPART,
                                              (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0);
                    swApp.ActivateDoc(parentDoc.GetTitle());
                    var props = PartProperties.GetAll(swApp, childDoc, ExternalFileReferences.Get(swApp).ConfigName);
                    //foreach (var item in props)
                    //{
                    //    MessageBox.Show(item.Key + " - " + item.Value, "Свойство заготовки");
                    //}
                    PartProperties.AddAll(swApp, (ModelDoc2)parentDoc, props);
                }
                catch (Exception)
                {
                    throw;
                }
            }
Exemple #10
0
        public List <PartProperties> CustomPropertiesList()
        {
            OpenDoc();
            var customPropertiesList = new List <PartProperties>();
            var partProperties       = new PartProperties();
            var customPropertyNames  = (object[])_swDocument13.GetCustomPropertyNames();

            //if (customPropertyNames == null) return null;

            foreach (string customPropertyName in customPropertyNames)
            {
                string             linkedTo;
                SwDmCustomInfoType nType;
                partProperties.PropName = customPropertyName;
                //MessageBox.Show(customPropertyName.ToString());
                customPropertiesList.Add(partProperties);
                var values = _swDocument13.GetCustomPropertyValues(customPropertyName, out nType, out linkedTo);
                if (values == null)
                {
                    return(null);
                }
            }
            return(customPropertiesList);
        }
 //Adds parts within the game to the data array
 public static void AddPartData(PartProperties properties)
 {
     partCollection.parts.Add(properties);
 }
    //Loading in all game objects from the save text file
    public void Load(string path, string casePath)
    {
        GameObject p;
        GameObject parentp = GameObject.Find("TEST OBJECTS");
        GameObject b       = GameObject.Find("pc_tower_el_mierde");
        GameObject c       = GameObject.Find("monitor");
        GameObject d       = GameObject.Find("CaseCover_placed");
        GameObject e       = GameObject.Find("CaseCover");
        var        oldP    = GameObject.FindGameObjectsWithTag("item");

        foreach (GameObject o in oldP)
        {
            if (!o.transform.IsChildOf(b.transform) && !o.name.Contains("Case") && !o.name.Contains("plug") &&
                !o.name.Contains("paint") && !o.transform.IsChildOf(c.transform) &&
                !o.name.Contains("Cover") && !o.name.Contains("notepad"))
            {
                GameObject.Destroy(o);
            }
        }
        ArrayList    caseProp = new ArrayList();
        StreamReader reader   = new StreamReader(casePath);
        string       s        = reader.ReadLine();

        if (s == "True")
        {
            parentp.transform.Find("CaseCover_placed").gameObject.SetActive(true);
            parentp.transform.Find("CaseCover").gameObject.SetActive(false);
            if (d == null)
            {
                parentp.transform.Find("pc_tower_el_mierde").SetParent(parentp.transform.Find("CaseCover_placed"));
                parentp.transform.Find("CaseCover_placed").Find("pc_tower_el_mierde").GetComponent <MeshCollider>().convex = true;
            }
            s = reader.ReadLine();
            char[]   delimiter1 = { ' ' };
            string[] fields     = s.Split(delimiter1);
            parentp.transform.Find("CaseCover_placed").position = new Vector3(float.Parse(fields[0]), float.Parse(fields[1]), float.Parse(fields[2]));
        }
        else
        {
            s = reader.ReadLine();
            char[]   delimiter1 = { ' ' };
            string[] fields     = s.Split(delimiter1);
            parentp.transform.Find("CaseCover_placed").position = new Vector3(float.Parse(fields[0]), float.Parse(fields[1]), float.Parse(fields[2]));
            parentp.transform.Find("CaseCover").gameObject.SetActive(true);
            b.transform.SetParent(parentp.transform);
            parentp.transform.Find("CaseCover").SetParent(parentp.transform);
            parentp.transform.Find("CaseCover_placed").gameObject.SetActive(false);
            s      = reader.ReadLine();
            fields = s.Split(delimiter1);
            b.transform.position = new Vector3(float.Parse(fields[0]), float.Parse(fields[1]), float.Parse(fields[2]));
            s      = reader.ReadLine();
            fields = s.Split(delimiter1);
            parentp.transform.Find("CaseCover").position = new Vector3(float.Parse(fields[0]), float.Parse(fields[1]), float.Parse(fields[2]));
        }
        s = reader.ReadLine();
        while (s != null)
        {
            char[]         delimiter2 = { ' ' };
            string[]       fields2    = s.Split(delimiter2);
            PartProperties cp         = new PartProperties
            {
                partName = fields2[0]
            };
            if (fields2[1] == "True")
            {
                cp.placed = true;
            }
            else
            {
                cp.placed = false;
            }
            caseProp.Add(cp);
            s = reader.ReadLine();
        }
        reader.Close();
        LoadCaseProp(b.transform, caseProp, 0);
        partCollection = LoadParts(path);
        foreach (PartProperties part in partCollection.parts)
        {
            if (part.partName == "MB")
            {
                p = Instantiate(prefM, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "CPU")
            {
                p = Instantiate(prefCPU, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "CPUFan")
            {
                p = Instantiate(prefCPUF, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "GPU")
            {
                p = Instantiate(prefGPU, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "Storage")
            {
                p = Instantiate(prefS, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "RAM")
            {
                p = Instantiate(prefRAM, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "PSU")
            {
                p = Instantiate(prefPSU, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "Keyboard")
            {
                p = Instantiate(prefKBD, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "Mouse")
            {
                p = Instantiate(prefMOU, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
            else if (part.partName == "CDDrive")
            {
                p = Instantiate(prefCD, new Vector3(part.posX, part.posY, part.posZ), Quaternion.Euler(part.rotX, part.rotY, part.rotZ));
                p.transform.parent = parentp.transform;
                p.GetComponent <Renderer>().material.SetColor("_Color", part.c);
            }
        }
        ClearParts();
    }
Exemple #13
0
        public List<PartProperties> CustomPropertiesList()
        {
            OpenDoc();
            var customPropertiesList = new List<PartProperties>();
            var partProperties = new PartProperties();
            var customPropertyNames = (object[])_swDocument13.GetCustomPropertyNames();

            //if (customPropertyNames == null) return null;

            foreach (string customPropertyName in customPropertyNames)
            {
                string linkedTo;
                SwDmCustomInfoType nType;
                partProperties.PropName = customPropertyName;
                //MessageBox.Show(customPropertyName.ToString());
                customPropertiesList.Add(partProperties);
                var values = _swDocument13.GetCustomPropertyValues(customPropertyName, out nType, out linkedTo);
                if (values == null) return null;
            }
            return customPropertiesList;
        }