Exemple #1
0
        private void CloseButtonClicked()
        {
            KnowledgeAmount know = (KnowledgeAmount)((!this.def.noteTeaches) ? 7 : 8);

            PlayerKnowledgeDatabase.KnowledgeDemonstrated(this.def, know);
            Find.ActiveLesson.Deactivate();
        }
        private void CloseButtonClicked()
        {
            KnowledgeAmount know = (def.noteTeaches ? KnowledgeAmount.NoteTaught : KnowledgeAmount.NoteClosed);

            PlayerKnowledgeDatabase.KnowledgeDemonstrated(def, know);
            Find.ActiveLesson.Deactivate();
        }
        public static void KnowledgeDemonstrated(ConceptDef conc, KnowledgeAmount know)
        {
            float num = know switch
            {
                KnowledgeAmount.FrameDisplayed => (Event.current.type == EventType.Repaint) ? 0.004f : 0f,
                KnowledgeAmount.FrameInteraction => 0.008f,
                KnowledgeAmount.TinyInteraction => 0.03f,
                KnowledgeAmount.SmallInteraction => 0.1f,
                KnowledgeAmount.SpecificInteraction => 0.4f,
                KnowledgeAmount.Total => 1f,
                KnowledgeAmount.NoteClosed => 0.5f,
                KnowledgeAmount.NoteTaught => 1f,
                _ => throw new NotImplementedException(),
            };

            if (!(num <= 0f))
            {
                SetKnowledge(conc, GetKnowledge(conc) + num);
                LessonAutoActivator.Notify_KnowledgeDemonstrated(conc);
                if (Find.ActiveLesson != null)
                {
                    Find.ActiveLesson.Notify_KnowledgeDemonstrated(conc);
                }
            }
        }
Exemple #4
0
        public static void KnowledgeDemonstrated(ConceptDef conc, KnowledgeAmount know)
        {
            float num;

            switch (know)
            {
            case KnowledgeAmount.FrameDisplayed:
                num = ((Event.current.type != EventType.Repaint) ? 0f : 0.004f);
                break;

            case KnowledgeAmount.FrameInteraction:
                num = 0.008f;
                break;

            case KnowledgeAmount.TinyInteraction:
                num = 0.03f;
                break;

            case KnowledgeAmount.SmallInteraction:
                num = 0.1f;
                break;

            case KnowledgeAmount.SpecificInteraction:
                num = 0.4f;
                break;

            case KnowledgeAmount.Total:
                num = 1f;
                break;

            case KnowledgeAmount.NoteClosed:
                num = 0.5f;
                break;

            case KnowledgeAmount.NoteTaught:
                num = 1f;
                break;

            default:
                throw new NotImplementedException();
            }
            if (num <= 0f)
            {
                return;
            }
            PlayerKnowledgeDatabase.SetKnowledge(conc, PlayerKnowledgeDatabase.GetKnowledge(conc) + num);
            LessonAutoActivator.Notify_KnowledgeDemonstrated(conc);
            if (Find.ActiveLesson != null)
            {
                Find.ActiveLesson.Notify_KnowledgeDemonstrated(conc);
            }
        }