コード例 #1
0
        public static bool CanCreateChild()
        {
            int       humans = 0, dogs = 0, cats = 0, horses = 0;
            ICASModel cASModel = Responder.Instance.CASModel;

            foreach (ISimDescription sim in Responder.Instance.CASModel.GetSimsInHousehold())
            {
                if (sim.Age >= CASAgeGenderFlags.YoungAdult)
                {
                    if (sim.IsHuman)
                    {
                        humans++;
                    }
                    else if (sim.IsADogSpecies)
                    {
                        dogs++;
                    }
                    else if (sim.IsCat)
                    {
                        cats++;
                    }
                    else
                    {
                        horses++;
                    }
                }
            }
            return((humans > 1) || (cats > 1) || (dogs > 1) || (horses > 1));
        }
コード例 #2
0
        private static void AcceptHouseholdCallback(CASPuck ths)
        {
            if (!ths.AllSimsNamed())
            {
                CASController.Singleton.ErrorMsg(CASErrorCode.AllSimsNeedName);
            }
            else
            {
                ICASModel cASModel = Responder.Instance.CASModel;
                if (cASModel.CASMode == CASMode.Full)
                {
                    if (cASModel.HouseholdName == null)
                    {
                        cASModel.HouseholdName = Responder.Instance.CASModel.LastName;
                    }

                    //cASModel.RequestUpdateCurrentSim(true);
                    CASLogic.CASOperationStack.Instance.Push(new UpdateCurrentSimOperationEx(true));

                    cASModel.SetHouseholdStartingFunds();
                    cASModel.RequestClearStack();

                    ths.mGotoCAF = true;
                }
            }
        }
コード例 #3
0
ファイル: CASGeneticsEx.cs プロジェクト: yakoder/NRaas
        public static bool HasGender(CASAgeGenderFlags gender)
        {
            ICASModel cASModel = Responder.Instance.CASModel;

            foreach (ISimDescription description in Responder.Instance.CASModel.GetSimsInHousehold())
            {
                if (description.Gender == gender)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
        public static void OnCloseClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.gSingleton;
                if (ths == null)
                {
                    return;
                }

                //Common.DebugNotify(delegate { return "UiBusy: " + ths.mUiBusy + Common.NewLine + "LeaveCAS: " + ths.mLeaveCAS; });

                //if (!ths.UiBusy && !ths.mLeaveCAS)
                {
                    ths.UiBusy = true;
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate
                    {
                        string entryKey = (Responder.Instance.CASModel.CASMode == CASMode.Full) ? "Ui/Caption/CAS/ExitDialog:Prompt" : "Ui/Caption/CAS/ExitDialog:AlternatePrompt";
                        if (TwoButtonDialog.Show(Common.LocalizeEAString(entryKey), Common.LocalizeEAString("Ui/Caption/Global:Yes"), Common.LocalizeEAString("Ui/Caption/Global:No")))
                        {
                            CASController singleton = CASController.Singleton;
                            singleton.AllowCameraMovement(false);

                            ICASModel cASModel = Responder.Instance.CASModel;
                            while (cASModel.IsProcessing())
                            {
                                SpeedTrap.Sleep();
                            }

                            Sims.CASBase.sWasCanceled = true;

                            sender.Enabled = false;
                            cASModel.RequestClearChangeReport();
                            singleton.SetCurrentState(CASState.None);
                        }
                        else
                        {
                            ths.UiBusy = false;
                        }
                    }));
                    eventArgs.Handled = true;
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnCloseClick", e);
            }
        }
