当前位置: 首页>>代码示例>>C#>>正文


C# OSDMap.ContainsKey方法代码示例

本文整理汇总了C#中OpenMetaverse.StructuredData.OSDMap.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# OSDMap.ContainsKey方法的具体用法?C# OSDMap.ContainsKey怎么用?C# OSDMap.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenMetaverse.StructuredData.OSDMap的用法示例。


在下文中一共展示了OSDMap.ContainsKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RequestMapItemsCompleted

        /// <summary>
        /// Sends the mapitem response to the IClientAPI
        /// </summary>
        /// <param name="response">The OSDMap Response for the mapitem</param>
        private void RequestMapItemsCompleted(OSDMap response)
        {
            UUID requestID = response["requestID"].AsUUID();

            if (requestID != UUID.Zero)
            {
                MapRequestState mrs = new MapRequestState();
                mrs.agentID = UUID.Zero;
                lock (m_openRequests)
                {
                    if (m_openRequests.ContainsKey(requestID))
                    {
                        mrs = m_openRequests[requestID];
                        m_openRequests.Remove(requestID);
                    }
                }

                if (mrs.agentID != UUID.Zero)
                {
                    ScenePresence av = null;
                    m_scene.TryGetScenePresence(mrs.agentID, out av);
                    if (av != null)
                    {
                        if (response.ContainsKey(mrs.itemtype.ToString()))
                        {
                            List<mapItemReply> returnitems = new List<mapItemReply>();
                            OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()];
                            for (int i = 0; i < itemarray.Count; i++)
                            {
                                OSDMap mapitem = (OSDMap)itemarray[i];
                                mapItemReply mi = new mapItemReply();
                                mi.x = (uint)mapitem["X"].AsInteger();
                                mi.y = (uint)mapitem["Y"].AsInteger();
                                mi.id = mapitem["ID"].AsUUID();
                                mi.Extra = mapitem["Extra"].AsInteger();
                                mi.Extra2 = mapitem["Extra2"].AsInteger();
                                mi.name = mapitem["Name"].AsString();
                                returnitems.Add(mi);
                            }
                            av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
                        }
                    }
                }
            }
        }
开发者ID:gumho,项目名称:diva-distribution,代码行数:49,代码来源:WorldMapModule.cs

示例2: OnSimulatorFeaturesRequest

        private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
        {
            m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
            if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
            {
                OSDMap extrasMap;
                OSDMap specialUI = new OSDMap();
                using (StreamReader s = new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR, "panel_toolbar.xml")))
                {
                    if (features.ContainsKey("OpenSimExtras"))
                        extrasMap = (OSDMap)features["OpenSimExtras"];
                    else
                    {
                        extrasMap = new OSDMap();
                        features["OpenSimExtras"] = extrasMap;
                    }

                    specialUI["toolbar"] = OSDMap.FromString(s.ReadToEnd());
                    extrasMap["special-ui"] = specialUI;
                }
                m_log.DebugFormat("[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);

                if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters")))
                {
                    OSDMap floaters = new OSDMap();
                    uint n = 0;
                    foreach (String name in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"), "*.xml"))
                    {
                        using (StreamReader s = new StreamReader(name))
                        {
                            string simple_name = Path.GetFileNameWithoutExtension(name);
                            OSDMap floater = new OSDMap();
                            floaters[simple_name] = OSDMap.FromString(s.ReadToEnd());
                            n++;
                        }
                    }
                    specialUI["floaters"] = floaters;
                    m_log.DebugFormat("[SPECIAL UI]: Sending {0} floaters", n);
                }
            }
            else
                m_log.DebugFormat("[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:44,代码来源:SpecialUIModule.cs

示例3: OnSimulatorFeaturesRequest

        private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
        {
            m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
            if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
            {
                OSDMap extrasMap;
                if (features.ContainsKey("OpenSimExtras"))
                {
                    extrasMap = (OSDMap)features["OpenSimExtras"];
                }
                else
                {
                    extrasMap = new OSDMap();
                    features["OpenSimExtras"] = extrasMap;
                }
                extrasMap["camera-only-mode"] = OSDMap.FromString("true");
                m_log.DebugFormat("[CAMERA-ONLY MODE]: Sent in {0}", m_scene.RegionInfo.RegionName);

                // Detaching attachments doesn't work for HG visitors,
                // so I'm giving that up.
                //Util.FireAndForget(delegate { DetachAttachments(agentID); });
            }
            else
                m_log.DebugFormat("[CAMERA-ONLY MODE]: NOT Sending camera-only-mode in {0}", m_scene.RegionInfo.RegionName);
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:25,代码来源:CameraOnlyModeModule.cs

示例4: OnSimulatorFeaturesRequest

        private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
        {
            OSD menus = new OSDMap();
            if (features.ContainsKey("menus"))
                menus = features["menus"];

            OSDMap agent = new OSDMap();
            OSDMap world = new OSDMap();
            OSDMap tools = new OSDMap();
            OSDMap advanced = new OSDMap();
            OSDMap admin = new OSDMap();
            if (((OSDMap)menus).ContainsKey("agent"))
                agent = (OSDMap)((OSDMap)menus)["agent"];
            if (((OSDMap)menus).ContainsKey("world"))
                world = (OSDMap)((OSDMap)menus)["world"];
            if (((OSDMap)menus).ContainsKey("tools"))
                tools = (OSDMap)((OSDMap)menus)["tools"];
            if (((OSDMap)menus).ContainsKey("advanced"))
                advanced = (OSDMap)((OSDMap)menus)["advanced"];
            if (((OSDMap)menus).ContainsKey("admin"))
                admin = (OSDMap)((OSDMap)menus)["admin"];

            if (m_menuItems.ContainsKey(UUID.Zero))
            {
                foreach (MenuItemData d in m_menuItems[UUID.Zero])
                {
                    if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID)))
                        continue;

                    OSDMap loc = null;
                    switch (d.Location)
                    {
                    case InsertLocation.Agent:
                        loc = agent;
                        break;
                    case InsertLocation.World:
                        loc = world;
                        break;
                    case InsertLocation.Tools:
                        loc = tools;
                        break;
                    case InsertLocation.Advanced:
                        loc = advanced;
                        break;
                    case InsertLocation.Admin:
                        loc = admin;
                        break;
                    }

                    if (loc == null)
                        continue;
                    
                    loc[d.Title] = OSD.FromString(d.Title);
                }
            }

            if (m_menuItems.ContainsKey(agentID))
            {
                foreach (MenuItemData d in m_menuItems[agentID])
                {
                    if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID)))
                        continue;

                    OSDMap loc = null;
                    switch (d.Location)
                    {
                    case InsertLocation.Agent:
                        loc = agent;
                        break;
                    case InsertLocation.World:
                        loc = world;
                        break;
                    case InsertLocation.Tools:
                        loc = tools;
                        break;
                    case InsertLocation.Advanced:
                        loc = advanced;
                        break;
                    case InsertLocation.Admin:
                        loc = admin;
                        break;
                    }

                    if (loc == null)
                        continue;
                    
                    loc[d.Title] = OSD.FromString(d.Title);
                }
            }


            ((OSDMap)menus)["agent"] = agent;
            ((OSDMap)menus)["world"] = world;
            ((OSDMap)menus)["tools"] = tools;
            ((OSDMap)menus)["advanced"] = advanced;
            ((OSDMap)menus)["admin"] = admin;

            features["menus"] = menus;
        }
