⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msagent.js

📁 shooting flash game with script
💻 JS
字号:
// msagent.js
// scritp file for the microsoft agent

/* -Character Interface-----------------------------------------------------*/
function Character( CharacterID ) {

	this.CharObject = null;
	this.CharacterID = CharacterID;
}

/* -Characters Object Methods----------------------------------------------- */

/* -------------------------------------------------------------------------
 *  Character Method
 *  Returns a Character object in a Characters collection.
 * ------------------------------------------------------------------------- */
Character.prototype.Character = function( ) {

	return this.CharObject;
}

/* -------------------------------------------------------------------------
 *  Load Method
 *  Loads a character into the Characters collection. 
 * ------------------------------------------------------------------------- */
Character.prototype.Load = function( Provider ) {
	
	AgentControl.Connected = true;
	AgentControl.Characters.Load( this.CharacterID, Provider );
			
	this.CharObject = AgentControl.Characters.Character(this.CharacterID);
	this.CharObject.LanguageID = 0x0409;	
}

/* -------------------------------------------------------------------------
 *  UnLoad Method
 *  Unloads the character data for the specified character.
 * ------------------------------------------------------------------------- */
Character.prototype.UnLoad = function() {
	
	this.CharObject = null;
	AgentControl.Characters.UnLoad( this.CharacterID );
	AgentControl.Connected = false;
}


/* -Character Object Methods------------------------------------------------ */

/* -------------------------------------------------------------------------
 *  Activate Method
 *  Sets the active client or character. 
 *	
 *	State [Optional]: 
 *	0 			Not the active client.
 *	1 			The active client. 
 *	2(Default) 	The topmost character. 
 * ------------------------------------------------------------------------- */
Character.prototype.Activate = function( State ) {
	
	if( State == null )
		this.CharObject.Activate();		//default
	else
		this.CharObject.Activate( State );
}

/* -------------------------------------------------------------------------
 *  GestureAt Method
 *  Plays the gesturing animation for the specified character at the 
 *	specified location. 
 * ------------------------------------------------------------------------- */
Character.prototype.GestureAt = function( x, y ) {

	this.CharObject.GestureAt( x, y );
}

/* -------------------------------------------------------------------------
 *  Get Method
 *  Retrieves specified animation data for the specified character.  
 * ------------------------------------------------------------------------- */
Character.prototype.Get = function( Type, Name, Queue ) {	

	if( Queue = null )
		this.CharObject.Get( Type, Name );	//default
	else
		this.CharObject.Get( Type, Name, Queue );
}

/* -------------------------------------------------------------------------
 *  Hide Method
 *  Hide the specified character.
 *
 *	Fast [Optional]:
 * 	A Boolean value that indicates whether to skip the animation associated
 *	with the character's Hiding state. 
 *	True 			Does not play the Hiding animation. 
 *	False(Default) 	Plays the Hiding animation. 
 * ------------------------------------------------------------------------- */
Character.prototype.Hide = function( Fast ) {	

	if( Fast == null )		
		this.CharObject.Hide();			//default
	else
		this.CharObject.Hide( Fast );	
}

/* -------------------------------------------------------------------------
 *  Interrupt Method
 *  Interrupts the animation for the specified character.
 *
 *	Request: 
 *	A Request object for a particular animation call. 
 * ------------------------------------------------------------------------- */
Character.prototype.Interrupt = function( Request ) {

	AgentControl.Characters( this.CharacterID ).Interrupt( Request );
}

/* -------------------------------------------------------------------------
 *  Listen Method
 *  Turns on Listening mode (speech recognition) for a timed period. 
 *
 *	State: A Boolean value that determines whether to turn Listening mode on 
 *	or off. True Turns Listening mode on. False Turns Listening mode off.
 * ------------------------------------------------------------------------- */
Character.prototype.Listen = function( State ) {
	AgentControl.Characters( this.CharacterID ).Listen( State );
}

/* -------------------------------------------------------------------------
 *  MoveTo Method
 *  Moves the specified character to the specified location. 
 *	
 *	x, y: An integer value that indicates the left edge (x) and top edge (y) 
 * 	of the animation frame. Express these coordinates in pixels. 
 *	
 *	Speed: A Long integer value specifying in milliseconds how quickly 
 *	the character's frame moves. The default value is 1000. Specifying zero (0)
 *  moves the frame without playing an animation. 
 * ------------------------------------------------------------------------- */