コード例 #5
0
ファイル: CASModelProxy.cs プロジェクト: Robobeurre/NRaas
        public CASModelProxy(ICASModel casModel)
        {
            mCASModel = casModel;

            mCASModel.OnFacialBlendApplied += OnFacialBlendAppliedProxy;
            mCASModel.OnOutfitSavedDeleted += OnOutfitSavedDeletedProxy;
            mCASModel.OnSimOutfitRemoved += OnSimOutfitRemovedProxy;
            mCASModel.OnSimPreviewLoadFinished += OnSimPreviewLoadFinishedProxy;
            mCASModel.OnSimSpeciesChanged += OnSimSpeciesChangedProxy;

            mCASModel.ClosingDown += OnClosingDownProxy;
            mCASModel.FacialBlendComponentsUpdate += OnFacialBlendComponentsUpdateProxy;
            mCASModel.FavoritesUpdated += OnFavoritesUpdatedProxy;
            mCASModel.OnCASContentAdded += OnCASContentAddedProxy;
            mCASModel.OnCASError += OnCASErrorProxy;
            mCASModel.OnCASPartAdded += OnCASPartAddedProxy;
            mCASModel.OnCASPartRemoved += OnCASPartRemovedProxy;
            mCASModel.OnDynamicUpdateCurrentSimThumbnail += OnDynamicUpdateCurrentSimThumbnailProxy;
            mCASModel.OnHairPresetApplied += OnHairPresetAppliedProxy;
            mCASModel.OnHouseholdSaved += OnHouseholdSavedProxy;
            mCASModel.OnPresetAppliedToPart += OnPresetAppliedToPartProxy;
            mCASModel.OnSetHairColor += OnSetHairColorProxy;
            mCASModel.OnSimAddedToHousehold += OnSimAddedToHouseholdProxy;
            mCASModel.OnSimAgeGenderChanged += OnSimAgeGenderChangedProxy;
            mCASModel.OnSimDeleted += OnSimDeletedProxy;
            mCASModel.OnSimFaceRandomized += OnSimFaceRandomizedProxy;
            mCASModel.OnSimLoaded += OnSimLoadedProxy;
            mCASModel.OnSimOutfitCategoryChanged += OnSimOutfitCategoryChangedProxy;
            mCASModel.OnSimOutfitIndexChanged += OnSimOutfitIndexChangedProxy;
            mCASModel.OnSimPreviewChange += OnSimPreviewChangeProxy;
            mCASModel.OnSimRandomized += OnSimRandomizedProxy;
            mCASModel.OnSimReplaced += OnSimReplacedProxy;
            mCASModel.OnSimSaved += OnSimSavedProxy;
            mCASModel.OnSimUpdated += OnSimUpdatedProxy;
            mCASModel.OnUndoRedoStackChanged += OnUndoRedoStackChangedProxy;
            mCASModel.OnUpdateThumbnails += OnUpdateThumbnailsProxy;
            mCASModel.RedoSelected += OnRedoSelectedProxy;
            mCASModel.ShowUI += OnShowUIProxy;
            mCASModel.SignUpdated += OnSignUpdatedProxy;
            mCASModel.TraitsUpdated += OnTraitsUpdatedProxy;
            mCASModel.TraitsValidatedOnAgeChange += OnTraitsValidatedOnAgeChangeProxy;
            mCASModel.UndoSelected += OnUndoSelectedProxy;
            mCASModel.VoiceUpdated += OnVoiceUpdatedProxy;
            mCASModel.OccultTypeSelected += OnOccultTypeSelectedProxy;
        }
コード例 #6
0
ファイル: CAF.cs プロジェクト: yakoder/NRaas
            protected override bool OnPerform()
            {
                CASPuck puck = CASPuck.Instance;

                if (puck == null)
                {
                    return(true);
                }

                if (puck.mAcceptButton != null)
                {
                    ICASModel cASModel = Sims3.UI.Responder.Instance.CASModel;
                    if ((cASModel.CASMode == CASMode.Full) && !cASModel.EditingExistingSim())
                    {
                        puck.mAcceptButton.Click -= puck.OnAcceptHousehold;
                        puck.mAcceptButton.Click -= OnAcceptHousehold;
                        puck.mAcceptButton.Click += OnAcceptHousehold;
                    }
                }

                CASFamilyScreen familyScreen = CASFamilyScreen.gSingleton;

                if (familyScreen != null)
                {
                    Window topLevel = familyScreen.mFamilyTopLevelWin;

                    uint       index = 0;
                    WindowBase child = topLevel.GetChildByIndex(index);
                    while (child != null)
                    {
                        CAFThumb thumb = child as CAFThumb;
                        if (thumb != null)
                        {
                            thumb.DragDrop -= familyScreen.OnCAFThumbDragDrop;
                            thumb.DragDrop -= OnCAFThumbDragDrop;
                            thumb.DragDrop += OnCAFThumbDragDrop;
                        }

                        index++;
                        child = topLevel.GetChildByIndex(index);
                    }
                }

                return(true);
            }
