private void EditActionCommand(SmartAction obj) { ParametersEditView v = new ParametersEditView(); List <KeyValuePair <Parameter, string> > paramss = new List <KeyValuePair <Parameter, string> >(); for (int i = 0; i < obj.Source.ParametersCount; ++i) { paramss.Add(new KeyValuePair <Parameter, string>(obj.Source.GetParameter(i), "Source")); } for (int i = 0; i < obj.ParametersCount; ++i) { paramss.Add(new KeyValuePair <Parameter, string>(obj.GetParameter(i), "Action")); } for (int i = 0; i < obj.Target.ParametersCount; ++i) { paramss.Add(new KeyValuePair <Parameter, string>(obj.Target.GetParameter(i), "Target")); } for (int i = 0; i < 4; ++i) { int j = i; Parameter wrapper = new FloatIntParameter(obj.Target.Position[i].Name); wrapper.SetValue((int)(obj.Target.Position[i].GetValue() * 1000)); wrapper.OnValueChanged += (sender, value) => obj.Target.Position[j].SetValue(wrapper.GetValue() / 1000.0f); paramss.Add(new KeyValuePair <Parameter, string>(wrapper, "Target")); } v.DataContext = new ParametersEditViewModel(_container, obj, paramss); v.ShowDialog(); }
private void EditEventCommand(SmartEvent ev) { ParametersEditView v = new ParametersEditView(); List <KeyValuePair <Parameter, string> > paramss = new List <KeyValuePair <Parameter, string> >(); paramss.Add(new KeyValuePair <Parameter, string>(ev.Chance, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.Flags, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.Phases, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.CooldownMax, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.CooldownMin, "General")); for (int i = 0; i < ev.ParametersCount; ++i) { paramss.Add(new KeyValuePair <Parameter, string>(ev.GetParameter(i), "Event specific")); } v.DataContext = new ParametersEditViewModel(_container, ev, paramss); v.ShowDialog(); }