├── Images
├── CreateItemIcon.png
├── DeleteItemIcon.png
├── RenameItemIcon.png
└── Screenshots
│ ├── Tabs-Archetypes.png
│ ├── Tabs-Input-Axes.png
│ ├── Tabs-Behavior-Sets.png
│ ├── Tabs-Knowledge-Base.png
│ ├── Tabs-Scenarios-Logs.png
│ ├── Tabs-Behaviors-Scoring.png
│ ├── Tabs-Project-Overview.png
│ ├── Tabs-Scenarios-Agents.png
│ ├── Tabs-Scenarios-Locations.png
│ ├── Tabs-Scenarios-Simulation.png
│ └── Tabs-Behaviors-Considerations.png
├── App.config
├── Properties
├── Settings.settings
├── Settings.Designer.cs
├── AssemblyInfo.cs
├── Resources.Designer.cs
└── Resources.resx
├── Interfaces
├── INameable.cs
└── IInputBroker.cs
├── Program.cs
├── Widgets
├── EditWidgetCurveAdvanced.cs
├── EditWidgetKnowledgeBaseParameter.cs
├── EditWidgetInputs.cs
├── EditWidgetKnowledgeBase.cs
├── EditWidgetArchetype.cs
├── EditWidgetParameterValue.cs
├── EditWidgetName.cs
├── EditWidgetArchetype.Designer.cs
├── EditWidgetParameter.cs
├── EditWidgetKnowledgeBase.Designer.cs
├── EditWidgetArchetypes.cs
├── EditWidgetConsiderationScore.cs
├── EditWidgetCurveAdvanced.Designer.cs
├── EditWidgetScenarios.cs
├── EditWidgetKnowledgeBaseParameter.Designer.cs
├── EditWidgetInputAxis.cs
├── EditWidgetBehaviorSets.cs
├── EditWidgetConsideration.cs
├── EditWidgetProject.cs
├── EditWidgetConsiderationScore.Designer.cs
├── EditWidgetInputs.Designer.cs
├── EditWidgetParameterValue.Designer.cs
├── EditWidgetBehavior.cs
├── EditWidgetConsiderationInput.cs
├── EditWidgetConsiderationInput.Designer.cs
├── EditWidgetKnowledgeBaseRecord.cs
├── EditWidgetName.Designer.cs
├── EditWidgetArchetype.resx
├── EditWidgetBehavior.resx
├── EditWidgetParameter.resx
├── EditWidgetProject.resx
├── EditWidgetConsideration.resx
├── EditWidgetCurvePresets.resx
├── EditWidgetParameterValue.resx
├── EditWidgetResponseCurve.resx
├── EditWidgetBehaviorScoring.resx
└── EditWidgetConsiderationInput.resx
├── Forms
├── CurvePresetForm.cs
├── EnumerationEditorForm.cs
├── CurveWizardForm.cs
├── CurvePresetForm.Designer.cs
└── CurvePresetForm.resx
├── UtilityAISystem
├── InputParameter.cs
├── InputParameterValue.cs
├── Archetype.cs
├── InputEnumerations.cs
├── BehaviorSet.cs
├── KnowledgeBase.cs
├── ResponseCurve.cs
└── Behavior.cs
├── Curvature.sln
├── Scenarios
├── ScenarioMath.cs
└── ScenarioLocation.cs
├── License.txt
├── .gitattributes
├── README.md
└── .gitignore
/Images/CreateItemIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/CreateItemIcon.png
--------------------------------------------------------------------------------
/Images/DeleteItemIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/DeleteItemIcon.png
--------------------------------------------------------------------------------
/Images/RenameItemIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/RenameItemIcon.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Archetypes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Archetypes.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Input-Axes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Input-Axes.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Behavior-Sets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Behavior-Sets.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Knowledge-Base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Knowledge-Base.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Scenarios-Logs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Scenarios-Logs.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Behaviors-Scoring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Behaviors-Scoring.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Project-Overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Project-Overview.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Scenarios-Agents.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Scenarios-Agents.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Scenarios-Locations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Scenarios-Locations.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Scenarios-Simulation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Scenarios-Simulation.png
--------------------------------------------------------------------------------
/Images/Screenshots/Tabs-Behaviors-Considerations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apoch/curvature/HEAD/Images/Screenshots/Tabs-Behaviors-Considerations.png
--------------------------------------------------------------------------------
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Interfaces/INameable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Curvature
8 | {
9 | interface INameable
10 | {
11 | string GetName();
12 | void Rename(string newname);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Interfaces/IInputBroker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Curvature
8 | {
9 | public interface IInputBroker
10 | {
11 | double GetInputValue(Consideration consideration);
12 | double GetInputValue(Consideration consideration, Scenario.Context context);
13 | void RefreshInputs();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Curvature
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetCurveAdvanced.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetCurveAdvanced : UserControl
14 | {
15 | public EditWidgetCurveAdvanced()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | internal void AttachCurve(ResponseCurve curve, Project project)
21 | {
22 | ResponseCurveEditor.AttachCurve(curve, project);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Forms/CurvePresetForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class CurvePresetForm : Form
14 | {
15 | private ResponseCurve EditingCurve;
16 |
17 | public CurvePresetForm(ResponseCurve editingcurve)
18 | {
19 | InitializeComponent();
20 | EditingCurve = editingcurve;
21 | }
22 |
23 |
24 | private void OKButton_Click(object sender, EventArgs e)
25 | {
26 | CurvePresetsWidget.Apply(EditingCurve);
27 | Close();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/UtilityAISystem/InputParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Curvature
9 | {
10 | [DataContract(Namespace = "")]
11 | public class InputParameter
12 | {
13 | [DataMember]
14 | public string ReadableName;
15 | }
16 |
17 | [DataContract(Namespace = "")]
18 | public class InputParameterNumeric : InputParameter
19 | {
20 | [DataMember]
21 | public float MinimumValue;
22 |
23 | [DataMember]
24 | public float MaximumValue;
25 |
26 |
27 | internal InputParameterNumeric()
28 | {
29 | }
30 |
31 | public InputParameterNumeric(string name, float min, float max)
32 | {
33 | ReadableName = name;
34 | MinimumValue = min;
35 | MaximumValue = max;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Curvature.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Curvature", "Curvature.csproj", "{45A21C7A-B406-4305-BCF6-5F4959491BDC}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {45A21C7A-B406-4305-BCF6-5F4959491BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {45A21C7A-B406-4305-BCF6-5F4959491BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {45A21C7A-B406-4305-BCF6-5F4959491BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {45A21C7A-B406-4305-BCF6-5F4959491BDC}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Scenarios/ScenarioMath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Curvature.Scenarios
9 | {
10 | class ScenarioMath
11 | {
12 | public static float Distance(PointF a, PointF b)
13 | {
14 | float dx = b.X - a.X;
15 | float dy = b.Y - a.Y;
16 | return (float)Math.Sqrt(dx * dx + dy * dy);
17 | }
18 |
19 | public static PointF Normalize(PointF input)
20 | {
21 | float length = (float)Math.Sqrt(input.X * input.X + input.Y * input.Y);
22 | if (length < 0.001f)
23 | return new PointF(0.0f, 0.0f);
24 |
25 | float invlength = 1.0f / length;
26 | return new PointF(input.X * invlength, input.Y * invlength);
27 | }
28 |
29 |
30 | public static float Magnitude(PointF p)
31 | {
32 | return (float)Math.Sqrt(p.X * p.X + p.Y * p.Y);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/UtilityAISystem/InputParameterValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Curvature
9 | {
10 | [DataContract(Namespace = "")]
11 | public abstract class InputParameterValue
12 | {
13 | public abstract InputParameter GetControllingParameter();
14 | }
15 |
16 |
17 | [DataContract(Namespace = "")]
18 | public class InputParameterValueNumeric : InputParameterValue
19 | {
20 | [DataMember]
21 | public InputParameterNumeric ControllingParameter;
22 |
23 | [DataMember]
24 | public float Value;
25 |
26 |
27 | public InputParameterValueNumeric(InputParameterNumeric controller, float value)
28 | {
29 | ControllingParameter = controller;
30 | Value = value;
31 | }
32 |
33 | public override InputParameter GetControllingParameter()
34 | {
35 | return ControllingParameter;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Curvature.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/UtilityAISystem/Archetype.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Curvature
9 | {
10 | [DataContract(Namespace = "")]
11 | public class Archetype : INameable
12 | {
13 | [DataMember]
14 | public string ReadableName;
15 |
16 | [DataMember]
17 | public List BehaviorSets;
18 |
19 |
20 | internal delegate void DialogRebuildNeededHandler();
21 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
22 |
23 |
24 | public Archetype(string name)
25 | {
26 | ReadableName = name;
27 | BehaviorSets = new List();
28 | }
29 |
30 | public override string ToString()
31 | {
32 | return ReadableName;
33 | }
34 |
35 | public string GetName()
36 | {
37 | return ReadableName;
38 | }
39 |
40 | public void Rename(string newname)
41 | {
42 | ReadableName = newname;
43 | DialogRebuildNeeded?.Invoke();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UtilityAISystem/InputEnumerations.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Runtime.Serialization;
3 |
4 |
5 | namespace Curvature
6 | {
7 | [DataContract(Namespace = "")]
8 | public class InputParameterEnumeration : InputParameter
9 | {
10 | [DataMember]
11 | public HashSet ValidValues;
12 |
13 | [DataMember]
14 | public bool ScoreOnMatch;
15 |
16 |
17 | public InputParameterEnumeration(string name, HashSet valids)
18 | {
19 | ReadableName = name;
20 | ValidValues = valids;
21 |
22 | ScoreOnMatch = true;
23 | }
24 | }
25 |
26 | [DataContract(Namespace = "")]
27 | public class InputParameterValueEnumeration : InputParameterValue
28 | {
29 | [DataMember]
30 | public InputParameterEnumeration ControllingParameter;
31 |
32 | [DataMember]
33 | public string Key;
34 |
35 |
36 | public InputParameterValueEnumeration(InputParameterEnumeration controller, string key)
37 | {
38 | ControllingParameter = controller;
39 | Key = key;
40 | }
41 |
42 | public override InputParameter GetControllingParameter()
43 | {
44 | return ControllingParameter;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/UtilityAISystem/BehaviorSet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace Curvature
10 | {
11 | [DataContract(Namespace = "")]
12 | public class BehaviorSet : INameable
13 | {
14 | [DataMember]
15 | public string ReadableName;
16 |
17 | [DataMember]
18 | public HashSet EnabledBehaviors;
19 |
20 |
21 | internal delegate void DialogRebuildNeededHandler();
22 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
23 |
24 |
25 | internal BehaviorSet()
26 | {
27 | }
28 |
29 | public BehaviorSet(string name)
30 | {
31 | ReadableName = name;
32 | EnabledBehaviors = new HashSet();
33 | }
34 |
35 | public override string ToString()
36 | {
37 | return ReadableName;
38 | }
39 |
40 | public void Rename(string newname)
41 | {
42 | ReadableName = newname;
43 | DialogRebuildNeeded?.Invoke();
44 | }
45 |
46 | public string GetName()
47 | {
48 | return ReadableName;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/License.txt:
--------------------------------------------------------------------------------
1 | Curvature AI Suite
2 | Copyright (c) 2017, Michael A. Lewis
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | Neither the name of the Curvature project nor the names of its contributors
17 | may be used to endorse or promote products derived from this software
18 | without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Curvature Studio")]
9 | [assembly: AssemblyDescription("A full-featured editor for working with Utility-based AI")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Curvature")]
13 | [assembly: AssemblyCopyright("Copyright © 2017-2018 Mike Lewis")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("45a21c7a-b406-4305-bcf6-5f4959491bdc")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetKnowledgeBaseParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetKnowledgeBaseParameter : UserControl
14 | {
15 | public EditWidgetKnowledgeBaseParameter(double initialValue, double minimum, double maximum)
16 | {
17 | InitializeComponent();
18 |
19 | ValueUpDown.Minimum = (decimal)minimum;
20 | ValueUpDown.Maximum = (decimal)maximum;
21 | ValueUpDown.Value = (decimal)initialValue;
22 |
23 |
24 | ValueSlider.Minimum = (int)(minimum * 100.0);
25 | ValueSlider.Maximum = (int)(maximum * 100.0);
26 | ValueSlider.Value = (int)(initialValue * 100.0);
27 |
28 | int range = ValueSlider.Maximum - ValueSlider.Minimum;
29 | ValueSlider.SmallChange = range / 10;
30 | ValueSlider.LargeChange = range / 4;
31 | ValueSlider.TickFrequency = range / 25;
32 |
33 | ValueSlider.ValueChanged += (e, args) =>
34 | {
35 | ValueUpDown.Value = (decimal)ValueSlider.Value / 100;
36 | };
37 |
38 | ValueUpDown.ValueChanged += (e, args) =>
39 | {
40 | int newval = (int)(ValueUpDown.Value * 100);
41 | if (ValueSlider.Value != newval)
42 | ValueSlider.Value = newval;
43 | };
44 | }
45 |
46 | public double GetValue()
47 | {
48 | return (double)ValueUpDown.Value;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetInputs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetInputs : UserControl
14 | {
15 | Project EditingProject;
16 | List Inputs;
17 |
18 | public EditWidgetInputs()
19 | {
20 | InitializeComponent();
21 |
22 | NewInputButton.Click += (e, args) =>
23 | {
24 | Inputs.Add(new InputAxis("New input", InputAxis.OriginType.PropertyOfSelf));
25 | EditingProject.MarkDirty();
26 | RefreshControls();
27 | };
28 | }
29 |
30 | internal void Attach(Project project, List inputs)
31 | {
32 | EditingProject = project;
33 | Inputs = inputs;
34 | RefreshControls();
35 | }
36 |
37 | private void RefreshControls()
38 | {
39 | ScrollablePanel.SuspendLayout();
40 |
41 | foreach (Control c in ScrollablePanel.Controls)
42 | c.Dispose();
43 |
44 | ScrollablePanel.Controls.Clear();
45 |
46 | foreach (var input in Inputs)
47 | {
48 | var inputcontrol = new EditWidgetInputAxis(EditingProject, input)
49 | {
50 | Dock = DockStyle.Top
51 | };
52 | ScrollablePanel.Controls.Add(inputcontrol);
53 | }
54 |
55 | ScrollablePanel.ResumeLayout();
56 | ScrollablePanel.PerformLayout();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetKnowledgeBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetKnowledgeBase : UserControl
14 | {
15 | private KnowledgeBase EditingKB;
16 | private Project EditingProject;
17 |
18 | public EditWidgetKnowledgeBase()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | internal void Attach(KnowledgeBase kb, Project project)
24 | {
25 | EditingKB = kb;
26 | EditingProject = project;
27 | RefreshKBControls();
28 | }
29 |
30 |
31 | private void RefreshKBControls()
32 | {
33 | foreach (Control c in KnowledgeBaseFlowPanel.Controls)
34 | c.Dispose();
35 |
36 | KnowledgeBaseFlowPanel.Controls.Clear();
37 |
38 |
39 | foreach (var rec in EditingKB.Records)
40 | {
41 | KnowledgeBaseFlowPanel.Controls.Add(new EditWidgetKnowledgeBaseRecord(rec, EditingProject));
42 | }
43 |
44 | var newRecordButton = new Button
45 | {
46 | ImageList = IconImageList,
47 | ImageIndex = 0,
48 | ImageAlign = ContentAlignment.MiddleRight,
49 | TextImageRelation = TextImageRelation.ImageBeforeText,
50 |
51 | Text = "Create Knowledge",
52 | AutoSize = true
53 | };
54 |
55 | newRecordButton.Click += (e, args) =>
56 | {
57 | EditingKB.Records.Add(new KnowledgeBase.Record("New knowledge", false, KnowledgeBase.Record.Parameterization.FixedRange));
58 | EditingProject.MarkDirty();
59 | RefreshKBControls();
60 | };
61 |
62 | KnowledgeBaseFlowPanel.Controls.Add(newRecordButton);
63 | KnowledgeBaseFlowPanel.ScrollControlIntoView(newRecordButton);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetArchetype.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetArchetype : UserControl
14 | {
15 | private Archetype EditingArchetype;
16 | private Project EditingProject;
17 |
18 | internal delegate void DialogRebuildNeededHandler(Archetype editedContent);
19 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
20 |
21 |
22 | public EditWidgetArchetype()
23 | {
24 | InitializeComponent();
25 |
26 | EnabledBehaviorSetsListBox.ItemCheck += (e, args) =>
27 | {
28 | if (EditingArchetype == null)
29 | return;
30 |
31 | var set = EnabledBehaviorSetsListBox.Items[args.Index] as BehaviorSet;
32 |
33 | if (args.NewValue == CheckState.Checked)
34 | {
35 | if (EditingArchetype.BehaviorSets.Contains(set))
36 | return;
37 |
38 | EditingArchetype.BehaviorSets.Add(set);
39 | }
40 | else
41 | {
42 | EditingArchetype.BehaviorSets.Remove(set);
43 | }
44 |
45 | EditingProject.MarkDirty();
46 | };
47 | }
48 |
49 | internal void Attach(Archetype archetype, Project project)
50 | {
51 | if (EditingArchetype != null)
52 | EditingArchetype.DialogRebuildNeeded -= Rebuild;
53 |
54 | EditingArchetype = archetype;
55 | NameEditWidget.Attach("Archetype", EditingArchetype, project);
56 | EditingArchetype.DialogRebuildNeeded += Rebuild;
57 | EditingProject = project;
58 |
59 | EnabledBehaviorSetsListBox.Items.Clear();
60 | foreach (var behaviorSet in project.BehaviorSets)
61 | {
62 | EnabledBehaviorSetsListBox.Items.Add(behaviorSet, EditingArchetype.BehaviorSets.Contains(behaviorSet));
63 | }
64 | }
65 |
66 | internal void Rebuild()
67 | {
68 | Attach(EditingArchetype, EditingProject);
69 | DialogRebuildNeeded?.Invoke(EditingArchetype);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Forms/EnumerationEditorForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Forms
12 | {
13 | public partial class EnumerationEditorForm : Form
14 | {
15 | private HashSet ValidEntries;
16 |
17 |
18 | public static void ShowEditor(HashSet entries)
19 | {
20 | var form = new EnumerationEditorForm(entries);
21 | form.ShowDialog();
22 | }
23 |
24 |
25 | private EnumerationEditorForm(HashSet entries)
26 | {
27 | InitializeComponent();
28 |
29 | ValidEntries = entries;
30 |
31 | foreach (var v in ValidEntries)
32 | EntriesListView.Items.Add(v);
33 | }
34 |
35 | private void AddNewEntryButton_Click(object sender, EventArgs e)
36 | {
37 | string newname = "New enumerated value";
38 |
39 | int counter = 2;
40 | while (HasMatchingEntry(newname))
41 | {
42 | newname = $"New enumerated value {counter}";
43 | ++counter;
44 | }
45 |
46 | EntriesListView.Items.Add(newname);
47 | }
48 |
49 | private bool HasMatchingEntry(string entry)
50 | {
51 | foreach (ListViewItem item in EntriesListView.Items)
52 | {
53 | if (item.Text == entry)
54 | return true;
55 | }
56 |
57 | return false;
58 | }
59 |
60 | private void DeleteEntryButton_Click(object sender, EventArgs e)
61 | {
62 | var items = new List();
63 | foreach (ListViewItem i in EntriesListView.SelectedItems)
64 | items.Add(i);
65 |
66 | foreach (var i in items)
67 | EntriesListView.Items.Remove(i);
68 | }
69 |
70 | private void ButtonCancel_Click(object sender, EventArgs e)
71 | {
72 | Close();
73 | }
74 |
75 | private void ButtonOK_Click(object sender, EventArgs e)
76 | {
77 | ValidEntries.Clear();
78 | foreach (ListViewItem i in EntriesListView.Items)
79 | ValidEntries.Add(i.Text);
80 |
81 | Close();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Scenarios/ScenarioLocation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Runtime.Serialization;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Curvature
10 | {
11 | [DataContract(Namespace = "")]
12 | public class ScenarioLocation : Scenario.IScenarioMember
13 | {
14 | [DataMember]
15 | public string Name;
16 |
17 | [DataMember]
18 | public PointF Position;
19 |
20 | [DataMember]
21 | public float Radius;
22 |
23 | [DataMember]
24 | public Dictionary Properties;
25 |
26 | [DataMember]
27 | public Dictionary StartProperties;
28 |
29 |
30 | public override string ToString()
31 | {
32 | return Name;
33 | }
34 |
35 |
36 | public ScenarioLocation(string name)
37 | {
38 | Name = name;
39 |
40 | Position = new PointF(0.0f, 0.0f);
41 | Radius = 2.5f;
42 |
43 | Properties = new Dictionary();
44 | }
45 |
46 |
47 | public string GetName()
48 | {
49 | return Name;
50 | }
51 |
52 | public PointF GetPosition()
53 | {
54 | return Position;
55 | }
56 |
57 | public object GetProperty(KnowledgeBase.Record kbrec)
58 | {
59 | if (Properties == null || !Properties.ContainsKey(kbrec))
60 | return 0.0;
61 |
62 | return Properties[kbrec];
63 | }
64 |
65 | public float GetRadius()
66 | {
67 | return Radius;
68 | }
69 |
70 | public void GenerateStartProperties(KnowledgeBase kb)
71 | {
72 | var oldstarts = StartProperties;
73 | if (oldstarts == null)
74 | oldstarts = new Dictionary();
75 |
76 | StartProperties = new Dictionary();
77 |
78 | foreach (var rec in kb.Records)
79 | {
80 | if (rec.Computed)
81 | continue;
82 |
83 | if (oldstarts.ContainsKey(rec))
84 | StartProperties.Add(rec, oldstarts[rec]);
85 | else
86 | {
87 | if (rec.Params == KnowledgeBase.Record.Parameterization.Enumeration)
88 | StartProperties.Add(rec, rec.EnumerationValues.First());
89 | else
90 | StartProperties.Add(rec, rec.MinimumValue);
91 | }
92 | }
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/UtilityAISystem/KnowledgeBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace Curvature
10 | {
11 | [DataContract(Namespace = "")]
12 | public class KnowledgeBase
13 | {
14 |
15 | [DataContract(Namespace = "")]
16 | public class Record
17 | {
18 | public enum Prefabs
19 | {
20 | NoPrefab,
21 | Distance,
22 | SimulationTime,
23 | }
24 |
25 | public enum Parameterization
26 | {
27 | FixedRange,
28 | ConfigurableRange,
29 | Enumeration
30 | }
31 |
32 | [DataMember]
33 | public string ReadableName;
34 |
35 | [DataMember]
36 | public bool Computed;
37 |
38 | [DataMember]
39 | public double MinimumValue;
40 |
41 | [DataMember]
42 | public double MaximumValue;
43 |
44 | [DataMember]
45 | public HashSet EnumerationValues;
46 |
47 | [DataMember]
48 | public Prefabs Prefab;
49 |
50 |
51 | [DataMember]
52 | private Parameterization Parameters;
53 |
54 | public Parameterization Params
55 | {
56 | get { return Parameters; }
57 | set
58 | {
59 | Parameters = value;
60 | PropertyChanged?.Invoke();
61 | }
62 | }
63 |
64 |
65 | internal delegate void PropertyChangedHandler();
66 | internal event PropertyChangedHandler PropertyChanged;
67 |
68 |
69 | internal Record()
70 | {
71 | }
72 |
73 | public Record(string name, bool computed, Parameterization param)
74 | {
75 | ReadableName = name;
76 | Computed = computed;
77 | Params = param;
78 | Prefab = Prefabs.NoPrefab;
79 |
80 | MinimumValue = 0.0;
81 | MaximumValue = 1.0;
82 |
83 | EnumerationValues = new HashSet();
84 | }
85 |
86 | public override string ToString()
87 | {
88 | return ReadableName;
89 | }
90 | }
91 |
92 | [DataMember]
93 | internal List Records;
94 |
95 |
96 | public KnowledgeBase()
97 | {
98 | Records = new List();
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetParameterValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetParameterValue : UserControl
14 | {
15 | private InputParameterValue EditingParameter;
16 | private Project EditingProject;
17 |
18 |
19 | internal EditWidgetParameterValue(InputParameterValue param, Project project)
20 | {
21 | InitializeComponent();
22 |
23 | EditingProject = project;
24 | EditingParameter = param;
25 |
26 | ParamNameLabel.Text = EditingParameter.GetControllingParameter().ReadableName;
27 |
28 | if (param is InputParameterValueNumeric)
29 | {
30 | var pnum = param as InputParameterValueNumeric;
31 |
32 | ValueUpDown.Minimum = (decimal)pnum.ControllingParameter.MinimumValue;
33 | ValueUpDown.Maximum = (decimal)pnum.ControllingParameter.MaximumValue;
34 | ValueUpDown.Value = (decimal)pnum.Value;
35 |
36 | InputValueDropDown.Visible = false;
37 | }
38 | else if (param is InputParameterValueEnumeration)
39 | {
40 | var penum = param as InputParameterValueEnumeration;
41 |
42 | foreach (var valid in penum.ControllingParameter.ValidValues)
43 | InputValueDropDown.Items.Add(valid);
44 |
45 |
46 | InputValueDropDown.SelectedItem = penum.Key;
47 |
48 | ValueUpDown.Visible = false;
49 | }
50 | }
51 |
52 | private void ValueUpDown_ValueChanged(object sender, EventArgs e)
53 | {
54 | if (!(EditingParameter is InputParameterValueNumeric))
55 | return;
56 |
57 | var param = EditingParameter as InputParameterValueNumeric;
58 | var prev = param.Value;
59 |
60 | param.Value = (float)ValueUpDown.Value;
61 |
62 | if (prev != param.Value)
63 | EditingProject.MarkDirty();
64 | }
65 |
66 | private void InputValueDropDown_SelectedIndexChanged(object sender, EventArgs e)
67 | {
68 | if (!(EditingParameter is InputParameterValueEnumeration))
69 | return;
70 |
71 | var param = EditingParameter as InputParameterValueEnumeration;
72 | var prev = param.Key;
73 |
74 | param.Key = InputValueDropDown.SelectedItem as string;
75 |
76 | if (prev != param.Key)
77 | EditingProject.MarkDirty();
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Curvature
2 | Curvature is a full-featured Utility-based AI editor and sandbox tool.
3 |
4 | The project provides a complete playground for creating, editing, and testing decision-making AI. Under the hood, Curvature uses *Utility Theory* to model the appeal of various behaviors. Specifically, Curvature is based on the Infinite Axis Utility System by Dave Mark. Curvature builds on the IAUS approach and includes enhancements and refinements developed during work on *Guild Wars 2: Heart of Thorns* as well as *Guild Wars 2: Path of Fire*.
5 |
6 | Curvature is fully data-driven and supports the creation of a complete AI pipeline, from the core knowledge-base accessed by agents, to the specific *considerations* that drive the scoring of individual behaviors. The result is an end-to-end solution for modeling and testing AI, including a simple world representation that allows designers or AI programmers to place agents in a virtual space and see how they would choose to behave.
7 |
8 | For complete project documentation, please see [the Curvature wiki](https://github.com/apoch/curvature/wiki).
9 |
10 | # Screenshots
11 | 
12 | 
13 |
14 | # Project Status
15 | Curvature is currently in an open beta testing phase. Check the [project releases page](https://github.com/apoch/curvature/releases) for the latest version of the tool suite.
16 |
17 | Existing features of Curvature:
18 | * Design a *knowledge-base* to contain your world representation and data
19 | * Select knowledge-base entries to assemble a list of *inputs* that can drive decision-making
20 | * Pair an input with a decision using a *consideration*, which can control the relevance of the input via *response curves*
21 | * Collect considerations to make up a *behavior* which represents a discrete choice available to an AI agent
22 | * Group behaviors into *behavior sets* for easy categorization and bundling of related activities
23 | * Choose which behavior sets will be enacted for a given *archetype* of AI agent
24 | * Place AI agents in a sandbox world and watch them make decisions using *scenarios*
25 | * Response curves and considerations can be constructed with a simple wizard-style helper
26 | * Running scenarios will log the decisions made by each agent at each "tick" so you can review how things came about
27 |
28 | More fine-grained information on project plans can be found in the [issue tracker](https://github.com/apoch/curvature/issues).
29 |
30 | Overviews of releases and other high-level planning can be found in the [project tracker](https://github.com/apoch/curvature/projects).
31 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetName.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetName : UserControl
14 | {
15 | private INameable EditingObject;
16 | private Project EditingProject;
17 |
18 | public EditWidgetName()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | internal void Attach(string objectType, INameable editedObject, Project project)
24 | {
25 | EditingObject = editedObject;
26 | EditingProject = project;
27 |
28 | ObjectTypeLabel.Text = $"{objectType}:";
29 | ObjectNameLabel.Text = EditingObject.GetName();
30 | }
31 |
32 | private void EditIcon_Click(object sender, EventArgs e)
33 | {
34 | ObjectNameLabel.Visible = false;
35 | EditIcon.Visible = false;
36 |
37 | var edit = new TextBox
38 | {
39 | MinimumSize = new Size(85, 0),
40 | Size = ObjectNameLabel.Size,
41 | Location = ObjectNameLabel.Location,
42 | Text = ObjectNameLabel.Text
43 | };
44 |
45 | edit.KeyPress += (o, args) =>
46 | {
47 | if (ObjectNameLabel.Visible)
48 | return;
49 |
50 | if (args.KeyChar == '\r' || args.KeyChar == '\n')
51 | {
52 | ObjectNameLabel.Text = edit.Text;
53 | ObjectNameLabel.Visible = true;
54 | EditIcon.Visible = true;
55 | EditingObject.Rename(edit.Text);
56 | EditingProject.MarkDirty();
57 | edit.Dispose();
58 | }
59 | else if (args.KeyChar == '\u001b') // Escape
60 | {
61 | ObjectNameLabel.Visible = true;
62 | EditIcon.Visible = true;
63 | edit.Dispose();
64 | }
65 | };
66 |
67 | edit.LostFocus += (o, args) =>
68 | {
69 | if (ObjectNameLabel.Visible)
70 | return;
71 |
72 | EditingObject.Rename(edit.Text);
73 | EditingProject.MarkDirty();
74 | ObjectNameLabel.Text = edit.Text;
75 | ObjectNameLabel.Visible = true;
76 | EditIcon.Visible = true;
77 | edit.Dispose();
78 | };
79 |
80 | EditIcon.Parent = null;
81 | FlowPanel.Controls.Add(edit);
82 | FlowPanel.Controls.Add(EditIcon);
83 |
84 | edit.SelectAll();
85 | edit.Focus();
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Curvature.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Curvature.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/UtilityAISystem/ResponseCurve.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Curvature
9 | {
10 | [DataContract(Namespace = "")]
11 | public class ResponseCurve
12 | {
13 | public enum CurveType
14 | {
15 | Linear,
16 | Polynomial,
17 | Logistic,
18 | Logit,
19 | Normal,
20 | Sine
21 | }
22 |
23 | [DataMember]
24 | public CurveType Type;
25 |
26 | [DataMember]
27 | public double Slope;
28 |
29 | [DataMember]
30 | public double Exponent;
31 |
32 | [DataMember]
33 | public double XShift;
34 |
35 | [DataMember]
36 | public double YShift;
37 |
38 |
39 | internal ResponseCurve()
40 | {
41 | }
42 |
43 | public ResponseCurve(CurveType type, double slope, double exponent, double xshift, double yshift)
44 | {
45 | Type = type;
46 | Slope = slope;
47 | Exponent = exponent;
48 | XShift = xshift;
49 | YShift = yshift;
50 | }
51 |
52 |
53 | public void CopyFrom(ResponseCurve other)
54 | {
55 | Type = other.Type;
56 | Slope = other.Slope;
57 | Exponent = other.Exponent;
58 | XShift = other.XShift;
59 | YShift = other.YShift;
60 | }
61 |
62 |
63 | public double ComputeValue(double x)
64 | {
65 | switch (Type)
66 | {
67 | case CurveType.Linear:
68 | return Sanitize((Slope * (x - XShift)) + YShift);
69 |
70 | case CurveType.Polynomial:
71 | return Sanitize((Slope * Math.Pow(x - XShift, Exponent)) + YShift);
72 |
73 | case CurveType.Logistic:
74 | return Sanitize((Slope / (1 + Math.Exp(-10.0 * Exponent * (x - 0.5 - XShift)))) + YShift);
75 |
76 | case CurveType.Logit:
77 | return Sanitize(Slope * Math.Log((x - XShift) / (1.0 - (x - XShift))) / 5.0 + 0.5 + YShift);
78 |
79 | case CurveType.Normal:
80 | return Sanitize(Slope * Math.Exp(-30.0 * Exponent * (x - XShift - 0.5) * (x - XShift - 0.5)) + YShift);
81 |
82 | case CurveType.Sine:
83 | return Sanitize(0.5 * Slope * Math.Sin(2.0 * Math.PI * (x - XShift)) + 0.5 + YShift);
84 | }
85 |
86 | return 0.0;
87 | }
88 |
89 | private double Sanitize(double y)
90 | {
91 | if (double.IsInfinity(y))
92 | return 0.0;
93 |
94 | if (double.IsNaN(y))
95 | return 0.0;
96 |
97 | if (y < 0.0)
98 | return 0.0;
99 |
100 | if (y > 1.0)
101 | return 1.0;
102 |
103 | return y;
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetArchetype.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetArchetype
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.EnabledBehaviorSetsListBox = new System.Windows.Forms.CheckedListBox();
32 | this.NameEditWidget = new Curvature.EditWidgetName();
33 | this.SuspendLayout();
34 | //
35 | // EnabledBehaviorSetsListBox
36 | //
37 | this.EnabledBehaviorSetsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
38 | | System.Windows.Forms.AnchorStyles.Left)
39 | | System.Windows.Forms.AnchorStyles.Right)));
40 | this.EnabledBehaviorSetsListBox.FormattingEnabled = true;
41 | this.EnabledBehaviorSetsListBox.Location = new System.Drawing.Point(7, 38);
42 | this.EnabledBehaviorSetsListBox.Name = "EnabledBehaviorSetsListBox";
43 | this.EnabledBehaviorSetsListBox.Size = new System.Drawing.Size(493, 304);
44 | this.EnabledBehaviorSetsListBox.TabIndex = 1;
45 | //
46 | // NameEditWidget
47 | //
48 | this.NameEditWidget.Dock = System.Windows.Forms.DockStyle.Top;
49 | this.NameEditWidget.Location = new System.Drawing.Point(0, 0);
50 | this.NameEditWidget.Name = "NameEditWidget";
51 | this.NameEditWidget.Size = new System.Drawing.Size(503, 30);
52 | this.NameEditWidget.TabIndex = 0;
53 | //
54 | // EditWidgetArchetype
55 | //
56 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
57 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
58 | this.Controls.Add(this.NameEditWidget);
59 | this.Controls.Add(this.EnabledBehaviorSetsListBox);
60 | this.Name = "EditWidgetArchetype";
61 | this.Size = new System.Drawing.Size(503, 350);
62 | this.ResumeLayout(false);
63 |
64 | }
65 |
66 | #endregion
67 | private System.Windows.Forms.CheckedListBox EnabledBehaviorSetsListBox;
68 | private EditWidgetName NameEditWidget;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetParameter : UserControl
14 | {
15 | private InputParameter EditingParameter;
16 | private Project EditingProject;
17 |
18 |
19 | internal EditWidgetParameter(InputParameter param, Project project)
20 | {
21 | InitializeComponent();
22 |
23 | EditingProject = project;
24 | EditingParameter = param;
25 |
26 | ParameterNameLabel.Text = EditingParameter.ReadableName;
27 |
28 | if (EditingParameter is InputParameterNumeric)
29 | {
30 | var p = EditingParameter as InputParameterNumeric;
31 |
32 | MinimumValue.Minimum = (decimal)p.MinimumValue;
33 | MaximumValue.Maximum = (decimal)p.MaximumValue;
34 |
35 | MinimumValue.Value = (decimal)p.MinimumValue;
36 | MaximumValue.Value = (decimal)p.MaximumValue;
37 |
38 | NumericPanel.Visible = true;
39 | EnumerationPanel.Visible = false;
40 | }
41 | else if (EditingParameter is InputParameterEnumeration)
42 | {
43 | var p = EditingParameter as InputParameterEnumeration;
44 |
45 | if (p.ScoreOnMatch)
46 | EnumerationDropDown.SelectedIndex = 0;
47 | else
48 | EnumerationDropDown.SelectedIndex = 1;
49 |
50 | NumericPanel.Visible = false;
51 | EnumerationPanel.Visible = true;
52 | }
53 | }
54 |
55 | private void MinimumValue_ValueChanged(object sender, EventArgs e)
56 | {
57 | var p = EditingParameter as InputParameterNumeric;
58 | if (p == null)
59 | return;
60 |
61 | var prev = p.MinimumValue;
62 |
63 | p.MinimumValue = (float)MinimumValue.Value;
64 |
65 | if (prev != p.MinimumValue)
66 | EditingProject.MarkDirty();
67 | }
68 |
69 | private void MaximumValue_ValueChanged(object sender, EventArgs e)
70 | {
71 | var p = EditingParameter as InputParameterNumeric;
72 | if (p == null)
73 | return;
74 |
75 | var prev = p.MaximumValue;
76 |
77 | p.MaximumValue = (float)MaximumValue.Value;
78 |
79 | if (prev != p.MaximumValue)
80 | EditingProject.MarkDirty();
81 | }
82 |
83 | private void EnumerationDropDown_SelectedIndexChanged(object sender, EventArgs e)
84 | {
85 | var p = EditingParameter as InputParameterEnumeration;
86 | if (p == null)
87 | return;
88 |
89 | var prev = p.ScoreOnMatch;
90 |
91 | p.ScoreOnMatch = (EnumerationDropDown.SelectedIndex == 0);
92 |
93 | if (prev != p.ScoreOnMatch)
94 | EditingProject.MarkDirty();
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetKnowledgeBase.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetKnowledgeBase
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditWidgetKnowledgeBase));
33 | this.KnowledgeBaseFlowPanel = new System.Windows.Forms.FlowLayoutPanel();
34 | this.IconImageList = new System.Windows.Forms.ImageList(this.components);
35 | this.SuspendLayout();
36 | //
37 | // KnowledgeBaseFlowPanel
38 | //
39 | this.KnowledgeBaseFlowPanel.AutoScroll = true;
40 | this.KnowledgeBaseFlowPanel.Dock = System.Windows.Forms.DockStyle.Fill;
41 | this.KnowledgeBaseFlowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
42 | this.KnowledgeBaseFlowPanel.Location = new System.Drawing.Point(0, 0);
43 | this.KnowledgeBaseFlowPanel.Name = "KnowledgeBaseFlowPanel";
44 | this.KnowledgeBaseFlowPanel.Size = new System.Drawing.Size(474, 202);
45 | this.KnowledgeBaseFlowPanel.TabIndex = 0;
46 | //
47 | // IconImageList
48 | //
49 | this.IconImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("IconImageList.ImageStream")));
50 | this.IconImageList.TransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
51 | this.IconImageList.Images.SetKeyName(0, "CreateItemIcon.png");
52 | //
53 | // EditWidgetKnowledgeBase
54 | //
55 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
56 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
57 | this.Controls.Add(this.KnowledgeBaseFlowPanel);
58 | this.Name = "EditWidgetKnowledgeBase";
59 | this.Size = new System.Drawing.Size(474, 202);
60 | this.ResumeLayout(false);
61 |
62 | }
63 |
64 | #endregion
65 |
66 | private System.Windows.Forms.FlowLayoutPanel KnowledgeBaseFlowPanel;
67 | private System.Windows.Forms.ImageList IconImageList;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetArchetypes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetArchetypes : UserControl
14 | {
15 | private Project EditingProject;
16 |
17 |
18 | public EditWidgetArchetypes()
19 | {
20 | InitializeComponent();
21 |
22 | ArchetypeEditWidget.DialogRebuildNeeded += RefreshArchetypeControls;
23 | }
24 |
25 | public void Attach(Project project)
26 | {
27 | EditingProject = project;
28 | RefreshArchetypeControls(null);
29 | }
30 |
31 | private void RefreshArchetypeControls(Archetype editedContent)
32 | {
33 | ArchetypesListView.Items.Clear();
34 |
35 | foreach (var archetype in EditingProject.Archetypes)
36 | {
37 | var item = new ListViewItem(archetype.ReadableName)
38 | {
39 | Tag = archetype
40 | };
41 | ArchetypesListView.Items.Add(item);
42 | }
43 |
44 | ArchetypeEditWidget.Visible = false;
45 |
46 | if (ArchetypesListView.Items.Count <= 0)
47 | return;
48 |
49 | if (editedContent != null)
50 | {
51 | foreach (ListViewItem item in ArchetypesListView.Items)
52 | {
53 | if (item.Tag == editedContent)
54 | {
55 | ArchetypesListView.SelectedIndices.Add(item.Index);
56 | break;
57 | }
58 | }
59 | }
60 | else
61 | ArchetypesListView.SelectedIndices.Add(0);
62 | }
63 |
64 | private void AddArchetypeButton_Click(object sender, EventArgs e)
65 | {
66 | var archetype = new Archetype("Untitled Archetype");
67 | EditingProject.Archetypes.Add(archetype);
68 | EditingProject.MarkDirty();
69 | RefreshArchetypeControls(archetype);
70 | }
71 |
72 | private void ArchetypesListView_SelectedIndexChanged(object sender, EventArgs e)
73 | {
74 | if (ArchetypesListView.SelectedItems.Count <= 0)
75 | {
76 | ArchetypeEditWidget.Visible = false;
77 | return;
78 | }
79 |
80 | ArchetypeEditWidget.Attach(ArchetypesListView.SelectedItems[0].Tag as Archetype, EditingProject);
81 | ArchetypeEditWidget.Visible = true;
82 | }
83 |
84 | private void DeleteArchetypesButton_Click(object sender, EventArgs e)
85 | {
86 | var selection = new List();
87 | foreach (var item in ArchetypesListView.SelectedItems)
88 | {
89 | selection.Add((item as ListViewItem).Tag as Archetype);
90 | }
91 |
92 | foreach (var archetype in selection)
93 | {
94 | EditingProject.Delete(archetype);
95 | }
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsiderationScore.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetConsiderationScore : UserControl
14 | {
15 | private Consideration EditingConsideration;
16 | private IInputBroker InputBroker;
17 |
18 | internal EditWidgetConsiderationScore(Consideration consideration, IInputBroker broker)
19 | {
20 | InitializeComponent();
21 | EditingConsideration = consideration;
22 | InputBroker = broker;
23 |
24 | ConsiderationNameLabel.Text = EditingConsideration.ReadableName + " (0.0) x";
25 |
26 | ResponseCurvePictureBox.Paint += (e, args) =>
27 | {
28 | Point previousPoint = ConvertXYToPoint(0.0, EditingConsideration.Curve.ComputeValue(0.0));
29 |
30 | for (double x = 0.0; x <= 1.0; x += 0.001)
31 | {
32 | double y = EditingConsideration.Curve.ComputeValue(x);
33 | Point p = ConvertXYToPoint(x, y);
34 |
35 | args.Graphics.DrawLine(Pens.Blue, previousPoint, p);
36 | previousPoint = p;
37 | }
38 |
39 | double inputX = InputBroker.GetInputValue(EditingConsideration);
40 | inputX = EditingConsideration.NormalizeInput(inputX);
41 | double inputY = EditingConsideration.Curve.ComputeValue(inputX);
42 |
43 | string name = EditingConsideration.ReadableName;
44 | ConsiderationNameLabel.Text = $"{name} ({inputX:f3}) x";
45 | ScoreLabel.Text = $"= {inputY:f3}";
46 |
47 | Point offsetPoint = ConvertXYToPoint(inputX, inputY);
48 | offsetPoint.X -= 4;
49 | offsetPoint.Y -= 4;
50 |
51 | args.Graphics.FillEllipse(Brushes.Blue, new Rectangle(offsetPoint, new Size(8, 8)));
52 | };
53 | }
54 |
55 | public double GetValue()
56 | {
57 | double inputX = InputBroker.GetInputValue(EditingConsideration);
58 | inputX = EditingConsideration.NormalizeInput(inputX);
59 | return EditingConsideration.Curve.ComputeValue(inputX);
60 | }
61 |
62 | public string GetName()
63 | {
64 | return EditingConsideration.ReadableName;
65 | }
66 |
67 | private Point ConvertXYToPoint(double x, double y)
68 | {
69 | var rect = ResponseCurvePictureBox.ClientRectangle;
70 | double height = (double)rect.Height;
71 | double width = (double)rect.Width;
72 |
73 | if (height >= width)
74 | height = width;
75 | else
76 | width = height;
77 |
78 | double marginX = ((double)rect.Width - width) / 2.0;
79 | double marginY = ((double)rect.Height - height) / 2.0;
80 |
81 | double pixelX = x * width + marginX;
82 | double pixelY = (1.0 - y) * height + marginY;
83 |
84 | return new Point((int)pixelX, (int)pixelY);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetCurveAdvanced.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature.Widgets
2 | {
3 | partial class EditWidgetCurveAdvanced
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditWidgetCurveAdvanced));
32 | this.ResponseCurveDescriptionLabel = new System.Windows.Forms.Label();
33 | this.ResponseCurveEditor = new Curvature.EditWidgetResponseCurve();
34 | this.SuspendLayout();
35 | //
36 | // ResponseCurveDescriptionLabel
37 | //
38 | this.ResponseCurveDescriptionLabel.Location = new System.Drawing.Point(3, 0);
39 | this.ResponseCurveDescriptionLabel.Name = "ResponseCurveDescriptionLabel";
40 | this.ResponseCurveDescriptionLabel.Size = new System.Drawing.Size(212, 230);
41 | this.ResponseCurveDescriptionLabel.TabIndex = 2;
42 | this.ResponseCurveDescriptionLabel.Text = resources.GetString("ResponseCurveDescriptionLabel.Text");
43 | //
44 | // ResponseCurveEditor
45 | //
46 | this.ResponseCurveEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
47 | | System.Windows.Forms.AnchorStyles.Left)
48 | | System.Windows.Forms.AnchorStyles.Right)));
49 | this.ResponseCurveEditor.Location = new System.Drawing.Point(221, 3);
50 | this.ResponseCurveEditor.Name = "ResponseCurveEditor";
51 | this.ResponseCurveEditor.Size = new System.Drawing.Size(376, 227);
52 | this.ResponseCurveEditor.TabIndex = 3;
53 | //
54 | // EditWidgetCurveAdvanced
55 | //
56 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
57 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
58 | this.Controls.Add(this.ResponseCurveDescriptionLabel);
59 | this.Controls.Add(this.ResponseCurveEditor);
60 | this.Name = "EditWidgetCurveAdvanced";
61 | this.Size = new System.Drawing.Size(604, 237);
62 | this.ResumeLayout(false);
63 |
64 | }
65 |
66 | #endregion
67 |
68 | private System.Windows.Forms.Label ResponseCurveDescriptionLabel;
69 | private EditWidgetResponseCurve ResponseCurveEditor;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetScenarios.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetScenarios : UserControl
14 | {
15 |
16 | private Project EditingProject;
17 |
18 |
19 |
20 | public EditWidgetScenarios()
21 | {
22 | InitializeComponent();
23 | ScenarioEditWidget.DialogRebuildNeeded += RefreshScenarioControls;
24 | }
25 |
26 |
27 | public void Attach(Project project)
28 | {
29 | EditingProject = project;
30 | RefreshScenarioControls(null);
31 | }
32 |
33 |
34 | private void RefreshScenarioControls(Scenario editedScenario)
35 | {
36 | ScenariosListView.Items.Clear();
37 |
38 | foreach (var scenario in EditingProject.Scenarios)
39 | {
40 | var item = new ListViewItem(scenario.ReadableName)
41 | {
42 | Tag = scenario
43 | };
44 | ScenariosListView.Items.Add(item);
45 | }
46 |
47 |
48 | if (ScenariosListView.Items.Count <= 0)
49 | {
50 | ScenarioEditWidget.Visible = false;
51 | return;
52 | }
53 |
54 | ScenarioEditWidget.Visible = true;
55 |
56 | if (editedScenario != null)
57 | {
58 | foreach(ListViewItem item in ScenariosListView.Items)
59 | {
60 | if (item.Tag == editedScenario)
61 | {
62 | ScenariosListView.SelectedIndices.Add(item.Index);
63 | break;
64 | }
65 | }
66 | }
67 | else
68 | ScenariosListView.SelectedIndices.Add(0);
69 | }
70 |
71 | private void ScenariosListView_SelectedIndexChanged(object sender, EventArgs e)
72 | {
73 | if (ScenariosListView.SelectedItems.Count <= 0)
74 | {
75 | ScenarioEditWidget.Visible = false;
76 | return;
77 | }
78 |
79 | ScenarioEditWidget.Visible = true;
80 | ScenarioEditWidget.Attach(ScenariosListView.SelectedItems[0].Tag as Scenario, EditingProject);
81 | }
82 |
83 | private void DeleteScenariosButton_Click(object sender, EventArgs e)
84 | {
85 | var selection = new List();
86 | foreach (var item in ScenariosListView.SelectedItems)
87 | {
88 | selection.Add((item as ListViewItem).Tag as Scenario);
89 | }
90 |
91 | foreach (var scenario in selection)
92 | {
93 | EditingProject.Delete(scenario);
94 | }
95 |
96 | EditingProject.MarkDirty();
97 | }
98 |
99 | private void CreateScenarioButton_Click(object sender, EventArgs e)
100 | {
101 | var scenario = new Scenario("Untitled Scenario");
102 | EditingProject.Scenarios.Add(scenario);
103 | EditingProject.MarkDirty();
104 | RefreshScenarioControls(scenario);
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetKnowledgeBaseParameter.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature.Widgets
2 | {
3 | partial class EditWidgetKnowledgeBaseParameter
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.ValueSlider = new System.Windows.Forms.TrackBar();
32 | this.ValueUpDown = new System.Windows.Forms.NumericUpDown();
33 | ((System.ComponentModel.ISupportInitialize)(this.ValueSlider)).BeginInit();
34 | ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // ValueSlider
38 | //
39 | this.ValueSlider.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
40 | | System.Windows.Forms.AnchorStyles.Right)));
41 | this.ValueSlider.Location = new System.Drawing.Point(3, 3);
42 | this.ValueSlider.Name = "ValueSlider";
43 | this.ValueSlider.Size = new System.Drawing.Size(141, 45);
44 | this.ValueSlider.TabIndex = 0;
45 | //
46 | // ValueUpDown
47 | //
48 | this.ValueUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
49 | | System.Windows.Forms.AnchorStyles.Right)));
50 | this.ValueUpDown.DecimalPlaces = 3;
51 | this.ValueUpDown.Location = new System.Drawing.Point(3, 54);
52 | this.ValueUpDown.Name = "ValueUpDown";
53 | this.ValueUpDown.Size = new System.Drawing.Size(141, 20);
54 | this.ValueUpDown.TabIndex = 1;
55 | this.ValueUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
56 | //
57 | // EditWidgetKnowledgeBaseParameter
58 | //
59 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
60 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
61 | this.Controls.Add(this.ValueUpDown);
62 | this.Controls.Add(this.ValueSlider);
63 | this.Name = "EditWidgetKnowledgeBaseParameter";
64 | this.Size = new System.Drawing.Size(147, 83);
65 | ((System.ComponentModel.ISupportInitialize)(this.ValueSlider)).EndInit();
66 | ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).EndInit();
67 | this.ResumeLayout(false);
68 | this.PerformLayout();
69 |
70 | }
71 |
72 | #endregion
73 |
74 | private System.Windows.Forms.TrackBar ValueSlider;
75 | private System.Windows.Forms.NumericUpDown ValueUpDown;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetInputAxis.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetInputAxis : UserControl
14 | {
15 | private InputAxis EditingAxis;
16 | private Project EditingProject;
17 |
18 |
19 | internal delegate void DialogRebuildNeededHandler();
20 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
21 |
22 |
23 | internal EditWidgetInputAxis(Project project, InputAxis axis)
24 | {
25 | InitializeComponent();
26 | EditingAxis = axis;
27 | EditingProject = project;
28 |
29 | EditingAxis.DialogRebuildNeeded += Rebuild;
30 |
31 | NameEditWidget.Attach("Input Axis", axis, project);
32 |
33 | InputTypeComboBox.SelectedIndex = (int)axis.Origin;
34 |
35 | EditingAxis.ParametersChanged += (obj, args) =>
36 | {
37 | GenerateParameterControls();
38 | EditingProject.MarkDirty();
39 | };
40 | }
41 |
42 | private void InputTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
43 | {
44 | bool selectComputedProperties = false;
45 | DataSourceComboBox.Items.Clear();
46 |
47 | if (InputTypeComboBox.SelectedIndex == 0 || InputTypeComboBox.SelectedIndex == 1)
48 | {
49 | selectComputedProperties = false;
50 | }
51 | else if (InputTypeComboBox.SelectedIndex == 2)
52 | {
53 | selectComputedProperties = true;
54 | }
55 |
56 | foreach (var rec in EditingProject.KB.Records)
57 | {
58 | if (rec.Computed == selectComputedProperties)
59 | DataSourceComboBox.Items.Add(rec);
60 | }
61 |
62 | var prev = EditingAxis.Origin;
63 |
64 | DataSourceComboBox.SelectedItem = EditingAxis.KBRec;
65 | EditingAxis.Origin = (InputAxis.OriginType)InputTypeComboBox.SelectedIndex;
66 |
67 | GenerateParameterControls();
68 |
69 |
70 | if (prev != EditingAxis.Origin)
71 | EditingProject.MarkDirty();
72 | }
73 |
74 | private void DataSourceComboBox_SelectedIndexChanged(object sender, EventArgs e)
75 | {
76 | var prev = EditingAxis.KBRec;
77 |
78 | EditingAxis.KBRec = DataSourceComboBox.SelectedItem as KnowledgeBase.Record;
79 |
80 | if (prev != EditingAxis.KBRec)
81 | EditingProject.MarkDirty();
82 | }
83 |
84 | private void DeleteButton_Click(object sender, EventArgs e)
85 | {
86 | EditingProject.Delete(EditingAxis);
87 | }
88 |
89 | private void GenerateParameterControls()
90 | {
91 | foreach (Control ctl in ParamFlowPanel.Controls)
92 | ctl.Dispose();
93 |
94 | ParamFlowPanel.Controls.Clear();
95 |
96 | foreach (InputParameter param in EditingAxis.Parameters)
97 | {
98 | ParamFlowPanel.Controls.Add(new EditWidgetParameter(param, EditingProject));
99 | }
100 | }
101 |
102 |
103 | internal void Rebuild()
104 | {
105 | NameEditWidget.Attach("Input Axis", EditingAxis, EditingProject);
106 | DialogRebuildNeeded?.Invoke();
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetBehaviorSets.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature.Widgets
12 | {
13 | public partial class EditWidgetBehaviorSets : UserControl
14 | {
15 |
16 | private Project EditingProject;
17 |
18 |
19 | internal delegate void AutoNavigationRequestedHandler(Behavior behavior);
20 | internal event AutoNavigationRequestedHandler AutoNavigationRequested;
21 |
22 |
23 | public EditWidgetBehaviorSets()
24 | {
25 | InitializeComponent();
26 | BehaviorSetEditWidget.AutoNavigationRequested += AutoNavigationRequestedFromChild;
27 | BehaviorSetEditWidget.DialogRebuildNeeded += RefreshBehaviorSetControls;
28 | }
29 |
30 | public void Attach(Project project)
31 | {
32 | EditingProject = project;
33 | RefreshBehaviorSetControls(null);
34 | }
35 |
36 | private void RefreshBehaviorSetControls(BehaviorSet editedSet)
37 | {
38 | BehaviorSetsListView.Items.Clear();
39 |
40 | foreach (var behaviorSet in EditingProject.BehaviorSets)
41 | {
42 | var item = new ListViewItem(behaviorSet.ReadableName)
43 | {
44 | Tag = behaviorSet
45 | };
46 | BehaviorSetsListView.Items.Add(item);
47 | }
48 |
49 | BehaviorSetEditWidget.Visible = false;
50 |
51 | if (BehaviorSetsListView.Items.Count <= 0)
52 | return;
53 |
54 | if (editedSet != null)
55 | {
56 | foreach (ListViewItem item in BehaviorSetsListView.Items)
57 | {
58 | if (item.Tag == editedSet)
59 | {
60 | BehaviorSetsListView.SelectedIndices.Add(item.Index);
61 | break;
62 | }
63 | }
64 | }
65 | else
66 | BehaviorSetsListView.SelectedIndices.Add(0);
67 | }
68 |
69 | private void BehaviorSetsListView_SelectedIndexChanged(object sender, EventArgs e)
70 | {
71 | if (BehaviorSetsListView.SelectedItems.Count <= 0)
72 | {
73 | BehaviorSetEditWidget.Visible = false;
74 | return;
75 | }
76 |
77 | BehaviorSetEditWidget.Attach(BehaviorSetsListView.SelectedItems[0].Tag as BehaviorSet, EditingProject);
78 | BehaviorSetEditWidget.Visible = true;
79 | }
80 |
81 | private void DeleteBehaviorSetButton_Click(object sender, EventArgs e)
82 | {
83 | var selection = new List();
84 | foreach (var item in BehaviorSetsListView.SelectedItems)
85 | {
86 | selection.Add((item as ListViewItem).Tag as BehaviorSet);
87 | }
88 |
89 | foreach (var behaviorset in selection)
90 | {
91 | EditingProject.Delete(behaviorset);
92 | }
93 | }
94 |
95 | private void AddBehaviorSetButton_Click(object sender, EventArgs e)
96 | {
97 | var set = new BehaviorSet("Untitled Behavior Set");
98 | EditingProject.BehaviorSets.Add(set);
99 | EditingProject.MarkDirty();
100 | RefreshBehaviorSetControls(set);
101 | }
102 |
103 | internal void AutoNavigationRequestedFromChild(Behavior behavior)
104 | {
105 | AutoNavigationRequested?.Invoke(behavior);
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsideration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using Curvature.Widgets;
11 |
12 | namespace Curvature
13 | {
14 | public partial class EditWidgetConsideration : UserControl
15 | {
16 | private Consideration EditingConsideration;
17 | private Project EditingProject;
18 |
19 |
20 | internal delegate void DialogRebuildNeededHandler(Consideration editedContent);
21 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
22 |
23 |
24 | public EditWidgetConsideration()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | internal void Attach(Project project, Consideration editConsideration)
30 | {
31 | if (EditingConsideration != null)
32 | EditingConsideration.DialogRebuildNeeded -= Rebuild;
33 |
34 | EditingConsideration = editConsideration;
35 | EditingProject = project;
36 |
37 | EditingConsideration.DialogRebuildNeeded += Rebuild;
38 |
39 | NameEditWidget.Attach("Consideration", EditingConsideration, project);
40 |
41 | InputAxisDropdown.Items.Clear();
42 | foreach (InputAxis axis in project.Inputs)
43 | {
44 | InputAxisDropdown.Items.Add(axis);
45 | }
46 |
47 | InputAxisDropdown.SelectedItem = EditingConsideration.Input;
48 | ResponseCurveEditor.AttachCurve(EditingConsideration.Curve, EditingProject);
49 |
50 | WrapInputCheckBox.Checked = EditingConsideration.WrapInput;
51 | }
52 |
53 | private void CurveWizardButton_Click(object sender, EventArgs e)
54 | {
55 | var prev = new Consideration(EditingConsideration.GetName());
56 | prev.CopyFrom(EditingConsideration);
57 |
58 | var result = (new CurveWizardForm(EditingProject, EditingConsideration)).ShowDialog();
59 | if (result == DialogResult.OK)
60 | {
61 | EditingProject.MarkDirty();
62 | Rebuild();
63 | }
64 | else
65 | EditingConsideration.CopyFrom(prev);
66 | }
67 |
68 | private void InputAxisDropdown_SelectedIndexChanged(object sender, EventArgs e)
69 | {
70 | var prev = EditingConsideration.Input;
71 |
72 | var axis = InputAxisDropdown.SelectedItem as InputAxis;
73 | EditingConsideration.Input = axis;
74 |
75 | foreach (Control c in ParamFlowPanel.Controls)
76 | c.Dispose();
77 |
78 | ParamFlowPanel.Controls.Clear();
79 |
80 | EditingConsideration.GenerateParameterValuesFromInput();
81 | foreach (var param in EditingConsideration.ParameterValues)
82 | ParamFlowPanel.Controls.Add(new EditWidgetParameterValue(param, EditingProject));
83 |
84 | if (prev != EditingConsideration.Input)
85 | EditingProject.MarkDirty();
86 | }
87 |
88 | internal void Rebuild()
89 | {
90 | Attach(EditingProject, EditingConsideration);
91 | DialogRebuildNeeded?.Invoke(EditingConsideration);
92 | }
93 |
94 | private void WrapInputCheckBox_CheckedChanged(object sender, EventArgs e)
95 | {
96 | var prev = EditingConsideration.WrapInput;
97 |
98 | EditingConsideration.WrapInput = WrapInputCheckBox.Checked;
99 |
100 | if (prev != EditingConsideration.WrapInput)
101 | EditingProject.MarkDirty();
102 | }
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetProject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetProject : UserControl
14 | {
15 | private Project EditingProject;
16 |
17 |
18 | internal delegate void GuidanceEventHandler(object sender, EventArgs args);
19 | internal event GuidanceEventHandler GuidanceKnowledgeBase;
20 | internal event GuidanceEventHandler GuidanceInputs;
21 | internal event GuidanceEventHandler GuidanceBehaviors;
22 | internal event GuidanceEventHandler GuidanceScenarios;
23 | internal event GuidanceEventHandler GuidanceTour;
24 |
25 |
26 | internal delegate void DialogRebuildNeededHandler();
27 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
28 |
29 |
30 | public EditWidgetProject()
31 | {
32 | InitializeComponent();
33 | }
34 |
35 |
36 | internal void Attach(Project editedProject)
37 | {
38 | if (EditingProject != null)
39 | EditingProject.DialogRebuildNeeded -= Rebuild;
40 |
41 | EditingProject = editedProject;
42 | NameEditWidget.Attach("Project", EditingProject, EditingProject);
43 |
44 | EditingProject.DialogRebuildNeeded += Rebuild;
45 |
46 | int considerationCount = 0;
47 | foreach (var behavior in EditingProject.Behaviors)
48 | {
49 | considerationCount += behavior.Considerations.Count;
50 | }
51 |
52 | KnowledgeBaseEntriesLabel.Text = $"Knowledge Base Entries: {EditingProject.KB.Records.Count}";
53 | InputAxesLabel.Text = $"Input Axes: {EditingProject.Inputs.Count}";
54 | ConsiderationsLabel.Text = $"Considerations: {considerationCount}";
55 | BehaviorsLabel.Text = $"Behaviors: {EditingProject.Behaviors.Count}";
56 | BehaviorSetsLabel.Text = $"Behavior Sets: {EditingProject.BehaviorSets.Count}";
57 | ArchetypesLabel.Text = $"Archetypes: {EditingProject.Archetypes.Count}";
58 | ScenariosLabel.Text = $"Scenarios: {EditingProject.Scenarios.Count}";
59 | }
60 |
61 | private void WikiLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
62 | {
63 | System.Diagnostics.Process.Start("https://github.com/apoch/curvature/wiki");
64 | }
65 |
66 | private void UtilityCrashCourseLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
67 | {
68 | System.Diagnostics.Process.Start("https://github.com/apoch/curvature/wiki/Utility-Theory-Crash-Course");
69 | }
70 |
71 | private void CreateKnowledgeButton_Click(object sender, EventArgs e)
72 | {
73 | GuidanceKnowledgeBase(this, null);
74 | }
75 |
76 | private void DefineInputsButton_Click(object sender, EventArgs e)
77 | {
78 | GuidanceInputs(this, null);
79 | }
80 |
81 | private void SpecifyBehaviorsButton_Click(object sender, EventArgs e)
82 | {
83 | GuidanceBehaviors(this, null);
84 | }
85 |
86 | private void ScenariosButton_Click(object sender, EventArgs e)
87 | {
88 | GuidanceScenarios(this, null);
89 | }
90 |
91 | internal void Rebuild()
92 | {
93 | Attach(EditingProject);
94 | DialogRebuildNeeded?.Invoke();
95 | }
96 |
97 | private void GuidedTourButton_Click(object sender, EventArgs e)
98 | {
99 | GuidanceTour(this, null);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsiderationScore.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetConsiderationScore
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.ConsiderationNameLabel = new System.Windows.Forms.Label();
32 | this.ScoreLabel = new System.Windows.Forms.Label();
33 | this.ResponseCurvePictureBox = new System.Windows.Forms.PictureBox();
34 | ((System.ComponentModel.ISupportInitialize)(this.ResponseCurvePictureBox)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // ConsiderationNameLabel
38 | //
39 | this.ConsiderationNameLabel.Location = new System.Drawing.Point(3, 47);
40 | this.ConsiderationNameLabel.Name = "ConsiderationNameLabel";
41 | this.ConsiderationNameLabel.Size = new System.Drawing.Size(159, 23);
42 | this.ConsiderationNameLabel.TabIndex = 0;
43 | this.ConsiderationNameLabel.Text = "(Consideration Name) x";
44 | this.ConsiderationNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
45 | //
46 | // ScoreLabel
47 | //
48 | this.ScoreLabel.AutoSize = true;
49 | this.ScoreLabel.Location = new System.Drawing.Point(284, 52);
50 | this.ScoreLabel.Name = "ScoreLabel";
51 | this.ScoreLabel.Size = new System.Drawing.Size(31, 13);
52 | this.ScoreLabel.TabIndex = 1;
53 | this.ScoreLabel.Text = "= 0.0";
54 | //
55 | // ResponseCurvePictureBox
56 | //
57 | this.ResponseCurvePictureBox.BackColor = System.Drawing.Color.White;
58 | this.ResponseCurvePictureBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
59 | this.ResponseCurvePictureBox.Location = new System.Drawing.Point(168, 3);
60 | this.ResponseCurvePictureBox.Name = "ResponseCurvePictureBox";
61 | this.ResponseCurvePictureBox.Size = new System.Drawing.Size(110, 110);
62 | this.ResponseCurvePictureBox.TabIndex = 0;
63 | this.ResponseCurvePictureBox.TabStop = false;
64 | //
65 | // EditWidgetConsiderationScore
66 | //
67 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
68 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
69 | this.Controls.Add(this.ScoreLabel);
70 | this.Controls.Add(this.ConsiderationNameLabel);
71 | this.Controls.Add(this.ResponseCurvePictureBox);
72 | this.Name = "EditWidgetConsiderationScore";
73 | this.Size = new System.Drawing.Size(347, 116);
74 | ((System.ComponentModel.ISupportInitialize)(this.ResponseCurvePictureBox)).EndInit();
75 | this.ResumeLayout(false);
76 | this.PerformLayout();
77 |
78 | }
79 |
80 | #endregion
81 |
82 | private System.Windows.Forms.PictureBox ResponseCurvePictureBox;
83 | private System.Windows.Forms.Label ConsiderationNameLabel;
84 | private System.Windows.Forms.Label ScoreLabel;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetInputs.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetInputs
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditWidgetInputs));
33 | this.IconImageList = new System.Windows.Forms.ImageList(this.components);
34 | this.NewInputButton = new System.Windows.Forms.Button();
35 | this.ScrollablePanel = new System.Windows.Forms.Panel();
36 | this.SuspendLayout();
37 | //
38 | // IconImageList
39 | //
40 | this.IconImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("IconImageList.ImageStream")));
41 | this.IconImageList.TransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
42 | this.IconImageList.Images.SetKeyName(0, "CreateItemIcon.png");
43 | //
44 | // NewInputButton
45 | //
46 | this.NewInputButton.Dock = System.Windows.Forms.DockStyle.Bottom;
47 | this.NewInputButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
48 | this.NewInputButton.ImageIndex = 0;
49 | this.NewInputButton.ImageList = this.IconImageList;
50 | this.NewInputButton.Location = new System.Drawing.Point(0, 225);
51 | this.NewInputButton.Name = "NewInputButton";
52 | this.NewInputButton.Size = new System.Drawing.Size(426, 30);
53 | this.NewInputButton.TabIndex = 1;
54 | this.NewInputButton.Text = "Create Input Axis";
55 | this.NewInputButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
56 | this.NewInputButton.UseVisualStyleBackColor = true;
57 | //
58 | // ScrollablePanel
59 | //
60 | this.ScrollablePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
61 | | System.Windows.Forms.AnchorStyles.Left)
62 | | System.Windows.Forms.AnchorStyles.Right)));
63 | this.ScrollablePanel.AutoScroll = true;
64 | this.ScrollablePanel.Location = new System.Drawing.Point(3, 3);
65 | this.ScrollablePanel.Name = "ScrollablePanel";
66 | this.ScrollablePanel.Size = new System.Drawing.Size(420, 216);
67 | this.ScrollablePanel.TabIndex = 2;
68 | //
69 | // EditWidgetInputs
70 | //
71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73 | this.Controls.Add(this.ScrollablePanel);
74 | this.Controls.Add(this.NewInputButton);
75 | this.Name = "EditWidgetInputs";
76 | this.Size = new System.Drawing.Size(426, 255);
77 | this.ResumeLayout(false);
78 |
79 | }
80 |
81 | #endregion
82 | private System.Windows.Forms.ImageList IconImageList;
83 | private System.Windows.Forms.Button NewInputButton;
84 | private System.Windows.Forms.Panel ScrollablePanel;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Forms/CurveWizardForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using Curvature.Widgets;
11 |
12 | namespace Curvature
13 | {
14 | public partial class CurveWizardForm : Form
15 | {
16 | private Consideration EditingConsideration;
17 | private Project EditingProject;
18 |
19 | public CurveWizardForm(Project project, Consideration consideration)
20 | {
21 | InitializeComponent();
22 | EditingConsideration = consideration;
23 | EditingProject = project;
24 |
25 | foreach (InputAxis axis in EditingProject.Inputs)
26 | {
27 | InputComboBox.Items.Add(axis);
28 | }
29 |
30 | InputComboBox.SelectedItem = EditingConsideration.Input;
31 |
32 | ConsiderationNameEditBox.Text = EditingConsideration.ReadableName;
33 |
34 | AdvancedCurvesWidget.AttachCurve(EditingConsideration.Curve, EditingProject);
35 | }
36 |
37 | private void OKButton_Click(object sender, EventArgs e)
38 | {
39 | CopyControlsToConsideration();
40 | Close();
41 | }
42 |
43 | private void CopyControlsToConsideration()
44 | {
45 | EditingConsideration.Rename(ConsiderationNameEditBox.Text);
46 | EditingConsideration.Input = InputComboBox.SelectedItem as InputAxis;
47 |
48 | if (ResponseCurveAdvancedTabs.SelectedTab == ResponseCurvePresetsTab)
49 | {
50 | PresetCurvesWidget.Apply(EditingConsideration.Curve);
51 | }
52 | }
53 |
54 | private void InputComboBox_SelectedIndexChanged(object sender, EventArgs e)
55 | {
56 | var axis = InputComboBox.SelectedItem as InputAxis;
57 | EditingConsideration.Input = axis;
58 |
59 | ParameterInputHintLabel.Text = "The input being configured is: " + axis.ReadableName;
60 |
61 | foreach (Control c in ParamFlowPanel.Controls)
62 | c.Dispose();
63 |
64 | ParamFlowPanel.Controls.Clear();
65 |
66 | EditingConsideration.GenerateParameterValuesFromInput();
67 | foreach (var param in EditingConsideration.ParameterValues)
68 | ParamFlowPanel.Controls.Add(new EditWidgetParameterValue(param, EditingProject));
69 |
70 | if (EditingConsideration.ParameterValues.Count == 0)
71 | ParameterHintSpecificsLabel.Text = "This input has no parameters, so go ahead and click Next to move on.";
72 | else if (EditingConsideration.ParameterValues.Count == 1)
73 | {
74 | if (EditingConsideration.ParameterValues[0] is InputParameterValueNumeric)
75 | ParameterHintSpecificsLabel.Text = "This input has one parameter. By default, input numbers are divided by this value before being processed through a response curve.";
76 | else
77 | {
78 | if ((EditingConsideration.Input.Parameters[0] as InputParameterEnumeration).ScoreOnMatch)
79 | ParameterHintSpecificsLabel.Text = "This input must have a predefined value; if the subject has the same value assigned, the input will score 1.0.";
80 | else
81 | ParameterHintSpecificsLabel.Text = "This input must have a predefined value; if the subject has any other value assigned, the input will score 1.0.";
82 | }
83 | }
84 | else if (EditingConsideration.ParameterValues.Count == 2)
85 | ParameterHintSpecificsLabel.Text = "This input controls a range. Input numbers will be normalized to 0-1 using this lower and upper bound.";
86 | else
87 | ParameterHintSpecificsLabel.Text = "This input has multiple parameters. Nobody knows what they do.";
88 | }
89 |
90 | private void NamingWikiLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
91 | {
92 | System.Diagnostics.Process.Start("https://github.com/apoch/curvature/wiki"); // TODO - #45 - wiki documentation
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetParameterValue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature.Widgets
2 | {
3 | partial class EditWidgetParameterValue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.ParamNameLabel = new System.Windows.Forms.Label();
32 | this.ValueUpDown = new System.Windows.Forms.NumericUpDown();
33 | this.InputValueDropDown = new System.Windows.Forms.ComboBox();
34 | ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // ParamNameLabel
38 | //
39 | this.ParamNameLabel.AutoSize = true;
40 | this.ParamNameLabel.Location = new System.Drawing.Point(24, 9);
41 | this.ParamNameLabel.Name = "ParamNameLabel";
42 | this.ParamNameLabel.Size = new System.Drawing.Size(95, 13);
43 | this.ParamNameLabel.TabIndex = 0;
44 | this.ParamNameLabel.Text = "(Parameter Name):";
45 | this.ParamNameLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
46 | //
47 | // ValueUpDown
48 | //
49 | this.ValueUpDown.DecimalPlaces = 3;
50 | this.ValueUpDown.Increment = new decimal(new int[] {
51 | 1,
52 | 0,
53 | 0,
54 | 65536});
55 | this.ValueUpDown.Location = new System.Drawing.Point(125, 6);
56 | this.ValueUpDown.Name = "ValueUpDown";
57 | this.ValueUpDown.Size = new System.Drawing.Size(137, 20);
58 | this.ValueUpDown.TabIndex = 1;
59 | this.ValueUpDown.ValueChanged += new System.EventHandler(this.ValueUpDown_ValueChanged);
60 | //
61 | // InputValueDropDown
62 | //
63 | this.InputValueDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
64 | | System.Windows.Forms.AnchorStyles.Right)));
65 | this.InputValueDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
66 | this.InputValueDropDown.FormattingEnabled = true;
67 | this.InputValueDropDown.Location = new System.Drawing.Point(125, 5);
68 | this.InputValueDropDown.Name = "InputValueDropDown";
69 | this.InputValueDropDown.Size = new System.Drawing.Size(162, 21);
70 | this.InputValueDropDown.TabIndex = 2;
71 | this.InputValueDropDown.SelectedIndexChanged += new System.EventHandler(this.InputValueDropDown_SelectedIndexChanged);
72 | //
73 | // EditWidgetParameterValue
74 | //
75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
77 | this.Controls.Add(this.InputValueDropDown);
78 | this.Controls.Add(this.ValueUpDown);
79 | this.Controls.Add(this.ParamNameLabel);
80 | this.Name = "EditWidgetParameterValue";
81 | this.Size = new System.Drawing.Size(295, 31);
82 | ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).EndInit();
83 | this.ResumeLayout(false);
84 | this.PerformLayout();
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.Label ParamNameLabel;
91 | private System.Windows.Forms.NumericUpDown ValueUpDown;
92 | private System.Windows.Forms.ComboBox InputValueDropDown;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetBehavior : UserControl
14 | {
15 | private Behavior EditingBehavior;
16 | private Project EditingProject;
17 |
18 |
19 | internal delegate void DialogRebuildNeededHandler(Behavior editedContent);
20 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
21 |
22 |
23 | public EditWidgetBehavior()
24 | {
25 | InitializeComponent();
26 |
27 | foreach (Behavior.ActionType e in Enum.GetValues(typeof(Behavior.ActionType)))
28 | {
29 | ActionComboBox.Items.Add(e.GetDescription());
30 | }
31 |
32 | ActionComboBox.SelectedIndex = 0;
33 | }
34 |
35 | internal void Attach(Behavior behavior, Project project)
36 | {
37 | if (EditingBehavior != null)
38 | EditingBehavior.DialogRebuildNeeded -= Rebuild;
39 |
40 | EditingProject = project;
41 | EditingBehavior = behavior;
42 |
43 | if (!string.IsNullOrEmpty(EditingBehavior.Payload))
44 | CustomPayload.Text = EditingBehavior.Payload;
45 | else
46 | CustomPayload.Text = "";
47 |
48 | EditingBehavior.DialogRebuildNeeded += Rebuild;
49 |
50 | BehaviorWeightEditBox.Value = (decimal)EditingBehavior.Weight;
51 |
52 | ActionComboBox.SelectedIndex = (int)EditingBehavior.Action;
53 | CanTargetSelfCheckBox.Checked = EditingBehavior.CanTargetSelf;
54 | CanTargetOthersCheckBox.Checked = EditingBehavior.CanTargetOthers;
55 | }
56 |
57 |
58 | internal void Rebuild()
59 | {
60 | Attach(EditingBehavior, EditingProject);
61 | DialogRebuildNeeded?.Invoke(EditingBehavior);
62 | }
63 |
64 |
65 |
66 |
67 | private void ActionComboBox_SelectedIndexChanged(object sender, EventArgs e)
68 | {
69 | if (EditingBehavior != null)
70 | {
71 | var prev = EditingBehavior.Action;
72 | EditingBehavior.Action = (Behavior.ActionType)ActionComboBox.SelectedIndex;
73 | if (prev != EditingBehavior.Action)
74 | EditingProject.MarkDirty();
75 | }
76 | }
77 |
78 | private void CustomPayload_TextChanged(object sender, EventArgs e)
79 | {
80 | if (EditingBehavior != null)
81 | {
82 | var prev = EditingBehavior.Payload;
83 | EditingBehavior.Payload = CustomPayload.Text;
84 | if (prev != EditingBehavior.Payload)
85 | EditingProject.MarkDirty();
86 | }
87 | }
88 |
89 | private void BehaviorWeightEditBox_ValueChanged(object sender, EventArgs e)
90 | {
91 | if (EditingBehavior != null)
92 | {
93 | var prev = EditingBehavior.Weight;
94 | EditingBehavior.Weight = (double)BehaviorWeightEditBox.Value;
95 | if (prev != EditingBehavior.Weight)
96 | EditingProject.MarkDirty();
97 | }
98 | }
99 |
100 |
101 | private void CanTargetSelfCheckBox_CheckedChanged(object sender, EventArgs e)
102 | {
103 | if (EditingBehavior != null)
104 | {
105 | var prev = EditingBehavior.CanTargetSelf;
106 | EditingBehavior.CanTargetSelf = CanTargetSelfCheckBox.Checked;
107 | if (prev != EditingBehavior.CanTargetSelf)
108 | EditingProject.MarkDirty();
109 | }
110 | }
111 |
112 | private void CanTargetOthersCheckBox_CheckedChanged(object sender, EventArgs e)
113 | {
114 | if (EditingBehavior != null)
115 | {
116 | var prev = EditingBehavior.CanTargetOthers;
117 | EditingBehavior.CanTargetOthers = CanTargetOthersCheckBox.Checked;
118 | if (EditingBehavior.CanTargetOthers != prev)
119 | EditingProject.MarkDirty();
120 | }
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsiderationInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetConsiderationInput : UserControl
14 | {
15 | private InputAxis EditingAxis;
16 | private IInputBroker InputBroker;
17 |
18 | internal EditWidgetConsiderationInput(InputAxis axis, IInputBroker broker)
19 | {
20 | InitializeComponent();
21 | EditingAxis = axis;
22 | InputBroker = broker;
23 |
24 | InputValueTrackBar.Minimum = 0;
25 | InputValueTrackBar.Maximum = 100;
26 |
27 | InputValueDropDown.Visible = false;
28 |
29 | if ((EditingAxis != null) && (EditingAxis.Parameters != null))
30 | {
31 | if (EditingAxis.Parameters.Count == 1)
32 | {
33 | var rawparam = EditingAxis.Parameters[0];
34 | if (rawparam is InputParameterNumeric)
35 | {
36 | var numericparam = rawparam as InputParameterNumeric;
37 | InputValueTrackBar.Minimum = (int)(numericparam.MinimumValue * 100.0f);
38 | InputValueTrackBar.Maximum = (int)(numericparam.MaximumValue * 100.0f);
39 | }
40 | else if (rawparam is InputParameterEnumeration)
41 | {
42 | InputValueTrackBar.Visible = false;
43 | InputValueDropDown.Visible = true;
44 | InputValueDropDown.Items.Clear();
45 |
46 | var penum = rawparam as InputParameterEnumeration;
47 | foreach (var valid in penum.ValidValues)
48 | InputValueDropDown.Items.Add(valid);
49 |
50 | if (penum.ValidValues.Count > 0)
51 | InputValueDropDown.SelectedIndex = 0;
52 | }
53 | }
54 | else if (EditingAxis.Parameters.Count == 2)
55 | {
56 | InputValueTrackBar.Minimum = (int)((EditingAxis.Parameters[0] as InputParameterNumeric).MinimumValue * 100.0f);
57 | InputValueTrackBar.Maximum = (int)((EditingAxis.Parameters[1] as InputParameterNumeric).MaximumValue * 100.0f);
58 | }
59 | else
60 | {
61 | InputValueTrackBar.Visible = false;
62 | }
63 | }
64 |
65 | if (InputValueTrackBar.Visible)
66 | {
67 | int range = InputValueTrackBar.Maximum - InputValueTrackBar.Minimum;
68 | InputValueTrackBar.SmallChange = range / 10;
69 | InputValueTrackBar.LargeChange = range / 4;
70 | InputValueTrackBar.TickFrequency = range / 25;
71 |
72 | InputValueTrackBar.Value = InputValueTrackBar.Minimum + (range / 2);
73 | InputValueTrackBar_Scroll(null, null);
74 | }
75 | }
76 |
77 | public double GetRawValue()
78 | {
79 | if ((EditingAxis.Parameters.Count == 1) && (EditingAxis.Parameters[0] is InputParameterEnumeration))
80 | throw new Exception();
81 |
82 | return (double)InputValueTrackBar.Value / 100.0;
83 | }
84 |
85 | public string GetStringValue()
86 | {
87 | if ((EditingAxis.Parameters.Count != 1) || !(EditingAxis.Parameters[0] is InputParameterEnumeration))
88 | return null;
89 |
90 | if (InputValueDropDown.SelectedIndex < 0)
91 | return null;
92 |
93 | return InputValueDropDown.SelectedItem as string;
94 | }
95 |
96 | private void InputValueTrackBar_Scroll(object sender, EventArgs e)
97 | {
98 | InputCaption.Text = $"{EditingAxis.ReadableName} ({GetRawValue():f3})";
99 | InputBroker.RefreshInputs();
100 | }
101 |
102 | private void InputValueDropDown_SelectedIndexChanged(object sender, EventArgs e)
103 | {
104 | InputCaption.Text = $"{EditingAxis.ReadableName}";
105 | InputBroker.RefreshInputs();
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Forms/CurvePresetForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class CurvePresetForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.CancelPresetsButton = new System.Windows.Forms.Button();
32 | this.OKButton = new System.Windows.Forms.Button();
33 | this.CurvePresetsWidget = new Curvature.Widgets.EditWidgetCurvePresets();
34 | this.SuspendLayout();
35 | //
36 | // CancelPresetsButton
37 | //
38 | this.CancelPresetsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
39 | this.CancelPresetsButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
40 | this.CancelPresetsButton.Location = new System.Drawing.Point(501, 280);
41 | this.CancelPresetsButton.Name = "CancelPresetsButton";
42 | this.CancelPresetsButton.Size = new System.Drawing.Size(75, 23);
43 | this.CancelPresetsButton.TabIndex = 8;
44 | this.CancelPresetsButton.Text = "Cancel";
45 | this.CancelPresetsButton.UseVisualStyleBackColor = true;
46 | //
47 | // OKButton
48 | //
49 | this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
50 | this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK;
51 | this.OKButton.Location = new System.Drawing.Point(420, 280);
52 | this.OKButton.Name = "OKButton";
53 | this.OKButton.Size = new System.Drawing.Size(75, 23);
54 | this.OKButton.TabIndex = 7;
55 | this.OKButton.Text = "OK";
56 | this.OKButton.UseVisualStyleBackColor = true;
57 | this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
58 | //
59 | // CurvePresetsWidget
60 | //
61 | this.CurvePresetsWidget.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
62 | | System.Windows.Forms.AnchorStyles.Left)
63 | | System.Windows.Forms.AnchorStyles.Right)));
64 | this.CurvePresetsWidget.Location = new System.Drawing.Point(2, 2);
65 | this.CurvePresetsWidget.Name = "CurvePresetsWidget";
66 | this.CurvePresetsWidget.Size = new System.Drawing.Size(583, 272);
67 | this.CurvePresetsWidget.TabIndex = 9;
68 | //
69 | // CurvePresetForm
70 | //
71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73 | this.ClientSize = new System.Drawing.Size(588, 315);
74 | this.Controls.Add(this.CurvePresetsWidget);
75 | this.Controls.Add(this.OKButton);
76 | this.Controls.Add(this.CancelPresetsButton);
77 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
78 | this.MaximizeBox = false;
79 | this.MinimizeBox = false;
80 | this.Name = "CurvePresetForm";
81 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
82 | this.Text = "Curve Preset Generator";
83 | this.ResumeLayout(false);
84 |
85 | }
86 |
87 | #endregion
88 | private System.Windows.Forms.Button CancelPresetsButton;
89 | private System.Windows.Forms.Button OKButton;
90 | private Widgets.EditWidgetCurvePresets CurvePresetsWidget;
91 | }
92 | }
--------------------------------------------------------------------------------
/UtilityAISystem/Behavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.Serialization;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 |
10 | namespace Curvature
11 | {
12 | [DataContract(Namespace = "")]
13 | public class Behavior : INameable
14 | {
15 | [DataMember]
16 | public string ReadableName;
17 |
18 | [DataMember]
19 | public List Considerations;
20 |
21 | [DataMember]
22 | public double Weight;
23 |
24 | [DataMember]
25 | public ActionType Action;
26 |
27 | [DataMember]
28 | public bool CanTargetSelf;
29 |
30 | [DataMember]
31 | public bool CanTargetOthers;
32 |
33 | [DataMember]
34 | public string Payload;
35 |
36 |
37 | public enum ActionType
38 | {
39 | [Description("Do nothing")]
40 | Idle,
41 |
42 | [Description("Move towards the target")]
43 | MoveToTarget,
44 |
45 | [Description("Move away from the target")]
46 | MoveAwayFromTarget,
47 |
48 | [Description("Show a speech balloon")]
49 | Talk,
50 |
51 | [Description("Show a custom animation")]
52 | Custom
53 | }
54 |
55 | internal delegate void DialogRebuildNeededHandler();
56 | internal event DialogRebuildNeededHandler DialogRebuildNeeded;
57 |
58 |
59 | internal Behavior()
60 | {
61 | Action = ActionType.Idle;
62 | CanTargetSelf = false;
63 | CanTargetOthers = true;
64 | }
65 |
66 | public Behavior(string name)
67 | {
68 | ReadableName = name;
69 | Considerations = new List();
70 | Weight = 1.0;
71 | Action = ActionType.Idle;
72 | CanTargetSelf = false;
73 | CanTargetOthers = true;
74 | }
75 |
76 |
77 | public override string ToString()
78 | {
79 | if (string.IsNullOrEmpty(ReadableName))
80 | return "(Untitled)";
81 |
82 | return ReadableName;
83 | }
84 |
85 | internal Scenario.ConsiderationScores Score(IInputBroker broker, Scenario.Context context)
86 | {
87 | var ret = new Scenario.ConsiderationScores
88 | {
89 | Considerations = new Dictionary()
90 | };
91 |
92 | double compensationFactor = 1.0 - (1.0 / (double)Considerations.Count);
93 | double result = Weight;
94 | ret.InitialWeight = Weight;
95 |
96 | foreach (Consideration c in Considerations)
97 | {
98 | Scenario.Score considerationScore = c.Score(broker, context);
99 | double modification = (1.0 - considerationScore.FinalScore) * compensationFactor;
100 | considerationScore.FinalScore = considerationScore.FinalScore + (modification * considerationScore.FinalScore);
101 |
102 | result *= considerationScore.FinalScore;
103 | ret.Considerations.Add(c, considerationScore);
104 | }
105 |
106 | ret.FinalScore = result;
107 | return ret;
108 | }
109 |
110 | public void Rename(string newname)
111 | {
112 | ReadableName = newname;
113 | DialogRebuildNeeded?.Invoke();
114 | }
115 |
116 | public string GetName()
117 | {
118 | return ReadableName;
119 | }
120 | }
121 |
122 | internal static class EnumExtensions
123 | {
124 | internal static string GetDescription(this Enum genericEnum)
125 | {
126 | Type genericEnumType = genericEnum.GetType();
127 | var memberInfo = genericEnumType.GetMember(genericEnum.ToString());
128 | if ((memberInfo != null && memberInfo.Length > 0))
129 | {
130 | var _Attribs = memberInfo[0].GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
131 | if ((_Attribs != null && _Attribs.Count() > 0))
132 | {
133 | return ((System.ComponentModel.DescriptionAttribute)_Attribs.ElementAt(0)).Description;
134 | }
135 | }
136 | return genericEnum.ToString();
137 | }
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Windows Store app package directory
170 | AppPackages/
171 | BundleArtifacts/
172 |
173 | # Visual Studio cache files
174 | # files ending in .cache can be ignored
175 | *.[Cc]ache
176 | # but keep track of directories ending in .cache
177 | !*.[Cc]ache/
178 |
179 | # Others
180 | ClientBin/
181 | [Ss]tyle[Cc]op.*
182 | ~$*
183 | *~
184 | *.dbmdl
185 | *.dbproj.schemaview
186 | *.pfx
187 | *.publishsettings
188 | node_modules/
189 | orleans.codegen.cs
190 |
191 | # RIA/Silverlight projects
192 | Generated_Code/
193 |
194 | # Backup & report files from converting an old project file
195 | # to a newer Visual Studio version. Backup files are not needed,
196 | # because we have git ;-)
197 | _UpgradeReport_Files/
198 | Backup*/
199 | UpgradeLog*.XML
200 | UpgradeLog*.htm
201 |
202 | # SQL Server files
203 | *.mdf
204 | *.ldf
205 |
206 | # Business Intelligence projects
207 | *.rdl.data
208 | *.bim.layout
209 | *.bim_*.settings
210 |
211 | # Microsoft Fakes
212 | FakesAssemblies/
213 |
214 | # GhostDoc plugin setting file
215 | *.GhostDoc.xml
216 |
217 | # Node.js Tools for Visual Studio
218 | .ntvs_analysis.dat
219 |
220 | # Visual Studio 6 build log
221 | *.plg
222 |
223 | # Visual Studio 6 workspace options file
224 | *.opt
225 |
226 | # Visual Studio LightSwitch build output
227 | **/*.HTMLClient/GeneratedArtifacts
228 | **/*.DesktopClient/GeneratedArtifacts
229 | **/*.DesktopClient/ModelManifest.xml
230 | **/*.Server/GeneratedArtifacts
231 | **/*.Server/ModelManifest.xml
232 | _Pvt_Extensions
233 |
234 | # LightSwitch generated files
235 | GeneratedArtifacts/
236 | ModelManifest.xml
237 |
238 | # Paket dependency manager
239 | .paket/paket.exe
240 |
241 | # FAKE - F# Make
242 | .fake/
243 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsiderationInput.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetConsiderationInput
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.InputValueTrackBar = new System.Windows.Forms.TrackBar();
32 | this.InputCaption = new System.Windows.Forms.Label();
33 | this.InputValueDropDown = new System.Windows.Forms.ComboBox();
34 | ((System.ComponentModel.ISupportInitialize)(this.InputValueTrackBar)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // InputValueTrackBar
38 | //
39 | this.InputValueTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
40 | | System.Windows.Forms.AnchorStyles.Right)));
41 | this.InputValueTrackBar.BackColor = System.Drawing.SystemColors.Window;
42 | this.InputValueTrackBar.Location = new System.Drawing.Point(6, 3);
43 | this.InputValueTrackBar.Margin = new System.Windows.Forms.Padding(3, 3, 12, 3);
44 | this.InputValueTrackBar.Name = "InputValueTrackBar";
45 | this.InputValueTrackBar.Size = new System.Drawing.Size(258, 45);
46 | this.InputValueTrackBar.TabIndex = 0;
47 | this.InputValueTrackBar.Scroll += new System.EventHandler(this.InputValueTrackBar_Scroll);
48 | //
49 | // InputCaption
50 | //
51 | this.InputCaption.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
52 | | System.Windows.Forms.AnchorStyles.Right)));
53 | this.InputCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
54 | this.InputCaption.Location = new System.Drawing.Point(3, 51);
55 | this.InputCaption.Name = "InputCaption";
56 | this.InputCaption.Size = new System.Drawing.Size(261, 23);
57 | this.InputCaption.TabIndex = 1;
58 | this.InputCaption.Text = "(Input Name)";
59 | this.InputCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
60 | //
61 | // InputValueDropDown
62 | //
63 | this.InputValueDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
64 | | System.Windows.Forms.AnchorStyles.Right)));
65 | this.InputValueDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
66 | this.InputValueDropDown.FormattingEnabled = true;
67 | this.InputValueDropDown.Location = new System.Drawing.Point(6, 14);
68 | this.InputValueDropDown.Margin = new System.Windows.Forms.Padding(3, 3, 12, 3);
69 | this.InputValueDropDown.Name = "InputValueDropDown";
70 | this.InputValueDropDown.Size = new System.Drawing.Size(258, 21);
71 | this.InputValueDropDown.TabIndex = 2;
72 | this.InputValueDropDown.SelectedIndexChanged += new System.EventHandler(this.InputValueDropDown_SelectedIndexChanged);
73 | //
74 | // EditWidgetConsiderationInput
75 | //
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
79 | this.Controls.Add(this.InputValueDropDown);
80 | this.Controls.Add(this.InputCaption);
81 | this.Controls.Add(this.InputValueTrackBar);
82 | this.Name = "EditWidgetConsiderationInput";
83 | this.Padding = new System.Windows.Forms.Padding(0, 0, 10, 0);
84 | this.Size = new System.Drawing.Size(277, 77);
85 | ((System.ComponentModel.ISupportInitialize)(this.InputValueTrackBar)).EndInit();
86 | this.ResumeLayout(false);
87 | this.PerformLayout();
88 |
89 | }
90 |
91 | #endregion
92 |
93 | private System.Windows.Forms.TrackBar InputValueTrackBar;
94 | private System.Windows.Forms.Label InputCaption;
95 | private System.Windows.Forms.ComboBox InputValueDropDown;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetKnowledgeBaseRecord.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Curvature
12 | {
13 | public partial class EditWidgetKnowledgeBaseRecord : UserControl
14 | {
15 | private KnowledgeBase.Record EditingRec;
16 | private Project EditingProject;
17 |
18 | internal EditWidgetKnowledgeBaseRecord(KnowledgeBase.Record rec, Project project)
19 | {
20 | InitializeComponent();
21 | EditingRec = rec;
22 | EditingProject = project;
23 |
24 | RecordTagEditBox.Text = EditingRec.ReadableName;
25 |
26 | if (EditingRec.Computed)
27 | OriginComboBox.SelectedIndex = 1;
28 | else
29 | OriginComboBox.SelectedIndex = 0;
30 |
31 | ClampingBehaviorComboBox.SelectedIndex = (int)EditingRec.Params;
32 |
33 | if (EditingRec.Params == KnowledgeBase.Record.Parameterization.Enumeration)
34 | {
35 | UpdateEnumeration();
36 | }
37 | else
38 | {
39 | RangeMinimum.Value = (decimal)EditingRec.MinimumValue;
40 | RangeMaximum.Value = (decimal)EditingRec.MaximumValue;
41 | }
42 |
43 | if (EditingRec.Prefab != KnowledgeBase.Record.Prefabs.NoPrefab)
44 | PrefabComboBox.SelectedIndex = (int)(EditingRec.Prefab) - 1;
45 | else
46 | PrefabPanel.Visible = false;
47 |
48 | Paint += (obj, args) =>
49 | {
50 | args.Graphics.DrawLine(SystemPens.ButtonShadow, 0, Height - 1, Width, Height - 1);
51 | };
52 | }
53 |
54 | private void RecordTagEditBox_TextChanged(object sender, EventArgs e)
55 | {
56 | if (EditingRec.ReadableName.Equals(RecordTagEditBox.Text))
57 | return;
58 |
59 | EditingRec.ReadableName = RecordTagEditBox.Text;
60 | EditingProject.MarkDirty();
61 | }
62 |
63 | private void UpdateComputedMode()
64 | {
65 | var prev = EditingRec.Computed;
66 |
67 | if (OriginComboBox.SelectedIndex == 1)
68 | EditingRec.Computed = true;
69 | else
70 | EditingRec.Computed = false;
71 |
72 | if (prev != EditingRec.Computed)
73 | EditingProject.MarkDirty();
74 |
75 | PrefabPanel.Visible = EditingRec.Computed;
76 | }
77 |
78 | private void OriginComboBox_SelectedIndexChanged(object sender, EventArgs e)
79 | {
80 | UpdateComputedMode();
81 | }
82 |
83 | private void DeleteButton_Click(object sender, EventArgs e)
84 | {
85 | EditingProject.Delete(EditingRec);
86 | }
87 |
88 | private void ClampingBehaviorComboBox_SelectedIndexChanged(object sender, EventArgs e)
89 | {
90 | var prev = EditingRec.Params;
91 |
92 | EditingRec.Params = (KnowledgeBase.Record.Parameterization)ClampingBehaviorComboBox.SelectedIndex;
93 |
94 | if (prev != EditingRec.Params)
95 | EditingProject.MarkDirty();
96 |
97 | if (EditingRec.Params == KnowledgeBase.Record.Parameterization.Enumeration)
98 | {
99 | RangeConfigurationPanel.Visible = false;
100 | EnumerationPanel.Visible = true;
101 | }
102 | else
103 | {
104 | RangeConfigurationPanel.Visible = true;
105 | EnumerationPanel.Visible = false;
106 | }
107 | }
108 |
109 | private void RangeMinimum_ValueChanged(object sender, EventArgs e)
110 | {
111 | var prev = EditingRec.MinimumValue;
112 |
113 | EditingRec.MinimumValue = (double)RangeMinimum.Value;
114 |
115 | if (prev != EditingRec.MinimumValue)
116 | EditingProject.MarkDirty();
117 | }
118 |
119 | private void RangeMaximum_ValueChanged(object sender, EventArgs e)
120 | {
121 | var prev = EditingRec.MaximumValue;
122 |
123 | EditingRec.MaximumValue = (double)RangeMaximum.Value;
124 |
125 | if (prev != EditingRec.MaximumValue)
126 | EditingProject.MarkDirty();
127 | }
128 |
129 | private void PrefabComboBox_SelectedIndexChanged(object sender, EventArgs e)
130 | {
131 | var prev = EditingRec.Prefab;
132 |
133 | EditingRec.Prefab = (KnowledgeBase.Record.Prefabs)(PrefabComboBox.SelectedIndex + 1);
134 |
135 | if (prev != EditingRec.Prefab)
136 | EditingProject.MarkDirty();
137 | }
138 |
139 | private void UpdateEnumeration()
140 | {
141 | EnumerationValidComboBox.Items.Clear();
142 |
143 | foreach (var v in EditingRec.EnumerationValues)
144 | EnumerationValidComboBox.Items.Add(v);
145 |
146 | if (EnumerationValidComboBox.Items.Count > 0)
147 | EnumerationValidComboBox.SelectedIndex = 0;
148 | }
149 |
150 | private void EditEnumerationButton_Click(object sender, EventArgs e)
151 | {
152 | Forms.EnumerationEditorForm.ShowEditor(EditingRec.EnumerationValues);
153 | UpdateEnumeration();
154 | }
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetName.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Curvature
2 | {
3 | partial class EditWidgetName
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditWidgetName));
33 | this.FlowPanel = new System.Windows.Forms.FlowLayoutPanel();
34 | this.ObjectTypeLabel = new System.Windows.Forms.Label();
35 | this.ObjectNameLabel = new System.Windows.Forms.Label();
36 | this.EditIcon = new System.Windows.Forms.Label();
37 | this.IconImageList = new System.Windows.Forms.ImageList(this.components);
38 | this.RenameWidgetTooltip = new System.Windows.Forms.ToolTip(this.components);
39 | this.FlowPanel.SuspendLayout();
40 | this.SuspendLayout();
41 | //
42 | // FlowPanel
43 | //
44 | this.FlowPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
45 | this.FlowPanel.Controls.Add(this.ObjectTypeLabel);
46 | this.FlowPanel.Controls.Add(this.ObjectNameLabel);
47 | this.FlowPanel.Controls.Add(this.EditIcon);
48 | this.FlowPanel.Dock = System.Windows.Forms.DockStyle.Fill;
49 | this.FlowPanel.Location = new System.Drawing.Point(0, 0);
50 | this.FlowPanel.Name = "FlowPanel";
51 | this.FlowPanel.Size = new System.Drawing.Size(398, 141);
52 | this.FlowPanel.TabIndex = 0;
53 | this.FlowPanel.WrapContents = false;
54 | //
55 | // ObjectTypeLabel
56 | //
57 | this.ObjectTypeLabel.AutoSize = true;
58 | this.ObjectTypeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
59 | this.ObjectTypeLabel.Location = new System.Drawing.Point(3, 0);
60 | this.ObjectTypeLabel.Name = "ObjectTypeLabel";
61 | this.ObjectTypeLabel.Size = new System.Drawing.Size(127, 20);
62 | this.ObjectTypeLabel.TabIndex = 0;
63 | this.ObjectTypeLabel.Text = "Named Object:";
64 | //
65 | // ObjectNameLabel
66 | //
67 | this.ObjectNameLabel.AutoSize = true;
68 | this.ObjectNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
69 | this.ObjectNameLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
70 | this.ObjectNameLabel.Location = new System.Drawing.Point(136, 0);
71 | this.ObjectNameLabel.Name = "ObjectNameLabel";
72 | this.ObjectNameLabel.Size = new System.Drawing.Size(55, 20);
73 | this.ObjectNameLabel.TabIndex = 1;
74 | this.ObjectNameLabel.Text = "Name";
75 | //
76 | // EditIcon
77 | //
78 | this.EditIcon.ImageIndex = 0;
79 | this.EditIcon.ImageList = this.IconImageList;
80 | this.EditIcon.Location = new System.Drawing.Point(197, 0);
81 | this.EditIcon.Name = "EditIcon";
82 | this.EditIcon.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0);
83 | this.EditIcon.Size = new System.Drawing.Size(18, 18);
84 | this.EditIcon.TabIndex = 2;
85 | this.RenameWidgetTooltip.SetToolTip(this.EditIcon, "Rename this item");
86 | this.EditIcon.Click += new System.EventHandler(this.EditIcon_Click);
87 | //
88 | // IconImageList
89 | //
90 | this.IconImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("IconImageList.ImageStream")));
91 | this.IconImageList.TransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
92 | this.IconImageList.Images.SetKeyName(0, "RenameItemIcon.png");
93 | //
94 | // EditWidgetName
95 | //
96 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
97 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
98 | this.Controls.Add(this.FlowPanel);
99 | this.Name = "EditWidgetName";
100 | this.Size = new System.Drawing.Size(398, 141);
101 | this.FlowPanel.ResumeLayout(false);
102 | this.FlowPanel.PerformLayout();
103 | this.ResumeLayout(false);
104 |
105 | }
106 |
107 | #endregion
108 | private System.Windows.Forms.FlowLayoutPanel FlowPanel;
109 | private System.Windows.Forms.Label ObjectTypeLabel;
110 | private System.Windows.Forms.Label ObjectNameLabel;
111 | private System.Windows.Forms.ImageList IconImageList;
112 | private System.Windows.Forms.Label EditIcon;
113 | private System.Windows.Forms.ToolTip RenameWidgetTooltip;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Forms/CurvePresetForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetArchetype.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetBehavior.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetParameter.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetProject.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsideration.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetCurvePresets.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetParameterValue.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetResponseCurve.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetBehaviorScoring.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Widgets/EditWidgetConsiderationInput.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------