Exemple #1
0
            public void DoUI(IObjectUIControl control)
            {
                if (obj.mFields.ContainsKey("flag.noreset"))
                {
                    obj.mFields["flag.noreset"] = Convert.ToInt32(control.CheckBox("No Reset", (int)obj.mFields["flag.noreset"] != 0));
                }

                if (obj.mFields.ContainsKey("flag.nofovy"))
                {
                    obj.mFields["flag.nofovy"] = Convert.ToInt32(control.CheckBox("No Fovy", (int)obj.mFields["flag.nofovy"] != 0));
                }

                if (obj.mFields.ContainsKey("flag.lofserpoff"))
                {
                    obj.mFields["flag.lofserpoff"] = Convert.ToInt32(control.CheckBox("lofserpoff", (int)obj.mFields["flag.lofserpoff"] != 0));
                }

                if (obj.mFields.ContainsKey("flag.antibluroff"))
                {
                    obj.mFields["flag.antibluroff"] = Convert.ToInt32(control.CheckBox("No Anti-Blur", (int)obj.mFields["flag.antibluroff"] != 0));
                }

                if (obj.mFields.ContainsKey("flag.collisionoff"))
                {
                    obj.mFields["flag.collisionoff"] = Convert.ToInt32(control.CheckBox("No Collision", (int)obj.mFields["flag.collisionoff"] != 0));
                }

                if (obj.mFields.ContainsKey("flag.subjectiveoff"))
                {
                    obj.mFields["flag.subjectiveoff"] = Convert.ToInt32(control.CheckBox("Subjective Off", (int)obj.mFields["flag.subjectiveoff"] != 0));
                }
            }
Exemple #2
0
            public void DoUI(IObjectUIControl _control)
            {
                var control = (IObjectUIControlWithMultipleSupport)_control;

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    centerPosition = _control.Vector3Input(centerPosition, "Center Position", 1, 16);
                }
                else
                {
                    centerPosition = _control.Vector3Input(centerPosition, "Center Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    rotation.Value = control.Vector3Input(rotation.Value, "Rotation", 45, 18, -180, 180, true, allowMixed: false);
                }
                else
                {
                    rotation.Value = control.Vector3Input(rotation.Value, "Rotation", 5, 2, -180, 180, true, allowMixed: false);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    scale.Value = control.Vector3Input(scale.Value, "Scale", 1, 16, multiResolveValue: Vector3.One);
                }
                else
                {
                    scale.Value = control.Vector3Input(scale.Value, "Scale", 0.125f, 2, multiResolveValue: Vector3.One);
                }
            }
Exemple #3
0
            public void DoUI(IObjectUIControl control)
            {
                if (obj.mFields.ContainsKey("eflag.enableErpFrame"))
                {
                    obj.mFields["eflag.enableErpFrame"] = Convert.ToInt32(control.CheckBox("eflag.enableErpFrame", (int)obj.mFields["eflag.enableErpFrame"] != 0));
                }

                if (obj.mFields.ContainsKey("eflag.enableEndErpFrame"))
                {
                    obj.mFields["eflag.enableEndErpFrame"] = Convert.ToInt32(control.CheckBox("eflag.enableEndErpFrame", (int)obj.mFields["eflag.enableEndErpFrame"] != 0));
                }

                if (obj.mFields.ContainsKey("camendint"))
                {
                    obj.mFields["camendint"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["camendint"], "camendint"));
                }

                if (obj.mFields.ContainsKey("evfrm"))
                {
                    obj.mFields["evfrm"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["evfrm"], "evfrm"));
                }

                if (obj.mFields.ContainsKey("evpriority"))
                {
                    obj.mFields["evpriority"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["evpriority"], "evpriority"));
                }
            }
