Ejemplo n.º 1
0
 public static bool AllowAction(EventPack ep)
 {
     if (!TutorialMode)
     {
         return(true);
     }
     if (DebugViewSettings.logTutor)
     {
         Log.Message("AllowAction: " + ep);
     }
     if (ep.Cells != null && ep.Cells.Count() == 1)
     {
         return(AllowAction(new EventPack(ep.Tag, ep.Cells.First())));
     }
     if (Find.ActiveLesson.Current != null)
     {
         AcceptanceReport acceptanceReport = Find.ActiveLesson.Current.AllowAction(ep);
         if (!acceptanceReport.Accepted)
         {
             Messages.Message((!acceptanceReport.Reason.NullOrEmpty()) ? acceptanceReport.Reason : Find.ActiveLesson.Current.DefaultRejectInputMessage, MessageTypeDefOf.RejectInput, historical: false);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
 public override void Notify_Event(EventPack ep)
 {
     if (this.def.eventTagsEnd != null && this.def.eventTagsEnd.Contains(ep.Tag))
     {
         Find.ActiveLesson.Deactivate();
     }
 }
 public override void Notify_Event(EventPack ep)
 {
     if (ep.Tag == "Designate-Door")
     {
         Find.ActiveLesson.Deactivate();
     }
 }
Ejemplo n.º 4
0
 public override void Notify_Event(EventPack ep)
 {
     if (this.NumPlaced() >= base.def.targetCount)
     {
         Find.ActiveLesson.Deactivate();
     }
 }
Ejemplo n.º 5
0
 public override void Notify_Event(EventPack ep)
 {
     if (ep.Tag == "Designate-Mine" && this.ProgressPercent > 0.999f)
     {
         Find.ActiveLesson.Deactivate();
     }
 }
Ejemplo n.º 6
0
        public static bool EventCellsMatchExactly(EventPack ep, List <IntVec3> targetCells)
        {
            bool result;

            if (ep.Cell.IsValid)
            {
                result = (targetCells.Count == 1 && ep.Cell == targetCells[0]);
            }
            else if (ep.Cells == null)
            {
                result = false;
            }
            else
            {
                int num = 0;
                foreach (IntVec3 item in ep.Cells)
                {
                    if (!targetCells.Contains(item))
                    {
                        return(false);
                    }
                    num++;
                }
                result = (num == targetCells.Count);
            }
            return(result);
        }
Ejemplo n.º 7
0
        public static void Notify_Event(EventPack ep)
        {
            if (!TutorSystem.TutorialMode)
            {
                return;
            }
            if (DebugViewSettings.logTutor)
            {
                Log.Message("Notify_Event: " + ep);
            }
            if (Current.Game == null)
            {
                return;
            }
            Lesson current = Find.ActiveLesson.Current;

            if (Find.ActiveLesson.Current != null)
            {
                Find.ActiveLesson.Current.Notify_Event(ep);
            }
            foreach (InstructionDef current2 in DefDatabase <InstructionDef> .AllDefs)
            {
                if (current2.eventTagInitiate == ep.Tag && (current2.eventTagInitiateSource == null || (current != null && current2.eventTagInitiateSource == current.Instruction)) && (TutorSystem.TutorialMode || !current2.tutorialModeOnly))
                {
                    Find.ActiveLesson.Activate(current2);
                    break;
                }
            }
        }
Ejemplo n.º 8
0
 public static bool AllowAction(EventPack ep)
 {
     if (!TutorSystem.TutorialMode)
     {
         return(true);
     }
     if (DebugViewSettings.logTutor)
     {
         Log.Message("AllowAction: " + ep);
     }
     if (ep.Cells != null && ep.Cells.Count <IntVec3>() == 1)
     {
         return(TutorSystem.AllowAction(new EventPack(ep.Tag, ep.Cells.First <IntVec3>())));
     }
     if (Find.ActiveLesson.Current != null)
     {
         AcceptanceReport acceptanceReport = Find.ActiveLesson.Current.AllowAction(ep);
         if (!acceptanceReport.Accepted)
         {
             string text = acceptanceReport.Reason.NullOrEmpty() ? Find.ActiveLesson.Current.DefaultRejectInputMessage : acceptanceReport.Reason;
             Messages.Message(text, MessageTypeDefOf.RejectInput);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 9
0
        public static bool EventCellsMatchExactly(EventPack ep, List <IntVec3> targetCells)
        {
            if (ep.Cell.IsValid)
            {
                if (targetCells.Count == 1)
                {
                    return(ep.Cell == targetCells[0]);
                }
                return(false);
            }
            if (ep.Cells == null)
            {
                return(false);
            }
            int num = 0;

            foreach (IntVec3 cell in ep.Cells)
            {
                if (!targetCells.Contains(cell))
                {
                    return(false);
                }
                num++;
            }
            return(num == targetCells.Count);
        }
Ejemplo n.º 10
0
 public static void Notify_Event(EventPack ep)
 {
     if (TutorSystem.TutorialMode)
     {
         if (DebugViewSettings.logTutor)
         {
             Log.Message("Notify_Event: " + ep, false);
         }
         if (Current.Game != null)
         {
             Lesson lesson = Find.ActiveLesson.Current;
             if (Find.ActiveLesson.Current != null)
             {
                 Find.ActiveLesson.Current.Notify_Event(ep);
             }
             foreach (InstructionDef instructionDef in DefDatabase <InstructionDef> .AllDefs)
             {
                 if (instructionDef.eventTagInitiate == ep.Tag && (instructionDef.eventTagInitiateSource == null || (lesson != null && instructionDef.eventTagInitiateSource == lesson.Instruction)) && (TutorSystem.TutorialMode || !instructionDef.tutorialModeOnly))
                 {
                     Find.ActiveLesson.Activate(instructionDef);
                     break;
                 }
             }
         }
     }
 }
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-Door")
     {
         return(TutorUtility.EventCellsAreWithin(ep, allowedPlaceCells));
     }
     return(base.AllowAction(ep));
 }
Ejemplo n.º 12
0
 public static bool EventCellsAreWithin(EventPack ep, List <IntVec3> targetCells)
 {
     if (ep.Cell.IsValid)
     {
         return(targetCells.Contains(ep.Cell));
     }
     return(ep.Cells != null && !ep.Cells.Any((IntVec3 c) => !targetCells.Contains(c)));
 }
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-ZoneAddStockpile_Resources")
     {
         return(TutorUtility.EventCellsMatchExactly(ep, cachedCells));
     }
     return(base.AllowAction(ep));
 }
Ejemplo n.º 14
0
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-" + base.def.thingDef.defName)
     {
         return(this.AllowBuildAt(ep.Cell));
     }
     return(base.AllowAction(ep));
 }
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-Sandbags")
     {
         return(TutorUtility.EventCellsAreWithin(ep, sandbagCells));
     }
     return(base.AllowAction(ep));
 }
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-ZoneAdd_Growing")
     {
         return(TutorUtility.EventCellsMatchExactly(ep, this.cachedCells));
     }
     return(base.AllowAction(ep));
 }
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     if (ep.Tag == "Designate-Wall")
     {
         return(TutorUtility.EventCellsAreWithin(ep, this.cachedEdgeCells));
     }
     return(base.AllowAction(ep));
 }
