예제 #1
0
        private void NewRecord()
        {
            clothRecord = new ClothTable.Cloth();

            flagEdit          = 1;
            selectedRecord    = 0;
            bodyStrucSelected = -1;
            bodyStructIndex   = 0;
        }
예제 #2
0
        private void SelectRecord(int id)
        {
            selectedRecord = id;

            clothRecord = clothTable.GetRecord(id);

            bodyStrucSelected = bodyStrucList.FindIndex(x => x.ID == clothRecord.IDBodyStructure);

            FilterSlots(bodyStrucSelected);

            //Update selected slots array
            List <ClothTable.ClothSlots> tList = clothTable.GetSlotsList(selectedRecord);
            int index = 0;

            for (int i = 0; i < tList.Count; i++)
            {
                index = bodyStrucSlots.FindIndex(x => x.IDSlot == tList [i].ClothSlot);
                if (index > -1)
                {
                    selectedSlots [index] = true;
                }
            }

            //Update models list
            List <ClothTable.ClothModels> mList = clothTable.GetModelsList(selectedRecord);

            for (int i = 0; i < mList.Count; i++)
            {
                ModelPrefab tRec = modelsList.Find(x => x.IDSubtype == mList [i].IDBodySubtype);
                tRec.PrefabName = mList [i].ModelName;

                //Try to find the object
                GameObject prefabToLoad = (GameObject)Resources.Load(_config.GetPathName(CSConfig.PathTypeEnum.ClothPath) + "/" + tRec.PrefabName);
                if (prefabToLoad != null)
                {
                    tRec.Prefab         = prefabToLoad;
                    tRec.PrefabSelected = prefabToLoad;
                }
                else
                {
                    tRec.PrefabError = true;
                }
            }

            flagEdit = 2;
        }