Exemple #4
0
            public void DoUI(IObjectUIControl control)
            {
                obj.mName = control.FullWidthTextInput(obj.mName, "Camera Name");
                obj.mType = control.DropDownTextInput("Camera Type", obj.mEntry.Get <string>("camtype"), cameraTypes, false);

                control.VerticalSeperator();
                control.Spacing(2);
                obj.mFields["woffset.X"] = control.NumberInput((float)obj.mFields["woffset.X"], "World Offset X");
                obj.mFields["woffset.Y"] = control.NumberInput((float)obj.mFields["woffset.Y"], "World Offset Y");
                obj.mFields["woffset.Z"] = control.NumberInput((float)obj.mFields["woffset.Z"], "World Offset Z");

                obj.mFields["loffset"]  = control.NumberInput((float)obj.mFields["loffset"], "loffset");
                obj.mFields["loffsetv"] = control.NumberInput((float)obj.mFields["loffsetv"], "loffsetv");
                obj.mFields["roll"]     = control.NumberInput((float)obj.mFields["roll"], "roll");
                obj.mFields["fovy"]     = control.NumberInput((float)obj.mFields["fovy"], "fovy");
                obj.mFields["camint"]   = Convert.ToInt32(control.NumberInput((int)obj.mFields["camint"], "camint"));
                obj.mFields["upper"]    = control.NumberInput((float)obj.mFields["upper"], "upper");
                obj.mFields["lower"]    = control.NumberInput((float)obj.mFields["lower"], "lower");

                obj.mFields["gndint"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["gndint"], "gndint"));
                obj.mFields["uplay"]  = control.NumberInput((float)obj.mFields["uplay"], "uplay");
                obj.mFields["lplay"]  = control.NumberInput((float)obj.mFields["lplay"], "lplay");

                obj.mFields["pushdelay"]    = Convert.ToInt32(control.NumberInput((int)obj.mFields["pushdelay"], "pushdelay"));
                obj.mFields["pushdelaylow"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["pushdelaylow"], "pushdelaylow"));

                obj.mFields["udown"]   = Convert.ToInt32(control.NumberInput((int)obj.mFields["udown"], "udown"));
                obj.mFields["vpanuse"] = Convert.ToInt32(control.NumberInput((int)obj.mFields["vpanuse"], "vpanuse"));

                obj.mFields["vpanaxis.X"] = control.NumberInput((float)obj.mFields["vpanaxis.X"], "Pan Axis X");
                obj.mFields["vpanaxis.Y"] = control.NumberInput((float)obj.mFields["vpanaxis.Y"], "Pan Axis Y");
                obj.mFields["vpanaxis.Z"] = control.NumberInput((float)obj.mFields["vpanaxis.Z"], "Pan Axis Z");
            }
Exemple #5
0
            public void DoUI(IObjectUIControl control)
            {
                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 1, 16);
                }
                else
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 45, 18, -180, 180, true);
                }
                else
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 5, 2, -180, 180, true);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 1, 16);
                }
                else
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 0.125f, 2);
                }
            }
Exemple #6
0
            public void DoUI(IObjectUIControl control)
            {
                text = control.TextInput(obj.Get <string>("name"), "Name");
                zone = control.DropDownTextInput("Zone", obj.mParentZone.mZoneName, zones.ToArray(), false);

                obj.mMarioNo  = (int)control.NumberInput(obj.mMarioNo, "Mario Number");
                obj.mObjArg0  = (int)control.NumberInput(obj.mObjArg0, "Obj_arg0");
                obj.mCameraID = (int)control.NumberInput(obj.mCameraID, "Camera ID");
            }
Exemple #7
0
 public void DoUI(IObjectUIControl control)
 {
     foreach (KeyValuePair <string, List <I3dWorldObject> > keyValuePair in obj.Links)
     {
         if (control.Link(keyValuePair.Key))
         {
             scene.EnterList(keyValuePair.Value);
         }
     }
 }
 public void DoUI(IObjectUIControl control)
 {
     foreach (var(linkName, link) in obj.Links)
     {
         if (control.Link(linkName))
         {
             scene.EnterList(link);
         }
     }
 }
 public void DoUI(IObjectUIControl control)
 {
     foreach ((string name, I3dWorldObject _obj) in obj.LinkDestinations)
     {
         if (control.Link($"{_obj.ToString()} ({name})"))
         {
             scene.FocusOn(_obj);
         }
     }
 }