开发者ID:RadaSangOn,项目名称:workCore2,代码行数:99,代码来源:DynamicMenuModule.cs

示例5: RequestMapItemsAsync

        /// <summary>
        /// Does the actual remote mapitem request
        /// This should be called from an asynchronous thread
        /// Request failures get blacklisted until region restart so we don't
        /// continue to spend resources trying to contact regions that are down.
        /// </summary>
        /// <param name="httpserver">blank string, we discover this in the process</param>
        /// <param name="id">Agent ID that we are making this request on behalf</param>
        /// <param name="flags">passed in from packet</param>
        /// <param name="EstateID">passed in from packet</param>
        /// <param name="godlike">passed in from packet</param>
        /// <param name="itemtype">passed in from packet</param>
        /// <param name="regionhandle">Region we're looking up</param>
        /// <returns></returns>
        private OSDMap RequestMapItemsAsync(UUID id, uint flags,
            uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
        {
//            m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype);

            string httpserver = "";
            bool blacklisted = false;
            lock (m_blacklistedregions)
            {
                if (m_blacklistedregions.ContainsKey(regionhandle))
                {
                    if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout))
                    {
                        m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted region {0}", regionhandle);

                        m_blacklistedregions.Remove(regionhandle);
                    }
                    else
                        blacklisted = true;
                }
            }

            if (blacklisted)
                return new OSDMap();

            UUID requestID = UUID.Random();
            lock (m_cachedRegionMapItemsAddress)
            {
                if (m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                    httpserver = m_cachedRegionMapItemsAddress[regionhandle];
            }
            if (httpserver.Length == 0)
            {
                uint x = 0, y = 0;
                Utils.LongToUInts(regionhandle, out x, out y);
                GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); 

                if (mreg != null)
                {
                    httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
                    lock (m_cachedRegionMapItemsAddress)
                    {
                        if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                            m_cachedRegionMapItemsAddress.Add(regionhandle, httpserver);
                    }
                }
                else
                {
                    lock (m_blacklistedregions)
                    {
                        if (!m_blacklistedregions.ContainsKey(regionhandle))
                            m_blacklistedregions.Add(regionhandle, Environment.TickCount);
                    }
                    //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
                }
            }

            blacklisted = false;
            lock (m_blacklistedurls)
            {
                if (m_blacklistedurls.ContainsKey(httpserver))
                {
                    if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout))
                    {
                        m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted URL {0}", httpserver);

                        m_blacklistedurls.Remove(httpserver);
                    }
                    else
                        blacklisted = true;
                }
            }

            // Can't find the http server
            if (httpserver.Length == 0 || blacklisted)
                return new OSDMap();

            MapRequestState mrs = new MapRequestState();
            mrs.agentID = id;
            mrs.EstateID = EstateID;
            mrs.flags = flags;
            mrs.godlike = godlike;
            mrs.itemtype=itemtype;
            mrs.regionhandle = regionhandle;

            lock (m_openRequests)
