//通常のパラメーターを追加 public void AddData(StringGrid grid) { foreach (StringGridRow row in grid.Rows) { if (row.RowIndex < grid.DataTopRow) { continue; } if (row.IsEmptyOrCommantOut) { continue; } AdvParamData data = new AdvParamData(); if (!data.TryParse(row)) { Debug.LogError(row.ToErrorString(" Parse Error")); continue; } else { if (Tbl.ContainsKey(data.Key)) { Debug.LogError(row.ToErrorString(data.Key + " is already contaisn")); } else { Tbl.Add(data.Key, data); } } } }
//ヘッダ情報と値一覧から初期化 public AdvParamStruct(AdvParamStruct header, StringGridRow values) { int index = 1; foreach (var item in header.Tbl.Values) { string value = index < values.Length ? values.Strings[index] : ""; AdvParamData data = new AdvParamData(); if (!data.TryParse(item, value)) { Debug.LogError(values.ToErrorString(" Parse Error <b>" + value + "</b>")); continue; } Tbl.Add(data.Key, data); ++index; } }
//ヘッダ情報と値一覧から初期化 public AdvParamStruct(AdvParamStruct header, StringGridRow values) { int index0 = 0; foreach (var keyValue in header.Tbl) { int index = ToIndexCommentOuted(values.Grid.Rows[0], index0 + 1); string value = (index < values.Strings.Length) ? values.Strings[index] : ""; AdvParamData data = new AdvParamData(); if (!data.TryParse(keyValue.Value, value)) { Debug.LogError(values.ToErrorString(" Parse Error <b>" + value + "</b>" + "type = " + keyValue.Value.Type)); continue; } Tbl.Add(data.Key, data); ++index0; } }
//構造体のヘッダ情報として初期化 public AdvParamStruct(StringGridRow names, StringGridRow types, StringGridRow fileTypes) { for (int i = 1; i < names.Length; ++i) { string name = names.Strings[i]; if (!name.StartsWith("//") && name.Length > 0) { AdvParamData data = new AdvParamData(); string type = (i < types.Length) ? types.Strings[i] : ""; string fileType = (i < fileTypes.Length) ? fileTypes.Strings[i] : ""; if (!data.TryParse(name, type, fileType)) { Debug.LogError(string.Format("{0} Header [<b>{1}</b>]: ", names.Grid.Name, i)); continue; } Tbl.Add(data.Key, data); } } }
//構造体のヘッダ情報として初期化 public AdvParamStruct(StringGridRow names, StringGridRow types, StringGridRow fileTypes) { if (names.Length != types.Length) { Debug.LogError(names.Grid.Name + " Contains Cell in Name or Type"); return; } for (int i = 1; i < names.Length; ++i) { AdvParamData data = new AdvParamData(); string fileType = (i < fileTypes.Length) ? fileTypes.Strings[i] : ""; if (!data.TryParse(names.Strings[i], types.Strings[i], fileType)) { Debug.LogError(string.Format("{0} Header [<b>{1}</b>]: ", names.Grid.Name, i)); continue; } Tbl.Add(data.Key, data); } }
public AdvParamStruct(AdvParamStruct header, StringGridRow values) { this.tbl = new Dictionary <string, AdvParamData>(); int index = 1; foreach (KeyValuePair <string, AdvParamData> pair in header.Tbl) { if (!pair.Value.Key.StartsWith("//")) { string str = (index >= values.Length) ? string.Empty : values.Strings[index]; AdvParamData data = new AdvParamData(); if (!data.TryParse(pair.Value, str)) { Debug.LogError(values.ToErrorString(" Parse Error <b>" + str + "</b>")); continue; } this.Tbl.Add(data.Key, data); } index++; } }
public AdvParamStruct(StringGridRow names, StringGridRow types, StringGridRow fileTypes) { this.tbl = new Dictionary <string, AdvParamData>(); if (names.Length != types.Length) { Debug.LogError(names.Grid.Name + " Contains Cell in Name or Type"); } else { for (int i = 1; i < names.Length; i++) { AdvParamData data = new AdvParamData(); string fileType = (i >= fileTypes.Length) ? string.Empty : fileTypes.Strings[i]; if (!data.TryParse(names.Strings[i], types.Strings[i], fileType)) { Debug.LogError(string.Format("{0} Header [<b>{1}</b>]: ", names.Grid.Name, i)); } else { this.Tbl.Add(data.Key, data); } } } }