public override void Update(UpdateState state)
 {
     UpdateMotives();
     base.Update(state);
     if (Opacity < 1)
     {
         if (DynamicOverlay.GetChildren().Count > 0)
         {
             foreach (var m in MotiveDisplays)
             {
                 DynamicOverlay.Remove(m);
                 Add(m);
             }
         }
         Invalidate();
     }
     else
     {
         if (DynamicOverlay.GetChildren().Count == 0)
         {
             foreach (var m in MotiveDisplays)
             {
                 Remove(m);
                 DynamicOverlay.Add(m);
                 Invalidate();
             }
         }
     }
 }
Example #2
0
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible || Opacity == 0)
            {
                return;
            }

            DrawLocalTexture(batch, ShadowImg, null, Vector2.Zero, Vector2.One, Color.Black * 0.5f);
            if (Target != null)
            {
                var effect = LotView.WorldContent.SpriteEffect;
                batch.SetEffect(effect);

                effect.CurrentTechnique = effect.Techniques["StickyEffect"];
                var off = ((Position + Size * Scale / 2) - ContainerSize / 2).X * -0.001f * (Size.Y / 240f);
                effect.Parameters["stickyOffset"].SetValue(off * OffsetMultiplier);
                effect.Parameters["stickyPersp"].SetValue((Size.Y / 240f) * -0.2f);

                DrawLocalTexture(batch, Target,
                                 new Rectangle((int)(-100 * ScaleX), 0, (int)(Target.Width + 200 * ScaleX), Target.Height),
                                 -(BackOffset.ToVector2() + new Vector2(100, 0)), new Vector2(1 / (Scale.X), 1 / (Scale.Y)));
                batch.SetEffect();
            }
            DynamicOverlay.GetChildren().ForEach(x =>
            {
                if (x.Opacity != Opacity)
                {
                    x.Opacity = Opacity;
                }
            });
            DynamicOverlay.Draw(batch);
        }
Example #3
0
        public void Fade(float opacity)
        {
            var elems = DynamicOverlay.GetChildren().ToList();

            if (opacity == 1f)
            {
                MayorPostsScroll     = MayorPostsScroll;
                SystemPostsScroll    = SystemPostsScroll;
                CommunityPostsScroll = CommunityPostsScroll;
                LastMayorPost.ScaleX = LastMayorPost.ScaleY = 1f;
                foreach (var elem in MayorPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }
                foreach (var elem in SystemPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }
                LastCommunityPost.ScaleX = LastCommunityPost.ScaleY = 1f;
                foreach (var elem in CommunityPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }

                NoPostMayor.Opacity     = 1;
                NoPostCommunity.Opacity = 1;
                NoPostSystem.Opacity    = 1;

                UpdateScrollButtons();
                elems.RemoveAll(x => x.Opacity == 0 && x is UIMediumBulletinSummary);
                foreach (var elem in elems)
                {
                    elem.Opacity = 0;
                }
            }
            foreach (var child in elems)
            {
                GameFacade.Screens.Tween.To(child, 0.66f, new Dictionary <string, float>()
                {
                    { "Opacity", opacity }
                }, (Opacity == 0) ? TweenQuad.EaseIn : TweenQuad.EaseOut);
            }

            GameFacade.Screens.Tween.To(this, 0.66f, new Dictionary <string, float>()
            {
                { "Opacity", opacity }
            }, (Opacity == 0) ? TweenQuad.EaseIn : TweenQuad.EaseOut);
        }
Example #4
0
        public override void Update(UpdateState state)
        {
            base.Update(state);

            if (Opacity < 1)
            {
                if (DynamicOverlay.GetChildren().Count > 0)
                {
                    DynamicOverlay.Remove(PerformanceBar);
                    Add(PerformanceBar);
                }
            }
            else
            {
                if (DynamicOverlay.GetChildren().Count == 0)
                {
                    Remove(PerformanceBar);
                    DynamicOverlay.Add(PerformanceBar);
                }
            }
            var sel = Game.SelectedAvatar;

            if (sel == null)
            {
                return;
            }
            var type        = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobType);
            var level       = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPromotionLevel);
            var performance = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPerformance);

            var job = Content.Get().Jobs.GetJob((ushort)type);

            if (job == null)
            {
                if (LastPerformance != -200)
                {
                    JobTitle.Caption         = "Unemployed";
                    SalaryTitle.Caption      = "";
                    PerformanceBar.Visible   = false;
                    PerformanceTitle.Visible = false;

                    LastJobLevel    = null;
                    LastPerformance = -200;
                }
            }
            else
            {
                var myLevel = job.JobLevels[level];

                if (myLevel != LastJobLevel)
                {
                    JobTitle.Caption    = myLevel.JobName;
                    SalaryTitle.Caption = "Salary: ยง" + myLevel.Salary + " (" + ToTime(myLevel.StartTime) + "-" + ToTime(myLevel.EndTime) + ")";

                    LastJobLevel = myLevel;
                }

                if (LastPerformance != performance)
                {
                    PerformanceBar.Visible     = true;
                    PerformanceTitle.Visible   = true;
                    PerformanceBar.MotiveValue = performance;
                    LastPerformance            = performance;
                }
                for (int i = 0; i < 6; i++)
                {
                    Skills[i].Needed = myLevel.MinRequired[i + 1] / 100;
                }
            }

            for (int i = 0; i < 6; i++)
            {
                Skills[i].Value = sel.GetPersonData(SkillInd[i]) / 100;
            }
        }