Exemple #1
0
        public static Shift ReturnNextValidShift(OFBOven oven, List<Shift> shifts)
        {
            Shift shift = null;
            StringBuilder sb = new StringBuilder();
            //Sort the shifts and get the next one
            shifts.Sort(delegate(Shift s1, Shift s2)
            {
                return s1.StarWork.CompareTo(s2.StarWork);
            });

            Shift next = BusinessMethods.ReturnNextOrCurrentShift(shifts, SimClock.CurrentTime().Hour);

            if (next != null && next.Cheff != null)
            {
                if (BusinessMethods.CheckIfValidEmployee(next.Cheff.DescriptionId))
                {
                    shift = next;
                }
                else
                {
                    sb.Append("Selected chef is not valid.\n");
                    sb.Append("Please select a new chef");
                    CommonMethodsOFBBistroSet.PrintMessage(sb.ToString());
                }
            }
            else
            {
                if (next == null)
                    CommonMethodsOFBBistroSet.PrintMessage("Couldn't calculate next shift");
                else
                {
                    CommonMethodsOFBBistroSet.PrintMessage(BusinessMethods.ShowShiftInfo(next, "Shift information invalid", null, null));
                }

            }
            if (OFBOven.ShowDebugMessages)
                CommonMethodsOFBBistroSet.PrintMessage(BusinessMethods.ShowShiftInfo(next, "Next shift:", null, null));

            return shift;
        }
Exemple #2
0
        public static IndustrialOven.MenuRecipeInfo ReturnSelectedFoodItem(OFBOven.Menu menu, Sim sim)
        {
            List<ObjectPicker.HeaderInfo> headers = new List<ObjectPicker.HeaderInfo>();
            List<ObjectPicker.TabInfo> listObjs = new List<ObjectPicker.TabInfo>();
            //IndustrialOven.Menu menu = parameters.Target as IndustrialOven.Menu;
            if (menu == null)
            {
                return null;
            }
            int cost = sim.FamilyFunds;
            if (sim.TraitManager.HasElement(TraitNames.DiscountDiner))
            {
                cost = 2147483647;
            }
            List<IndustrialOven.MenuRecipeInfo> foodsAtOrBelowCost = menu.GetFoodsAtOrBelowCost(cost);
            if (foodsAtOrBelowCost == null)
            {
                return null;
            }
            headers.Add(new ObjectPicker.HeaderInfo("Store/Objects/IndustrialOven:SelectRecipeHeader", "Store/Objects/IndustrialOven:SelectRecipeHeaderTooltip", 500));
            List<ObjectPicker.RowInfo> list = new List<ObjectPicker.RowInfo>();
            for (int i = 0; i < foodsAtOrBelowCost.Count; i++)
            {
                Recipe recipe = foodsAtOrBelowCost[i].FindRecipe();
                if (recipe != null)
                {
                    List<ObjectPicker.ColumnInfo> list2 = new List<ObjectPicker.ColumnInfo>();
                    list2.Add(new ObjectPicker.ThumbAndTextColumn(recipe.GetThumbnailKey(ThumbnailSize.Large), recipe.GenericName));
                    ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(foodsAtOrBelowCost[i], list2);
                    list.Add(item);
                }
            }
            ObjectPicker.TabInfo item2 = new ObjectPicker.TabInfo("recipeRowImageName", StringTable.GetLocalizedString("Store/Objects/IndustrialOven/SetMenu:TabText"), list);
            listObjs.Add(item2);

            List<ObjectPicker.RowInfo> selection = ObjectPickerDialog.Show(true, ModalDialog.PauseMode.PauseSimulator, 
                CommonMethodsOFBBistroSet.LocalizeString("SelectMeal", new object[]{sim.FullName}),
                CommonMethodsOFBBistroSet.LocalizeString("Select", new object[0]),
                CommonMethodsOFBBistroSet.LocalizeString("Cancel", new object[0]), 
                listObjs, headers, 1);

            if (selection != null && selection.Count > 0)
                return ((IndustrialOven.MenuRecipeInfo)selection[0].Item);

            return null;

        }
Exemple #3
0
        public static void SendEverybodyHome(OFBOven oven, Sim cheff)
        {
            try
            {
                if (cheff != null)
                {
                    cheff.PopPosture();
                    cheff.InteractionQueue.CancelAllInteractions();
                    cheff.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);

                    if (!cheff.IsActiveSim)
                        Sim.MakeSimGoHome(cheff, false);
                }

                //Send waiters home
                if (oven.Waiters != null)
                {
                    foreach (ulong id in oven.Waiters)
                    {
                        SimDescription simDescription = CommonMethodsOFBBistroSet.ReturnSim(id); ;
                        if (simDescription != null && simDescription.CreatedSim != null)
                        {
                            simDescription.CreatedSim.PopPosture();
                            simDescription.CreatedSim.InteractionQueue.CancelAllInteractions();
                            simDescription.CreatedSim.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
                            if (!simDescription.CreatedSim.IsActiveSim)
                            {
                                Sim.MakeSimGoHome(simDescription.CreatedSim, false);
                            }
                        }
                        else
                        {
                            CommonMethodsOFBBistroSet.PrintMessage("Couldn't send waiter home");
                        }
                    }
                }
            }
            finally
            {
                oven.Waiters = new List<ulong>();
            }
        }