public WindowSharedTraitsEditor(StoryEntity parentEntity, StoryData storyData)
        {
            InitializeComponent();
            _parentEntity = parentEntity;
            _currentStoryData = storyData;
            newList = new List<Trait>();

            this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
        public WindowSharedTraitsEditor(StoryEntity parentEntity, StoryData storyData)
        {
            InitializeComponent();
            _parentEntity     = parentEntity;
            _currentStoryData = storyData;
            newList           = new List <Trait>();

            this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
Exemplo n.º 3
0
        // Copy trait and keep trait type id to identify it as the same relationship elsewhere in the program
        public Relationship(Relationship anotherRel, StoryEntity originatingEntity, StoryData world)
        {
            UInt64 nullTargetId = 0;

            if (originatingEntity.GetType() == typeof(Character))
            {
                nullTargetId = Character.getNoOneCharacter().Id;
            }
            else if (originatingEntity.GetType() == typeof(Environment))
            {
                nullTargetId = Environment.getNoWhereEnvironment().Id;
            }

            Constructor(anotherRel.Name, originatingEntity.Id, nullTargetId, 0.0, anotherRel.TypeId, world);
        }
Exemplo n.º 4
0
        // Copy trait and keep trait type id to identify it as the same relationship elsewhere in the program
        public Relationship(Relationship anotherRel, StoryEntity originatingEntity, StoryData world)
        {
            UInt64 nullTargetId = 0;
            if (originatingEntity.GetType() == typeof(Character))
            {
                nullTargetId = Character.getNoOneCharacter().Id;
            }
            else if (originatingEntity.GetType() == typeof(Environment))
            {

                nullTargetId = Environment.getNoWhereEnvironment().Id;
            }

            Constructor(anotherRel.Name, originatingEntity.Id, nullTargetId, 0.0, anotherRel.TypeId, world);
        }
Exemplo n.º 5
0
        virtual public Object Clone()
        {
            StoryEntity newClone = (StoryEntity)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());
            }

            foreach (Relationship relItem in _relationships)
            {
                Relationship newRel = (Relationship)relItem.Clone();
                //Hook up fromId properly
                newRel.FromId = newClone.Id;

                newClone.Relationships.Add(newRel);
            }

            //Give the clone a unique name, making sure the new name is actually unique.
            //If name is not unique, keep increment suffix number until it is
            // string newName = (string)newClone.Name;
            // int cloneCount = 1;
            //  while (StoryWorldDataProvider.getStoryData().findCharacterByName(newName) != null)
            // {
            //     newName = newClone.Name + "_clone" + cloneCount;
            // cloneCount++;
            // }

            // newClone.Name = newName;

            return(newClone);
        }