public static void SynchronizePlotPointWithType(PlotPointType ppType, PlotPoint pp, StoryData world) { List <Trait> properList = new List <Trait>(); foreach (Trait newTrait in ppType.Traits) { // Trait oldTrait = pp.getTraitByTypeId(newTrait.TypeId); // if (oldTrait == null) //{ Trait convertedTrait = new Trait(newTrait, world); Trait oldTrait = pp.findTraitByName(newTrait.Name); if ((oldTrait != null) && (oldTrait.Type == newTrait.Type)) { convertedTrait.Value = oldTrait.Value; } properList.Add(convertedTrait); // properList.Add(new Trait(newTrait, world)); // } // else //{ // oldTrait.Name = newTrait.Name; // oldTrait.Type = newTrait.Type; //properList.Add(oldTrait); //} } pp.Traits = properList; }
public WindowPlotPointEditor(PlotPoint existingPP, StoryData storyData) { InitializeComponent(); _pP = existingPP; _ppType = storyData.findPlotPointTypeById(existingPP.TypeId); _currentStoryData = storyData; this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); dataBind(); }
public override object Clone() { PlotPoint newClone = (PlotPoint)MemberwiseClone(); newClone.Id = StoryWorldDataProvider.getStoryData().getNewId(); newClone.Traits = new List <Trait>(); newClone.Relationships = new List <Relationship>(); foreach (Trait traitItem in _traits) { newClone.Traits.Add((Trait)traitItem.Clone()); } //no relationships return(newClone); }
public static void SynchronizePlotPointWithType(PlotPointType ppType, PlotPoint pp, StoryData world) { List<Trait> properList = new List<Trait>(); foreach (Trait newTrait in ppType.Traits) { // Trait oldTrait = pp.getTraitByTypeId(newTrait.TypeId); // if (oldTrait == null) //{ Trait convertedTrait = new Trait(newTrait, world); Trait oldTrait = pp.findTraitByName(newTrait.Name); if ((oldTrait != null) && (oldTrait.Type == newTrait.Type)) { convertedTrait.Value = oldTrait.Value; } properList.Add(convertedTrait); // properList.Add(new Trait(newTrait, world)); // } // else //{ // oldTrait.Name = newTrait.Name; // oldTrait.Type = newTrait.Type; //properList.Add(oldTrait); //} } pp.Traits = properList; }
public ActionCreatePlotPoint(UInt64 parentPlotFragmentId, PlotPointType type, string varName, StoryData world) : base(parentPlotFragmentId, varName, world) { _newPP = new PlotPoint(type, world); }
private void declareNewPlotPoint(bool prependType, PlotPoint pp, PlotPointType ppType, string saveAsName) { int currentCount = 0; string typeName = (string)_plotPointTypeNames[ppType.Id]; int paramCount = 1 + ppType.Traits.Count; if(prependType) { _tw.WriteLine(typeName + " " + saveAsName + " = new " + typeName + " ( "); } else { _tw.WriteLine(saveAsName + " = new " + typeName + " ( "); } _tw.Indent(); _tw.WriteLine(pp.Id.ToString() + ", "); currentCount++; string attribString; foreach (Trait tr in pp.Traits) { attribString = generateJavaValueString(tr); currentCount++; if (currentCount != paramCount) { attribString += ", "; } _tw.WriteLine(attribString); } _tw.OutDent(); _tw.WriteLine(");"); }