コード例 #1
0
ファイル: MotivesPanelControl.cs プロジェクト: yakoder/NRaas
        protected static void OnUpdateMotives()
        {
            MotivesPanel display = MotivesPanel.Instance;

            if (display == null)
            {
                return;
            }

            if (display.mHudModel == null)
            {
                return;
            }

            SimInfo currentSimInfo = display.mHudModel.GetCurrentSimInfo();

            if (currentSimInfo == null)
            {
                return;
            }

            currentSimInfo.OccultInfo = OccultManagerEx.GetSimOccultInfo();

            MotivesPanelEx.OnMotivesChanged(display, currentSimInfo);
        }
コード例 #2
0
        /// <summary>
        /// 获取整棵树的分组信息
        /// </summary>
        /// <returns></returns>
        private List <SimInfo> GetSimLst()
        {
            var lis = new List <SimInfo>();

            int index = 1;

            foreach (var t in this.Data)
            {
                if (string.IsNullOrEmpty(t.TelNum) == false)
                {
                    var tmp =
                        new SimInfo(new ZcSim.ZcSimItem()
                    {
                        Id     = t.Id,
                        IpAddr = t.IP,
                        DtKt   = t.ActivateTime.Ticks,
                        DtXf   = t.ChargeTime.Ticks,
                        RtuId  = t.NodeId,
                        SimNum = long.Parse(t.TelNum),
                        State  = t.SelectedState.Value
                    });
                    lis.Add(tmp);
                }
            }
            return(lis);
        }
コード例 #3
0
ファイル: SimInfoDbMgr.cs プロジェクト: kennebel/CoreSimFun
        public SimInfo GetSimInfo()
        {
            var Result = SimInfos.GetSimInfo();

            if (Result == null)
            {
                Result = new SimInfo();
            }
            return(Result);
        }
コード例 #4
0
ファイル: MotivesPanelControl.cs プロジェクト: yakoder/NRaas
 protected static void OnSimMotivesChanged(SimInfo info)
 {
     try
     {
         Common.FunctionTask.Perform(OnUpdateMotives);
     }
     catch (Exception e)
     {
         Common.Exception("OnSimMotivesChanged", e);
     }
 }
コード例 #5
0
 protected static void OnSimMotivesChanged(SimInfo info)
 {
     try
     {
         Common.FunctionTask.Perform(OnUpdateMotives);
     }
     catch (Exception e)
     {
         Common.Exception("OnSimMotivesChanged", e);
     }
 }
コード例 #6
0
ファイル: TestSimInfo.cs プロジェクト: kennebel/CoreSimFun
        public void TickCount_ShoudStayAtZero()
        {
            // Arrange
            var si = new SimInfo();

            // Act
            si.TickCount = -1;

            // Assert
            Assert.Equal(0, si.TickCount);
        }
コード例 #7
0
ファイル: SimDisplayEx.cs プロジェクト: yakoder/NRaas
 public static void UpdateMagicMotiveBar(SimDisplay ths, SimInfo info)
 {
     if (((info != null) && (info.OccultInfo != null)) && (IsOccult(info)))
     {
         ths.mMagicMotiveBarWindow.Visible = true;
         OnMotivesChanged(ths, info);
     }
     else
     {
         ths.mMagicMotiveBarWindow.Visible = false;
     }
 }
