mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-31 16:35:52 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			795 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			795 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * Class will intercept any text or dialogue message calls and log them for test purposes
 | |
|  */
 | |
| export default class TextInterceptor {
 | |
|   private scene;
 | |
|   public logs: string[] = [];
 | |
|   constructor(scene) {
 | |
|     this.scene = scene;
 | |
|     scene.messageWrapper = this;
 | |
|   }
 | |
| 
 | |
|   showText(
 | |
|     text: string,
 | |
|     _delay?: number,
 | |
|     _callback?: Function,
 | |
|     _callbackDelay?: number,
 | |
|     _prompt?: boolean,
 | |
|     _promptDelay?: number,
 | |
|   ): void {
 | |
|     console.log(text);
 | |
|     this.logs.push(text);
 | |
|   }
 | |
| 
 | |
|   showDialogue(
 | |
|     text: string,
 | |
|     name: string,
 | |
|     _delay?: number,
 | |
|     _callback?: Function,
 | |
|     _callbackDelay?: number,
 | |
|     _promptDelay?: number,
 | |
|   ): void {
 | |
|     console.log(name, text);
 | |
|     this.logs.push(name, text);
 | |
|   }
 | |
| 
 | |
|   getLatestMessage(): string {
 | |
|     return this.logs.pop() ?? "";
 | |
|   }
 | |
| }
 |