public override void CreateStaticNodesIfNotPresent() { base.CreateStaticNodesIfNotPresent(); if (InputEvents.Count != 1) { InputEvents.Clear(); EntityLink <MonsterTestBase> InputLink = new EntityLink <MonsterTestBase>(); InputLink.SetOwner(this); InputLink.Name = "Start Dialogue"; InputEvents.Add(InputLink); } if (OutputEvents.Count != 3) { EntityLink <MonsterTestBase> OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Game Finished"; OutputEvents.Add(OutputLink); OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Problem Encountered"; OutputEvents.Add(OutputLink); OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Navigation Required"; OutputEvents.Add(OutputLink); } }
public virtual void FixupLinksWithList(GetLinkedEntityForFilename GetEntityFunction, GetLinkedEntityManager GetManagerFunction, ref List <string> LookupList, LinkType NameType) { foreach (string CurrentLinkName in LookupList) { string LinkFilename = CurrentLinkName.Substring(0, CurrentLinkName.IndexOf(":-:")); string LinkName = CurrentLinkName.Substring(CurrentLinkName.IndexOf(":-:") + 3); if (NameType == XMLSerializable.LinkType.LINK_NormalLink) { EntityType Linked = GetEntityFunction(LinkFilename); if (Linked != null) { EntityLink <EntityType> DestinationLink = ((EntityType)Linked).GetLinkByName(LinkName); if (DestinationLink != null) { EstablishLink(DestinationLink); } } } else { LinkedEntityManager <EntityType> EntityManager = GetManagerFunction(); if (EntityManager != null) { EntityManager.FixupStartEndLink(this, LinkFilename, LinkName, NameType); } } } }
public virtual void LinkToLinkName(ref EntityLink <EntityType> CurrentLink, ref string SavedLinkName) { if (CurrentLink != null) { SavedLinkName = CurrentLink.Owner.GetFilename() + ":-:" + CurrentLink.ListPrefix + CurrentLink.Name; } else if (SavedLinkName != null) { switch (CurrentLinkType) { case XMLSerializable.LinkType.LINK_StartLink: StartLinkNamesToResolve.Add(SavedLinkName); break; case XMLSerializable.LinkType.LINK_EndLink: EndLinkNamesToResolve.Add(SavedLinkName); break; case XMLSerializable.LinkType.LINK_NormalLink: default: LinkNamesToResolve.Add(SavedLinkName); break; } } }
public override void CreateStaticNodesIfNotPresent() { base.CreateStaticNodesIfNotPresent(); if (InputEvents.Count == 0) { EntityLink <MonsterTestBase> InputLink = new EntityLink <MonsterTestBase>(); InputLink.SetOwner(this); InputLink.Name = "Input"; InputEvents.Add(InputLink); } /* if(OutputEvents.Count != NumberOfOutputs) * { * for(int CurrentLink = OutputEvents.Count; CurrentLink < NumberOfOutputs; ++CurrentLink) * { * EntityLink<MonsterTestBase> OutputLink = new EntityLink<MonsterTestBase>(); * OutputLink.SetOwner(this); * OutputLink.Name = "Option " + CurrentLink; * OutputEvents.Add(OutputLink); * } * * for(int CurrentLink = NumberOfOutputs; CurrentLink < OutputEvents.Count;) * { * OutputEvents[CurrentLink].BreakAllLinks(); * OutputEvents.RemoveAt(CurrentLink); * } * }*/ }
public virtual void BreakLinksToLink(EntityLink <EntityType> SourceLink) { for (int CurrentRemoteLink = 0; CurrentRemoteLink < SourceLink.LinkedEntities.Count; ++CurrentRemoteLink) { SourceLink.LinkedEntities[CurrentRemoteLink].BreakLink(SourceLink); } }
public virtual void FixupStartEndLink(EntityLink <EntityType> SourceLink, string DestLinkFilename, string DestLinkName, XMLSerializable.LinkType TypeName) { EntityType DestEntity = GetEntityByFileName(DestLinkFilename); if (DestEntity != null) { EntityLink <EntityType> DestinationLink = ((EntityType)DestEntity).GetLinkByName(DestLinkName); if (DestinationLink != null) { SourceLink.EstablishLink(DestinationLink); DestinationLink.EstablishLink(SourceLink); } } else { string InvertLinkType = (DestLinkName.StartsWith("Input") ? DestLinkName.Replace("Input", "Output") : DestLinkName.Replace("Output", "Input")); EntityLink <EntityType> DestinationLink = GetLinkByName(InvertLinkType); if (DestinationLink != null) { SourceLink.EstablishLink(DestinationLink); DestinationLink.EstablishLink(SourceLink); } } }
public override void CreateStaticNodesIfNotPresent() { base.CreateStaticNodesIfNotPresent(); if (StartingEntities.Count == 0) { EntityLink <MonsterTestBase> StartLink = new EntityLink <MonsterTestBase>(); StartLink.CurrentLinkType = XMLSerializable.LinkType.LINK_StartLink; StartLink.Name = "Test Started"; StartingEntities.Add(StartLink); StartLink = new EntityLink <MonsterTestBase>(); StartLink.CurrentLinkType = XMLSerializable.LinkType.LINK_StartLink; StartLink.Name = "Test Failed To Start"; StartingEntities.Add(StartLink); } if (EndingEntities.Count == 0) { EntityLink <MonsterTestBase> EndLink = new EntityLink <MonsterTestBase>(); EndLink.CurrentLinkType = XMLSerializable.LinkType.LINK_EndLink; EndLink.Name = "Test Succeeded"; EndingEntities.Add(EndLink); EndLink = new EntityLink <MonsterTestBase>(); EndLink.CurrentLinkType = XMLSerializable.LinkType.LINK_EndLink; EndLink.Name = "Test Failed"; EndingEntities.Add(EndLink); } }
public virtual LinkedEntity <EntityType> EditorDuplicate(LinkedEntity <EntityType> DerivedDuplicateInto = null) { LinkedEntity <EntityType> DuplicateInto = DerivedDuplicateInto; if (DuplicateInto == null) { DuplicateInto = new LinkedEntity <EntityType>(); } DuplicateInto.Title = Title; DuplicateInto.Filename = ""; DuplicateInto.InputEvents = new List <EntityLink <EntityType> >(); foreach (EntityLink <EntityType> CurrentLink in InputEvents) { EntityLink <EntityType> DuplicatedLink = CurrentLink.EditorDuplicateLink(DuplicateInto); DuplicateInto.InputEvents.Add(DuplicatedLink); } DuplicateInto.OutputEvents = new List <EntityLink <EntityType> >(); foreach (EntityLink <EntityType> CurrentLink in OutputEvents) { EntityLink <EntityType> DuplicatedLink = CurrentLink.EditorDuplicateLink(DuplicateInto); DuplicateInto.OutputEvents.Add(DuplicatedLink); } return(DuplicateInto); }
public virtual bool InspectEntityLink(ref EntityLink <EntityType> CurrentLink) { InspectorGUIString("Name", ref CurrentLink.Name); InspectorGUIOrderedListEmbedded <EntityLink <EntityType> >("Linked Elements", "Link", ref CurrentLink.LinkedEntities, InspectEntityPerLinkDetails); return(false); }
public virtual IGraphEvent GetNextEventAfterCurrentTestState(EntityLink <MonsterTestBase> NextLink) { if (Owner != null) { return(Owner.GetNextTest(NextLink)); } return(null); }
public virtual void BreakAllLinks() { for (int CurrentIndex = 0; CurrentIndex < LinkedEntities.Count; ++CurrentIndex) { EntityLink <EntityType> CurrentLink = LinkedEntities[CurrentIndex]; CurrentLink.BreakLink(this); } LinkedEntities.Clear(); }
public virtual EntityLink <EntityType> EditorDuplicateLink(LinkedEntity <EntityType> NewOwner) { EntityLink <EntityType> DupedLink = new EntityLink <EntityType>(); DupedLink.Name = Name; DupedLink.ListPrefix = ListPrefix; DupedLink.Owner = NewOwner; DupedLink.CurrentLinkType = CurrentLinkType; return(DupedLink); }
public virtual IGraphEvent GetNextEvent() { IGraphEvent NextEvent = null; EntityLink <EntityType> NextLink = FindNextValidOutputLink(); if (NextLink != null) { NextEvent = NextLink.GetEventAndTriggerLink(); } return(NextEvent); }
public override void TriggerLink(EntityLink <MonsterTestBase> InputLink) { base.TriggerLink(InputLink); if (InputLink.Name == "Start New Game") { bShouldStartNewGame = true; } else if (InputLink.Name == "Load Saved Game") { bShouldLoadGame = true; } else if (InputLink.Name == "Quit") { bShouldQuit = true; } }
public override void CreateStaticNodesIfNotPresent() { base.CreateStaticNodesIfNotPresent(); if (InputEvents.Count == 0) { EntityLink <MonsterTest> InputLink = new EntityLink <MonsterTest>(); InputLink.SetOwner(this); InputLink.Name = "Test Started"; InputEvents.Add(InputLink); InputLink = new EntityLink <MonsterTest>(); InputLink.SetOwner(this); InputLink.Name = "Test Failed To Start"; InputEvents.Add(InputLink); } }
public virtual void CreateAndAddNewStartEndNodeConnection(string ConnectionName, XMLSerializable.LinkType NodeType) { if (NodeType == XMLSerializable.LinkType.LINK_StartLink) { EntityLink <EntityType> StartLink = new EntityLink <EntityType>(); StartLink.CurrentLinkType = XMLSerializable.LinkType.LINK_StartLink; StartLink.Name = ConnectionName; StartingEntities.Add(StartLink); } else if (NodeType == XMLSerializable.LinkType.LINK_EndLink) { EntityLink <EntityType> EndLink = new EntityLink <EntityType>(); EndLink.CurrentLinkType = XMLSerializable.LinkType.LINK_EndLink; EndLink.Name = ConnectionName; EndingEntities.Add(EndLink); } }
public virtual void EstablishLink(EntityLink <EntityType> OtherLink) { bool bFound = false; foreach (EntityLink <EntityType> CurrentLink in LinkedEntities) { if (CurrentLink == OtherLink) { bFound = true; break; } } if (!bFound) { LinkedEntities.Add(OtherLink); } }
public override IGraphEvent GetEventAndTriggerLink(EntityLink <MonsterTest> InputLink) { // MonsterTestManager.GetActiveInstance().CurrentNode = this; base.GetEventAndTriggerLink(InputLink); if (TestStates == null) { LoadTestStates(); } /* if(GameManager.GetInstance() != null) * { * GameManager.GetInstance().ChapterChanged(); * }*/ return(TestStates.GetEventForStart(InputLink)); }
public virtual IGraphEvent GetEventForStart(EntityLink <MonsterTest> StartLink) { for (int CurrentLink = 0; CurrentLink < StartingEntities.Count; ++CurrentLink) { if (StartingEntities[CurrentLink].Name == StartLink.Name) { if (StartingEntities[CurrentLink].LinkedEntities.Count > 0) { EntityLink <MonsterTestBase> ValidLink = StartingEntities[CurrentLink].GetValidLink(); if (ValidLink != null) { return(ValidLink.GetEventAndTriggerLink()); } } } } return(null); }
public override void CreateStaticNodesIfNotPresent() { base.CreateStaticNodesIfNotPresent(); if (InputEvents.Count != 3) { InputEvents.Clear(); EntityLink <MonsterTestBase> InputLink = new EntityLink <MonsterTestBase>(); InputLink.SetOwner(this); InputLink.Name = "Start New Game"; InputEvents.Add(InputLink); InputLink = new EntityLink <MonsterTestBase>(); InputLink.SetOwner(this); InputLink.Name = "Load Saved Game"; InputEvents.Add(InputLink); InputLink = new EntityLink <MonsterTestBase>(); InputLink.SetOwner(this); InputLink.Name = "Quit"; InputEvents.Add(InputLink); } if (OutputEvents.Count != 3) { EntityLink <MonsterTestBase> OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Game Started"; OutputEvents.Add(OutputLink); OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Game Failed To Start"; OutputEvents.Add(OutputLink); OutputLink = new EntityLink <MonsterTestBase>(); OutputLink.SetOwner(this); OutputLink.Name = "Quit"; OutputEvents.Add(OutputLink); } }
public virtual IGraphEvent GetNextTest(EntityLink <MonsterTestBase> NextLink) { foreach (EntityLink <MonsterTest> CurrentLink in OutputEvents) { if (CurrentLink.Name == NextLink.Name) { if (CurrentLink.Name == "Test Succeeded") { TestSucceeded(); } else if (CurrentLink.Name == "Test Failed") { TestFailed(); } if (CurrentLink.LinkedEntities.Count > 0 && CurrentLink.LinkedEntities[0].GetOwner() != null) { return(CurrentLink.LinkedEntities[0].GetOwner().GetStartingEvent()); } } } return(null); }
public override IGraphEvent GetNextEvent() { IGraphEvent NextEvent = null; int OutputIndex = GetOutputIndex(); if (OutputIndex != -1 && OutputEvents.Count > OutputIndex && OutputEvents[OutputIndex].LinkedEntities.Count > 0) { EntityLink <MonsterTestBase> ValidLink = OutputEvents[OutputIndex].GetValidLink(); if (ValidLink != null) { NextEvent = ValidLink.GetEventAndTriggerLink(); } } if (NextEvent == null) { NextEvent = base.GetNextEvent(); } return(NextEvent); }
public virtual void OnDisconnectedAnchors(Anchor <EntityType> LocalAnchor, Anchor <EntityType> RemoteAnchor) { EntityBox <EntityType> RemoteBox = RemoteAnchor.Owner; string LocalAnchorName = ""; string RemoteAnchorName = ""; if (Inputs.Contains(LocalAnchor)) { LocalAnchorName = "Input"; } else { LocalAnchorName = "Output"; } LocalAnchorName += LocalAnchor.GetLabelText(); if (RemoteBox.Inputs.Contains(RemoteAnchor)) { RemoteAnchorName = "Input"; } else { RemoteAnchorName = "Output"; } RemoteAnchorName += RemoteAnchor.GetLabelText(); EntityLink <EntityType> LocalLink = GetLinkByName(LocalAnchorName); EntityLink <EntityType> RemoteLink = RemoteBox.GetLinkByName(RemoteAnchorName); if (LocalLink != null && RemoteLink != null) { LocalLink.BreakLink(RemoteLink); } }
public virtual void TriggerLink(EntityLink <EntityType> InputLink) { }
public virtual IGraphEvent GetEventAndTriggerLink(EntityLink <EntityType> InputLink) { TriggerLink(InputLink); return(this); }
public override void TriggerLink(EntityLink <MonsterTestBase> InputLink) { base.TriggerLink(InputLink); }
public virtual string GetAnchorText(EntityLink <EntityType> Link) { return(Link.Name); }
public virtual void BreakLink(EntityLink <EntityType> OtherLink) { LinkedEntities.Remove(OtherLink); }
public virtual bool InspectEntityPerLinkDetails(ref EntityLink <EntityType> CurrentLink) { InspectorGUIString("Name", ref CurrentLink.Name, true); return(false); }