Пример #1
0
 internal Occurence(Place linkedLocation, PastEvent linkedEvent, OccurenceType type, Guid referenceId, GameTime.GameTime started, GameTime.GameTime ended = null) : base(type, referenceId)
 {
     LinkedLocation = linkedLocation;
     LinkedEvent    = linkedEvent;
     Started        = started;
     Ended          = ended;
     ItemType       = MemoryItemType.Occurence;
 }
 internal PersonalInvolvement(PastEvent linkedEvent, Person linkedPerson, PersonalInvolvementType type, Guid referenceId, GameTime.GameTime started, GameTime.GameTime ended = null) : base(type, referenceId)
 {
     LinkedEvent  = linkedEvent;
     LinkedPerson = linkedPerson;
     Started      = started;
     Ended        = ended;
     ItemType     = MemoryItemType.PersonalInvolvement;
 }
Пример #3
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid(), started, ended);

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Пример #4
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid());

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Пример #5
0
        /// <summary>
        /// Creates and defines a link between 2 events and add a reference to both Events
        /// </summary>
        /// <param name="firstEvent">The first Event to link</param>
        /// <param name="secondEvent">The second Event to link</param>
        /// <param name="firstToSecondEventRelationship">The nature of the link</param>
        /// <returns>The new links (2)</returns>
        public List <EventRelationship> CreateLinkBetweenTwoEvents(PastEvent firstEvent, PastEvent secondEvent, EventRelationshipType firstToSecondEventRelationship)
        {
            string description        = string.Empty;
            string reverseDescription = string.Empty;
            EventRelationshipType inverseRelationshipType = EventRelationshipType.Followed;

            switch (firstToSecondEventRelationship)
            {
            case EventRelationshipType.Caused:
                description             = EventRelationshipDescriptions.Caused;
                reverseDescription      = EventRelationshipDescriptions.CausedBy;
                inverseRelationshipType = EventRelationshipType.CausedBy;
                break;

            case EventRelationshipType.CausedBy:
                description             = EventRelationshipDescriptions.CausedBy;
                reverseDescription      = EventRelationshipDescriptions.Caused;
                inverseRelationshipType = EventRelationshipType.Caused;
                break;

            case EventRelationshipType.Followed:
                description             = EventRelationshipDescriptions.Followed;
                reverseDescription      = EventRelationshipDescriptions.Preceded;
                inverseRelationshipType = EventRelationshipType.Preceded;
                break;

            case EventRelationshipType.PartOf:
                description             = EventRelationshipDescriptions.PartOf;
                reverseDescription      = EventRelationshipDescriptions.Included;
                inverseRelationshipType = EventRelationshipType.Included;
                break;

            case EventRelationshipType.Preceded:
                description             = EventRelationshipDescriptions.Preceded;
                reverseDescription      = EventRelationshipDescriptions.Followed;
                inverseRelationshipType = EventRelationshipType.Followed;
                break;
            }

            EventRelationship directRelationship = new EventRelationship(secondEvent, firstToSecondEventRelationship, Guid.NewGuid(), description);

            firstEvent.AddEventLink(directRelationship);

            EventRelationship reverseRelationship = new EventRelationship(firstEvent, inverseRelationshipType, Guid.NewGuid(), reverseDescription);

            secondEvent.AddEventLink(reverseRelationship);

            return(new List <EventRelationship> {
                directRelationship, reverseRelationship
            });
        }
Пример #6
0
        /// <summary>
        /// Returns a copy of the object with all the information copied accurately
        /// </summary>
        /// <returns>Item with the information</returns>
        public override MemoryItem GetAccurateCopy()
        {
            PastEvent copy = new PastEvent(Name, ReferenceId, Description, Started, Ended)
            {
                ItemType           = ItemType,
                _linkedPlaces      = _linkedPlaces,
                _linkedEvents      = _linkedEvents,
                _linkedOccupations = _linkedOccupations,
                _linkedPersons     = _linkedPersons,
                Type = Type
            };

            return(copy);
        }
Пример #7
0
        /// <summary>
        /// Returns a copy of the object with all the information copied inaccurately
        /// this represents the character having wrong information
        /// </summary>
        /// <returns>Item with the information</returns>
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime started = Started;
            GameTime.GameTime ended   = Ended;
            PastEventType     type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (PastEventType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PastEventType)).Length);
                break;

            case 4:
                type     = (PastEventType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PastEventType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new PastEvent(Name, ReferenceId, Description, started, ended)
            {
                ItemType           = ItemType,
                _linkedPlaces      = _linkedPlaces,
                _linkedEvents      = _linkedEvents,
                _linkedOccupations = _linkedOccupations,
                _linkedPersons     = _linkedPersons,
                Type = type
            };

            return(copy);
        }