Exemple #10
0
            public void DoUI(IObjectUIControl control)
            {
#if ODYSSEY
                control.PlainText(Convert.ToString(area.ScenarioBitField, 2));
#endif
                if (Spotlight.Properties.Settings.Default.AllowIDEdits)
                {
                    area.ID = control.TextInput(area.ID, "Object ID");
                }
                else
                {
                    control.TextInput(area.ID, "Object ID");
                }

                if (area.comment != null)
                {
                    control.TextInput(area.comment, "Comment");
                }

                area.Layer = control.TextInput(area.Layer, "Layer");

                area.ClassName = control.DropDownTextInput("Class Name", area.ClassName, DB_classNames);
                area.ModelName = control.DropDownTextInput("Shape Name", area.ModelName, shapeNames, false);

                area.Priority = (int)control.NumberInput(area.Priority, "Priority");

                control.VerticalSeperator();

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    area.Position = control.Vector3Input(area.Position, "Position", 1, 16);
                }
                else
                {
                    area.Position = control.Vector3Input(area.Position, "Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    area.Rotation = control.Vector3Input(area.Rotation, "Rotation", 45, 18);
                }
                else
                {
                    area.Rotation = control.Vector3Input(area.Rotation, "Rotation", 5, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    area.Scale = control.Vector3Input(area.Scale, "Scale", 1, 16);
                }
                else
                {
                    area.Scale = control.Vector3Input(area.Scale, "Scale", 0.125f, 2);
                }
            }
Exemple #11
0
            public void DoUI(IObjectUIControl control)
            {
                lightID   = Convert.ToInt32(control.NumberInput(obj.mEntry.Get <int>("LightID"), "LightID"));
                lightName = control.FullWidthTextInput(obj.mEntry.Get <string>("AreaLightName"), "AreaLightName");

                if (control.Button("View Light Attributes"))
                {
                    LightAttribEditor l = new LightAttribEditor(lightName);
                    l.Show();
                }
            }
Exemple #12
0
 public void DoUI(IObjectUIControl _control)
 {
     if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
     {
         centerPosition = _control.Vector3Input(centerPosition, "Center Position", 1, 16);
     }
     else
     {
         centerPosition = _control.Vector3Input(centerPosition, "Center Position", 0.125f, 2);
     }
 }
Exemple #13
0
            public void DoUI(IObjectUIControl control)
            {
                obj.ModelName = control.TextInput(obj.ModelName, "Bone");

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 1, 16);
                }
                else
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 0.125f, 2);
                }
            }
            public void DoUI(IObjectUIControl control)
            {
                control.PlainText(scene.SelectedConnection.Source + " to " + scene.SelectedConnection.Dest);

                connectionName = control.DropDownTextInput("Connection Name", connectionName, scene.SelectedConnection.PossibleNames);
                if (control.Button("Reverse Connection"))
                {
                    scene.ChangeSelectedConnection(
                        scene.SelectedConnection.Dest,
                        scene.SelectedConnection.Source,
                        scene.SelectedConnection.Name);

                    scene.GL_Control.Refresh();
                }
            }
Exemple #15
0
            public void DoUI(IObjectUIControl control)
            {
                if (obj.mFields.ContainsKey("gflag.thru"))
                {
                    obj.mFields["gflag.thru"] = Convert.ToInt32(control.CheckBox("gflag.thru", (int)obj.mFields["gflag.thru"] != 0));
                }

                if (obj.mFields.ContainsKey("gflag.enableEndErpFrame"))
                {
                    obj.mFields["gflag.enableEndErpFrame"] = Convert.ToInt32(control.CheckBox("gflag.enableEndErpFrame", (int)obj.mFields["gflag.enableEndErpFrame"] != 0));
                }

                if (obj.mFields.ContainsKey("gflag.camendint"))
                {
                    obj.mFields["gflag.camendint"] = Convert.ToInt32(control.CheckBox("gflag.camendint", (int)obj.mFields["gflag.camendint"] != 0));
                }
            }
