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


C# this.Cast方法代码示例

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


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

示例1: JungleClear

 public static Obj_AI_Base JungleClear(this Spell.Skillshot s, bool useCast = true, int numberOfHits = 1)
 {
     if (!s.IsReady() || numberOfHits <= 0) return null;
     var minions = EntityManager.MinionsAndMonsters.GetJungleMonsters(s.Source(), s.Range + s.Width).OrderBy(m => m.MaxHealth);
     if (!minions.Any() || minions.Count() < numberOfHits) return null;
     switch (s.Type)
     {
         case SkillShotType.Linear:
             var t = s.GetBestLineTarget(minions.ToList<Obj_AI_Base>());
             if (t.Item1 >= numberOfHits)
             {
                 if (useCast)
                 {
                     s.Cast(t.Item2);
                 }
                 return t.Item2;
             }
             break;
         case SkillShotType.Circular:
             var t2 = s.GetBestCircularTarget(minions.ToList<Obj_AI_Base>());
             if (t2.Item1 < numberOfHits) return null;
             if (useCast)
             {
                 s.Cast(t2.Item2);
             }
             return t2.Item2;
     }
     return null;
 }
开发者ID:mezer123,项目名称:EloBuddy,代码行数:29,代码来源:Util.cs

示例2: Cast

        public static bool Cast(this Spell.Skillshot spell, Obj_AI_Base target, int MinChance = 65, Vector3? From = null, bool UseICPred = false)
        {
            if (!UseICPred)
            {
                Prediction.Manager.PredictionSelected = "SDK Prediction";

                var SpellPred = Prediction.Position.PredictLinearMissile
                    (target, spell.Range, spell.Width, spell.CastDelay, spell.Speed, spell.AllowedCollisionCount, From.HasValue ? From.Value : Player.Instance.Position);

                if (SpellPred.HitChancePercent >= MinChance && spell.Cast(SpellPred.CastPosition)) return true;
            }
            else
            {
                Prediction.Manager.PredictionSelected = "SDK Beta Prediction";

                var SpellPred = Prediction.Manager.GetPrediction(new Prediction.Manager.PredictionInput
                {
                    Delay = (float)spell.CastDelay / 1000,
                    Radius = spell.Width,
                    Range = spell.Range,
                    Speed = spell.Speed,
                    Type = spell.Type,
                    Target = target,
                    From = From.HasValue ? From.Value : Player.Instance.Position
                });

                if (SpellPred.CollisionObjects.Count() <= spell.AllowedCollisionCount && SpellPred.HitChancePercent >= MinChance && spell.Cast(SpellPred.CastPosition)) return true;
            }

            return false;
        }
开发者ID:Toyota7,项目名称:EloBuddy,代码行数:31,代码来源:Program.cs

示例3: Cast

 public static void Cast(this Spell.Skillshot spell, Obj_AI_Base target, bool value = true)
 {
     if (target != null && value && spell.IsReady() && target.IsKillable(spell.Range))
     {
         spell.Cast(spell.GetPrediction(target).CastPosition);
     }
 }
开发者ID:FireBuddy,项目名称:kappa-s-aio,代码行数:7,代码来源:HitChanceManager.cs

示例4:

 public static Dictionary<string, string> ToDictionary
     (this NameValueCollection source)
 {
     return source.Cast<string>()
                  .Select(s => new { Key = s, Value = source[s] })
                  .ToDictionary(p => p.Key, p => p.Value);
 }
开发者ID:GovindMalviya,项目名称:IAnswerable.Web,代码行数:7,代码来源:NameValueCollectionHelper.cs

示例5: ToXPathItems

      public static IEnumerable<XPathItem> ToXPathItems(this XdmValue value) {

         if (value == null)
            return Enumerable.Empty<XPathItem>();

         return ToXPathItems(value.Cast<XdmItem>());
      }
开发者ID:nuxleus,项目名称:Nuxleus,代码行数:7,代码来源:SaxonExtensions.cs

