コード例 #1
0
        public static string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("RelaxDesire: " + LessonAutoActivator.RelaxDesire);
            foreach (ConceptDef conceptDef in from co in DefDatabase <ConceptDef> .AllDefs
                     orderby LessonAutoActivator.GetDesire(co) descending
                     select co)
            {
                if (PlayerKnowledgeDatabase.IsComplete(conceptDef))
                {
                    stringBuilder.AppendLine(conceptDef.defName + " complete");
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        conceptDef.defName,
                        "\n   know ",
                        PlayerKnowledgeDatabase.GetKnowledge(conceptDef).ToString("F3"),
                        "\n   need ",
                        LessonAutoActivator.opportunities[conceptDef].ToString("F3"),
                        "\n   des ",
                        LessonAutoActivator.GetDesire(conceptDef).ToString("F3")
                    }));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #2
0
        public static string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("RelaxDesire: " + LessonAutoActivator.RelaxDesire);
            foreach (ConceptDef current in DefDatabase <ConceptDef> .AllDefs.OrderByDescending(new Func <ConceptDef, float>(LessonAutoActivator.GetDesire)))
            {
                if (PlayerKnowledgeDatabase.IsComplete(current))
                {
                    stringBuilder.AppendLine(current.defName + " complete");
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        current.defName,
                        "\n   know ",
                        PlayerKnowledgeDatabase.GetKnowledge(current).ToString("F3"),
                        "\n   need ",
                        LessonAutoActivator.opportunities[current].ToString("F3"),
                        "\n   des ",
                        LessonAutoActivator.GetDesire(current).ToString("F3")
                    }));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #3
0
        private static ConceptDef MostDesiredConcept()
        {
            float             num    = -9999f;
            ConceptDef        result = null;
            List <ConceptDef> allDefsListForReading = DefDatabase <ConceptDef> .AllDefsListForReading;
            int i = 0;

            while (i < allDefsListForReading.Count)
            {
                ConceptDef conceptDef = allDefsListForReading[i];
                float      desire     = LessonAutoActivator.GetDesire(conceptDef);
                if (desire > num)
                {
                    if (!conceptDef.needsOpportunity || LessonAutoActivator.GetOpportunity(conceptDef) >= 0.1f)
                    {
                        if (PlayerKnowledgeDatabase.GetKnowledge(conceptDef) <= 0.15f)
                        {
                            num    = desire;
                            result = conceptDef;
                        }
                    }
                }
IL_72:
                i++;
                continue;
                goto IL_72;
            }
            return(result);
        }
コード例 #4
0
        public static string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("RelaxDesire: " + LessonAutoActivator.RelaxDesire);
            IEnumerable <ConceptDef> allDefs = DefDatabase <ConceptDef> .AllDefs;

            if (LessonAutoActivator.< > f__mg$cache0 == null)
            {
                LessonAutoActivator.< > f__mg$cache0 = new Func <ConceptDef, float>(LessonAutoActivator.GetDesire);
            }
            foreach (ConceptDef conceptDef in allDefs.OrderByDescending(LessonAutoActivator.< > f__mg$cache0))
            {
                if (PlayerKnowledgeDatabase.IsComplete(conceptDef))
                {
                    stringBuilder.AppendLine(conceptDef.defName + " complete");
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        conceptDef.defName,
                        "\n   know ",
                        PlayerKnowledgeDatabase.GetKnowledge(conceptDef).ToString("F3"),
                        "\n   need ",
                        LessonAutoActivator.opportunities[conceptDef].ToString("F3"),
                        "\n   des ",
                        LessonAutoActivator.GetDesire(conceptDef).ToString("F3")
                    }));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #5
0
        private static ConceptDef MostDesiredConcept()
        {
            float             num    = -9999f;
            ConceptDef        result = null;
            List <ConceptDef> allDefsListForReading = DefDatabase <ConceptDef> .AllDefsListForReading;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                ConceptDef conceptDef = allDefsListForReading[i];
                float      desire     = LessonAutoActivator.GetDesire(conceptDef);
                if (desire > num && (!conceptDef.needsOpportunity || !(LessonAutoActivator.GetOpportunity(conceptDef) < 0.10000000149011612)) && !(PlayerKnowledgeDatabase.GetKnowledge(conceptDef) > 0.15000000596046448))
                {
                    num    = desire;
                    result = conceptDef;
                }
            }
            return(result);
        }
コード例 #6
0
 private static float <DebugForceInitiateBestLessonNow> m__1(ConceptDef def)
 {
     return(LessonAutoActivator.GetDesire(def));
 }
コード例 #7
0
 private static float <DebugString> m__0(ConceptDef co)
 {
     return(LessonAutoActivator.GetDesire(co));
 }
コード例 #8
0
 public static void DebugForceInitiateBestLessonNow()
 {
     LessonAutoActivator.TryInitiateLesson((from def in DefDatabase <ConceptDef> .AllDefs
                                            orderby LessonAutoActivator.GetDesire(def) descending
                                            select def).First <ConceptDef>());
 }