Exemple #16
0
            public void DoUI(IObjectUIControl control)
            {
                obj.attributes[2] = control.FullWidthTextInput(obj.attributes[2], "Events");

                control.Spacing(20);

                control.Heading("Normal Exit");
                obj.attributes[3] = control.FullWidthTextInput(obj.attributes[3], "Unlock Levels");
                obj.attributes[4] = control.FullWidthTextInput(obj.attributes[4], "Unlock Routes");

                control.Spacing(20);

                control.Heading("Secret Exit");
                obj.attributes[5] = control.FullWidthTextInput(obj.attributes[5], "Events");
                obj.attributes[6] = control.FullWidthTextInput(obj.attributes[6], "Unlock Levels");
                obj.attributes[7] = control.FullWidthTextInput(obj.attributes[7], "Unlock Routes");
            }
Exemple #17
0
            public void DoUI(IObjectUIControl control)
            {
                rail.ObjType = (RailObjType)control.ChoicePicker("Rail Type", rail.ObjType, Enum.GetValues(typeof(RailObjType)));

                rail.IsLadder = control.CheckBox("Is Ladder", rail.IsLadder);

                rail.Closed = control.CheckBox("Closed", rail.Closed);

                if (rail.ObjType == RailObjType.RailWithMoveParameter)
                {
                    rail.IsReverseCoord = control.CheckBox("Reverse Coord", rail.IsReverseCoord);
                }

                if (scene.CurrentList != rail.pathPoints && control.Button("Edit Pathpoints"))
                {
                    scene.EnterList(rail.pathPoints);
                }
            }
Exemple #18
0
            public void DoUI(IObjectUIControl control)
            {
                text     = control.TextInput(text, "TextInput");
                longText = control.FullWidthTextInput(longText, "Long Text Input");
                number   = control.NumberInput(number, "Number Input");
                control.Link("Just some Link");

                control.DoubleButton("Add", "Remove");
                control.TripleButton("Add", "Remove", "Insert");
                control.QuadripleButton("+", "-", "*", "/");
                enemyType  = (EnemyType)control.ChoicePicker("Enemy1 Type", enemyType, Enum.GetValues(typeof(EnemyType)));
                enemyType2 = (EnemyType)control.ChoicePicker("Enemy2 Type", enemyType2, Enum.GetValues(typeof(EnemyType)));
                control.VerticalSeperator();
                objectType = control.AdvancedTextInput("Object Type", objectType, objectTypes);

                control.Spacing(30);
                control.PlainText("Some Text");
            }
Exemple #19
0
            public void DoUI(IObjectUIControl control)
            {
                placement.Layer = control.TextInput(placement.Layer, "Layer");

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    placement.Position = control.Vector3Input(placement.Position, "Position", 1, 16);
                }
                else
                {
                    placement.Position = control.Vector3Input(placement.Position, "Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    placement.Rotation = control.Vector3Input(placement.Rotation, "Rotation", 45, 18, -180, 180, true);
                }
                else
                {
                    placement.Rotation = control.Vector3Input(placement.Rotation, "Rotation", 5, 2, -180, 180, true);
                }
            }