Character.prototype.MoveTo = function( x, y, Speed ) {
	AgentControl.Characters( this.CharacterID ).MoveTo( x, y, Speed )
}

/* -------------------------------------------------------------------------
 *  Play Method
 *  Plays the specified animation for the specified character. 
 *	
 *	AnimationName: A string that specifies the name of an animation sequence.
 * ------------------------------------------------------------------------- */ 
Character.prototype.Play = function( AnimationName ) {
	AgentControl.Characters( this.CharacterID ).Play( AnimationName );
}

/* -------------------------------------------------------------------------
 *  Show Method
 *  Makes the specified character visible and plays its associated Showing 
 *	animation. 
 *	
 *	Fast: 
 *	A Boolean expression specifying whether the server plays the 
 *	Showing animation. True Skips the Showing state animation. False (Default) 
 *	Does not skip the Showing state animation. 
 * ------------------------------------------------------------------------- */ 
Character.prototype.Show = function( Fast ) {
	
	if( Fast == null )
		this.CharObject.Show();
	else
		this.CharObject.Show( Fast );
}

/* -------------------------------------------------------------------------
 *  ShowPopupMenu Method
 *  Displays the character's pop-up menu at the specified location. 
 *	
 *	x: An integer value that indicates the horizontal (x) screen coordinate 
 *	to display the menu. These coordinates must be specified in pixels. 
 *	y: An integer value that indicates the vertical (y) screen coordinate to
 * 	display the menu. These coordinates must be specified in pixels. 
 * ------------------------------------------------------------------------- */ 
Character.prototype.ShowPopupMenu = function( x, y ) {
	AgentControl.Characters( this.CharacterID ).ShowPopupMenu( x, y );	
}

/* -------------------------------------------------------------------------
 *  Speak Method
 *  Speaks the specified text or sound file for the specified character. 
 *	
 *	Text:
 * 	A string that specifies what the character says. 
 *
 *	Url: 
 *	A string expression specifying the location of an audio file (.WAV or 
 *	.LWV format). The location can be specified as a file (including a UNC 
 *	path specification) or URL (when character animation data is also being 
 *	retrieved via HTTP protocol). 
 * ------------------------------------------------------------------------- */ 
Character.prototype.Speak = function( Text, Url ) {
	AgentControl.Characters( this.CharacterID ).Speak( Text, Url );
}

/* -------------------------------------------------------------------------
 *  Stop Method
 *  Stops the animation for the specified character. 
 *	
 *	Request: 
 *	A Request object specifying a particular animation call. 
 * ------------------------------------------------------------------------- */ 
Character.prototype.Stop = function( Request ) {
	AgentControl.Characters( this.CharacterID ).Stop( Request );
}

/* -------------------------------------------------------------------------
 *  StopAll Method
 *  Stops all animation requests or specified types of requests for the 
 *	specified character. 
 *	
 *	Type:
 *	To use this parameter you can use any of the following values. You can 
 *	also specify multiple types by separating them with commas. 
 *	
 *	"Get"
 *	To stop all queued Get requests.
 *
 *	"NonQueuedGet"
 *	To stop all non-queued Get requests (Get method with Queue parameter set to False).
 *
 *	"Move"
 *	To stop all queued MoveTo requests.
 *
 *	"Play" 
 *	To stop all queued Play requests.
 *
 *	"Speak" 
 *	To stop all queued Speak requests.
 *
 * ------------------------------------------------------------------------- */ 
Character.prototype.StopAll = function( Type ) {
	AgentControl.Characters( this.CharacterID ).StopAll( Type );
}

/* -------------------------------------------------------------------------
 *  Think Method
 *  Displays the specified text for the specified character in a "thought" 
 *	word balloon. 
 *	
 *	Text [Optional]:
 *	A string that specifies the character's thought output.
 * ------------------------------------------------------------------------- */ 
Character.prototype.Think = function( Text ) {
	AgentControl.Characters( this.CharacterID ).Think( Text );
}

/* -------------------------------------------------------------------------
 *  Wait Method
 *  Causes the animation queue for the specified character to wait until the 
 *	specified animation request completes. 
 *	
 *	Request:
 *	Request A Request object specifying a particular animation..  
 * ------------------------------------------------------------------------- */ 
Character.prototype.Wait = function( Request ) {
	AgentControl.Characters( this.CharacterID ).Wait( Request );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -