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


C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetSublist方法代码示例

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


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

示例1: llList2List

 public LSL_List llList2List(LSL_List src, int start, int end)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     
     return src.GetSublist(start, end);
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:6,代码来源:LSL_Api.cs

示例2: llListInsertList

        /// <summary>
        /// Insert the list identified by <src> into the
        /// list designated by <dest> such that the first
        /// new element has the index specified by <index>
        /// </summary>

        public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
        {
			ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            
            LSL_List pref = null;
            LSL_List suff = null;

            

            if (index < 0)
            {
                index = index+dest.Length;
                if (index < 0)
                {
                    index = 0;
                }
            }

            if (index != 0)
            {
                pref = dest.GetSublist(0,index-1);
                if (index < dest.Length)
                {
                    suff = dest.GetSublist(index,-1);
                    return pref + src + suff;
                }
                else
                {
                    return pref + src;
                }
            }
            else
            {
                if (index < dest.Length)
                {
                    suff = dest.GetSublist(index,-1);
                    return src + suff;
                }
                else
                {
                    return src;
                }
            }

        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:51,代码来源:LSL_Api.cs

示例3: llListReplaceList

        /// <summary>
        /// illListReplaceList removes the sub-list defined by the inclusive indices
        /// start and end and inserts the src list in its place. The inclusive
        /// nature of the indices means that at least one element must be deleted
        /// if the indices are within the bounds of the existing list. I.e. 2,2
        /// will remove the element at index 2 and replace it with the source
        /// list. Both indices may be negative, with the usual interpretation. An
        /// interesting case is where end is lower than start. As these indices
        /// bound the list to be removed, then 0->end, and start->lim are removed
        /// and the source list is added as a suffix.
        /// </summary>

        public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
        {
            LSL_List pref = null;

            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            
            
            // Note that although we have normalized, both
            // indices could still be negative.
            if (start < 0)
            {
                start = start+dest.Length;
            }

            if (end < 0)
            {
                end = end+dest.Length;
            }
            // The comventional case, remove a sequence starting with
            // start and ending with end. And then insert the source
            // list.
            if (start <= end)
            {
                // If greater than zero, then there is going to be a
                // surviving prefix. Otherwise the inclusive nature
                // of the indices mean that we're going to add the
                // source list as a prefix.
                if (start > 0)
                {
                    pref = dest.GetSublist(0,start-1);
                    // Only add a suffix if there is something
                    // beyond the end index (it's inclusive too).
                    if (end + 1 < dest.Length)
                    {
                        return pref + src + dest.GetSublist(end + 1, -1);
                    }
                    else
                    {
                        return pref + src;
                    }
                }
                // If start is less than or equal to zero, then
                // the new list is simply a prefix. We still need to
                // figure out any necessary surgery to the destination
                // based upon end. Note that if end exceeds the upper
                // bound in this case, the entire destination list
                // is removed.
                else
                {
                    if (end + 1 < dest.Length)
                    {
                        return src + dest.GetSublist(end + 1, -1);
                    }
                    else
                    {
                        return src;
                    }
                }
            }
            // Finally, if start > end, we strip away a prefix and
            // a suffix, to leave the list that sits <between> ens
            // and start, and then tag on the src list. AT least
            // that's my interpretation. We can get sublist to do
            // this for us. Note that one, or both of the indices
            // might have been negative.
            else
            {
                return dest.GetSublist(end + 1, start - 1) + src;
            }
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:82,代码来源:LSL_Api.cs


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