private void GlobalVariables_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { GlobalVariableInfo item = (ShowSavedOnly) ? Globals.Where(x => x.Index == e.NewStartingIndex).FirstOrDefault() : Globals[e.NewStartingIndex]; item.IntValue = TheEditor.GetGlobal(item.Index); item.FloatValue = TheEditor.GetGlobalAsFloat(item.Index); }
public void UpdateFloatValue() { if (SelectedItem != null) { float oldVal = TheEditor.GetGlobalAsFloat(SelectedItem.Index); float newVal = SelectedItem.FloatValue; if (oldVal != newVal) { TheEditor.SetGlobal(SelectedItem.Index, newVal); } } }
private void PopulateAllVariables() { for (int i = 0, enumIndex = 0; i < TheEditor.GetNumGlobals(); i++, enumIndex++) { while (TheEditor.GetIndexOfGlobal((GlobalVariable)enumIndex) < i) { enumIndex++; } string name = Enum.GetName(typeof(GlobalVariable), enumIndex); Globals.Add(new GlobalVariableInfo() { Index = i, IntValue = TheEditor.GetGlobal(i), FloatValue = TheEditor.GetGlobalAsFloat(i), Name = name }); } }
private void PopulateSavedVariables() { foreach (GlobalVariable var in Enum.GetValues(typeof(GlobalVariable))) { int index = TheEditor.GetIndexOfGlobal(var); if (index == -1) { continue; } Globals.Add(new GlobalVariableInfo() { Index = index, IntValue = TheEditor.GetGlobal(var), FloatValue = TheEditor.GetGlobalAsFloat(var), Name = var.ToString() }); } }