示例6: IsFatal

        /// <summary>
        /// Test if an exception is a fatal exception. 
        /// </summary>
        /// <param name="ex">Exception object.</param>
        public static bool IsFatal(this Exception ex)
        {
            if (ex is AggregateException)
            {
                return ex.Cast<AggregateException>().Flatten().InnerExceptions.Any(exception => exception.IsFatal());
            }

            if (ex.InnerException != null && ex.InnerException.IsFatal())
            {
                return true;
            }

            return
                ex is TypeInitializationException ||
                ex is AppDomainUnloadedException ||
                ex is ThreadInterruptedException ||
                ex is AccessViolationException ||
                ex is InvalidProgramException ||
                ex is BadImageFormatException ||
                ex is StackOverflowException ||
                ex is ThreadAbortException ||
                ex is OutOfMemoryException ||
                ex is SecurityException ||
                ex is SEHException;
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:29,代码来源:ExceptionExtensions.cs

示例7: GetSubnodes

        public static IEnumerable<XmlNode> GetSubnodes(this XmlNode node, string subNodeName)
        {
            Preconditions.NotNull(node, "node");
            Preconditions.NotNull(subNodeName, "subNodeName");

            return node.Cast<XmlNode>().Where(n => n.Name == subNodeName);
        }
开发者ID:jtvn,项目名称:Eir-CTLLTL,代码行数:7,代码来源:XmlNodeExtensions.cs

示例8: GetItemType

        internal static Type GetItemType(this IEnumerable list)
        {
            Type listType = list.GetType();
            Type itemType = null;

            // if it's a generic enumerable, we get the generic type

            // Unfortunately, if data source is fed from a bare IEnumerable, TypeHelper will report an element type of object,
            // which is not particularly interesting.  We deal with it further on.
            if (listType.IsEnumerableType())
            {
                itemType = listType.GetEnumerableItemType();
            }

            // Bare IEnumerables mean that result type will be object.  In that case, we try to get something more interesting
            if (itemType == null || itemType == typeof(object))
            {
                // We haven't located a type yet.. try a different approach.
                // Does the list have anything in it?

                itemType = list
                    .Cast<object>() // cast to convert IEnumerable to IEnumerable<object>
                    .Select(x => x.GetType()) // get the type
                    .FirstOrDefault(); // get only the first thing to come out of the sequence, or null if empty

                // 

            }

            // if we're null at this point, give up

            return itemType;
        }
开发者ID:dfr0,项目名称:moon,代码行数:33,代码来源:Extensions.cs

示例9: CastWithExtraTrapLogic

        internal static Spell.CastStates CastWithExtraTrapLogic(this Spell spell)
        {
            if (spell.isReadyPerfectly())
            {
                var Teleport = MinionManager.GetMinions(spell.Range).FirstOrDefault(x => x.HasBuff("teleport_target"));
                var Zhonya = HeroManager.Enemies.FirstOrDefault(x => ObjectManager.Player.Distance(x) <= spell.Range && x.HasBuff("zhonyasringshield"));

                if (Teleport != null)
                    return spell.Cast(Teleport);

                if (Zhonya != null)
                    return spell.Cast(Zhonya);

            }
            return Spell.CastStates.NotCasted;
        }
开发者ID:zezzy,项目名称:LeagueSharp-1,代码行数:16,代码来源:ExtraExtensions.cs

示例10: AvailableSearchFields

 public static List<SPField> AvailableSearchFields(this SPFieldCollection fields)
 {
     return fields.Cast<SPField>().Where(p => !p.Hidden &&
            (p.Type != SPFieldType.Computed || p.Id == SPBuiltInFieldId.ContentType) &&
            p.Title != "Predecessors" &&
            p.Title != "Related Issues").ToList();
 }
开发者ID:chutinhha,项目名称:aiaintranet,代码行数:7,代码来源:SPFieldCollectionExtensions.cs

示例11: ToProtoType

        public static PolyCurve ToProtoType(this Autodesk.Revit.DB.CurveArray revitCurves)
        {
            if (revitCurves == null) throw new ArgumentNullException("revitCurves");

            var protoCurves = revitCurves.Cast<Autodesk.Revit.DB.Curve>().Select(x => x.ToProtoType());
            return PolyCurve.ByJoinedCurves(protoCurves.ToArray());
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:7,代码来源:RevitToProtoCurve.cs

示例12: AtPosition

 private static IEnumerable<ICellLocation> AtPosition(this IEnumerable<ICellLocation> pattern, int x, int y)
 {
     return pattern
         .Cast<XYCellLocation>()
         .Select(cell =>
             new XYCellLocation(cell.X + x, cell.Y + y)).ToList();
 }
开发者ID:jancowol,项目名称:game-of-life-cs,代码行数:7,代码来源:Program.cs

示例13: HasSameItemsRegardlessOfSortOrder

        public static bool HasSameItemsRegardlessOfSortOrder(this IEnumerable left, IEnumerable right)
        {
            var leftCollection = left.Cast<object>().ToList();
            var rightCollection = right.Cast<object>().ToList();

            return leftCollection.Except(rightCollection).Count() == 0;
        }
开发者ID:p69,项目名称:magellan-framework,代码行数:7,代码来源:EnumerableExtensions.cs

示例14: Execute

 /// <summary>
 ///     Basit spell execute
 /// </summary>
 /// <param name="spell">Spell</param>
 public static void Execute(this Spell spell)
 {
     foreach (var enemy in HeroManager.Enemies.Where(o => o.LSIsValidTarget(spell.Range)))
     {
         spell.Cast(enemy);
     }
 }
开发者ID:yashine59fr,项目名称:PortAIO,代码行数:11,代码来源:Combo.cs

示例15: ToIDString

 public static string ToIDString(this MatchCollection matches)
 {
     var match = matches.Cast<Match>().FirstOrDefault();
     return match != null
                ? match.Value.TrimStart('#')
                : string.Empty;
 }
开发者ID:dbrinks,项目名称:HtmlBuilder,代码行数:7,代码来源:MatchCollectionExtensions.cs


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