//.........这里部分代码省略.........
开发者ID:pluraldj,项目名称:opensim,代码行数:101,代码来源:WorldMapModule.cs

示例6: AssignRequestedMaterials

        /// <summary>
        /// Assign The requested materials to the specified part(s).
        /// </summary>
        /// <param name="materialsFromViewer"></param>
        private void AssignRequestedMaterials(OSDMap materialsFromViewer, UUID agentID)
        {
            if (!(materialsFromViewer.ContainsKey("FullMaterialsPerFace") &&
                  (materialsFromViewer["FullMaterialsPerFace"] is OSDArray)))
            {
                m_log.Warn("[RenderMaterials]: AssignRequestedMaterials - FullMaterialsPerFace not defined or incorrect type");
                return;
            }

            OSDArray mats = materialsFromViewer["FullMaterialsPerFace"] as OSDArray;

            foreach (OSDMap matsMap in mats)
            {
                uint matLocalID = 0;
                int face = -1;
                OSDMap matData = null;

                try
                {
                    matLocalID = matsMap["ID"].AsUInteger();

                    if (matsMap.ContainsKey("Face"))
                        face = matsMap["Face"].AsInteger();

                    if (matsMap.ContainsKey("Material"))
                        matData = matsMap["Material"] as OSDMap;
                }
                catch (Exception e)
                {
                    m_log.Warn("[RenderMaterials]: cannot decode material from matsMap: " + e.Message);
                    continue;
                }

                /// Look up the scene object this material pertains to.
                var sop = m_scene.GetSceneObjectPart(matLocalID);
                if (sop == null)
                {
                    m_log.Warn("[RenderMaterials]: null SOP for localId: " + matLocalID.ToString());
                    continue;
                }

                // Make sure we can modify it
                if (m_scene.Permissions.CanEditObject(sop.UUID, agentID, (uint)PermissionMask.Modify) == false)
                {
                    m_log.WarnFormat("[RenderMaterials]: User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
                    continue;
                }

                AssignSingleMaterial(sop, face, matData);
            }
        }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:55,代码来源:RenderMaterialsModule.cs

示例7: GetHandler

 private OMVSD.OSD GetHandler(RestHandler handler, Uri uri, String after)
 {
     OMVSD.OSDMap ret = new OMVSD.OSDMap();
     string lastDate = "xx";
     lock (m_chats) {
     while (m_chats.Count > 0) {
         ChatEntry ce = m_chats.Dequeue();
         string dateString = ce.time.ToString("yyyyMMddhhmmssfff");
         OMVSD.OSDMap chat = new OMVSD.OSDMap();
         chat.Add("Time", new OMVSD.OSDString(dateString));
         chat.Add("From", new OMVSD.OSDString(ce.fromName));
         chat.Add("Message", new OMVSD.OSDString(ce.message));
         chat.Add("Type", new OMVSD.OSDString(ce.chatTypeString));
         chat.Add("EntryType", new OMVSD.OSDString(ChatEntryTypeString[(int)ce.chatEntryType]));
         chat.Add("Position", new OMVSD.OSDString(ce.position.ToString()));
         if (ce.ownerID != null) {
             chat.Add("OwnerID", new OMVSD.OSDString(ce.ownerID.ToString()));
         }
         while (ret.ContainsKey(dateString)) {
             dateString += "1";
         }
         ret.Add(dateString, chat);
         lastDate = dateString;
     }
     }
     return ret;
 }
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:27,代码来源:LLChat.cs

示例8: DecodeMeshFace

        /// <summary>
        /// Add a submesh to an existing list of coords and faces.
        /// </summary>
        /// <param name="subMeshData"></param>
        /// <param name="size">Size of entire object</param>
        /// <param name="coords"></param>
        /// <param name="faces"></param>
        private static int DecodeMeshFace(OSDMap subMeshData)
        {
            // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap));

            // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level
            // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no
            // geometry for this submesh.
            if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"]))
                return 0;

            int vertex_count = 0;
            if (subMeshData.ContainsKey("Position"))
            {
                byte[] posBytes = subMeshData["Position"].AsBinary();
                vertex_count = posBytes.Length / 6;
            }

            return vertex_count;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:26,代码来源:SceneObjectPartMeshCost.cs


注:本文中的OpenMetaverse.StructuredData.OSDMap.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。