コード例 #7
0
        public static void OnSimGridClicked(ItemGrid sender, ItemGridCellClickEvent itemClicked)
        {
            try
            {
                CASLoadSim ths = CASLoadSim.gSingleton;
                if (ths == null)
                {
                    return;
                }

                ICASModel cASModel = Responder.Instance.CASModel;
                if (ths.mLoading)
                {
                    ths.mSimGrid.SelectedItem = ths.mPreviousSelection;
                }
                else
                {
                    if (itemClicked.mTag is CASLoadSim.SimDescriptionKeyPair)
                    {
                        CASLoadSim.SimDescriptionKeyPair tag = (CASLoadSim.SimDescriptionKeyPair)itemClicked.mTag;
                        if (tag.mSimDesc.IsValid)
                        {
                            ths.mCurrSimDescKeyPair = tag;

                            // Custom
                            RequestLoadSim(tag.mSimDesc, false);

                            ths.SetCustomButtonStates();
                            ths.UpdateTooltips(tag.mSimDesc.Species);
                        }
                    }

                    ths.mPreviousSelection = sender.SelectedItem;
                    ths.mLoading           = true;
                    UIManager.SetOverrideCursor(0x1003);
                    Audio.StartSound("ui_secondary_button");
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnSimGridClicked", e);
            }
        }
コード例 #8
0
        private static void CreateSimCallback(CASAgeGenderFlags species)
        {
            CASPuck ths = CASPuck.gSingleton;

            ICASModel     cASModel  = Responder.Instance.CASModel;
            CASController singleton = CASController.Singleton;

            /*
             * if ((species == (CASAgeGenderFlags.None | CASAgeGenderFlags.Human)) && (cASModel.NumSimsInHousehold >= CASPuck.kMaxSimsPerHousehold))
             * {
             *  singleton.ErrorMsg(CASErrorCode.TooManySims);
             * }
             * else if ((species != (CASAgeGenderFlags.None | CASAgeGenderFlags.Human)) && (cASModel.NumPetsInHousehold >= CASPuck.kMaxPetsPerHousehold))
             * {
             *  singleton.ErrorMsg(CASErrorCode.TooManyPets);
             * }
             */
            if (cASModel.NumInHousehold >= CASPuck.kMaxPerHousehold)
            {
                singleton.ErrorMsg(CASErrorCode.TooMany);
            }
            else
            {
                ths.mAttemptingToAdd = true;
                if (species == CASAgeGenderFlags.Human)
                {
                    CASController.Singleton.SetCurrentState(CASState.Summary);
                    ths.mAttemptingToAddSim = true;
                    cASModel.RequestCreateNewSim();
                }
                else
                {
                    CASController.Singleton.SetCurrentState(CASState.PetSummary);
                    ths.mAttemptingToAddPet = true;
                    cASModel.RequestCreateNewPet(species);
                }

                CASPuck.ShowInputBlocker();
            }
            ths.UpdateAddSimButtons();
        }
コード例 #9
0
        public static void OnNameTextEditChange(WindowBase sender, UITextChangeEventArgs eventArgs)
        {
            try
            {
                CASRequiredItemsDialog dialog = CASRequiredItemsDialog.sDialog;
                if (dialog != null)
                {
                    dialog.OnNameTextEditChange(sender, eventArgs);
                }

                ICASModel cASModel = Responder.Instance.CASModel;
                if (cASModel != null)
                {
                    CASBase.ChangeName(cASModel.FirstName, cASModel.LastName);
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnNameTextEditChange", e);
            }
        }
コード例 #10
0
ファイル: CASDresserClothingEx.cs プロジェクト: yakoder/NRaas
            protected override void OnPerform()
            {
                List <OutfitBase.Item> allOptions = new List <OutfitBase.Item>();

                ICASModel casModel = Responder.Instance.CASModel;

                ArrayList outfits = casModel.GetOutfits(casModel.OutfitCategory);

                for (int i = 0; i < outfits.Count; i++)
                {
                    allOptions.Add(new OutfitBase.Item(new CASParts.Key(casModel.OutfitCategory, i), casModel.CurrentSimDescription as SimDescription));
                }

                OutfitBase.Item choice = new CommonSelection <OutfitBase.Item>(Common.Localize("ChangeOutfit:MenuName"), allOptions).SelectSingle();
                if (choice == null)
                {
                    return;
                }

                casModel.OutfitIndex = choice.Index;
            }
コード例 #11
0
        public static void SelectItem(CASClothingCategory ths, CASPart part, CASPartPreset preset, bool allowMultiple)
        {
            ICASModel      cASModel  = Responder.Instance.CASModel;
            List <CASPart> wornParts = cASModel.GetWornParts(part.BodyType);

            bool flag = false;

            if (ths.IsAccessoryType(ths.mCurrentPart))
            {
                if ((part.Key == ths.mInvalidCASPart.Key) && (!allowMultiple))
                {
                    ths.RemoveAllPartsOfType(ths.mCurrentPart);
                    CASClothingCategory.sAccessoriesSelection = (int)ths.mCurrentPart;
                }
                else
                {
                    flag = true;
                    CASClothingCategory.sAccessoriesSelection = (int)part.BodyType;
                    CASController.Singleton.SetAccessoryCam(part.BodyType, true);

                    if (!allowMultiple)
                    {
                        if (part.BodyType == BodyTypes.Earrings)
                        {
                            ths.RemoveAllPartsOfType(BodyTypes.LeftEarring);
                            ths.RemoveAllPartsOfType(BodyTypes.RightEarring);
                        }
                        else if ((part.BodyType == BodyTypes.LeftEarring) || (part.BodyType == BodyTypes.RightEarring))
                        {
                            ths.RemoveAllPartsOfType(BodyTypes.Earrings);
                        }
                    }
                }
            }
            else if (!wornParts.Contains(part))
            {
                flag = true;
            }

            if (preset != null)
            {
                ths.mCurrentPreset = preset;
                if (preset.mPresetString != null)
                {
                    if (flag)
                    {
                        ths.mModel.RequestAddCASPart(part, preset.mPresetString);
                    }
                    else
                    {
                        ths.mModel.RequestCommitPresetToPart(part, preset.mPresetString);
                    }
                }
            }
            else if (flag)
            {
                ths.mModel.RequestAddCASPart(part, false);
                CASSelectionGrid.SetSelectionIndex((uint)part.BodyType);
            }
            Audio.StartSound("ui_tertiary_button");
        }
コード例 #12
0
        private static void PopulateTypesGrid(CASHair ths)
        {
            if (ths == null)
            {
                return;
            }

            ICASModel cASModel = Responder.Instance.CASModel;

            Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) };
            ths.mHairTypesGrid.Clear();
            CASPart     wornPart = ths.GetWornPart();
            ResourceKey resKey   = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0);

            bool isHat = false;
            bool flag  = false;

            if (ths.mHairType == CASHair.HairType.Hat)
            {
                ths.mHatsShareButton.Enabled  = false;
                ths.mHatsDeleteButton.Enabled = false;
                ths.mDesignButton.Enabled     = CASHair.PartIsHat(wornPart);

                isHat = true;
            }

            bool shouldEnableCatalogProductFilter = false;

            List <object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat);

            ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter);

            if (!MasterController.Settings.mCompactHatCAS)
            {
                foreach (object obj2 in objectList)
                {
                    IFeaturedStoreItem item = obj2 as IFeaturedStoreItem;

                    if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000)))
                    {
                        WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                        if (windowByExportID != null)
                        {
                            windowByExportID.Tag = item;
                            windowByExportID.GetChildByID(0x23, true);
                            Window childByID = windowByExportID.GetChildByID(0x20, true) as Window;
                            if (childByID != null)
                            {
                                ImageDrawable drawable = childByID.Drawable as ImageDrawable;
                                if (drawable != null)
                                {
                                    drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey);
                                    childByID.Invalidate();
                                }
                            }
                            childByID     = windowByExportID.GetChildByID(0x300, true) as Window;
                            childByID.Tag = item;
                            childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip;
                            childByID.Visible = true;
                            childByID         = windowByExportID.GetChildByID(0x303, true) as Window;
                            childByID.Visible = item.IsSale;

                            Button button = windowByExportID.GetChildByID(0x301, true) as Button;
                            button.Caption        = item.PriceString;
                            button.Tag            = windowByExportID;
                            button.Click         += ths.OnBuyButtonClick;
                            button.FocusAcquired += ths.OnBuyButtonFocusAcquired;
                            button.FocusLost     += ths.OnBuyButtonFocusLost;
                            ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item));
                        }
                    }
                }
            }

            foreach (CASPart part2 in ths.mPartsList)
            {
                bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2);
                uint num3           = CASUtils.PartDataNumPresets(part2.Key);
                ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key);
                if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key)))
                {
                    ObjectDesigner.SetCASPart(part2.Key);
                    string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId));
                    if (string.IsNullOrEmpty(designPreset))
                    {
                        ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId);
                        designPreset = Simulator.LoadXMLString(key2);
                    }

                    CASPartPreset preset = new CASPartPreset(part2, designPreset);
                    string        str2   = "";
                    string        str3   = "";
                    if (wornPart.Key == preset.mPart.Key)
                    {
                        str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                        str3 = CASUtils.ReplaceHairColors(str2, colors);
                    }

                    if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue)))
                    {
                        ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                        if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset)))
                        {
                            ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                            flag = true;
                        }
                    }

                    if (ths.mHairType == CASHair.HairType.Hat)
                    {
                        if (MasterController.Settings.mCompactHatCAS)
                        {
                            num3 = 1;
                        }

                        for (int i = 0x0; i < num3; i++)
                        {
                            uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i);
                            customContentType = UIUtils.GetCustomContentType(part2.Key, presetId);

                            preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i));
                            if (preset.Valid)
                            {
                                bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                                if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors)))
                                {
                                    ths.mSavedPresetId = preset.mPresetId;
                                    flag = true;
                                    if (flag4)
                                    {
                                        ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                                        if (ObjectDesigner.IsUserDesignPreset((uint)i))
                                        {
                                            ths.mHatsShareButton.Enabled  = true;
                                            ths.mHatsDeleteButton.Enabled = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter;
            if (ths.mHairStylesGrid.Tag == null)
            {
                ths.mHairStylesGrid.Tag = false;
            }

            ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag;
            if (flag)
            {
                ths.mSaveButton.Enabled = false;
            }
            else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart))
            {
                WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                if (win != null)
                {
                    Window window2 = win.GetChildByID(0x20, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = false;
                    }
                    window2 = win.GetChildByID(0x24, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = true;
                    }
                    ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null));
                }
                ths.mSaveButton.Enabled = true;
            }
            ths.mUndoOnDelete = false;
            ths.mContentTypeFilter.UpdateFilterButtonState();
        }