コード例 #8
0
ファイル: PersistedSettings.cs プロジェクト: Robobeurre/NRaas
        public void SetCustomTitles(Sim sim)
        {
            if (sim != null)
            {
                List <string> titles;
                Tagger.Settings.mCustomSimTitles.TryGetValue(sim.SimDescription.SimDescriptionId, out titles);

                SimInfo info = Sims3.UI.Responder.Instance.HudModel.GetSimInfo(sim.ObjectId);
                if (info != null && titles != null)
                {
                    if (titles.Count > 0)
                    {
                        string name = sim.FullName;
                        foreach (string title in titles)
                        {
                            name = name + ", " + title;
                        }

                        info.mName = name;

                        Sims3.Gameplay.UI.HudModel model = Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel;
                        if (model != null)
                        {
                            foreach (SimInfo info2 in model.mSimList)
                            {
                                if (info2.mGuid == info.mGuid)
                                {
                                    model.mSimList.Remove(info2);
                                    model.mSimList.Add(info);
                                    model.SimNameChanged(info.mGuid);
                                    break;
                                }
                            }
                        }

                        int index = 0;
                        foreach (Skewer.SkewerItem item in Skewer.Instance.mHouseholdItems)
                        {
                            if (item.mSimInfo != null && item.mSimInfo.mGuid == info.mGuid)
                            {
                                item.mSimInfo.mName = name;
                                Skewer.Instance.mHouseholdItems[index] = item;
                            }
                        }
                    }
                    else
                    {
                        info.mName = sim.FullName;
                    }
                }
            }
        }
コード例 #9
0
        public SimInfo UpsertSimInfo(SimInfo si)
        {
            if (si.Id == 0)
            {
                DB.SimInfos.Add(si);
            }
            else
            {
                DB.SimInfos.Update(si);
            }

            return(null);
        }
コード例 #10
0
        public SimDescription GetSim(SimInfo info)
        {
            if (info.UninstantiatedSimDescriptionId == 0)
            {
                Sim sim = Sim.GetObject(info.mGuid) as Sim;
                if (sim == null)
                {
                    return(null);
                }

                return(sim.SimDescription);
            }
            else
            {
                return(GetSim(info.UninstantiatedSimDescriptionId));
            }
        }
コード例 #11
0
ファイル: SimDisplayEx.cs プロジェクト: Robobeurre/NRaas
        private static bool IsOccult(SimInfo info)
        {
            Sim actor = Sim.ActiveActor;
            if (actor == null) return false;

            if (actor.SimDescription.ChildOrAbove)
            {
                if (actor.SimDescription.IsFairy) return true;

                if (actor.SimDescription.IsGenie) return true;
            }
            
            if (actor.SimDescription.TeenOrAbove)
            {
                if (actor.SimDescription.IsWitch) return true;

                if (actor.SimDescription.IsUnicorn) return true;
            }

            return false;
        }
コード例 #12
0
        protected static void OnUpdateMagicBar()
        {
            SimDisplay display = SimDisplay.Instance;

            if (display == null)
            {
                return;
            }

            if (display.mHudModel == null)
            {
                return;
            }

            SimInfo currentSimInfo = display.mHudModel.GetCurrentSimInfo();

            if (currentSimInfo == null)
            {
                return;
            }

            SimDisplayEx.UpdateMagicMotiveBar(display, currentSimInfo);
        }