Пример #8
0
        /// <summary>
        /// This relationship links an Occupation and an Event. It was created to admit that someone might not know the Person linked to an Occupation, i.e. the King of Temeria.
        /// </summary>
        /// <param name="linkedOccupation">Occupation linked</param>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="type">Nature of the link between Occupation and Event</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public OccupationalInvolvement CreateInvolvementBetweenOccupationAndEvent(Occupation linkedOccupation, PastEvent linkedEvent, OccupationalInvolvementType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var occupationalInvolvement = new OccupationalInvolvement(linkedEvent, linkedOccupation, type, Guid.NewGuid(), started, ended);

            linkedOccupation.AddLinkedEvent(occupationalInvolvement);
            linkedEvent.AddOccupation(occupationalInvolvement);

            return(occupationalInvolvement);
        }
Пример #9
0
        /// <summary>
        /// This relationship links an Occupation and an Event. It was created to admit that someone might not know the Person linked to an Occupation, i.e. the King of Temeria.
        /// </summary>
        /// <param name="linkedOccupation">Occupation linked</param>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="type">Nature of the link between Occupation and Event</param>
        /// <returns>The new link</returns>
        public OccupationalInvolvement CreateInvolvementBetweenOccupationAndEvent(Occupation linkedOccupation, PastEvent linkedEvent, OccupationalInvolvementType type)
        {
            var occupationalInvolvement = new OccupationalInvolvement(linkedEvent, linkedOccupation, type, Guid.NewGuid());

            linkedOccupation.AddLinkedEvent(occupationalInvolvement);
            linkedEvent.AddOccupation(occupationalInvolvement);

            return(occupationalInvolvement);
        }
Пример #10
0
        /// <summary>
        /// Creates a link that defines a link between a Person and an Event
        /// </summary>
        /// <param name="linkedPerson">Linked Person</param>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="type">How a Person was involved in an Event</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        public PersonalInvolvement CreateInvolvementBetweenPersonAndEvent(Person linkedPerson, PastEvent linkedEvent, PersonalInvolvementType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var personalInvolvement = new PersonalInvolvement(linkedEvent, linkedPerson, type, Guid.NewGuid(), started, ended);

            linkedPerson.AddPersonalInvolvement(personalInvolvement);
            linkedEvent.AddAssociatedPerson(personalInvolvement);

            return(personalInvolvement);
        }
Пример #11
0
        /// <summary>
        /// Creates a link that defines a link between a Person and an Event
        /// </summary>
        /// <param name="linkedPerson">Person linked to the event</param>
        /// <param name="linkedEvent">Event linked to the Person</param>
        /// <param name="type">How a Person was involved in an Event</param>
        public PersonalInvolvement CreateInvolvementBetweenPersonAndEvent(Person linkedPerson, PastEvent linkedEvent, PersonalInvolvementType type)
        {
            var personalInvolvement = new PersonalInvolvement(linkedEvent, linkedPerson, type, Guid.NewGuid());

            linkedPerson.AddPersonalInvolvement(personalInvolvement);
            linkedEvent.AddAssociatedPerson(personalInvolvement);

            return(personalInvolvement);
        }
Пример #12
0
 public EventRelationshipType FindEventLinkType(PastEvent linkedEvent)
 {
     return(_linkedEvents.Find(e => e.LinkedEvent == linkedEvent).Type);
 }
Пример #13
0
 internal Occurence(Place linkedLocation, PastEvent linkedEvent, OccurenceType type, Guid referenceId) : base(type, referenceId)
 {
     LinkedLocation = linkedLocation;
     LinkedEvent    = linkedEvent;
     ItemType       = MemoryItemType.Occurence;
 }
 internal PersonalInvolvement(PastEvent linkedEvent, Person linkedPerson, PersonalInvolvementType type, Guid referenceId) : base(type, referenceId)
 {
     LinkedEvent  = linkedEvent;
     LinkedPerson = linkedPerson;
     ItemType     = MemoryItemType.PersonalInvolvement;
 }
 internal OccupationalInvolvement(PastEvent linkedEvent, Occupation linkedOccupation, OccupationalInvolvementType type, Guid referenceId) : base(type, referenceId)
 {
     LinkedEvent      = linkedEvent;
     LinkedOccupation = linkedOccupation;
     ItemType         = MemoryItemType.OccupationalInvolvement;
 }
Пример #16
0
 internal EventRelationship(PastEvent linkedEvent, EventRelationshipType type, Guid referenceId, string description = "") : base(type, referenceId)
 {
     LinkedEvent = linkedEvent;
     Description = description;
     ItemType    = MemoryItemType.EventRelationship;
 }