コード例 #13
0
ファイル: CASModelProxy.cs プロジェクト: Robobeurre/NRaas
 public CASModelProxy(ICASModel model)
     : base(model)
 { }
コード例 #14
0
        private static bool ShowRequiredItemsDialogTask(CASPuck ths)
        {
            int       currentPreviewSim = ths.CurrentPreviewSim;
            ICASModel cASModel          = Sims3.UI.Responder.Instance.CASModel;

            cASModel.OnSimUpdated -= ths.OnSimUpdated;
            cASModel.OnSimUpdated += ths.OnSimUpdatedRequiredItems;

            ths.mSimUpdated = false;
            //cASModel.RequestUpdateCurrentSim(true);
            CASLogic.CASOperationStack.Instance.Push(new UpdateCurrentSimOperationEx(true));
            while (!ths.mSimUpdated)
            {
                SpeedTrap.Sleep();
            }

            cASModel.OnSimUpdated -= ths.OnSimUpdatedRequiredItems;
            cASModel.OnSimUpdated += ths.OnSimUpdated;

            /*
             * if (IsPetOnlyHousehold())
             * {
             *  if (!AcceptCancelDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Family:PetOnlyHousehold", new object[0x0])))
             *  {
             *      return false;
             *  }
             * }
             * else */if (!IsHouseholdValid())
            {
                SimpleMessageDialog.Show(null, Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Family:InvalidHousehold", new object[0x0]), ModalDialog.PauseMode.PauseSimulator);
                return(false);
            }

            cASModel.OnSimPreviewChange -= ths.OnSimPreviewChange;
            cASModel.OnSimPreviewChange += ths.OnSimPreviewChangeRequiredItems;
            ths.mInputBlocker.Visible    = true;
            cASModel.RequestClearStack();

            cASModel.OnUndoRedoStackChanged -= ths.OnUndoRedoStackChanged;
            ths.mUndoButton.Enabled          = false;
            ths.mRedoButton.Enabled          = false;
            bool flag  = true;
            int  index = 0x0;

            foreach (ISimDescription description in cASModel.GetSimsInHousehold())
            {
                if (CASRequiredItemsDialog.ShouldShow(description))
                {
                    ths.mSimPreviewChanged = false;
                    cASModel.RequestSetPreviewSim(index);
                    ths.SelectSimButton(index);
                    while (!ths.mSimPreviewChanged || cASModel.IsProcessing())
                    {
                        SpeedTrap.Sleep();
                    }

                    CASController.Singleton.SetFullbodyCam(true);

                    ths.UiBusy = false;
                    if (!CASRequiredItemsDialog.Show())
                    {
                        flag = false;
                    }
                    ths.UiBusy = true;
                }

                if (description.TeenOrBelow)
                {
                    description.SimLifetimeWish = 0x0;
                }
                index++;
            }

            ths.mInputBlocker.Visible        = false;
            cASModel.OnSimPreviewChange     -= ths.OnSimPreviewChangeRequiredItems;
            cASModel.OnSimPreviewChange     += ths.OnSimPreviewChange;
            cASModel.OnUndoRedoStackChanged += ths.OnUndoRedoStackChanged;

            cASModel.RequestSetPreviewSim(currentPreviewSim);
            ths.SelectSimButton(currentPreviewSim);
            if (!flag)
            {
                string str;
                if (GameUtils.IsInstalled(ProductVersion.EP5))
                {
                    str = Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/CAS/Puck:RequiredItemsMissingEP5", new object[0x0]);
                }
                else
                {
                    str = Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/CAS/Puck:RequiredItemsMissing", new object[0x0]);
                }

                SimpleMessageDialog.Show(null, str, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
            }

            return(flag);
        }
コード例 #15
0
ファイル: CASModelProxy.cs プロジェクト: yakoder/NRaas
 public CASModelProxy(ICASModel model)
     : base(model)
 {
 }
コード例 #16
0
ファイル: CASControllerEx.cs プロジェクト: yakoder/NRaas
        public static void OnExitFullEditMode()
        {
            try
            {
                CASController ths = CASController.gSingleton;
                if (ths == null)
                {
                    return;
                }

                ICASModel casModel = Responder.Instance.CASModel;
                if (casModel == null)
                {
                    return;
                }

                bool reprocess = false;

                switch (casModel.CASMode)
                {
                case CASMode.Full:
                    if ((casModel.CurrentSimDescription != null) && (casModel.CurrentSimDescription.IsHuman))
                    {
                        reprocess = true;
                    }
                    break;

                case CASMode.Dresser:
                    reprocess = true;
                    break;

                case CASMode.Mirror:
                    reprocess = true;
                    break;

                case CASMode.Stylist:
                    reprocess = true;
                    break;
                }

                /*
                 * // Corrects for a bounce issue in CASDresserSheet:Init() with foreign language users
                 * if ((ths.mCurrUINode == null) && (casModel.CASMode == CASMode.Stylist) && (casModel.SelectionIndex != 0x1))
                 * {
                 *  if (CASDresserSheet.gSingleton == null)
                 *  {
                 *      CASDresserSheet.Load();
                 *      CASDresserSheet.gSingleton.UINodeShutdown += ths.SetState;
                 *
                 *      Window newWindow, oldWindow;
                 *      CASDresserSheetEx.GetWindows(out newWindow, out oldWindow);
                 *
                 *      CASDresserSheetEx.UpdateGlideEffects(newWindow);
                 *
                 *      CASDresserSheetEx.UpdatePanelGlide(newWindow);
                 *  }
                 * }
                 */
                ths.OnExitFullEditMode();

                if (reprocess)
                {
                    CASClothingCategoryEx.DelayedCategoryUpdate.Perform();
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnExitFullEditMode", e);
            }
        }
コード例 #17
0
            protected override bool OnPerform()
            {
                Common.StringBuilder msg = new Common.StringBuilder("EditTownCASTask" + Common.NewLine);

                try
                {
                    {
                        EditTownLibraryPanel panel = EditTownLibraryPanel.Instance;
                        if ((panel != null) && (panel.mCASButton != null))
                        {
                            panel.mCASButton.Click -= panel.OnCASClick;

                            panel.mCASButton.Click -= EditTownLibraryPanelEx.OnCASClick;
                            panel.mCASButton.Click += EditTownLibraryPanelEx.OnCASClick;
                        }
                    }

                    msg += "A";

                    {
                        PlayFlowMenuPanel playFlow = PlayFlowMenuPanel.gSingleton;
                        if ((playFlow != null) && (playFlow.mCASButton != null))
                        {
                            playFlow.mCASButton.Click -= playFlow.OnMenuButtonClick;

                            playFlow.mCASButton.Click -= PlayFlowMenuPanelEx.OnMenuButtonClick;
                            playFlow.mCASButton.Click += PlayFlowMenuPanelEx.OnMenuButtonClick;
                        }
                    }

                    msg += "C";

                    {
                        CASClothingCategory category = CASClothingCategory.gSingleton;
                        if (category != null)
                        {
                            category.mTopsButton.Click         -= category.OnCategoryButtonClick;
                            category.mBottomsButton.Click      -= category.OnCategoryButtonClick;
                            category.mShoesButton.Click        -= category.OnCategoryButtonClick;
                            category.mOutfitsButton.Click      -= category.OnCategoryButtonClick;
                            category.mAccessoriesButton.Click  -= category.OnCategoryButtonClick;
                            category.mHorseBridlesButton.Click -= category.OnCategoryButtonClick;
                            category.mHorseSaddleButton.Click  -= category.OnCategoryButtonClick;

                            category.mTopsButton.MouseDown         -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mTopsButton.MouseDown         += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mBottomsButton.MouseDown      -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mBottomsButton.MouseDown      += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mShoesButton.MouseDown        -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mShoesButton.MouseDown        += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mOutfitsButton.MouseDown      -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mOutfitsButton.MouseDown      += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mAccessoriesButton.MouseDown  -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mAccessoriesButton.MouseDown  += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mHorseBridlesButton.MouseDown -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mHorseBridlesButton.MouseDown += CASClothingCategoryEx.OnButtonMouseDown;
                            category.mHorseSaddleButton.MouseDown  -= CASClothingCategoryEx.OnButtonMouseDown;
                            category.mHorseSaddleButton.MouseDown  += CASClothingCategoryEx.OnButtonMouseDown;
                        }
                    }

                    msg += "D";

                    CASPuck puck = CASPuck.gSingleton;
                    if (puck != null)
                    {
                        CASFamilyScreen familyScreen = CASFamilyScreen.gSingleton;
                        if (familyScreen != null)
                        {
                            Window topLevel = familyScreen.mFamilyTopLevelWin;

                            uint       index = 0;
                            WindowBase child = topLevel.GetChildByIndex(index);
                            while (child != null)
                            {
                                CAFThumb thumb = child as CAFThumb;
                                if (thumb != null)
                                {
                                    thumb.DragDrop -= familyScreen.OnCAFThumbDragDrop;
                                    thumb.DragDrop -= CASFamilyScreenEx.OnCAFThumbDragDrop;
                                    thumb.DragDrop += CASFamilyScreenEx.OnCAFThumbDragDrop;
                                }

                                index++;
                                child = topLevel.GetChildByIndex(index);
                            }
                        }

                        if (puck.mGeneticsButton != null)
                        {
                            puck.mGeneticsButton.Enabled = CASPuckEx.CanCreateChild();
                        }

                        ICASModel cASModel = Responder.Instance.CASModel;
                        if (cASModel != null)
                        {
                            if ((MasterController.Settings.mAllowOverStuffed) && (cASModel.NumInHousehold < CASPuck.kMaxPerHousehold))
                            {
                                if (puck.mCreateHorseButton != null)
                                {
                                    puck.mCreateHorseButton.Enabled = true;

                                    puck.mCreateHorseButton.Click -= puck.OnCreateSimClick;
                                    puck.mCreateHorseButton.Click -= CASPuckEx.OnCreateSimClick;
                                    puck.mCreateHorseButton.Click += CASPuckEx.OnCreateSimClick;
                                }

                                if (puck.mCreateDogButton != null)
                                {
                                    puck.mCreateDogButton.Enabled = true;

                                    puck.mCreateDogButton.Click -= puck.OnCreateSimClick;
                                    puck.mCreateDogButton.Click -= CASPuckEx.OnCreateSimClick;
                                    puck.mCreateDogButton.Click += CASPuckEx.OnCreateSimClick;
                                }

                                if (puck.mCreateCatButton != null)
                                {
                                    puck.mCreateCatButton.Enabled = true;

                                    puck.mCreateCatButton.Click -= puck.OnCreateSimClick;
                                    puck.mCreateCatButton.Click -= CASPuckEx.OnCreateSimClick;
                                    puck.mCreateCatButton.Click += CASPuckEx.OnCreateSimClick;
                                }

                                if (puck.mCreateSimButton != null)
                                {
                                    puck.mCreateSimButton.Enabled = true;

                                    puck.mCreateSimButton.Click -= puck.OnCreateSimClick;
                                    puck.mCreateSimButton.Click -= CASPuckEx.OnCreateSimClick;
                                    puck.mCreateSimButton.Click += CASPuckEx.OnCreateSimClick;
                                }
                            }

                            cASModel.OnSimUpdated -= puck.OnSimUpdated;
                            cASModel.OnSimUpdated -= CASPuckEx.OnSimUpdated;
                            cASModel.OnSimUpdated += CASPuckEx.OnSimUpdated;

                            cASModel.OnSimPreviewChange -= puck.OnSimPreviewChange;
                            cASModel.OnSimPreviewChange -= CASPuckEx.OnSimPreviewChange;
                            cASModel.OnSimPreviewChange += CASPuckEx.OnSimPreviewChange;
                        }
                    }

                    msg += "E";

                    CASCompositorController controller = CASCompositorController.sController;
                    if (controller != null)
                    {
                        if (controller.mColorsDragButton != null)
                        {
                            controller.mColorsDragButton.MouseDown -= controller.OnMaterialsColorDragMouseDown;
                            controller.mColorsDragButton.MouseDown -= CASCompositorControllerEx.OnMaterialsColorDragMouseDown;
                            controller.mColorsDragButton.MouseDown += CASCompositorControllerEx.OnMaterialsColorDragMouseDown;

                            controller.mColorsDragButton.MouseUp -= controller.OnMaterialsColorDragMouseUp;
                            controller.mColorsDragButton.MouseUp -= CASCompositorControllerEx.OnMaterialsColorDragMouseUp;
                            controller.mColorsDragButton.MouseUp += CASCompositorControllerEx.OnMaterialsColorDragMouseUp;

                            for (uint j = 0x0; j < 0x4; j++)
                            {
                                controller.mColorsPopupButton[j].MouseDown -= controller.OnMaterialsColorGridMouseDown;
                                controller.mColorsPopupButton[j].MouseDown -= CASCompositorControllerEx.OnMaterialsColorGridMouseDown;
                                controller.mColorsPopupButton[j].MouseDown += CASCompositorControllerEx.OnMaterialsColorGridMouseDown;

                                controller.mColorsPopupButton[j].MouseUp -= controller.OnMaterialsColorGridMouseUp;
                                controller.mColorsPopupButton[j].MouseUp -= CASCompositorControllerEx.OnMaterialsColorGridMouseUp;
                                controller.mColorsPopupButton[j].MouseUp += CASCompositorControllerEx.OnMaterialsColorGridMouseUp;
                            }
                        }

                        if (controller.mMaterialsSkewerPatternButton.Length == 4)
                        {
                            for (int i = 0; i < 4; i++)
                            {
                                if (controller.mMaterialsSkewerPatternButton[i] == null)
                                {
                                    continue;
                                }

                                controller.mMaterialsSkewerPatternButton[i].MouseDown -= controller.OnMaterialsSkewerGridMouseDown;

                                controller.mMaterialsSkewerPatternButton[i].MouseDown -= CASCompositorControllerEx.OnMaterialsSkewerGridMouseDown;
                                controller.mMaterialsSkewerPatternButton[i].MouseDown += CASCompositorControllerEx.OnMaterialsSkewerGridMouseDown;

                                controller.mMaterialsSkewerPatternButton[i].MouseUp -= controller.OnMaterialsSkewerGridMouseUp;

                                controller.mMaterialsSkewerPatternButton[i].MouseUp -= CASCompositorControllerEx.OnMaterialsSkewerGridMouseUp;
                                controller.mMaterialsSkewerPatternButton[i].MouseUp += CASCompositorControllerEx.OnMaterialsSkewerGridMouseUp;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }
                return(true);
            }