Esempio n. 1
0
        private void SelectRecord(int id)
        {
            flagEdit = 2;

            selectedRecord = id;

            SkinsTable.Skin tRec = listSkins.Find(x => x.ID == id);
            skinName          = tRec.Name;
            bodyModelSelected = bodyModelList.FindIndex(x => x.ID == tRec.IDModel);
            defSkin           = tRec.DefaultSkin;

            FilterSlots(bodyModelSelected);

            List <SkinsTable.SkinSlots> tList = skinTable.GetSlotsList(selectedRecord, true);

            //Fill the material list
            for (int i = 0; i < tList.Count; i++)
            {
                MaterialPrefab tMat = new MaterialPrefab();
                tMat            = materialList.Find(x => x.IDSlot == tList [i].IDSkinSlot);
                tMat.PrefabName = tList [i].MaterialName;

                //Try to find the object
                Material prefabToLoad = (Material)Resources.Load(_config.GetPathName(CSConfig.PathTypeEnum.SkinsPath) + "/" + tMat.PrefabName);
                if (prefabToLoad != null)
                {
                    tMat.Prefab         = prefabToLoad;
                    tMat.PrefabSelected = prefabToLoad;
                }
                else
                {
                    tMat.PrefabError = true;
                }
            }
        }
Esempio n. 2
0
        public MaterialData(MaterialPrefab prefab, Vec3 diffuseColor)
        {
            this.diffuseColor = diffuseColor;

            switch (prefab)
            {
            case MaterialPrefab.ivory:
                this.ref_idx          = 10;
                this.specularExponent = 1.0;
                this.a0 = 0.6;
                this.a1 = 0.3;
                this.a2 = 0.1;
                this.a3 = 0.0;
                break;

            case MaterialPrefab.glass:
                this.ref_idx          = 125;
                this.specularExponent = 1.5;
                this.a0 = 0.0;
                this.a1 = 0.5;
                this.a2 = 0.1;
                this.a3 = 0.8;
                break;

            case MaterialPrefab.rubber:
                this.ref_idx          = 10;
                this.specularExponent = 1.0;
                this.a0 = 0.9;
                this.a1 = 0.1;
                this.a2 = 0.0;
                this.a3 = 0.0;
                break;

            case MaterialPrefab.mirror:
                this.ref_idx          = 1450;
                this.specularExponent = 1.0;
                this.a0 = 0.0;
                this.a1 = 10.0;
                this.a2 = 0.8;
                this.a3 = 0.0;
                break;

            default:
                this.ref_idx          = 1450;
                this.specularExponent = 1.0;
                this.a0 = 0.0;
                this.a1 = 10.0;
                this.a2 = 0.8;
                this.a3 = 0.0;
                break;
            }
        }
Esempio n. 3
0
        private void FilterSlots(int indexStruc)
        {
            int idStruc = bodyModelList [indexStruc].IDBodyStructure;

            //Filter available slots
            materialList.Clear();
            List <BodyStructureTable.BodySkinsSlots> tList = new List <BodyStructureTable.BodySkinsSlots> ();

            tList = bodyStrucTable.GetSkinSlotList(idStruc);

            for (int i = 0; i < tList.Count; i++)
            {
                MaterialPrefab toAdd = new MaterialPrefab();

                toAdd.SlotName = tList [i].SlotName;
                toAdd.IDSlot   = tList [i].IDSlot;

                materialList.Add(toAdd);
            }
        }