Exemple #20
0
            public void DoUI(IObjectUIControl control)
            {
                control.TextInput(entry[0], "Name");

                entry[1] = control.TextInput(entry[1], "Behaivior");
            }
            public void DoUI(IObjectUIControl control)
            {
#if ODYSSEY
                control.PlainText(Convert.ToString(obj.ScenarioBitField, 2));
#endif
                if (Spotlight.Properties.Settings.Default.AllowIDEdits)
                {
                    obj.ID = control.TextInput(obj.ID, "Object ID");
                }
                else
                {
                    control.TextInput(obj.ID, "Object ID");
                }

                if (obj.comment != null)
                {
                    control.TextInput(obj.comment, "Comment");
                }

                obj.Layer      = control.TextInput(obj.Layer, "Layer");
                obj.ObjectName = control.DropDownTextInput("Object Name", obj.ObjectName, DB_objectNames);

                if (showClassNameInfo)
                {
                    control.SetTooltip(classNameInfo);
                }
                obj.ClassName = control.DropDownTextInput("Class Name", obj.ClassName, DB_classNames);
                if (showClassNameAlias)
                {
                    control.PlainText(classNameAlias);
                }
                control.SetTooltip(null);

                obj.ModelName = control.DropDownTextInput("Model Name", obj.ModelName, DB_modelNames);

                control.VerticalSeperator();

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 1, 16);
                }
                else
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 45, 18);
                }
                else
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 5, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 1, 16);
                }
                else
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 0.125f, 2);
                }

                control.VerticalSeperator();

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.DisplayTranslation = control.Vector3Input(obj.DisplayTranslation, "Display Position", 1, 16);
                }
                else
                {
                    obj.DisplayTranslation = control.Vector3Input(obj.DisplayTranslation, "Display Position", 0.125f, 2);
                }

                //TODO
            }
            public void DoUI(IObjectUIControl control)
            {
                for (int i = 0; i < propertyDictKeys.Length; i++)
                {
                    string key = propertyDictKeys[i];

                    if (propertyInfos != null && propertyInfos.TryGetValue(key, out string desc))
                    {
                        control.SetTooltip(desc);
                    }
                    else
                    {
                        control.SetTooltip("No info for " + key);
                    }


                    if (propertyDict[key] is int)
                    {
                        propertyDict[key] = (int)control.NumberInput(propertyDict[key], key);
                    }
                    else if (propertyDict[key] is float)
                    {
                        propertyDict[key] = control.NumberInput(propertyDict[key], key);
                    }
                    else if (propertyDict[key] is string)
                    {
                        propertyDict[key] = control.TextInput(propertyDict[key], key);
                    }
                    else if (propertyDict[key] is bool)
                    {
                        propertyDict[key] = control.CheckBox(key, propertyDict[key]);
                    }
                }

                control.SetTooltip(null);


                if (control.Button("Edit"))
                {
                    ObjectParameterForm.TypeDef.Localize();
                    List <(ObjectParameterForm.TypeDef typeDef, string name)> parameterInfos = new List <(ObjectParameterForm.TypeDef typeDef, string name)>();

                    List <KeyValuePair <string, dynamic> > otherParameters = new List <KeyValuePair <string, dynamic> >();

                    //get parameterInfos from propertyDict
                    foreach (var item in propertyDict)
                    {
                        if (item.Value is int)
                        {
                            parameterInfos.Add((ObjectParameterForm.TypeDef.IntDef, item.Key));
                        }
                        else if (item.Value is float)
                        {
                            parameterInfos.Add((ObjectParameterForm.TypeDef.FloatDef, item.Key));
                        }
                        else if (item.Value is string)
                        {
                            parameterInfos.Add((ObjectParameterForm.TypeDef.StringDef, item.Key));
                        }
                        else if (item.Value is bool)
                        {
                            parameterInfos.Add((ObjectParameterForm.TypeDef.BoolDef, item.Key));
                        }
                        else
                        {
                            otherParameters.Add(item); //arrays and dictionaries are not supported
                        }
                    }

                    var parameterForm = new ObjectParameterForm(parameterInfos);

                    if (parameterForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        List <RevertableDictAddition.AddInfo>    addInfos    = new List <RevertableDictAddition.AddInfo>();
                        List <RevertableDictDeletion.DeleteInfo> deleteInfos = new List <RevertableDictDeletion.DeleteInfo>();
                        List <RevertableDictEntryChange>         changeInfos = new List <RevertableDictEntryChange>();

                        HashSet <string> newParamNames = new HashSet <string>();

                        List <KeyValuePair <string, dynamic> > newParameters = new List <KeyValuePair <string, dynamic> >();
                        foreach ((ObjectParameterForm.TypeDef typeDef, string parameterName) in parameterForm.EditedParameterInfos)
                        {
                            //check if name stayed the same
                            if (propertyDict.ContainsKey(parameterName))
                            {
                                if (propertyDict[parameterName].GetType() == typeDef.Type)
                                {
                                    //keep value if name and type stayed the same
                                    newParameters.Add(new KeyValuePair <string, dynamic>(parameterName, propertyDict[parameterName]));
                                }
                                else
                                {
                                    //set value to the default value of the new type
                                    newParameters.Add(new KeyValuePair <string, dynamic>(parameterName, typeDef.DefaultValue));
                                    //and add the value change to changeInfos
                                    changeInfos.Add(new RevertableDictEntryChange(parameterName, propertyDict, propertyDict[parameterName]));
                                }
                            }
                            else
                            {
                                //add added paramter to addInfos
                                newParameters.Add(new KeyValuePair <string, dynamic>(parameterName, typeDef.DefaultValue));
                                addInfos.Add(new RevertableDictAddition.AddInfo(typeDef.DefaultValue, parameterName));
                            }
                            newParamNames.Add(parameterName);
                        }

                        //add removed parameters to deleteInfos
                        foreach (var property in propertyDict)
                        {
                            if (!newParamNames.Contains(property.Key))
                            {
                                deleteInfos.Add(new RevertableDictDeletion.DeleteInfo(property.Value, property.Key));
                            }
                        }

                        //add everything to undo
                        scene.BeginUndoCollection();
                        scene.AddToUndo(new RevertableDictAddition(new RevertableDictAddition.AddInDictInfo[]
                        {
                            new RevertableDictAddition.AddInDictInfo(addInfos.ToArray(), propertyDict)
                        },
                                                                   Array.Empty <RevertableDictAddition.SingleAddInDictInfo>()));

                        scene.AddToUndo(new RevertableDictDeletion(new RevertableDictDeletion.DeleteInDictInfo[]
                        {
                            new RevertableDictDeletion.DeleteInDictInfo(deleteInfos.ToArray(), propertyDict)
                        },
                                                                   Array.Empty <RevertableDictDeletion.SingleDeleteInDictInfo>()));


                        foreach (var changeInfo in changeInfos)
                        {
                            scene.AddToUndo(changeInfo);
                        }
                        scene.EndUndoCollection();

                        //regenerate propertyDict by merging the newParameters and the oterParameters
                        propertyDict.Clear();

                        foreach (var parameter in newParameters)
                        {
                            propertyDict.Add(parameter.Key, parameter.Value);
                        }

                        foreach (var parameter in otherParameters)
                        {
                            propertyDict.Add(parameter.Key, parameter.Value);
                        }

                        //update keys
                        propertyDictKeys = propertyDict.Keys.ToArray();
                    }
                }
            }
 public void DoUI(IObjectUIControl control)
 {
     control.PlainText(objs.Count.ToString());
 }
