Beispiel #1
0
        public static ThinkResult TryIssueJobPackage2(ThinkNode_Priority __instance, Pawn pawn, JobIssueParams jobParams)
        {
            int count = __instance.subNodes.Count;

            for (int index = 0; index < count; ++index)
            {
                ThinkResult thinkResult = ThinkResult.NoJob;
                try
                {
                    ThinkNode thinkNode = __instance.subNodes[index];
                    if (thinkNode == null)
                    {
                        return(thinkResult);
                    }
                    thinkResult = thinkNode.TryIssueJobPackage(pawn, jobParams);
                }
                catch (Exception ex)
                {
                    Log.Error("Exception in " + __instance.GetType() + " TryIssueJobPackage: " + ex.ToString());
                }
                if (thinkResult.IsValid)
                {
                    return(thinkResult);
                }
            }
            return(ThinkResult.NoJob);
        }
        public static bool Fringe(MethodBase __originalMethod, ThinkNode_Priority __instance, Pawn pawn, JobIssueParams jobParams, ref string __state, ref ThinkResult __result)
        {
            if (Active)
            {
                int count = __instance.subNodes.Count;
                for (int i = 0; i < count; i++)
                {
                    ThinkResult result = ThinkResult.NoJob;
                    Profiler    prof   = null;
                    try
                    {
                        __state = $"ThinkNode_Priority SubNode [{__instance.subNodes[i].GetType()}]";
                        prof    = ProfileController.Start(__state, null, null, __originalMethod);
                        result  = __instance.subNodes[i].TryIssueJobPackage(pawn, jobParams);
                        prof.Stop();
                    }
                    catch (Exception)
                    {
                        prof?.Stop();
                    }
                    if (result.IsValid)
                    {
                        __result = result;
                        return(false);
                    }
                }
                __result = ThinkResult.NoJob;

                return(false);
            }
            return(true);
        }
Beispiel #3
0
        public static bool TryIssueJobPackage(ThinkNode_Priority __instance, ref ThinkResult __result, Pawn pawn, JobIssueParams jobParams)
        {
            ThinkNode subNode;

            for (int index = 0; index < __instance.subNodes.Count; ++index)
            {
                try
                {
                    subNode = __instance.subNodes[index];
                }
                catch (ArgumentOutOfRangeException) { break; }
                try
                {
                    if (subNode != null)
                    {
                        ThinkResult thinkResult = subNode.TryIssueJobPackage(pawn, jobParams);
                        if (null == thinkResult)
                        {
                            break;
                        }
                        if (thinkResult.IsValid)
                        {
                            __result = thinkResult;
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("Exception in " + (object)__instance.GetType() + " TryIssueJobPackage: " + ex.ToString());
                }
            }
            __result = ThinkResult.NoJob;
            return(false);
        }