Ejemplo n.º 18
0
        public override AcceptanceReport AllowAction(EventPack ep)
        {
            AcceptanceReport result;

            if (ep.Tag == "Designate-" + this.def.thingDef.defName)
            {
                result = this.AllowBuildAt(ep.Cell);
            }
            else
            {
                result = base.AllowAction(ep);
            }
            return(result);
        }
        public override AcceptanceReport AllowAction(EventPack ep)
        {
            AcceptanceReport result;

            if (ep.Tag == "Designate-Door")
            {
                result = TutorUtility.EventCellsAreWithin(ep, this.allowedPlaceCells);
            }
            else
            {
                result = base.AllowAction(ep);
            }
            return(result);
        }
        public override AcceptanceReport AllowAction(EventPack ep)
        {
            AcceptanceReport result;

            if (ep.Tag == "Designate-ZoneAddStockpile_Resources")
            {
                result = TutorUtility.EventCellsMatchExactly(ep, this.cachedCells);
            }
            else
            {
                result = base.AllowAction(ep);
            }
            return(result);
        }
Ejemplo n.º 21
0
 public virtual void Notify_Event(EventPack ep)
 {
 }
Ejemplo n.º 22
0
 public virtual AcceptanceReport AllowAction(EventPack ep)
 {
     return(true);
 }
Ejemplo n.º 23
0
 public override AcceptanceReport AllowAction(EventPack ep)
 {
     return(this.def.actionTagsAllowed != null && this.def.actionTagsAllowed.Contains(ep.Tag));
 }