Exemple #1
0
        /// <summary>
        /// Draw item.
        /// </summary>
        public override void Draw()
        {
            base.Draw();
            string caption = Collection == null ?
                             (_items.Count > 0 ? _items[Index].ToString() : " ") :
                             (Collection.Count > 0 ? Collection[Index].DisplayText : " ");
            int offset = StringMeasurer.MeasureString(caption);

            _itemText.Color = Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148);

            _itemText.Caption = caption;

            _arrowLeft.Color  = Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148);
            _arrowRight.Color = Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148);

            _arrowLeft.Position = new Point(375 - offset + Offset.X + Parent.WidthOffset, _arrowLeft.Position.Y);
            if (Selected)
            {
                _arrowLeft.Draw();
                _arrowRight.Draw();
                _itemText.Position = new Point(405 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            else
            {
                _itemText.Position = new Point(420 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            _itemText.Draw();
        }
Exemple #2
0
        public override void Draw(int interval)
        {
            SizeF res  = UIMenu.GetScreenResolutionMantainRatio();
            Point safe = UIMenu.GetSafezoneBounds();

            base.Draw(interval);
            ResText.Draw(Text, new Point((int)res.Width - safe.X - 10, (int)res.Height - safe.Y - (42 + (4 * interval))), 0.5f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
        }
Exemple #3
0
        public virtual void Draw(int interval)
        {
            SizeF res  = UIMenu.GetScreenResolutionMantainRatio();
            Point safe = UIMenu.GetSafezoneBounds();

            ResText.Draw(Label, new Point((int)res.Width - safe.X - 180, (int)res.Height - safe.Y - (30 + (4 * interval))), 0.3f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
            Sprite.Draw("timerbars", "all_black_bg", new Point((int)res.Width - safe.X - 298, (int)res.Height - safe.Y - (40 + (4 * interval))), new Size(300, 37), 0f, Color.FromArgb(180, 255, 255, 255));

            NativeFunction.Natives.HideHudComponentThisFrame(7); //AreaName
            NativeFunction.Natives.HideHudComponentThisFrame(9); //StreetName
            NativeFunction.Natives.HideHudComponentThisFrame(6); //VehicleName
        }
Exemple #4
0
        /// <summary>
        /// Draw this item.
        /// </summary>
        public virtual void Draw()
        {
            _rectangle.Size      = new Size(431 + Parent.WidthOffset, 38);
            _selectedSprite.Size = new Size(431 + Parent.WidthOffset, 38);

            if (Hovered && !Selected)
            {
                _rectangle.Color = Color.FromArgb(20, 255, 255, 255);
                _rectangle.Draw();
            }

            _selectedSprite.Color = Selected ? HighlightedBackColor : BackColor;
            _selectedSprite.Draw();

            _text.Color = Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148);

            if (LeftBadge != BadgeStyle.None)
            {
                _text.Position = new Point(35 + Offset.X, _text.Position.Y);
                _badgeLeft.TextureDictionary = BadgeToSpriteLib(LeftBadge);
                _badgeLeft.TextureName       = BadgeToSpriteName(LeftBadge, Selected);
                _badgeLeft.Color             = IsBagdeWhiteSprite(LeftBadge) ? Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148) : Color.White;
                _badgeLeft.Draw();
            }
            else
            {
                _text.Position = new Point(8 + Offset.X, _text.Position.Y);
            }

            if (RightBadge != BadgeStyle.None)
            {
                _badgeRight.Position          = new Point(385 + Offset.X + Parent.WidthOffset, _badgeRight.Position.Y);
                _badgeRight.TextureDictionary = BadgeToSpriteLib(RightBadge);
                _badgeRight.TextureName       = BadgeToSpriteName(RightBadge, Selected);
                _badgeRight.Color             = IsBagdeWhiteSprite(RightBadge) ? Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148) : Color.White;
                _badgeRight.Draw();
            }

            if (!String.IsNullOrWhiteSpace(RightLabel))
            {
                _labelText.Position = new Point(420 + Offset.X + Parent.WidthOffset, _labelText.Position.Y);
                _labelText.Caption  = RightLabel;
                _labelText.Color    = _text.Color = Enabled ? Selected ? HighlightedForeColor : ForeColor : Color.FromArgb(163, 159, 148);
                _labelText.Draw();
            }
            _text.Draw();
        }
Exemple #5
0
        protected virtual void Draw()
        {
            SizeF res    = UIMenu.GetScreenResolutionMantainRatio();
            int   middle = (int)(res.Width / 2);

            Sprite.Draw("mpentry", "mp_modenotselected_gradient", new Point(0, 10), new Size((int)res.Width, 450 + (Items.Count * 40)), 0.0f, Color.FromArgb(200, 255, 255, 255));

            ResText.Draw(Title, new Point(middle, 100), 2.5f, Color.FromArgb(255, 199, 168, 87), Common.EFont.Pricedown, true);

            ResText.Draw(Subtitle, new Point(middle, 230), 0.5f, Color.White, Common.EFont.ChaletLondon, true);
            ResRectangle.Draw(new Point(middle - 300, 290), new Size(600, 2), Color.White);

            for (int i = 0; i < Items.Count; i++)
            {
                MissionPassedScreenItem item = Items[i];

                ResText.Draw(item.Label, new Point(middle - 230, 300 + (40 * i)), 0.35f, Color.White, Common.EFont.ChaletLondon, false);
                ResText.Draw(item.Status, new Point(item.Tickbox == MissionPassedScreenItem.TickboxState.None ? middle + 265 : middle + 230, 300 + (40 * i)), 0.35f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);

                if (item.Tickbox == MissionPassedScreenItem.TickboxState.None)
                {
                    continue;
                }

                string spriteName;
                if (item.Tickbox == MissionPassedScreenItem.TickboxState.Tick)
                {
                    spriteName = "shop_box_tick";
                }
                else if (item.Tickbox == MissionPassedScreenItem.TickboxState.Cross)
                {
                    spriteName = "shop_box_cross";
                }
                else
                {
                    spriteName = "shop_box_blank";
                }

                Sprite.Draw("commonmenu", spriteName, new Point(middle + 230, 290 + (40 * i)), new Size(48, 48), 0.0f, Color.White);
            }

            ResRectangle.Draw(new Point(middle - 300, 300 + (40 * Items.Count)), new Size(600, 2), Color.White);

            ResText.Draw("Completion", new Point(middle - 150, 320 + (40 * Items.Count)), 0.4f, Color.White, Common.EFont.ChaletLondon, false);
            ResText.Draw(CompletionPercentage + "%", new Point(middle + 150, 320 + (40 * Items.Count)), 0.4f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);

            string medalSprite;

            if (Medal == MedalType.Silver)
            {
                medalSprite = "silvermedal";
            }
            else if (Medal == MedalType.Gold)
            {
                medalSprite = "goldmedal";
            }
            else
            {
                medalSprite = "bronzemedal";
            }

            Sprite.Draw("mpmissionend", medalSprite, new Point(middle + 150, 320 + (40 * Items.Count)), new Size(32, 32), 0.0f, Color.White);

            InstructionalButtons.Draw();
        }
        public void Load(MissionData mission)
        {
            CurrentStage = -1;
            CurrentObjectives = new List<SerializableObjective>();
            CurrentMission = mission;
            IsMissionPlaying = true;

            if (mission.Objectives.Count == 0)
            {
                Game.DisplayNotification("No spawnpoint found for stage 0.");
                AbortMission();
                return;
            }

            _oldModel = Game.LocalPlayer.Model;
            _oldPos = Game.LocalPlayer.Character.Position;
            
            GameFiber.StartNew(delegate
            {
                Game.FadeScreenOut(1000, true);
                LoadInteriors();

                World.Weather = CurrentMission.Weather;
                World.TimeOfDay = new TimeSpan(CurrentMission.Time, 0, 0);

                var res = UIMenu.GetScreenResolutionMantainRatio();

                var name = new ResText(CurrentMission.Name, new Point((int)res.Width - 100, (int)res.Height - 100), 0.7f, Color.WhiteSmoke, Common.EFont.HouseScript, ResText.Alignment.Right);
                name.Outline = true;

                GameFiber.StartNew(delegate
                {
                    DateTime start = DateTime.Now;
                    while (DateTime.Now.Subtract(start).TotalMilliseconds < 10000)
                    {
                        name.Draw();
                        GameFiber.Yield();
                    }
                });

                var startTime = Game.GameTime;

                while (IsMissionPlaying)
                {
                    Game.MaxWantedLevel = CurrentMission.MaxWanted;
                    if (Game.LocalPlayer.WantedLevel < CurrentMission.MinWanted)
                        Game.LocalPlayer.WantedLevel = CurrentMission.MinWanted;

                    if (Game.LocalPlayer.Character.IsDead)
                    {
                        FailMission(true);
                        break;
                    }

                    if (CurrentMission.TimeLimit.HasValue)
                    {
                        var elapsed = TimeSpan.FromMilliseconds(Convert.ToDouble((CurrentMission.TimeLimit.Value*1000) - (Game.GameTime - startTime)));
                        if(TimerBars != null)
                            TimerBars.UpdateValue("GLOBAL_TIME", "TIME", false, string.Format("{0:D2}:{1:D2}.{2:D3}", elapsed.Minutes, elapsed.Seconds, elapsed.Milliseconds));
                    }

                    if (CurrentMission.TimeLimit.HasValue && (Game.GameTime - startTime) > CurrentMission.TimeLimit*1000)
                    {
                        FailMission(reason: "You have run out of time.");
                        break;
                    }

                    if (CurrentObjectives.Count == 0)
                    {
                        AdvanceStage();
                        if (!CurrentMission.Objectives.Any(o => o.ActivateAfter >= CurrentStage))
                        {
                            SucceedMission();
                        }
                    }

                    TimerBars?.Draw();
                    GameFiber.Yield();
                }

                UnloadInteriors();

            });

        }