Exemple #24
0
            public void DoUI(IObjectUIControl control)
            {
                for (int i = 0; i < keys.Length; i++)
                {
                    string key = keys[i];
                    if (dict[key] is int)
                    {
                        dict[key] = (int)control.NumberInput(dict[key], key);
                    }
                    else if (dict[key] is float)
                    {
                        dict[key] = control.NumberInput(dict[key], key);
                    }
                    else if (dict[key] is string)
                    {
                        dict[key] = control.TextInput(dict[key], key);
                    }
                    else if (dict[key] is bool)
                    {
                        dict[key] = control.CheckBox(key, dict[key]);
                    }
                }

                if (control.Button("Edit"))
                {
                    List <(ObjectParameterForm.TypeDef typeDef, string name)> parameters = new List <(ObjectParameterForm.TypeDef typeDef, string name)>();

                    List <KeyValuePair <string, dynamic> > otherParameters = new List <KeyValuePair <string, dynamic> >();

                    foreach (var item in dict)
                    {
                        if (item.Value is int)
                        {
                            parameters.Add((ObjectParameterForm.typeDefs[0], item.Key));
                        }
                        else if (item.Value is float)
                        {
                            parameters.Add((ObjectParameterForm.typeDefs[1], item.Key));
                        }
                        else if (item.Value is string)
                        {
                            parameters.Add((ObjectParameterForm.typeDefs[2], item.Key));
                        }
                        else if (item.Value is bool)
                        {
                            parameters.Add((ObjectParameterForm.typeDefs[3], item.Key));
                        }
                        else
                        {
                            otherParameters.Add(item);
                        }
                    }

                    var parameterForm = new ObjectParameterForm(parameters);

                    if (parameterForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        List <RevertableDictAddition.AddInfo>    addInfos    = new List <RevertableDictAddition.AddInfo>();
                        List <RevertableDictDeletion.DeleteInfo> deleteInfos = new List <RevertableDictDeletion.DeleteInfo>();

                        HashSet <string> newParamNames = new HashSet <string>();

                        List <KeyValuePair <string, dynamic> > newEntries = new List <KeyValuePair <string, dynamic> >();
                        foreach ((ObjectParameterForm.TypeDef def, string name) in parameterForm.Parameters)
                        {
                            if (dict.ContainsKey(name))
                            {
                                newEntries.Add(new KeyValuePair <string, dynamic>(name, dict[name]));
                            }
                            else
                            {
                                newEntries.Add(new KeyValuePair <string, dynamic>(name, def.DefaultValue));
                                addInfos.Add(new RevertableDictAddition.AddInfo(def.DefaultValue, name));
                            }
                            newParamNames.Add(name);
                        }

                        foreach (var keyValuePair in dict)
                        {
                            if (!newParamNames.Contains(keyValuePair.Key))
                            {
                                deleteInfos.Add(new RevertableDictDeletion.DeleteInfo(keyValuePair.Value, keyValuePair.Key));
                            }
                        }

                        scene.BeginUndoCollection();
                        scene.AddToUndo(new RevertableDictAddition(new RevertableDictAddition.AddInDictInfo[]
                        {
                            new RevertableDictAddition.AddInDictInfo(addInfos.ToArray(), dict)
                        },
                                                                   new RevertableDictAddition.SingleAddInDictInfo[0]));

                        scene.AddToUndo(new RevertableDictDeletion(new RevertableDictDeletion.DeleteInDictInfo[]
                        {
                            new RevertableDictDeletion.DeleteInDictInfo(deleteInfos.ToArray(), dict)
                        },
                                                                   new RevertableDictDeletion.SingleDeleteInDictInfo[0]));
                        scene.EndUndoCollection();

                        dict.Clear();

                        foreach (var keyValuePair in newEntries)
                        {
                            dict.Add(keyValuePair.Key, keyValuePair.Value);
                        }

                        foreach (var keyValuePair in otherParameters)
                        {
                            dict.Add(keyValuePair.Key, keyValuePair.Value);
                        }


                        keys = dict.Keys.ToArray();
                    }
                }
            }