コード例 #13
0
ファイル: SimDisplayEx.cs プロジェクト: yakoder/NRaas
        private static bool IsOccult(SimInfo info)
        {
            Sim actor = Sim.ActiveActor;

            if (actor == null)
            {
                return(false);
            }

            if (actor.SimDescription.ChildOrAbove)
            {
                if (actor.SimDescription.IsFairy)
                {
                    return(true);
                }

                if (actor.SimDescription.IsGenie)
                {
                    return(true);
                }
            }

            if (actor.SimDescription.TeenOrAbove)
            {
                if (actor.SimDescription.IsWitch)
                {
                    return(true);
                }

                if (actor.SimDescription.IsUnicorn)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #14
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortByName(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    int result = HandleReverse(CompareName(leftSim.LastName, rightSim.LastName));

                    if (result == 0)
                    {
                        result = HandleReverse(CompareName(leftSim.FirstName, rightSim.FirstName));

                        if (result == 0)
                        {
                            return NextSort(left, right);
                        }
                    }

                    return result;
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #15
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortByAge(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    int result = HandleReverse(leftSim.Age.CompareTo(rightSim.Age));

                    if (result == 0)
                    {
                        result = HandleReverse(leftSim.AgingYearsSinceLastAgeTransition.CompareTo(rightSim.AgingYearsSinceLastAgeTransition));

                        if (result == 0)
                        {
                            result = NextSort(left, right);
                            if (result == 0)
                            {
                                return leftSim.FullName.CompareTo(rightSim.FullName);
                            }
                        }
                    }

                    return result;
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #16
0
ファイル: SimDisplayEx.cs プロジェクト: Robobeurre/NRaas
 public static void UpdateMagicMotiveBar(SimDisplay ths, SimInfo info)
 {
     if (((info != null) && (info.OccultInfo != null)) && (IsOccult(info)))
     {
         ths.mMagicMotiveBarWindow.Visible = true;
         OnMotivesChanged(ths, info);
     }
     else
     {
         ths.mMagicMotiveBarWindow.Visible = false;
     }
 }
コード例 #17
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void OnTraitsChangedProxy(SimInfo info)
 {
     try
     {
         if (TraitsChanged != null)
         {
             TraitsChanged(info);
         }
     }
     catch (Exception e)
     {
         Common.Exception(info.mName, e);
     }
 }
コード例 #18
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
        public void UpdateButton(ref Skewer.SkewerItem item, SimInfo info, bool bUpdateThumbnail, bool bUseCurrentThumbAsPlaceholder)
        {
            try
            {
                Skewer.Instance.UpdateButton(ref item, info, bUpdateThumbnail, bUseCurrentThumbAsPlaceholder);

                if (item.mGoButton != null)
                {
                    item.mGoButton.Visible = ShouldShowGoHomeButtonForSim(item.mSimInfo.mGuid);
                }
            }
            catch (Exception e)
            {
                Common.Exception(info.mName, e);
            }
        }
コード例 #19
0
ファイル: SimInfoDbMgr.cs プロジェクト: kennebel/CoreSimFun
        public bool RemoveSimInfo(SimInfo si)
        {
            SimInfos.RemoveSimInfo(si);

            return(UnitOfWork.Commit() > 0);
        }
コード例 #20
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            protected int NextSort(SimInfo left, SimInfo right)
            {
                if (mOrder >= 2) return 0;

                Sorter sorter = new Sorter(mOrder + 1);

                SorterFunc sort = sorter.GetSort();
                if (sort == null) return 0;

                return sort(left, right);
            }
コード例 #21
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
        public void OnHouseholdSimButtonMouseDown(WindowBase sender, UIMouseEventArgs eventArgs)
        {
            try
            {
                if (Skewer.Instance == null) return;

                IHudModel hudModel = Skewer.Instance.mHudModel;
                if (hudModel == null) return;

                Button button = sender as Button;
                if ((button != null) && (button.Tag != null))
                {
                    Sims3.UI.Responder.Instance.TutorialModel.TriggerTutorial(TutorialTriggers.SimSkewerClicked);
                    SimInfo tag = (SimInfo)button.Tag;

                    if (eventArgs.MouseKey == MouseKeys.kMouseLeft)
                    {
                        if ((eventArgs.Modifiers & (Modifiers.kModifierMaskControl|Modifiers.kModifierMaskShift)) != 0)
                        {
                            new ShowMenuTask(tag, false).AddToSimulator();
                        }
                        else
                        {
                            if ((mPreviousInfo != null) && (Matches(mPreviousInfo, tag)))
                            {
                                if (Skewer.Instance.mDoubleClickTimer.IsRunning() && (Skewer.Instance.mDoubleClickTimer.GetElapsedTimeFloat() < 0.5f))
                                {
                                    if (PortraitPanel.Settings.mMenuOnLeftClick)
                                    {
                                        new ShowMenuTask(tag, true).AddToSimulator();
                                    }
                                }
                            }

                            if ((Sim.ActiveActor != null) && (Sim.ActiveActor.ObjectId == tag.mGuid))
                            {
                                hudModel.MoveCameraToSim(tag.mGuid);
                            }
                            else if (!SelectSim(tag.mGuid))
                            {
                                if (hudModel.GetCurrentSimInfo() != null)
                                {
                                    if (Sims3.UI.Responder.Instance.PassportModel.IsSimRecallableFromPassport(tag))
                                    {
                                        hudModel.CheckPassportForRecall(tag);
                                    }

                                    OnSimChanged(hudModel.GetCurrentSimInfo().mGuid);
                                }
                            }

                            Skewer.Instance.mDoubleClickTimer.Restart();
                            mPreviousInfo = tag;
                        }

                        eventArgs.Handled = true;
                    }
                    else if (eventArgs.MouseKey == MouseKeys.kMouseRight)
                    {
                        bool following = false;

                        foreach(Skewer.SkewerItem item in mHouseholdItems)
                        {
                            if (Matches(item.mSimInfo, tag))
                            {
                                following = item.mbShouldShowFollowNotify;
                                break;
                            }
                        }

                        if ((following) || (PortraitPanel.Settings.mZoomInOnRightClick))
                        {
                            hudModel.AttachCameraToSim(tag.mGuid);
                        }
                        else
                        {
                            AttachCameraToSim(tag.mGuid);
                        }

                        if (!Matches(hudModel.GetCurrentSimInfo(), tag))
                        {
                            button.Selected = false;
                        }

                        eventArgs.Handled = true;
                    }
                    else if (eventArgs.MouseKey == MouseKeys.kMouseMiddle)
                    {
                        new ShowMenuTask(tag, false).AddToSimulator();
                        eventArgs.Handled = true;
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnHouseholdSimButtonMouseDown", exception);
            }
        }
コード例 #22
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void CheckPassportForRecall(SimInfo info)
 {
     mHudModel.CheckPassportForRecall(info);
 }
コード例 #23
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortByAutonomy(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    int result = HandleReverse(IsIdle(leftSim.CreatedSim).CompareTo(IsIdle(rightSim.CreatedSim)));

                    if (result == 0)
                    {
                        return NextSort(left, right);
                    }
                    else
                    {
                        return result;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #24
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void UpdateSimInfo(SimInfo info, SimUpdateContext context)
 {
     mHudModel.UpdateSimInfo(info, context);
 }
コード例 #25
0
ファイル: PersistedSettings.cs プロジェクト: Robobeurre/NRaas
        public SimDescription GetSim(SimInfo info)
        {
            if (info.UninstantiatedSimDescriptionId == 0)
            {
                Sim sim = Sim.GetObject(info.mGuid) as Sim;
                if (sim == null) return null;

                return sim.SimDescription;
            }
            else
            {
                return GetSim(info.UninstantiatedSimDescriptionId);
            }
        }
コード例 #26
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void GetCurrentSimInfluence(SimInfo info, ref int nerdLevel, ref int rebelLevel, ref int socialiteLevel)
 {
     mHudModel.GetCurrentSimInfluence(info, ref nerdLevel, ref rebelLevel, ref socialiteLevel);
 }
コード例 #27
0
 public bool RemoveSimInfo(SimInfo si)
 {
     return(DB.SimInfos.Remove(si) != null);
 }
コード例 #28
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void CheckPassportForRecallFromBook(SimInfo info, PASSPORTSLOT slot, bool wasPaused)
 {
     mHudModel.CheckPassportForRecallFromBook(info, slot, wasPaused);
 }
コード例 #29
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortBySelectability(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    int result = HandleReverse(leftSim.IsNeverSelectable.CompareTo(rightSim.IsNeverSelectable));

                    if (result == 0)
                    {
                        return NextSort(left, right);
                    }
                    else
                    {
                        return result;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #30
0
ファイル: SimDisplayEx.cs プロジェクト: Robobeurre/NRaas
        private static void OnMotivesChanged(SimDisplay ths, SimInfo info)
        {
            if ((info != null) && ths.mMagicMotiveBarWindow.Visible)
            {
                Sim actor = Sim.ActiveActor;
                if (actor == null) return;

                float leftExtent = -1;
                float rightExtent = 0;

                bool dual = false;

                if (actor.Motives != null)
                {
                    OccultTypes selection;
                    rightExtent = GetMagicLevel(actor, OccultTypes.None, out selection);

                    if (selection != OccultTypes.None)
                    {
                        dual = true;

                        OccultTypes selection2;
                        float value = GetMagicLevel(actor, selection, out selection2);

                        if (selection2 != OccultTypes.None)
                        {
                            leftExtent = rightExtent;
                            rightExtent = value;
                        }
                        else
                        {
                            dual = false;
                        }
                    }
                }

                Rect area = ths.mMagicMotiveSizeControlWin.Area;

                if (sMagicMotiveSizeControlLeft == -1)
                {
                    sMagicMotiveSizeControlLeft = area.TopLeft.x;
                }

                float leftFactor = 0;
                float rightFactor = (rightExtent + 100f) / 200f;

                if (dual)
                {
                    leftFactor = (100 - leftExtent) / 400f;
                    rightFactor /= 2f;
                    rightFactor += 0.5f;
                }

                if (Common.kDebugging)
                {
                    //Common.DebugNotify("Left: " + leftExtent + "\nRight: " + rightExtent + "\nDual: " + dual + "\nLeftFactor: " + leftFactor + "\nRightFactor: " + rightFactor);
                }

                area.Set(sMagicMotiveSizeControlLeft + (leftFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.TopLeft.y, sMagicMotiveSizeControlLeft + (rightFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.BottomRight.y);

                ths.mMagicMotiveSizeControlWin.Area = area;
                if (ths.mFlashMagicMotiveBar)
                {
                    ths.mMagicMotiveChangeWindow.Visible = true;
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(ths.OnMagicMotiveChangeFinish, StopWatch.TickStyles.Seconds, 3f));
                    ths.mFlashMagicMotiveBar = false;
                }
            }
        }
コード例 #31
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
        protected static bool Matches(SimInfo left, SimInfo right)
        {
            if ((left == null) || (right == null)) return false;

            if (left.mGuid == right.mGuid) return true;

            if (left.UninstantiatedSimDescriptionId == 0) return false;

            return (left.UninstantiatedSimDescriptionId == right.UninstantiatedSimDescriptionId);
        }
コード例 #32
0
        private void OnHouseholdSimChanged(Sims3.Gameplay.CAS.HouseholdEvent householdEvent, IActor actor, Household oldHousehold)
        {
            Common.StringBuilder msg = new Common.StringBuilder("OnHouseholdSimChanged");

            try
            {
                HudModel ths = Sims3.UI.Responder.Instance.HudModel as HudModel;

                if (ths.HouseholdChanged != null)
                {
                    msg += "A";

                    if (householdEvent != Sims3.Gameplay.CAS.HouseholdEvent.kNone)
                    {
                        msg += "B";

                        ths.ClearSimList();
                        if ((ths.mCurrentHousehold != null) && (ths.mCurrentHousehold.CurrentMembers != null))
                        {
                            msg += "C";

                            int count = ths.mCurrentHousehold.CurrentMembers.Count;
                            for (int i = 0x0; i < count; i++)
                            {
                                msg += "D";

                                Household.Member member = ths.mCurrentHousehold.CurrentMembers[i];
                                SimInfo          item   = ths.CreateSimInfo(member.mSimDescription);
                                if (item != null)
                                {
                                    msg += "E";

                                    ths.mSimList.Add(item);
                                }
                            }
                            ths.mSimList.Sort();
                        }
                    }

                    /*
                     * switch (householdEvent)
                     * {
                     *  case Sims3.Gameplay.CAS.HouseholdEvent.kSimAdded:
                     *      ths.HouseholdChanged(HouseholdEvent.SimAdded, actor.ObjectId);
                     *      break;
                     *
                     *  case Sims3.Gameplay.CAS.HouseholdEvent.kSimRemoved:
                     *      ths.HouseholdChanged(HouseholdEvent.SimRemoved, actor.ObjectId);
                     *      break;
                     * }
                     */
                }
                ths.UpdateHouseholdThumb();
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
            finally
            {
                Common.DebugNotify(msg);
            }
        }
コード例 #33
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
 public void OnMoodValueChanged(SimInfo info)
 {
     try
     {
         if (PortraitPanel.Settings.mSortType == SortType.ByMood)
         {
             mUpdateNeeded = true;
         }
         else
         {
             Skewer.Instance.UpdateForMoodValueChange(ref mHouseholdItems, info);
         }
     }
     catch (Exception exception)
     {
         Common.Exception(info.mName, exception);
     }
 }
コード例 #34
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
 public ShowMenuTask(SimInfo tag, bool forceListing)
 {
     mTag = tag;
     mForceListing = forceListing;
 }
コード例 #35
0
ファイル: SimInfoDbMgr.cs プロジェクト: kennebel/CoreSimFun
        public bool UpsertSimInfo(SimInfo save)
        {
            SimInfos.UpsertSimInfo(save);

            return(UnitOfWork.Commit() > 0);
        }
コード例 #36
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortByRelationship(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription active = Sim.ActiveActor.SimDescription;
                    if (Sim.ActiveActor == null) return 0;

                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    float leftLiking = float.MinValue;

                    if (active == leftSim)
                    {
                        leftLiking = float.MaxValue;
                    }
                    else
                    {
                        Relationship leftRelation = Relationship.Get(active, leftSim, false);
                        if (leftRelation != null)
                        {
                            leftLiking = leftRelation.CurrentLTRLiking;
                        }
                    }

                    float rightLiking = float.MinValue;

                    if (active == rightSim)
                    {
                        rightLiking = float.MaxValue;
                    }
                    else
                    {
                        Relationship rightRelation = Relationship.Get(active, rightSim, false);
                        if (rightRelation != null)
                        {
                            rightLiking = rightRelation.CurrentLTRLiking;
                        }
                    }

                    int result = HandleReverse(leftLiking.CompareTo(rightLiking));

                    if (result == 0)
                    {
                        return NextSort(left, right);
                    }
                    else
                    {
                        return result;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #37
0
ファイル: SimDisplayEx.cs プロジェクト: yakoder/NRaas
        private static void OnMotivesChanged(SimDisplay ths, SimInfo info)
        {
            if ((info != null) && ths.mMagicMotiveBarWindow.Visible)
            {
                Sim actor = Sim.ActiveActor;
                if (actor == null)
                {
                    return;
                }

                float leftExtent  = -1;
                float rightExtent = 0;

                bool dual = false;

                if (actor.Motives != null)
                {
                    OccultTypes selection;
                    rightExtent = GetMagicLevel(actor, OccultTypes.None, out selection);

                    if (selection != OccultTypes.None)
                    {
                        dual = true;

                        OccultTypes selection2;
                        float       value = GetMagicLevel(actor, selection, out selection2);

                        if (selection2 != OccultTypes.None)
                        {
                            leftExtent  = rightExtent;
                            rightExtent = value;
                        }
                        else
                        {
                            dual = false;
                        }
                    }
                }

                Rect area = ths.mMagicMotiveSizeControlWin.Area;

                if (sMagicMotiveSizeControlLeft == -1)
                {
                    sMagicMotiveSizeControlLeft = area.TopLeft.x;
                }

                float leftFactor  = 0;
                float rightFactor = (rightExtent + 100f) / 200f;

                if (dual)
                {
                    leftFactor   = (100 - leftExtent) / 400f;
                    rightFactor /= 2f;
                    rightFactor += 0.5f;
                }

                if (Common.kDebugging)
                {
                    //Common.DebugNotify("Left: " + leftExtent + "\nRight: " + rightExtent + "\nDual: " + dual + "\nLeftFactor: " + leftFactor + "\nRightFactor: " + rightFactor);
                }

                area.Set(sMagicMotiveSizeControlLeft + (leftFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.TopLeft.y, sMagicMotiveSizeControlLeft + (rightFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.BottomRight.y);

                ths.mMagicMotiveSizeControlWin.Area = area;
                if (ths.mFlashMagicMotiveBar)
                {
                    ths.mMagicMotiveChangeWindow.Visible = true;
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(ths.OnMagicMotiveChangeFinish, StopWatch.TickStyles.Seconds, 3f));
                    ths.mFlashMagicMotiveBar = false;
                }
            }
        }
コード例 #38
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortActiveHousehold(SimInfo left, SimInfo right)
            {
                try
                {
                    SimDescription leftSim = PortraitPanel.Settings.GetSim(left);
                    if (leftSim == null) return -1;

                    SimDescription rightSim = PortraitPanel.Settings.GetSim(right);
                    if (rightSim == null) return 1;

                    // Intentionally negated to push active sims to the bottom of the list
                    int result = -HandleReverse((leftSim.Household == Household.ActiveHousehold).CompareTo(rightSim.Household == Household.ActiveHousehold));

                    if (result == 0)
                    {
                        return NextSort(left, right);
                    }
                    else
                    {
                        return result;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #39
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
            public int OnSortByMood(SimInfo left, SimInfo right)
            {
                try
                {
                    int result = HandleReverse(left.mMoodValue.CompareTo(right.mMoodValue));

                    if (result == 0)
                    {
                        return NextSort(left, right);
                    }
                    else
                    {
                        return result;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(left.mName + " - " + right.mName, e);
                    return 0;
                }
            }
コード例 #40
0
ファイル: HudModelProxy.cs プロジェクト: Robobeurre/NRaas
 public void OnSimMotivesChangedProxy(SimInfo info)
 {
     try
     {
         if (SimMotivesChanged != null)
         {
             SimMotivesChanged(info);
         }
     }
     catch (Exception e)
     {
         Common.Exception(info.mName, e);
     }
 }
コード例 #41
0
        public static void OnMotivesChanged(MotivesPanel ths, SimInfo info)
        {
            Sim sim = Sim.ActiveActor;

            if (sim.SimDescription.IsMummy)
            {
                ths.mBladderMummyWraps.Visible   = true;
                ths.mEnergyMummyWraps.Visible    = true;
                ths.mBladderMotiveText.TextColor = new Color(0xffcbc7b6);
                ths.mEnergyMotiveText.TextColor  = new Color(0xffcbc7b6);
            }
            else
            {
                ths.mBladderMummyWraps.Visible   = false;
                ths.mEnergyMummyWraps.Visible    = false;
                ths.mBladderMotiveText.TextColor = new Color(ths.mDefaultMotiveTextColor);
                ths.mEnergyMotiveText.TextColor  = new Color(ths.mDefaultMotiveTextColor);
            }

            if (sim.SimDescription.IsFrankenstein)
            {
                ths.mHygieneFrankenSimWraps.Visible = true;
            }
            else
            {
                ths.mHygieneFrankenSimWraps.Visible = false;
            }

            if (sim.SimDescription.IsEP11Bot)
            {
                ths.mScrollBorderOverlayRobot.Visible = true;
                ths.mSocialRobotLock.Visible          = !ths.mHudModel.RobotSocialMotiveEnabled;
                ths.mHygieneRobotLock.Visible         = !ths.mHudModel.RobotFunMotiveEnabled;
            }
            else
            {
                ths.mScrollBorderOverlayRobot.Visible = false;
                ths.mSocialRobotLock.Visible          = false;
                ths.mHygieneRobotLock.Visible         = false;
            }

            if (sim.SimDescription.IsVampire)
            {
                ths.mScrollBorderOverlay.Visible        = false;
                ths.mScrollBorderOverlayVampire.Visible = true;
            }
            else
            {
                ths.mScrollBorderOverlay.Visible        = true;
                ths.mScrollBorderOverlayVampire.Visible = false;
            }

            if (sim.SimDescription.IsUnicorn)
            {
                ths.mScrollBorderOverlayUnicorn.Visible = true;
                if (info.mAge == CASAgeGenderFlags.Child)
                {
                    ths.mScrollBorderOverlayUnicornFun.Visible = false;
                }
                else
                {
                    ths.mScrollBorderOverlayUnicornFun.Visible = true;
                }
            }
            else
            {
                ths.mScrollBorderOverlayUnicorn.Visible    = false;
                ths.mScrollBorderOverlayUnicornFun.Visible = false;
            }

            if (sim.SimDescription.IsGenie)
            {
                ths.mHungerGenieSparkle.Visible       = info.OccultInfo.ShowMotiveOverlays;
                ths.mBladderGenieSparkle.Visible      = info.OccultInfo.ShowMotiveOverlays;
                ths.mEnergyGenieSparkle.Visible       = info.OccultInfo.ShowMotiveOverlays;
                ths.mSocialGenieSparkle.Visible       = info.OccultInfo.ShowMotiveOverlays;
                ths.mHygieneGenieSparkle.Visible      = info.OccultInfo.ShowMotiveOverlays;
                ths.mFunGenieSparkle.Visible          = info.OccultInfo.ShowMotiveOverlays;
                ths.mScrollBorderOverlay.Visible      = false;
                ths.mScrollBorderOverlayGenie.Visible = true;
            }
            else
            {
                ths.mHungerGenieSparkle.Visible       = false;
                ths.mBladderGenieSparkle.Visible      = false;
                ths.mEnergyGenieSparkle.Visible       = false;
                ths.mSocialGenieSparkle.Visible       = false;
                ths.mHygieneGenieSparkle.Visible      = false;
                ths.mFunGenieSparkle.Visible          = false;
                ths.mScrollBorderOverlay.Visible      = true;
                ths.mScrollBorderOverlayGenie.Visible = false;
            }

            if (sim.SimDescription.IsPlantSim)
            {
                ths.mBladderPlantSimWraps.Visible = true;
                ths.mHungerPlantSimWraps.Visible  = true;
                switch (info.mAge)
                {
                case CASAgeGenderFlags.Baby:
                case CASAgeGenderFlags.Toddler:
                    ths.mHygienePlantSimWraps.Visible = true;
                    break;

                default:
                    ths.mHygienePlantSimWraps.Visible = false;
                    break;
                }
            }
            else
            {
                ths.mBladderPlantSimWraps.Visible = false;
                ths.mHungerPlantSimWraps.Visible  = false;
                ths.mHygienePlantSimWraps.Visible = false;
            }

            ths.mBladderMotiveText.Caption = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Bladder));
            ths.mEnergyMotiveText.Caption  = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Energy));
            ths.mFunMotiveText.Caption     = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Fun));
            ths.mHungerMotiveText.Caption  = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Hunger));
            ths.mSocialMotiveText.Caption  = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Social));
            ths.mHygieneMotiveText.Caption = Common.LocalizeEAString(info.OccultInfo.GetMotiveNameKey(MotiveID.Hygiene));

            if (info.mIsFoal)
            {
                ths.mMotiveFunTopWin.Visible = false;
            }

            /* Performed by Core update, doing it again makes the needs bar flucuate
             * for (int i = 0x0; i < ths.mMotiveCount; i++)
             * {
             *  ths.UpdateMotiveBar(i, info);
             * }
             */
        }
コード例 #42
0
ファイル: SkewerEx.cs プロジェクト: Robobeurre/NRaas
        public bool UpdateForMoodChange(ref Skewer.SkewerItem[] skewerItems, SimInfo simInfo, bool bUpdateThumbnails)
        {
            if (simInfo != null)
            {
                for (int i = 0x0; i < skewerItems.Length; i++)
                {
                    if (Matches(skewerItems[i].mSimInfo, simInfo))
                    {
                        UpdateButton(ref skewerItems[i], simInfo, bUpdateThumbnails, true);

                        return true;
                    }
                }
            }
            return false;
        }