示例#1
0
 public static void removeRelationshipTargetReferencesFromStoryWorld(Character characterToWipe, StoryData world)
 {
     List<Character> globalChars = Utilities.getGlobalCharacterList(world);
     foreach (Character ch in globalChars)
     {
         foreach(Relationship rel in ch.Relationships)
         {
             if(rel.ToId == characterToWipe.Id)
             {
                 rel.ToId = StoryData.NullCharacterId;
             }
         }
     }
 }
示例#2
0
        public static void SynchronizeTwoCharacters(Character oldChar, Character newChar, StoryData world)
        {
            List<Character> characterSyncList = new List<Character>();
            characterSyncList.Add(newChar);

            Utilities.SynchronizeEntityRelationships(characterSyncList, oldChar.Relationships, world);
            Utilities.SynchronizeEntityTraits(characterSyncList, oldChar.Traits, world);
        }
        private void declareNewCharacter(bool prependType, Character ch, string saveAsName)
        {
            int currentCount = 0;

            int paramCount = 1 + ch.Traits.Count +  (2 * ch.Relationships.Count);

            if(prependType)
            {
                _tw.WriteLine("WR_CharacterWME " + saveAsName + " = new WR_CharacterWME ( ");
            }
            else
            {
                _tw.WriteLine(saveAsName + " = new WR_CharacterWME ( ");
            }

            _tw.Indent();

            _tw.WriteLine(ch.Id.ToString() + ", ");
            currentCount++;

            string attribString;
            foreach(Trait tr in ch.Traits)
            {
                attribString = generateJavaValueString(tr);
                currentCount++;
                if(currentCount != paramCount)
                {
                    attribString += ", ";
                }
                _tw.WriteLine(attribString);
            }

            string targetStr;

            foreach(Relationship rel in ch.Relationships)
            {
                targetStr = (string)rel.ToCharacter.Name;
                //if (rel.ToCharacter.Id == StoryData.NullCharacterId)
               // {
                //    targetStr = "";
                //}

                _tw.WriteLine(generateValidLiteralString(targetStr) + ", ");

                currentCount += 2;
                if(currentCount != paramCount)
                {
                    _tw.WriteLine(rel.Strength.ToString() + ", ");
                }
                else
                {
                    _tw.WriteLine(rel.Strength.ToString());
                }
            }
            _tw.OutDent();
            _tw.WriteLine(");");
        }
        private void btCharNew_Click(object sender, RoutedEventArgs e)
        {
            string newName = Utilities.MakeTextDialog("Please enter a name for the new Character:", this);
            if(newName != null)
            {
                Character newChar = new Character(newName, _currentStoryData.CharTypeId, _currentStoryData);

                List<Character> globalCharList = Utilities.getGlobalCharacterList(_currentStoryData);
                //Synchronize all traits and relationships
                if (globalCharList.Count > 0)
                {
                    Utilities.SynchronizeTwoCharacters(globalCharList[0], newChar, _currentStoryData);
                }
                _currentStoryData.Characters.Add(newChar);
                clearDataElements();
                dataBindWindow();

                Window newWin = new WindowCharacterEditor(newChar, _currentStoryData);
                newWin.Owner = this;
                newWin.ShowDialog();
                clearDataElements();
                dataBindWindow();
            }
        }
 public WindowCharacterEditor(Character currEntity, StoryData currStoryData)
 {
     InitializeComponent();
     _currentEntity = currEntity;
     _currentStoryData = currStoryData;
 }
 public ActionCreateCharacter(UInt64 parentPlotFragmentId, string charName, string varName, StoryData world)
     : base(parentPlotFragmentId, varName, world)
 {
     _newEntity = new Character(charName, world.CharTypeId, world);
 }