Exemple #25
0
 public void DoUI(IObjectUIControl control)
 {
     text = control.TextInput(text, "TextInput");
     control.PlainText("I hate people");
 }
Exemple #26
0
            public void DoUI(IObjectUIControl control)
            {
                if (SpotLight.Properties.Settings.Default.AllowIDEdits)
                {
                    obj.ID = control.TextInput(obj.ID, "Object ID");
                }
                else
                {
                    control.TextInput(obj.ID, "Object ID");
                }

                obj.ObjectName = control.TextInput(obj.ObjectName, "Object Name");
                obj.ClassName  = control.TextInput(obj.ClassName, "Class Name");
                obj.ModelName  = control.TextInput(obj.ModelName, "Model Name");

                control.VerticalSeperator();

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 1, 16);
                }
                else
                {
                    obj.Position = control.Vector3Input(obj.Position, "Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 45, 18);
                }
                else
                {
                    obj.Rotation = control.Vector3Input(obj.Rotation, "Rotation", 5, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 1, 16);
                }
                else
                {
                    obj.Scale = control.Vector3Input(obj.Scale, "Scale", 0.125f, 2);
                }

                control.VerticalSeperator();

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.DisplayTranslation = control.Vector3Input(obj.DisplayTranslation, "Display Position", 1, 16);
                }
                else
                {
                    obj.DisplayTranslation = control.Vector3Input(obj.DisplayTranslation, "Display Position", 0.125f, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.DisplayRotation = control.Vector3Input(obj.DisplayRotation, "Display Rotation", 45, 18);
                }
                else
                {
                    obj.DisplayRotation = control.Vector3Input(obj.DisplayRotation, "Display Rotation", 5, 2);
                }

                if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift))
                {
                    obj.DisplayScale = control.Vector3Input(obj.DisplayScale, "Display Scale", 1, 16);
                }
                else
                {
                    obj.DisplayScale = control.Vector3Input(obj.DisplayScale, "Display Scale", 0.125f, 2);
                }
            }