public static void SetSetting(string name, uColor v) { if (!dicdata.ContainsKey(name)) { dicdata.Add(name, ""); } dicdata[name] = v.r.ToString() + "," + v.g.ToString() + "," + v.b.ToString() + "," + v.a.ToString(); }
/// ------------------------------------------------------------------------------------------------- /// <summary> Gets settings color. </summary> /// <param name="name"> Setting Name. </param> /// <param name="defaultValue"> default value to return if not found. </param> /// <returns> The settings color. </returns> /// ------------------------------------------------------------------------------------------------- public static uColor GetSettingsColor(string name, uColor defaultValue) { uColor v = defaultValue; //foreach (SimpleSettingsSheet pd in Sheets) { //if (sheet == pd.sheetname) { //if (!pd.Ready) return defaultValue; string data = GetRawData(name); string[] splitLine = data.Split(','); //not the right number of data if (splitLine.Length == 3) { try { v.a = 1; v.r = float.Parse(splitLine[0]); v.g = float.Parse(splitLine[1]); v.b = float.Parse(splitLine[2]); } catch { //Debug.Log(name + " not found!"); return(defaultValue); } } if (splitLine.Length == 4) { try { v.r = float.Parse(splitLine[0]); v.g = float.Parse(splitLine[1]); v.b = float.Parse(splitLine[2]); v.a = float.Parse(splitLine[3]); } catch { //Debug.Log(name + " not found!"); return(defaultValue); } } return(v); } } return(v); }