public void InfoButtonPressed() { CurrentLanguageUI ui = GetComponentInParent <CurrentLanguageUI>(); ui.InfoBox.Description = Def.ContainsKey(Key) ? Def.Data[Key].Desription : "UNDEFINED!"; ui.InfoBox.DefaultLangVersion = Translation.DefaultLanguage.TryTranslate(Key); string args; if (Def.ContainsKey(Key)) { string[] p = Def.Data[Key].Params; if (p == null || p.Length == 0 || string.IsNullOrWhiteSpace(p[0])) { args = "None."; } else { args = ""; for (int i = 0; i < p.Length; i++) { string sep = ",\n"; if (i == p.Length - 1) { sep = ""; } args += p[i] + sep; } } } else { args = "UNDEFINED!"; } ui.InfoBox.Params = args; ui.InfoBox.Open(); }
public void ApplyCurrentState() { if (CurrentDefinition == null) return; if(CurrentDefinition.Data == null) { CurrentDefinition.Data = new Dictionary<string, LangDefParam>(); } else { CurrentDefinition.Data.Clear(); } foreach (var item in spawned) { if (item == null) continue; string key = item.NameInput.text.Trim(); string description = item.DescriptionInput.text.Trim(); string[] args = item.ParamsInput.text.Trim().Replace("\n", "").Split(','); for (int i = 0; i < args.Length; i++) { args[i] = args[i].Trim(); } if (CurrentDefinition.ContainsKey(key)) { Debug.LogError("Duplicate key! [" + key + "]"); continue; } else { LangDefParam value = new LangDefParam(); value.Key = key; value.Params = args; value.Desription = description; value.Locked = item.Lock.isOn; CurrentDefinition.Data.Add(key, value); } } }