Files
libremetaverse/libsecondlife-cs/examples/AnimationSample/AnimationSample.cs
John Hurliman 9830bf85e4 On a mad coding spree.
* Implemented AvatarManager, added the async functions
* Rebuilt the key2name functionality
* Fixed and cleaned up a lot of the teleporting code
* More functions implemented in GroupManager
* Renamed SecondLife.Avatar to SecondLife.Self
* Updated the groupmanager example to list group members
* Renamed Form1.cs to AnimationSample.cs

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@386 52acb1d6-8a22-11de-b505-999d5b087335
2006-10-24 11:16:26 +00:00

71 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using libsecondlife;
using libsecondlife.Packets;
using System.Collections;
namespace AnimationSample
{
public partial class Form1 : Form
{
SecondLife client;
public Form1()
{
InitializeComponent();
//Create the SecondLife client object
client = new SecondLife();
}
private void btnPlay_Click(object sender, EventArgs e)
{
//Build an animation packet
AgentAnimationPacket packet = new AgentAnimationPacket();
//create an AgentData block
AgentAnimationPacket.AgentDataBlock agentdata = new AgentAnimationPacket.AgentDataBlock();
//Fill in its values
agentdata.AgentID = client.Self.ID;
agentdata.SessionID = client.Network.SessionID;
//Add it in the packet
packet.AgentData = agentdata;
//Create an AnimationList block
AgentAnimationPacket.AnimationListBlock anims = new AgentAnimationPacket.AnimationListBlock();
//Set the UUID of the animation to avatar_dance1.bvh, a standard animation
anims.AnimID = new LLUUID("b68a3d7c-de9e-fc87-eec8-543d787e5b0d");
//Start the animation
anims.StartAnim = true;
//Add it to the packet. SInce it's a Variable number block, we have to construct an array.
packet.AnimationList = new AgentAnimationPacket.AnimationListBlock[] { anims };
//Send the packet
client.Network.SendPacket(packet);
}
private void btnLogin_Click(object sender, EventArgs e)
{
//Login information
Dictionary<string, object> loginParams = NetworkManager.DefaultLoginValues(txtFirst.Text, txtLast.Text, txtPassword.Text, "00:00:00:00:00:00",
"last", 1, 12, 12, 12, "Win", "0", "animationsample", "jessemalthus@gmail.com");
Hashtable loginReply = new Hashtable();
// Login
if (!client.Network.Login(loginParams))
{
// Login failed
MessageBox.Show("We're sorry, but login failed. Error: \n " + client.Network.LoginError);
}
else
{
MessageBox.Show("Login succeded. You're at " + client.Self.Position + " on " + client.Network.CurrentSim.Region.Name);
}
}
}
}