示例#1
0
        protected override bool OnPerform()
        {
            RelationshipsPanel panel = RelationshipsPanel.Instance;

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

            if (!panel.Visible)
            {
                return(true);
            }

            if (panel.mHudModel != null)
            {
                if (!(panel.mHudModel is HudModelProxy))
                {
                    panel.mHudModel.SimChanged             -= panel.OnSimChanged;
                    panel.mHudModel.SimAgeChanged          -= panel.OnSimAgeChanged;
                    panel.mHudModel.CareerUpdated          -= panel.OnCareerUpdated;
                    panel.mHudModel.OccultUpdated          -= panel.OnOccultChanged;
                    panel.mHudModel.RelationshipsChanged   -= panel.OnRelationshipsChanged;
                    panel.mHudModel.SimAppearanceChanged   -= panel.OnSimAppearanceChanged;
                    panel.mHudModel.VisitorsChanged        -= panel.OnVisitorsChanged;
                    panel.mHudModel.SimCurrentWorldChanged -= panel.OnSimCurrentWorldChanged;

                    panel.mHudModel = new HudModelProxy(panel.mHudModel);

                    panel.mHudModel.SimChanged             += panel.OnSimChanged;
                    panel.mHudModel.SimAgeChanged          += panel.OnSimAgeChanged;
                    panel.mHudModel.CareerUpdated          += panel.OnCareerUpdated;
                    panel.mHudModel.OccultUpdated          += panel.OnOccultChanged;
                    panel.mHudModel.RelationshipsChanged   += panel.OnRelationshipsChanged;
                    panel.mHudModel.SimAppearanceChanged   += panel.OnSimAppearanceChanged;
                    panel.mHudModel.VisitorsChanged        += panel.OnVisitorsChanged;
                    panel.mHudModel.SimCurrentWorldChanged += panel.OnSimCurrentWorldChanged;

                    panel.Repopulate(panel.mHudModel.CurrentRelationships);
                }
            }

            if ((panel.mRelItemGrid != null) && (panel.mRelItemGrid.mGrid != null))
            {
                for (int i = 0; i < panel.mRelItemGrid.mGrid.ColumnCount; i++)
                {
                    WindowBase window = panel.mRelItemGrid.mGrid.GetCellWindow(i, 0);

                    Window childByID = window.GetChildByID(0x2, true) as Window;
                    childByID.MouseUp -= panel.OnSimOnLotMouseUp;
                    childByID.MouseUp -= panel.OnSimNotOnLotMouseUp;

                    childByID.MouseUp -= OnSimMouseUp;
                    childByID.MouseUp += OnSimMouseUp;

                    float value = 0;

                    FillBarController controller = window.GetChildByID(0x5, true) as FillBarController;
                    if (controller != null)
                    {
                        value = controller.Value;
                    }

                    childByID = window.GetChildByID(0x24, true) as Window;
                    if (childByID != null)
                    {
                        if ((childByID.TooltipText != null) && (!childByID.TooltipText.EndsWith(")")))
                        {
                            childByID.TooltipText += " (" + EAText.GetNumberString(value) + ")";
                        }
                    }
                }
            }

            return(true);
        }