コード例 #1
0
        private List <FloatMenuOption> GetFloatMenuOptions(ScheduledDay day)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            foreach (ReligionProperty property in SelFacility.AssignedReligion.GetSettings <ReligionSettings_ReligionActivity>(SettingsTagDefOf.ActivityTag).Properties)
            {
                ActivityTaskDef taskDef = property.GetObject <ActivityTaskDef>();
                list.Add(new FloatMenuOption(taskDef.label, (Action)(() =>
                {
                    if (!this.SelFacility.Map.mapPawns.FreeColonists.Any <Pawn>(x => x.GetReligionComponent().Religion == SelFacility.AssignedReligion))
                    {
                        CreateNoPawnsOfReligionDialog(SelFacility.AssignedReligion);
                    }
                    ActivityTask task = new ActivityTask(day, property);
                    if (TaskManager.DefaultPawn != null)
                    {
                        task.PawnRestriction = TaskManager.DefaultPawn;
                    }
                    day.Add(task);
                    day.Reorder();
                }), MenuOptionPriority.Default, (Action)null, (Thing)null, 29f, (Func <Rect, bool>)(rect => Widgets.InfoCardButton(rect.x + 5f, rect.y + (float)(((double)rect.height - 24.0) / 2.0), taskDef)), (WorldObject)null));
            }
            if (!list.Any <FloatMenuOption>())
            {
                list.Add(new FloatMenuOption("NoneBrackets".Translate(), (Action)null, MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null));
            }
            return(list);
        }
コード例 #2
0
        private void DrawDay(Rect rect, int dayNumber)
        {
            Widgets.DrawBox(rect);

            Widgets.Label(rect.ContractedBy(6), dayNumber.ToString());
            ScheduledDay day = TaskManager.ScheduledDays.FirstOrDefault(x => x.DayNumber == dayNumber);

            if (day != null)
            {
                DrawDayInterFace(new Rect(rect.x + 6, rect.y + 30f, rect.width, rect.height * .75f), day);
            }

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawBox(rect, 3);
                if (Input.GetMouseButtonDown(0))
                {
                    if (day == null)
                    {
                        TaskManager.AddDay(dayNumber);
                    }

                    var options = GetFloatMenuOptions(day);
                    if (!options.NullOrEmpty())
                    {
                        Find.WindowStack.Add((Window) new Dialog_ScheduleDayConfig(day, GetFloatMenuOptions(day)));
                    }
                }
            }
        }
コード例 #3
0
 public Dialog_ScheduleDayConfig(ScheduledDay day, List <FloatMenuOption> menuOptions)
 {
     this.day           = day;
     this.menuOptions   = menuOptions;
     this.forcePause    = true;
     this.doCloseX      = true;
     this.doCloseButton = true;
     //this.absorbInputAroundWindow = true;
     this.closeOnClickedOutside = true;
 }
コード例 #4
0
 public ActivityTask(ActivityTask task)
 {
     this.dayOfTask = task.dayOfTask;
     this.startHour = task.startHour;
     this.property  = task.property;
     this.loadID    = Find.UniqueIDsManager.GetNextBillID();
     this.humanlike = task.humanlike;
     this.animal    = task.humanlike;
     this.filter    = task.filter;
 }
コード例 #5
0
 public ScheduledDay(ScheduledDay day)
 {
     this.schedule  = day.schedule;
     this.dayNumber = day.dayNumber;
     this.tasks     = new List <ActivityTask>();
     foreach (var task in day.tasks)
     {
         this.tasks.Add(new ActivityTask(task));
     }
 }
コード例 #6
0
 public ActivityTask(ScheduledDay dayOfTask, ReligionProperty property)
 {
     this.dayOfTask = dayOfTask;
     if (Scribe.mode == LoadSaveMode.Inactive)
     {
         this.loadID   = Find.UniqueIDsManager.GetNextThingID();
         startHour     = 18;
         this.property = property;
         humanlike     = new IngredientPawn();
         animal        = new IngredientPawn();
         List <ThingDef> defs = new List <ThingDef>();
         foreach (ThingDefsCount tcd in ActivityTaskDef.ThingDefsCount)
         {
             defs.Add(tcd.Thing);
         }
         filter = new SimpleFilter(defs);
     }
 }
コード例 #7
0
        private void DrawDayInterFace(Rect rect, ScheduledDay day)
        {
            float curY   = rect.y;
            float height = rect.height / 5;

            Text.Font = GameFont.Tiny;
            for (int i = 0; i < 3; ++i)
            {
                if (i < day.Tasks.Count())
                {
                    ActivityTask task = day.Tasks.ElementAt(i);
                    Widgets.Label(new Rect(rect.x, curY, rect.width, height), task.StartHour.ToString() + ". " + task.Label);
                    curY += height;
                }
            }
            if (day.Tasks.Count() > 3)
            {
                Widgets.Label(new Rect(rect.x, curY, rect.width, height), "ReligionInfo_AndXTasksMore".Translate((NamedArgument)(day.Tasks.Count() - 3).ToString()));
            }
            Text.Font = GameFont.Small;
        }
コード例 #8
0
        private void DrawDay(Rect rect, int dayNumber)
        {
            ScheduledDay day = TaskManager.ScheduledDays.FirstOrDefault(x => x.DayNumber == dayNumber);

            Widgets.DrawBox(rect);

            Rect firstLine = rect.ContractedBy(6);

            firstLine.height = 20;
            Widgets.Label(firstLine, dayNumber.ToString());

            Rect copy = new Rect(firstLine);

            copy.width = 20;
            copy.x    += copy.width;
            if (Widgets.ButtonImageFitted(copy, GraphicsCache.Copy, Color.white))
            {
                ActivityTaskUtility.Clipboard = day;
                SoundDefOf.Tick_High.PlayOneShotOnCamera((Map)null);
            }
            TooltipHandler.TipRegionByKey(copy, "CopyBillTip");

            Rect paste = new Rect(copy);

            paste.x += paste.width;
            if (ActivityTaskUtility.Clipboard == null)
            {
                GUI.color = Color.gray;
                Widgets.DrawTextureFitted(paste, (Texture)GraphicsCache.Paste, 1f);
                GUI.color = Color.white;
                TooltipHandler.TipRegionByKey(paste, "PasteBillTip");
            }
            else
            {
                if (Widgets.ButtonImageFitted(paste, GraphicsCache.Paste, Color.white))
                {
                    ScheduledDay clip = ActivityTaskUtility.Clipboard;
                    foreach (var task in clip.Tasks)
                    {
                        day.Add(task);
                    }
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera((Map)null);
                }
                TooltipHandler.TipRegionByKey(paste, "PasteBillTip");
            }


            if (day != null)
            {
                DrawDayInterFace(new Rect(rect.x + 6, rect.y + 30f, rect.width, rect.height * .75f), day);
            }

            Rect touchable = new Rect(rect);

            touchable.y      += 30;
            touchable.height -= 30;
            if (Mouse.IsOver(touchable))
            {
                //Widgets.DrawBox(rect, 3);
                Widgets.DrawBox(touchable, 3);
                if (Input.GetMouseButtonDown(0))
                {
                    if (day == null)
                    {
                        TaskManager.AddDay(dayNumber);
                    }

                    var options = GetFloatMenuOptions(day);
                    if (!options.NullOrEmpty())
                    {
                        Find.WindowStack.Add((Window) new Dialog_ScheduleDayConfig(day, GetFloatMenuOptions(day)));
                    }
                }
            }
        }