static bool Prefix(Job job, ref List <TemplatePaperData> __result)
        {
            if ((job.jobType != PassJobType.Express) &&
                (job.jobType != PassJobType.Commuter))
            {
                return(true);
            }

            if ((PassBookletUtil.ExtractStationFromId == null) ||
                (PassBookletUtil.CreateCoupleTaskData == null) ||
                (PassBookletUtil.CreateUncoupleTaskData == null) ||
                (PassBookletUtil.GetShuntingPickupsText == null) ||
                (PassBookletUtil.GetShuntingDropOffsText == null))
            {
                __result = null;
                PassengerJobs.ModEntry.Logger.Error("Couldn't connect to BookletCreator methods!");
                return(false);
            }

            // Express or branch service
            var startTask = job.GetJobData().First();
            var carsInfo  = PassBookletUtil.GetCarsInfo(startTask.cars);
            TemplatePaperData overviewPage = PassBookletUtil.CreateTransportDescriptionData(job, startTask.cars, carsInfo);

            __result = new List <TemplatePaperData>()
            {
                overviewPage
            };

            return(false);
        }
示例#2
0
        static bool Prefix(Job job, ref List <TemplatePaperData> __result)
        {
            if ((job.jobType != PassJobType.Express) &&
                (job.jobType != PassJobType.Commuter))
            {
                return(true);
            }

            if ((PassBookletUtil.ExtractStationFromId == null) ||
                (PassBookletUtil.CreateCoupleTaskData == null) ||
                (PassBookletUtil.CreateUncoupleTaskData == null) ||
                (PassBookletUtil.GetShuntingPickupsText == null) ||
                (PassBookletUtil.GetShuntingDropOffsText == null))
            {
                __result = null;
                PassengerJobs.ModEntry.Logger.Error("Couldn't connect to BookletCreator methods!");
                return(false);
            }

            // Express or branch service
            var startTask = job.GetJobData().First();
            List <Tuple <TrainCarType, string> > carsInfo;

            if (startTask.type == TaskType.Sequential)
            {
                startTask = startTask.nestedTasks.First().GetTaskData();
            }

            // check for special
            string trainName;

            if ((job.jobType == PassJobType.Express) && SpecialConsistManager.JobToSpecialMap.TryGetValue(job.ID, out SpecialTrain special))
            {
                int    lastDashIdx = job.ID.LastIndexOf('-');
                string trainNum    = job.ID.Substring(lastDashIdx + 1);
                trainName = $"{special.Name} #{trainNum}";
            }
            else
            {
                trainName = "a regional express train";
            }
            // if jobtype is commuter then the name is ignored

            carsInfo = PassBookletUtil.GetCarsInfo(startTask.cars);

            TemplatePaperData overviewPage = PassBookletUtil.CreateTransportDescriptionData(job, trainName, startTask.cars, carsInfo);

            __result = new List <TemplatePaperData>()
            {
                overviewPage
            };

            return(false);
        }