本文整理汇总了C#中OpenSim.Framework.AvatarAppearance类的典型用法代码示例。如果您正苦于以下问题:C# AvatarAppearance类的具体用法?C# AvatarAppearance怎么用?C# AvatarAppearance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AvatarAppearance类属于OpenSim.Framework命名空间,在下文中一共展示了AvatarAppearance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAppearance
public bool SetAppearance (UUID userID, AvatarAppearance appearance)
{
bool success = m_localService.SetAppearance (userID, appearance);
if (!success)
success = m_remoteService.SetAppearance (userID, appearance);
return success;
}
示例2: CreateDefault
private AvatarAppearance CreateDefault(UUID avatarId)
{
AvatarAppearance appearance = null;
AvatarWearable[] wearables;
byte[] visualParams;
GetDefaultAvatarAppearance(out wearables, out visualParams);
appearance = new AvatarAppearance(avatarId, wearables, visualParams);
return appearance;
}
示例3: TryGetAvatarAppearance
public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance)
{
AvatarData avatar = m_scene.AvatarService.GetAvatar(avatarId);
//if ((profile != null) && (profile.RootFolder != null))
if (avatar != null)
{
appearance = avatar.ToAvatarAppearance(avatarId);
return true;
}
m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId);
appearance = CreateDefault(avatarId);
return false;
}
示例4: TryGetAvatarAppearance
public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance)
{
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(avatarId);
//if ((profile != null) && (profile.RootFolder != null))
if (profile != null)
{
appearance = m_scene.CommsManager.AvatarService.GetUserAppearance(avatarId);
if (appearance != null)
{
//SetAppearanceAssets(profile, ref appearance);
//m_log.DebugFormat("[APPEARANCE]: Found : {0}", appearance.ToString());
return true;
}
}
appearance = CreateDefault(avatarId);
m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId);
return false;
}
示例5: SetNPCAppearance
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
{
ScenePresence sp = scene.GetScenePresence(agentId);
if (sp == null || sp.IsChildAgent)
return false;
lock (m_avatars)
if (!m_avatars.ContainsKey(agentId))
return false;
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
sp.Appearance = npcAppearance;
scene.AttachmentsModule.RezAttachments(sp);
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
module.SendAppearance(sp.UUID);
return true;
}
示例6: GetAssetsFrom
public void GetAssetsFrom(AvatarAppearance app)
{
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
{
for (int j = 0; j < m_wearables[i].Count; j++)
{
UUID itemID = m_wearables[i][j].ItemID;
UUID assetID = app.Wearables[i].GetAsset(itemID);
if (assetID != UUID.Zero)
m_wearables[i].Add(itemID, assetID);
}
}
}
示例7: AvatarAppearance
public AvatarAppearance(AvatarAppearance appearance)
: this(appearance, true)
{
}
示例8: CopyInventoryFolders
/// <summary>
/// This method is called by establishAppearance to copy inventory folders to make
/// copies of Clothing and Bodyparts inventory folders and attaches worn attachments
/// </summary>
private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap,
AvatarAppearance avatarAppearance)
{
IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;
InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, assetType);
InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, assetType);
if (sourceFolder == null || destinationFolder == null)
throw new Exception("Cannot locate folder(s)");
// Missing source folder? This should *never* be the case
if (sourceFolder.Type != (short)assetType)
{
sourceFolder = new InventoryFolderBase();
sourceFolder.ID = UUID.Random();
if (assetType == AssetType.Clothing) {
sourceFolder.Name = "Clothing";
} else {
sourceFolder.Name = "Body Parts";
}
sourceFolder.Owner = source;
sourceFolder.Type = (short)assetType;
sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID;
sourceFolder.Version = 1;
inventoryService.AddFolder(sourceFolder); // store base record
m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source);
}
// Missing destination folder? This should *never* be the case
if (destinationFolder.Type != (short)assetType)
{
destinationFolder = new InventoryFolderBase();
destinationFolder.ID = UUID.Random();
if (assetType == AssetType.Clothing) {
destinationFolder.Name = "Clothing";
} else {
destinationFolder.Name = "Body Parts";
}
destinationFolder.Owner = destination;
destinationFolder.Type = (short)assetType;
destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
destinationFolder.Version = 1;
inventoryService.AddFolder(destinationFolder); // store base record
m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
}
InventoryFolderBase extraFolder;
List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders;
foreach (InventoryFolderBase folder in folders)
{
extraFolder = new InventoryFolderBase();
extraFolder.ID = UUID.Random();
extraFolder.Name = folder.Name;
extraFolder.Owner = destination;
extraFolder.Type = folder.Type;
extraFolder.Version = folder.Version;
extraFolder.ParentID = destinationFolder.ID;
inventoryService.AddFolder(extraFolder);
m_log.DebugFormat("[RADMIN]: Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;
foreach (InventoryItemBase item in items)
{
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
destinationItem.Name = item.Name;
destinationItem.Owner = destination;
destinationItem.Description = item.Description;
destinationItem.InvType = item.InvType;
destinationItem.CreatorId = item.CreatorId;
destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
destinationItem.CreatorData = item.CreatorData;
destinationItem.NextPermissions = item.NextPermissions;
destinationItem.CurrentPermissions = item.CurrentPermissions;
destinationItem.BasePermissions = item.BasePermissions;
destinationItem.EveryOnePermissions = item.EveryOnePermissions;
destinationItem.GroupPermissions = item.GroupPermissions;
destinationItem.AssetType = item.AssetType;
destinationItem.AssetID = item.AssetID;
destinationItem.GroupID = item.GroupID;
destinationItem.GroupOwned = item.GroupOwned;
destinationItem.SalePrice = item.SalePrice;
destinationItem.SaleType = item.SaleType;
destinationItem.Flags = item.Flags;
destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = extraFolder.ID;
ApplyNextOwnerPermissions(destinationItem);
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
inventoryMap.Add(item.ID, destinationItem.ID);
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
//.........这里部分代码省略.........
示例9: MakeAgent
private AgentCircuitData MakeAgent(GridRegion region, UserAccount account,
AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position,
string ipaddress, string viewer, string channel, string mac, string id0)
{
AgentCircuitData aCircuit = new AgentCircuitData();
aCircuit.AgentID = account.PrincipalID;
if (avatar != null)
aCircuit.Appearance = new AvatarAppearance(avatar);
else
aCircuit.Appearance = new AvatarAppearance();
//aCircuit.BaseFolder = irrelevant
aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
aCircuit.child = false; // the first login agent is root
aCircuit.ChildrenCapSeeds = new Dictionary<ulong, string>();
aCircuit.circuitcode = circuit;
aCircuit.firstname = account.FirstName;
//aCircuit.InventoryFolder = irrelevant
aCircuit.lastname = account.LastName;
aCircuit.SecureSessionID = secureSession;
aCircuit.SessionID = session;
aCircuit.startpos = position;
aCircuit.IPAddress = ipaddress;
aCircuit.Viewer = viewer;
aCircuit.Channel = channel;
aCircuit.Mac = mac;
aCircuit.Id0 = id0;
SetServiceURLs(aCircuit, account);
return aCircuit;
}
示例10: ScenePresence
public ScenePresence(
IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
{
m_scene = world;
AttachmentsSyncLock = new Object();
AllowMovement = true;
IsChildAgent = true;
IsLoggingIn = false;
m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
Animator = new ScenePresenceAnimator(this);
Overrides = new MovementAnimationOverrides();
PresenceType = type;
DrawDistance = world.DefaultDrawDistance;
RegionHandle = world.RegionInfo.RegionHandle;
ControllingClient = client;
Firstname = ControllingClient.FirstName;
Lastname = ControllingClient.LastName;
m_name = String.Format("{0} {1}", Firstname, Lastname);
m_uuid = client.AgentId;
LocalId = m_scene.AllocateLocalId();
LegacySitOffsets = m_scene.LegacySitOffsets;
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
if (account != null)
m_userFlags = account.UserFlags;
else
m_userFlags = 0;
if (account != null)
UserLevel = account.UserLevel;
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
if (gm != null)
Grouptitle = gm.GetGroupTitle(m_uuid);
m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
AbsolutePosition = posLastSignificantMove = CameraPosition =
m_lastCameraPosition = ControllingClient.StartPos;
m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
m_reprioritization_timer.AutoReset = false;
AdjustKnownSeeds();
RegisterToEvents();
SetDirectionVectors();
Appearance = appearance;
m_stateMachine = new ScenePresenceStateMachine(this);
}
示例11: osNpcLoadAppearance
public void osNpcLoadAppearance(LSL_Key npc, string notecard)
{
CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
{
UUID npcId;
if (!UUID.TryParse(npc.m_string, out npcId))
return;
if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
return;
string appearanceSerialized = LoadNotecard(notecard);
if (appearanceSerialized == null)
OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard));
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized);
// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized);
// Console.WriteLine("a.Type {0}, a.ToString() {1}", a.Type, a);
AvatarAppearance appearance = new AvatarAppearance();
appearance.Unpack(appearanceOsd);
npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene);
}
}
示例12: UpdateUserAppearance
public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {}
示例13: Unpack
//.........这里部分代码省略.........
Groups = new AgentGroupData[groups.Count];
int i = 0;
foreach (OSD o in groups)
{
if (o.Type == OSDType.Map)
{
Groups[i++] = new AgentGroupData((OSDMap)o);
}
}
}
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
{
OSDArray anims = (OSDArray)(args["animations"]);
Anims = new Animation[anims.Count];
int i = 0;
foreach (OSD o in anims)
{
if (o.Type == OSDType.Map)
{
Anims[i++] = new Animation((OSDMap)o);
}
}
}
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
//{
// OSDArray textures = (OSDArray)(args["agent_textures"]);
// AgentTextures = new UUID[textures.Count];
// int i = 0;
// foreach (OSD o in textures)
// AgentTextures[i++] = o.AsUUID();
//}
Appearance = new AvatarAppearance(AgentID);
// The code to unpack textures, visuals, wearables and attachments
// should be removed; packed appearance contains the full appearance
// This is retained for backward compatibility only
if (args["texture_entry"] != null)
{
byte[] rawtextures = args["texture_entry"].AsBinary();
Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
List<UUID> changed = new List<UUID>();
Appearance.SetTextureEntries(textures, out changed);
}
if (args["visual_params"] != null)
Appearance.SetVisualParams(args["visual_params"].AsBinary());
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(args["wearables"]);
for (int i = 0; i < wears.Count / 2; i++)
{
AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
Appearance.SetWearable(i, awear);
}
}
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
{
OSDArray attachs = (OSDArray)(args["attachments"]);
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
// We know all of these must end up as attachments so we
// append rather than replace to ensure multiple attachments
// per point continues to work
Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
}
}
}
// end of code to remove
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
Appearance = new AvatarAppearance(AgentID, (OSDMap)args["packed_appearance"]);
// DEBUG ON
else
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
// DEBUG OFF
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
{
OSDArray controls = (OSDArray)(args["controllers"]);
Controllers = new ControllerData[controls.Count];
int i = 0;
foreach (OSD o in controls)
{
if (o.Type == OSDType.Map)
{
Controllers[i++] = new ControllerData((OSDMap)o);
}
}
}
if (args["callback_uri"] != null)
CallbackURI = args["callback_uri"].AsString();
}
示例14: GetAssetsFrom
public void GetAssetsFrom(AvatarAppearance app)
{
int len = m_wearables.Length;
if(len > app.m_wearables.Length)
len = app.m_wearables.Length;
for (int i = 0; i < len; i++)
{
int count = m_wearables[i].Count;
if(count > app.m_wearables[i].Count)
count = app.m_wearables[i].Count;
for (int j = 0; j < count; j++)
{
UUID itemID = m_wearables[i][j].ItemID;
UUID assetID = app.Wearables[i].GetAsset(itemID);
if (assetID != UUID.Zero)
m_wearables[i].Add(itemID, assetID);
}
}
}
示例15: AvatarAppearance
public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked)
{
// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
if (appearance == null)
{
m_serial = 0;
SetDefaultWearables();
SetDefaultTexture();
SetDefaultParams();
// SetHeight();
SetSize(new Vector3(0.45f, 0.6f, 1.9f));
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
return;
}
m_serial = appearance.Serial;
if (copyWearables && (appearance.Wearables != null))
{
m_wearables = new AvatarWearable[appearance.Wearables.Length];
for (int i = 0; i < appearance.Wearables.Length; i++)
{
m_wearables[i] = new AvatarWearable();
AvatarWearable wearable = appearance.Wearables[i];
for (int j = 0; j < wearable.Count; j++)
m_wearables[i].Add(wearable[j].ItemID, wearable[j].AssetID);
}
}
else
ClearWearables();
m_texture = null;
if (appearance.Texture != null)
{
byte[] tbytes = appearance.Texture.GetBytes();
m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
if (copyBaked && appearance.m_cacheitems != null)
m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone();
else
m_cacheitems = null;
}
m_visualparams = null;
if (appearance.VisualParams != null)
m_visualparams = (byte[])appearance.VisualParams.Clone();
// m_avatarHeight = appearance.m_avatarHeight;
SetSize(appearance.AvatarSize);
// Copy the attachment, force append mode since that ensures consistency
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
foreach (AvatarAttachment attachment in appearance.GetAttachments())
AppendAttachment(new AvatarAttachment(attachment));
}