Пример #1
0
            public void updateEmitter(string propertyField, string value, bool isSlider, bool onMouseUp)
            {
                ParticleEditor ParticleEditor = "ParticleEditor";
                editor         Editor         = "Editor";

                this.setEmitterDirty();

                SimObject emitter = this.currEmitter;

                SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"]).AsBool() && (!last["onMouseUp"].AsBool()))
                {
                    last["field"]     = propertyField;
                    last["isSlider"]  = isSlider.AsString();
                    last["onMouseUp"] = onMouseUp.AsString();
                    last["newValue"]  = value;
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitter>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["field"]     = propertyField;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();
                    action["newValue"]  = value;
                    action["oldValue"]  = emitter.getFieldValue(propertyField, -1);

                    ParticleEditor.submitUndo(action);
                }

                emitter.setFieldValue(propertyField, value, -1);
                emitter.call("reload");
            }
            public void updateParticle(string propertyField, string value, bool isSlider, bool onMouseUp)
            {
                editor         Editor         = "Editor";
                ParticleEditor ParticleEditor = "ParticleEditor";

                this.setParticleDirty();
                SimObject particle = this.currParticle;

                SimObject last =
                    Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool()))
                {
                    last["field"]     = propertyField;
                    last["isSlider"]  = isSlider.AsString();
                    last["onMouseUp"] = onMouseUp.AsString();
                    last["newValue"]  = value;
                }
                else
                {
                    var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticle>("Update Active Particle");
                    action["particle"]  = particle;
                    action["field"]     = propertyField;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();
                    action["newValue"]  = value;
                    action["oldValue"]  = particle.getFieldValue(propertyField, -1);

                    ParticleEditor.submitUndo(action);
                }

                particle.setFieldValue(propertyField, value, -1);
                particle.call("reload");
            }
            public void revertEdits(SimObject profile)
            {
                for (uint i = 0; i < this.getCount(); i++)
                {
                    SimObject obj = this.getObject(i);
                    if (obj["profile"] != profile)
                    {
                        continue;
                    }

                    profile.setFieldValue(obj["fieldName"], obj["oldValue"], obj["arrayIndex"].AsInt());

                    obj.delete();
                    i--;
                }
            }
Пример #4
0
 public T this[int index]
 {
     get
     {
         //if (_OwnerObject.IsDead()) throw new Exceptions.SimObjectPointerInvalidException();
         if (index >= _Count)
         {
             throw new IndexOutOfRangeException();
         }
         return(_GetterFunction(_OwnerObject.getFieldValue(_FieldName, index)));
     }
     set
     {
         //if (_OwnerObject.IsDead()) throw new Exceptions.SimObjectPointerInvalidException();
         if (index >= _Count)
         {
             throw new IndexOutOfRangeException();
         }
         _OwnerObject.setFieldValue(_FieldName, _SetterFunction(value), index);
     }
 }