public CharacterCustomizationData GetCustomizationData() { CharacterCustomizationData data = new CharacterCustomizationData(MaterialBody.color); Dictionary <ClothingSlot, CharacterClothing> dictionary = new Dictionary <ClothingSlot, CharacterClothing>(); List <GameObject> accessoryObjects = GetAccessoryObjects(); foreach (ClothingSlot slot in ClothingObjects.Keys) { if (IsClothingSlotUsed(slot)) { GameObject clothingObj = transform.GetChild(ClothingObjects[slot]).gameObject; CharacterClothing characterClothing = new CharacterClothing(clothingObj.GetComponent <ClothingSlotScript>().ClothingIndex, clothingObj.GetComponent <Renderer>().sharedMaterial.color); dictionary.Add(slot, characterClothing); } } foreach (GameObject accObj in accessoryObjects) { CharacterAccessory charAcc = new CharacterAccessory(accObj.GetComponent <AccessoryScript>().AccessoryIndex, accObj.GetComponent <Renderer>().sharedMaterial.color); data.CurrentAccessories.Add(charAcc); } data.SetUpLists(dictionary); //TEMP: Debug.Log("GENERATE CUSTOMIZATION DATA:"); Debug.Log("Body Color: " + data.GetBodyColor().ToString()); for (int i = 0; i < data.CurrentClothing_Keys.Count; i++) { Debug.Log("*" + data.CurrentClothing_Keys[i].ToString() + "* - Clothing ID: " + data.CurrentClothing_Values[i].ClothingID.ToString() + "; Color: " + data.CurrentClothing_Values[i].GetColor().ToString()); } for (int i = 0; i < data.CurrentAccessories.Count; i++) { Debug.Log("*" + "ACC ID: " + data.CurrentAccessories[i].AccessoryID.ToString() + "; ACC Color: " + data.CurrentAccessories[i].GetColor().ToString()); } return(data); }
/// <summary> /// Add the labels to the original blob /// </summary> /// <param name="__instance"></param> /// <param name="catData"></param> static void AddExtraCategoryDataToBlob(CharacterCreatorController __instance, Blob catData) { CharacterDesignDatabase dd = GameContext.CharacterDesignDatabase; CharacterSpeciesBody body = SendDataPatch.GetFieldValue(__instance, "_body") as CharacterSpeciesBody; Blob setupData = catData.FetchBlob("Setup_Data"); for (int i6 = 0; i6 < body.Palettes.Count; i6++) { Blob skinColourBlob = setupData.FetchBlob("Char_3").FetchBlob(IntegerStrings.ToString(0)).FetchBlob("palettes") .FetchBlob(IntegerStrings.ToString(i6)); Palette palette = default(Palette); GameContext.PaletteDatabase.TryGetPalette(body.Palettes[i6], out palette); skinColourBlob.SetString("label", SendDataPatch.LocalisePaletteCode(palette.Code)); } for (int i5 = 0; i5 < dd.Hairs.Count; i5++) { Blob hair = setupData.FetchBlob("Hair_1").FetchBlob(IntegerStrings.ToString(i5)); CharacterAccessory hairItem = dd.Hairs[i5]; for (int i = 0; i < hairItem.Palettes.Count; i++) { Blob hairColourBlob = hair.FetchBlob("palettes").FetchBlob(IntegerStrings.ToString(i)); Palette palette2 = default(Palette); GameContext.PaletteDatabase.TryGetPalette(hairItem.Palettes[i], out palette2); hairColourBlob.SetString("label", SendDataPatch.LocalisePaletteCode(palette2.Code)); } } for (int i4 = 0; i4 < dd.Eyes.Count; i4++) { Blob eyes = setupData.FetchBlob("Eyes_1").FetchBlob(IntegerStrings.ToString(i4)); CharacterAccessory eyeItem = dd.Eyes[i4]; for (int j = 0; j < eyeItem.Palettes.Count; j++) { Blob hairColourBlob2 = eyes.FetchBlob("palettes").FetchBlob(IntegerStrings.ToString(j)); Palette palette3 = default(Palette); GameContext.PaletteDatabase.TryGetPalette(eyeItem.Palettes[j], out palette3); hairColourBlob2.SetString("label", SendDataPatch.LocalisePaletteCode(palette3.Code)); } } for (int i3 = 0; i3 < dd.StarterShirts.Count; i3++) { Blob shirt = setupData.FetchBlob("Clothing_1").FetchBlob(IntegerStrings.ToString(i3)); CharacterAccessory shirtItem = dd.StarterShirts[i3]; for (int k = 0; k < shirtItem.Palettes.Count; k++) { Blob shirtColourBlob = shirt.FetchBlob("palettes").FetchBlob(IntegerStrings.ToString(k)); Palette palette4 = default(Palette); GameContext.PaletteDatabase.TryGetPalette(shirtItem.Palettes[k], out palette4); shirtColourBlob.SetString("label", SendDataPatch.LocalisePaletteCode(palette4.Code)); } } for (int i2 = 0; i2 < dd.StarterTrousers.Count; i2++) { Blob trousers = setupData.FetchBlob("Clothing_3").FetchBlob(IntegerStrings.ToString(i2)); CharacterAccessory trouserItem = dd.StarterTrousers[i2]; for (int l = 0; l < trouserItem.Palettes.Count; l++) { Blob trouserColourBlob = trousers.FetchBlob("palettes").FetchBlob(IntegerStrings.ToString(l)); Palette palette5 = default(Palette); GameContext.PaletteDatabase.TryGetPalette(trouserItem.Palettes[l], out palette5); trouserColourBlob.SetString("label", SendDataPatch.LocalisePaletteCode(palette5.Code)); } } for (int n = 0; n < dd.StarterShoes.Count; n++) { Blob shoes = setupData.FetchBlob("Clothing_5").FetchBlob(IntegerStrings.ToString(n)); CharacterAccessory shoeItem = dd.StarterShoes[n]; for (int m = 0; m < shoeItem.Palettes.Count; m++) { Blob shoeColourBlob = shoes.FetchBlob("palettes").FetchBlob(IntegerStrings.ToString(m)); Palette palette6 = default(Palette); GameContext.PaletteDatabase.TryGetPalette(shoeItem.Palettes[m], out palette6); shoeColourBlob.SetString("label", SendDataPatch.LocalisePaletteCode(palette6.Code)); } } }