LightingPalette ParseDataToLightingPalette(LightingPalette temp, string[] data) { int i = 1; temp.DirectionalLightColor = ParseStringToColor(data[i++]); temp.FogColor = ParseStringToColor(data[i++]); temp.LinearFogStart = float.Parse(data[i++]); temp.LinearFogEnd = float.Parse(data[i++]); temp.AmbientLightColor = ParseStringToColor(data[i++]); temp.BgColor = ParseStringToColor(data[i++]); //temp.FloorDiffuseColor = ParseColor(data[i++]); temp.FloorDyeColor1 = ParseStringToColor(data[i++]); temp.FloorDyeColor2 = ParseStringToColor(data[i++]); //temp.FloorReflectionColor = ParseColor(data[i++]); temp.FloorEmissionColor = ParseStringToColor(data[i++]); temp.OutsideWallLightColor = ParseStringToColor(data[i++]); temp.PillarLightColor1 = ParseStringToColor(data[i++]); temp.PillarLightColor2 = ParseStringToColor(data[i++]); temp.WallEmissionColor1 = ParseStringToColor(data[i++]); temp.WallEmissionColor2 = ParseStringToColor(data[i++]); temp.PropEmissionColor1 = ParseStringToColor(data[i++]); temp.PropEmissionColor2 = ParseStringToColor(data[i++]); temp.GateEmissionColor1 = ParseStringToColor(data[i++]); return(temp); }
void InitializePaletteList() { if (PaletteList.Count < 9) // only recreate the list, if there is no enough elemets in the list { PaletteList.Clear(); Debug.Log("!!!!!! InitializePaletteList: PaletteList " + PaletteList.Count); for (int i = 0; i < 9; i++) { LightingPalette currentPalette = new LightingPalette(); PaletteList.Add(currentPalette); } } }
// read scene lighting data from a file void ReadFromFile() { string path = "Assets/Resources/ScenePalette.txt"; StreamReader reader = new StreamReader(path); string text = reader.ReadToEnd(); string[] paletteText = text.Split("\n"[0]); PaletteList.Clear(); // clear PaletteList first for (int i = 2; i < 11; i++) // how many lines(should be 9), each line = 1 palette { LightingPalette currentPalette = new LightingPalette(); string[] paletteData = (paletteText[i].Trim()).Split('\t'); PaletteList.Add(ParseDataToLightingPalette(currentPalette, paletteData)); } Debug.Log("!!!!!!!!!!! Get lighting data from file done !!!!!!!!!!!!!!"); }