コード例 #9
0
 public static void LessonAutoActivatorUpdate()
 {
     if (TutorSystem.AdaptiveTrainingEnabled && Current.Game != null && !Find.Tutor.learningReadout.ShowAllMode)
     {
         LessonAutoActivator.timeSinceLastLesson += RealTime.realDeltaTime;
         if (Current.ProgramState == ProgramState.Playing)
         {
             if (Time.timeSinceLevelLoad < 8f || Find.WindowStack.SecondsSinceClosedGameStartDialog < 8f || Find.TickManager.NotPlaying)
             {
                 return;
             }
         }
         for (int i = LessonAutoActivator.alertingConcepts.Count - 1; i >= 0; i--)
         {
             if (PlayerKnowledgeDatabase.IsComplete(LessonAutoActivator.alertingConcepts[i]))
             {
                 LessonAutoActivator.alertingConcepts.RemoveAt(i);
             }
         }
         if (Time.frameCount % 15 == 0 && Find.ActiveLesson.Current == null)
         {
             for (int j = 0; j < DefDatabase <ConceptDef> .AllDefsListForReading.Count; j++)
             {
                 ConceptDef conceptDef = DefDatabase <ConceptDef> .AllDefsListForReading[j];
                 if (!PlayerKnowledgeDatabase.IsComplete(conceptDef))
                 {
                     float num = PlayerKnowledgeDatabase.GetKnowledge(conceptDef);
                     num -= 0.00015f * Time.deltaTime * 15f;
                     if (num < 0f)
                     {
                         num = 0f;
                     }
                     PlayerKnowledgeDatabase.SetKnowledge(conceptDef, num);
                     if (conceptDef.opportunityDecays)
                     {
                         float num2 = LessonAutoActivator.GetOpportunity(conceptDef);
                         num2 -= 0.4f * Time.deltaTime * 15f;
                         if (num2 < 0f)
                         {
                             num2 = 0f;
                         }
                         LessonAutoActivator.opportunities[conceptDef] = num2;
                     }
                 }
             }
             if (Find.Tutor.learningReadout.ActiveConceptsCount < 3)
             {
                 ConceptDef conceptDef2 = LessonAutoActivator.MostDesiredConcept();
                 if (conceptDef2 != null)
                 {
                     float desire = LessonAutoActivator.GetDesire(conceptDef2);
                     if (desire > 0.1f && LessonAutoActivator.RelaxDesire < desire)
                     {
                         LessonAutoActivator.TryInitiateLesson(conceptDef2);
                     }
                 }
             }
             else
             {
                 LessonAutoActivator.SetLastLessonTimeToNow();
             }
         }
     }
 }
コード例 #10
0
        public static string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("RelaxDesire: " + LessonAutoActivator.RelaxDesire);
            foreach (ConceptDef item in DefDatabase <ConceptDef> .AllDefs.OrderByDescending(LessonAutoActivator.GetDesire))
            {
                if (PlayerKnowledgeDatabase.IsComplete(item))
                {
                    stringBuilder.AppendLine(item.defName + " complete");
                }
                else
                {
                    stringBuilder.AppendLine(item.defName + "\n   know " + PlayerKnowledgeDatabase.GetKnowledge(item).ToString("F3") + "\n   need " + LessonAutoActivator.opportunities[item].ToString("F3") + "\n   des " + LessonAutoActivator.GetDesire(item).ToString("F3"));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #11
0
 public static void LessonAutoActivatorUpdate()
 {
     if (TutorSystem.AdaptiveTrainingEnabled && Current.Game != null && !Find.Tutor.learningReadout.ShowAllMode)
     {
         LessonAutoActivator.timeSinceLastLesson += RealTime.realDeltaTime;
         if (Current.ProgramState == ProgramState.Playing)
         {
             if (Time.timeSinceLevelLoad < 8.0)
             {
                 return;
             }
             if (Find.WindowStack.SecondsSinceClosedGameStartDialog < 8.0)
             {
                 return;
             }
             if (Find.TickManager.NotPlaying)
             {
                 return;
             }
         }
         for (int num = LessonAutoActivator.alertingConcepts.Count - 1; num >= 0; num--)
         {
             if (PlayerKnowledgeDatabase.IsComplete(LessonAutoActivator.alertingConcepts[num]))
             {
                 LessonAutoActivator.alertingConcepts.RemoveAt(num);
             }
         }
         if (Time.frameCount % 15 == 0 && Find.ActiveLesson.Current == null)
         {
             for (int i = 0; i < DefDatabase <ConceptDef> .AllDefsListForReading.Count; i++)
             {
                 ConceptDef conceptDef = DefDatabase <ConceptDef> .AllDefsListForReading[i];
                 if (!PlayerKnowledgeDatabase.IsComplete(conceptDef))
                 {
                     float knowledge = PlayerKnowledgeDatabase.GetKnowledge(conceptDef);
                     knowledge = (float)(knowledge - 0.0001500000071246177 * Time.deltaTime * 15.0);
                     if (knowledge < 0.0)
                     {
                         knowledge = 0f;
                     }
                     PlayerKnowledgeDatabase.SetKnowledge(conceptDef, knowledge);
                     if (conceptDef.opportunityDecays)
                     {
                         float opportunity = LessonAutoActivator.GetOpportunity(conceptDef);
                         opportunity = (float)(opportunity - 0.40000000596046448 * Time.deltaTime * 15.0);
                         if (opportunity < 0.0)
                         {
                             opportunity = 0f;
                         }
                         LessonAutoActivator.opportunities[conceptDef] = opportunity;
                     }
                 }
             }
             if (Find.Tutor.learningReadout.ActiveConceptsCount < 3)
             {
                 ConceptDef conceptDef2 = LessonAutoActivator.MostDesiredConcept();
                 if (conceptDef2 != null)
                 {
                     float desire = LessonAutoActivator.GetDesire(conceptDef2);
                     if (desire > 0.10000000149011612 && LessonAutoActivator.RelaxDesire < desire)
                     {
                         LessonAutoActivator.TryInitiateLesson(conceptDef2);
                     }
                 }
             }
             else
             {
                 LessonAutoActivator.SetLastLessonTimeToNow();
             }
         }
     }
 }