private static bool IsValidRelationship(IMiniSimDescription sim1, IMiniSimDescription sim2, CASFamilyScreen.RelationshipType relationship)
        {
            switch (relationship)
            {
                case CASFamilyScreen.RelationshipType.Roommate:
                    return true;

                case CASFamilyScreen.RelationshipType.Spouse:
                    if (!sim1.TeenOrAbove) return false;

                    if (!sim2.TeenOrAbove) return false;

                    if (CASFamilyScreenEx.kAllowAdultTeen) return true;

                    return (sim1.Teen == sim2.Teen);
                case CASFamilyScreen.RelationshipType.Parent:
                    if (sim2.Age > sim1.Age) return false;

                    return sim1.TeenOrAbove;
                case CASFamilyScreen.RelationshipType.Child:
                    if (sim1.Age > sim2.Age) return false;

                    return sim2.TeenOrAbove;
                case CASFamilyScreen.RelationshipType.Sibling:
                    return true;
            }
            return false;
        }
Exemple #2
0
            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);
            }
Exemple #3
0
        public static void OnCAFThumbDragDrop(WindowBase sender, UIDragEventArgs eventArgs)
        {
            try
            {
                CASFamilyScreen ths = CASFamilyScreen.gSingleton;

                CAFThumb data = eventArgs.Data as CAFThumb;
                if ((data != null) && eventArgs.Result)
                {
                    CAFThumb thumb2 = sender as CAFThumb;
                    if (data != thumb2)
                    {
                        ShowAddRelationshipDialog(ths, data, thumb2);
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnCAFThumbDragDrop", exception);
            }
        }
        private static void ShowAddRelationshipDialog(CASFamilyScreen ths, CAFThumb sim1Thumb, CAFThumb sim2Thumb)
        {
            ths.mAddRelationshipSimThumb1.SimDescription = sim1Thumb.SimDescription;
            ths.mAddRelationshipSimThumb2.SimDescription = sim2Thumb.SimDescription;
            CASFamilyScreen.RelationshipType relationship = ths.GetRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription);
            ths.mAddRelationshipHousematesButton.Selected = true;

            List<Text> captions = new List<Text>();
            captions.Add(ths.mAddRelationshipOther1Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther2Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther3Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther4Button.GetChildByID(0x1, false) as Text);

            List<Button> buttons = new List<Button>();
            buttons.Add(ths.mAddRelationshipOther1Button);
            buttons.Add(ths.mAddRelationshipOther2Button);
            buttons.Add(ths.mAddRelationshipOther3Button);
            buttons.Add(ths.mAddRelationshipOther4Button);

            foreach (Button button in buttons)
            {
                button.Visible = false;
            }

            int index = 0;

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Parent))
            {
                buttons[index].Tag = CASFamilyScreen.RelationshipType.Parent;
                buttons[index].Visible = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Parent", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Parent)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }
            else if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Child))
            {
                buttons[index].Tag = CASFamilyScreen.RelationshipType.Child;
                buttons[index].Visible = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Child", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Child)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Sibling))
            {
                buttons[index].Tag = CASFamilyScreen.RelationshipType.Sibling;
                buttons[index].Visible = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Sibling", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Sibling)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Spouse))
            {
                buttons[index].Tag = CASFamilyScreen.RelationshipType.Spouse;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Spouse", new object[0x0]);
                buttons[index].Visible = true;
                if (relationship == CASFamilyScreen.RelationshipType.Spouse)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;

                buttons[index].Tag = CASFamilyScreen.RelationshipType.BGFriend;
                buttons[index].Visible = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:BFriend", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.BGFriend)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;

                if (index < buttons.Count)
                {
                    buttons[index].Tag = CASFamilyScreen.RelationshipType.Fiancee;
                    buttons[index].Visible = true;
                    captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Fiance", new object[0x0]);
                    if (relationship == CASFamilyScreen.RelationshipType.Fiancee)
                    {
                        ths.mAddRelationshipHousematesButton.Selected = false;
                        buttons[index].Selected = true;
                    }

                    index++;
                }
            }

            ths.mAddRelationshipDialogWin.Visible = true;
            Audio.StartSound("ui_hardwindow_open");
        }
Exemple #5
0
        private static void ShowAddRelationshipDialog(CASFamilyScreen ths, CAFThumb sim1Thumb, CAFThumb sim2Thumb)
        {
            ths.mAddRelationshipSimThumb1.SimDescription = sim1Thumb.SimDescription;
            ths.mAddRelationshipSimThumb2.SimDescription = sim2Thumb.SimDescription;
            CASFamilyScreen.RelationshipType relationship = ths.GetRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription);
            ths.mAddRelationshipHousematesButton.Selected = true;

            List <Text> captions = new List <Text>();

            captions.Add(ths.mAddRelationshipOther1Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther2Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther3Button.GetChildByID(0x1, false) as Text);
            captions.Add(ths.mAddRelationshipOther4Button.GetChildByID(0x1, false) as Text);

            List <Button> buttons = new List <Button>();

            buttons.Add(ths.mAddRelationshipOther1Button);
            buttons.Add(ths.mAddRelationshipOther2Button);
            buttons.Add(ths.mAddRelationshipOther3Button);
            buttons.Add(ths.mAddRelationshipOther4Button);

            foreach (Button button in buttons)
            {
                button.Visible = false;
            }

            int index = 0;

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Parent))
            {
                buttons[index].Tag      = CASFamilyScreen.RelationshipType.Parent;
                buttons[index].Visible  = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Parent", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Parent)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }
            else if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Child))
            {
                buttons[index].Tag      = CASFamilyScreen.RelationshipType.Child;
                buttons[index].Visible  = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Child", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Child)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Sibling))
            {
                buttons[index].Tag      = CASFamilyScreen.RelationshipType.Sibling;
                buttons[index].Visible  = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Sibling", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.Sibling)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;
            }

            if (IsValidRelationship(sim1Thumb.SimDescription, sim2Thumb.SimDescription, CASFamilyScreen.RelationshipType.Spouse))
            {
                buttons[index].Tag      = CASFamilyScreen.RelationshipType.Spouse;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Spouse", new object[0x0]);
                buttons[index].Visible  = true;
                if (relationship == CASFamilyScreen.RelationshipType.Spouse)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;

                buttons[index].Tag      = CASFamilyScreen.RelationshipType.BGFriend;
                buttons[index].Visible  = true;
                captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:BFriend", new object[0x0]);
                if (relationship == CASFamilyScreen.RelationshipType.BGFriend)
                {
                    ths.mAddRelationshipHousematesButton.Selected = false;
                    buttons[index].Selected = true;
                }

                index++;

                if (index < buttons.Count)
                {
                    buttons[index].Tag      = CASFamilyScreen.RelationshipType.Fiancee;
                    buttons[index].Visible  = true;
                    captions[index].Caption = Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString(sim1Thumb.SimDescription.IsFemale, "Ui/Caption/CAF/AddRelationship:Fiance", new object[0x0]);
                    if (relationship == CASFamilyScreen.RelationshipType.Fiancee)
                    {
                        ths.mAddRelationshipHousematesButton.Selected = false;
                        buttons[index].Selected = true;
                    }

                    index++;
                }
            }

            ths.mAddRelationshipDialogWin.Visible = true;
            Audio.StartSound("ui_hardwindow_open");
        }
Exemple #6
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);
            }