public override void UpdateLogic(OfficeWorld officeWorld, Time timeElapsed) { if (this.associatedToken != this.previousAssociatedToken) { if (this.associatedToken != null) { AToken nextToken = this.NextToken; int i = 0; while (nextToken != null) { if (i == 0) { officeWorld.NotifyTextUpdated(nextToken, nextToken.PreviousToken, this.associatedToken, this.InitialPosition); } else { officeWorld.NotifyTextUpdated(nextToken, nextToken.PreviousToken, null, this.InitialPosition); } i++; nextToken = nextToken.NextToken; } officeWorld.NotifyInternalGameEvent(this.previousAssociatedToken, this.associatedToken, "association"); } this.previousAssociatedToken = this.associatedToken; } base.UpdateLogic(officeWorld, timeElapsed); }
public FieldToken(AToken previousToken, string text) : base(previousToken, "fieldToken", fillUserText(text)) { this.trueText = text; this.associatedToken = null; this.previousAssociatedToken = null; }
public static AToken CreateToken(string data, TokenType type) { AToken tokenObject = null; switch (type) { case TokenType.NORMAL: tokenObject = new NormalToken(null, data); break; case TokenType.SANCTUARY: tokenObject = new SanctuaryToken(null, data); break; case TokenType.ANSWER: tokenObject = new AnswerToken(null, data); break; case TokenType.HEADER: tokenObject = new HeaderToken(null, data); break; case TokenType.FIELD: tokenObject = new FieldToken(null, data); break; case TokenType.TIMER: tokenObject = new TimerTokenObject(null, data); break; } return(tokenObject); }
public static DialogueObject CreateDialogueFactory(int dialogueLength, string data, TokenType type) { DialogueObject dialogueObject = new DialogueObject(dialogueLength); AToken previousToken = null; string[] words; if (type != TokenType.ANSWER && type != TokenType.FIELD) { words = data.Split(' '); } else { words = new string[] { data }; } foreach (string word in words) { AToken tokenObject = null; switch (type) { case TokenType.NORMAL: tokenObject = new NormalToken(previousToken, word + " "); break; case TokenType.SANCTUARY: tokenObject = new SanctuaryToken(previousToken, word + " "); break; case TokenType.ANSWER: tokenObject = new AnswerToken(previousToken, word); break; case TokenType.HEADER: tokenObject = new HeaderToken(previousToken, word + " "); break; case TokenType.FIELD: tokenObject = new FieldToken(previousToken, word); break; } if (previousToken != null) { previousToken.NextToken = tokenObject; } dialogueObject.AddToken(tokenObject); previousToken = tokenObject; } return(dialogueObject); }
public static DialogueObject CreateDialogueFactory(int dialogueLength, Dialogue data) { DialogueObject dialogueObject = new DialogueObject(dialogueLength); AToken previousToken = null; DialogueToken previousDataToken = null; foreach (DialogueToken token in data.DialoguesToken) { string[] words; if (token.Type != TokenType.ANSWER && token.Type != TokenType.FIELD) { words = token.Token.Split(' '); } else { words = new string[] { token.Token }; } foreach (string word in words) { AToken tokenObject = null; switch (token.Type) { case TokenType.NORMAL: if (previousDataToken != null && (previousDataToken.Type == TokenType.FIELD || previousDataToken.Type == TokenType.ANSWER)) { tokenObject = new NormalToken(previousToken, " " + word + " "); } else { tokenObject = new NormalToken(previousToken, word + " "); } break; case TokenType.SANCTUARY: tokenObject = new SanctuaryToken(previousToken, word + " "); break; case TokenType.ANSWER: tokenObject = new AnswerToken(previousToken, word); break; case TokenType.HEADER: tokenObject = new HeaderToken(previousToken, word); break; case TokenType.FIELD: tokenObject = new FieldToken(previousToken, word); break; } if (previousToken != null) { previousToken.NextToken = tokenObject; } dialogueObject.AddToken(tokenObject); previousToken = tokenObject; previousDataToken = token; } } return(dialogueObject); }