本文整理汇总了C#中OpenSim.Services.Interfaces.AvatarData类的典型用法代码示例。如果您正苦于以下问题:C# AvatarData类的具体用法?C# AvatarData怎么用?C# AvatarData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AvatarData类属于OpenSim.Services.Interfaces命名空间,在下文中一共展示了AvatarData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAvatar
public bool SetAvatar (UUID userID, AvatarData avatar)
{
bool success = m_localService.SetAvatar (userID, avatar);
if (!success)
success = m_remoteService.SetAvatar (userID, avatar);
return success;
}
示例2: Store
public bool Store (UUID PrincipalID, AvatarData data)
{
GD.Delete (m_realm, new string[1] { "PrincipalID" }, new object[1] { PrincipalID });
for (int i = 0; i < data.Data.Count; i++)
{
GD.Insert (m_realm, new object[3] { PrincipalID, data.Data.ElementAt (i).Key, data.Data.ElementAt (i).Value });
}
return true;
}
示例3: SetAvatar
public bool SetAvatar(UUID principalID, AvatarData avatar)
{
m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("SetAppearance",
new object[2]
{
principalID,
avatar
});
return m_Database.Store(principalID, avatar);
}
示例4: SetAvatar
public override bool SetAvatar(UUID userID, AvatarData avatar)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "setavatar";
sendData["UserID"] = userID.ToString();
Dictionary<string, object> structData = avatar.ToKVP();
#if (!ISWIN)
foreach (KeyValuePair<string, object> kvp in structData)
{
if (kvp.Key != "Textures") sendData[kvp.Key] = kvp.Value.ToString();
}
#else
foreach (KeyValuePair<string, object> kvp in structData.Where(kvp => kvp.Key != "Textures"))
sendData[kvp.Key] = kvp.Value.ToString();
#endif
ResetAvatar(userID);
string reqString = WebUtils.BuildQueryString(sendData);
//MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try
{
List<string> serverURIs =
m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AvatarServerURI");
foreach (string mServerUri in serverURIs)
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", mServerUri, reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("result"))
{
if (replyData["result"].ToString().ToLower() == "success")
return true;
}
else
MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetAvatar reply data does not contain result field");
}
else
MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetAvatar received empty reply");
}
}
catch (Exception e)
{
MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message);
}
return false;
}
示例5: InternalGet
private AvatarData InternalGet (string realm, string field, string val)
{
List<string> data = GD.Query (field, val, realm, "Name, Value");
AvatarData retVal = new AvatarData ();
retVal.AvatarType = 1;
retVal.Data = new Dictionary<string, string> ();
for (int i = 0; i < data.Count; i += 2)
{
retVal.Data[data[i]] = data[i + 1];
}
return retVal;
}
示例6: Store
public bool Store(UUID PrincipalID, AvatarData data)
{
GD.Delete(m_realm, new string[1] {"PrincipalID"}, new object[1] {PrincipalID});
List<object[]> insertList = new List<object[]>();
foreach(KeyValuePair<string, string> kvp in data.Data)
{
insertList.Add(new object[3]
{
PrincipalID,
kvp.Key.MySqlEscape(32),
kvp.Key == "Textures" ? kvp.Value : kvp.Value.MySqlEscape()
});
}
GD.InsertMultiple(m_realm, insertList);
return true;
}
示例7: Store
public bool Store(UUID PrincipalID, AvatarData data)
{
QueryFilter filter = new QueryFilter();
filter.andFilters["PrincipalID"] = PrincipalID;
GD.Delete(m_realm, filter);
List<object[]> insertList = new List<object[]>();
foreach(KeyValuePair<string, string> kvp in data.Data)
{
insertList.Add(new object[3]{
PrincipalID,
kvp.Key.MySqlEscape(32),
kvp.Key == "Textures" ? kvp.Value : kvp.Value.MySqlEscape()
});
}
GD.InsertMultiple(m_realm, insertList);
return true;
}
示例8: GetAvatar
public AvatarData GetAvatar(UUID principalID)
{
AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
if (av.Length == 0)
return null;
AvatarData ret = new AvatarData();
ret.Data = new Dictionary<string,string>();
foreach (AvatarBaseData b in av)
{
if (b.Data["Name"] == "AvatarType")
ret.AvatarType = Convert.ToInt32(b.Data["Value"]);
else
ret.Data[b.Data["Name"]] = b.Data["Value"];
}
return ret;
}
示例9: Store
public bool Store(UUID PrincipalID, AvatarData data)
{
lock (m_locks[PrincipalID])
{
QueryFilter filter = new QueryFilter();
filter.andFilters["PrincipalID"] = PrincipalID;
GD.Delete(m_realm, filter);
List<object[]> insertList = new List<object[]>();
foreach (KeyValuePair<string, string> kvp in data.Data)
{
insertList.Add(new object[3]{
PrincipalID,
kvp.Key,
kvp.Value
});
}
GD.InsertMultiple(m_realm, insertList);
}
return true;
}
示例10: SetAvatar
public bool SetAvatar(UUID principalID, AvatarData avatar)
{
int count = 0;
foreach (KeyValuePair<string, string> kvp in avatar.Data)
if (kvp.Key.StartsWith("_"))
count++;
m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count);
m_Database.Delete("PrincipalID", principalID.ToString());
AvatarBaseData av = new AvatarBaseData();
av.Data = new Dictionary<string,string>();
av.PrincipalID = principalID;
av.Data["Name"] = "AvatarType";
av.Data["Value"] = avatar.AvatarType.ToString();
if (!m_Database.Store(av))
return false;
foreach (KeyValuePair<string,string> kvp in avatar.Data)
{
av.Data["Name"] = kvp.Key;
av.Data["Value"] = kvp.Value;
if (!m_Database.Store(av))
{
m_log.Error("[AVATARSERVICE]: Error saving appearance for " + principalID + ", data follows " +
kvp.Key + ", " + kvp.Value);
m_Database.Delete("PrincipalID", principalID.ToString());
return false;
}
}
return true;
}
示例11: LoadAvatarArchive
public void LoadAvatarArchive(string FileName, string Name)
{
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, Name);
m_log.Info("[AvatarArchive] Loading archive from " + FileName);
if (account == null)
{
m_log.Error("[AvatarArchive] User not found!");
return;
}
string file = "";
if (FileName.EndsWith(".database"))
{
m_log.Info("[AvatarArchive] Loading archive from the database " + FileName);
FileName = FileName.Substring(0, FileName.Length - 9);
Aurora.Framework.IAvatarArchiverConnector avarchiver = DataManager.RequestPlugin<IAvatarArchiverConnector>();
AvatarArchive archive = avarchiver.GetAvatarArchive(FileName);
file = archive.ArchiveXML;
}
else
{
m_log.Info("[AvatarArchive] Loading archive from " + FileName);
StreamReader reader = new StreamReader(FileName);
file = reader.ReadToEnd();
reader.Close();
reader.Dispose();
}
string FolderNameToLoadInto = "";
OSD m = OSDParser.DeserializeLLSDXml(file);
if (m.Type != OSDType.Map)
{
m_log.Warn("[AvatarArchiver]: Failed to load AA from " + FileName + ", text: " + file);
return;
}
OSDMap map = ((OSDMap)m);
OSDMap assetsMap = ((OSDMap)map["Assets"]);
OSDMap itemsMap = ((OSDMap)map["Items"]);
OSDMap bodyMap = ((OSDMap)map["Body"]);
AvatarAppearance appearance = ConvertXMLToAvatarAppearance(bodyMap, out FolderNameToLoadInto);
appearance.Owner = account.PrincipalID;
List<InventoryItemBase> items = new List<InventoryItemBase>();
InventoryFolderBase AppearanceFolder = InventoryService.GetFolderForType (account.PrincipalID, InventoryType.Unknown, AssetType.Clothing);
InventoryFolderBase folderForAppearance
= new InventoryFolderBase(
UUID.Random(), FolderNameToLoadInto, account.PrincipalID,
-1, AppearanceFolder.ID, 1);
InventoryService.AddFolder(folderForAppearance);
folderForAppearance = InventoryService.GetFolder(folderForAppearance);
try
{
LoadAssets(assetsMap, appearance);
LoadItems(itemsMap, account.PrincipalID, folderForAppearance, appearance, out items);
}
catch (Exception ex)
{
m_log.Warn("[AvatarArchiver]: Error loading assets and items, " + ex.ToString());
}
AvatarData adata = new AvatarData(appearance);
AvatarService.SetAvatar(account.PrincipalID, adata);
m_log.Info("[AvatarArchive] Loaded archive from " + FileName);
}
示例12: LoadAvatarArchive
//.........这里部分代码省略.........
}
if (appearance.ShoesItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.ShoesItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.ShoesItem, folderForAppearance);
items.Add(IB);
appearance.ShoesItem = IB.ID;
}
if (appearance.SkinItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.SkinItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.SkinItem, folderForAppearance);
items.Add(IB);
appearance.SkinItem = IB.ID;
}
if (appearance.SkirtItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.SkirtItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.SkirtItem, folderForAppearance);
items.Add(IB);
appearance.SkirtItem = IB.ID;
}
if (appearance.SocksItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.SocksItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.SocksItem, folderForAppearance);
items.Add(IB);
appearance.SocksItem = IB.ID;
}
if (appearance.UnderPantsItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.UnderPantsItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.UnderPantsItem, folderForAppearance);
items.Add(IB);
appearance.UnderPantsItem = IB.ID;
}
if (appearance.UnderShirtItem != UUID.Zero)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(appearance.UnderShirtItem));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, appearance.UnderShirtItem, folderForAppearance);
items.Add(IB);
appearance.UnderShirtItem = IB.ID;
}
appearance.ClearAttachments(); //Clear so that we can rebuild
int i = 0;
foreach (UUID uuid in AttachmentUUIDs)
{
InventoryItemBase IB = m_scene.InventoryService.GetItem(new InventoryItemBase(uuid));
IB = GiveInventoryItem(IB.CreatorIdAsUuid, appearance.Owner, uuid, folderForAppearance);
items.Add(IB);
appearance.SetAttachment(int.Parse(AttachmentPoints[i]), IB.ID, UUID.Parse(AttachmentAssets[i]));
i++;
}
#endregion
foreach (InventoryItemBase itemCopy in items)
{
if (itemCopy == null)
{
SP.ControllingClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false);
continue;
}
if (!SP.IsChildAgent)
{
SP.ControllingClient.SendBulkUpdateInventory(itemCopy);
}
}
appearance.Owner = account.PrincipalID;
AvatarData adata = new AvatarData(appearance);
m_scene.AvatarService.SetAvatar(account.PrincipalID, adata);
SP.Appearance = appearance;
SP.SendAppearanceToOtherAgent(SP);
SP.SendWearables();
SP.SendAppearanceToAllOtherAgents();
if (appearance.Texture != null)
{
for (i = 0; i < appearance.Texture.FaceTextures.Length; i++)
{
Primitive.TextureEntryFace face = (appearance.Texture.FaceTextures[i]);
if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{
m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + i + ") for avatar " + this.Name);
SP.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
}
}
}
m_log.Debug("[AvatarArchive] Loaded archive from " + FileName);
}
示例13: Login
public LoginResponse Login(string Name, string passwd, string startLocation, UUID scopeID,
string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, Hashtable requestData, UUID secureSession)
{
UUID session = UUID.Random();
MainConsole.Instance.InfoFormat("[LLOGIN SERVICE]: Login request for {0} from {1} with user agent {2} starting in {3}",
Name, clientIP.Address, clientVersion, startLocation);
UserAccount account = m_UserAccountService.GetUserAccount (scopeID, Name);
try
{
string DisplayName = account.Name;
IAgentInfo agent = null;
IAgentConnector agentData = DataManager.RequestPlugin<IAgentConnector>();
IProfileConnector profileData = DataManager.RequestPlugin<IProfileConnector>();
if (agentData != null)
agent = agentData.GetAgent(account.PrincipalID);
requestData["ip"] = clientIP.ToString();
foreach (ILoginModule module in LoginModules)
{
string message;
if (!module.Login(requestData, account.PrincipalID, out message))
{
LLFailedLoginResponse resp = new LLFailedLoginResponse(LoginResponseEnum.PasswordIncorrect,
message, false);
return resp;
}
}
//
// Get the user's inventory
//
if (m_RequireInventory && m_InventoryService == null)
{
MainConsole.Instance.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up");
return LLFailedLoginResponse.InventoryProblem;
}
List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel.Count == 0)))
{
m_InventoryService.CreateUserInventory(account.PrincipalID, m_DefaultUserAvatarArchive == "");
inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel.Count == 0)))
{
MainConsole.Instance.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: unable to retrieve user inventory");
return LLFailedLoginResponse.InventoryProblem;
}
}
if (m_InventoryService.CreateUserRootFolder (account.PrincipalID))
//Gotta refetch... since something went wrong
inventorySkel = m_InventoryService.GetInventorySkeleton (account.PrincipalID);
if (profileData != null)
{
IUserProfileInfo UPI = profileData.GetUserProfile(account.PrincipalID);
if (UPI == null)
{
profileData.CreateNewProfile(account.PrincipalID);
UPI = profileData.GetUserProfile(account.PrincipalID);
UPI.AArchiveName = m_DefaultUserAvatarArchive;
UPI.IsNewUser = true;
//profileData.UpdateUserProfile(UPI); //It gets hit later by the next thing
}
//Find which is set, if any
string archiveName = (UPI.AArchiveName != "" && UPI.AArchiveName != " ") ? UPI.AArchiveName : m_DefaultUserAvatarArchive;
if (UPI.IsNewUser && archiveName != "")
{
AvatarAppearance appearance = m_ArchiveService.LoadAvatarArchive(archiveName, account.Name);
UPI.AArchiveName = "";
inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
AvatarData adata = new AvatarData(appearance);
m_AvatarService.SetAppearance(account.PrincipalID, appearance);
}
if (UPI.IsNewUser)
{
UPI.IsNewUser = false;
profileData.UpdateUserProfile(UPI);
}
if(UPI.DisplayName != "")
DisplayName = UPI.DisplayName;
}
// Get active gestures
List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(account.PrincipalID);
//MainConsole.Instance.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count);
//Reset logged in to true if the user was crashed, but don't fire the logged in event yet
m_agentInfoService.SetLoggedIn (account.PrincipalID.ToString (), true, false, UUID.Zero);
//Lock it as well
m_agentInfoService.LockLoggedInStatus (account.PrincipalID.ToString (), true);
//Now get the logged in status, then below make sure to kill the previous agent if we crashed before
UserInfo guinfo = m_agentInfoService.GetUserInfo (account.PrincipalID.ToString ());
//
// Clear out any existing CAPS the user may have
//
if (m_CapsService != null)
{
IAgentProcessing agentProcessor = m_registry.RequestModuleInterface<IAgentProcessing>();
//.........这里部分代码省略.........
示例14: SetAppearance
public bool SetAppearance(UUID userID, AvatarAppearance appearance)
{
AvatarData avatar = new AvatarData(appearance);
return SetAvatar(userID,avatar);
}
示例15: SetAppearance
public bool SetAppearance(UUID principalID, AvatarAppearance appearance)
{
AvatarData avatar = new AvatarData(appearance);
return SetAvatar(principalID, avatar);
}