Exemplo n.º 1
0
        public override void Draw(Size offset)
        {
            HeaderColor = Color.White;

            var container = new UIContainer(new Point(), new Size(UI.WIDTH, UI.HEIGHT), Color.FromArgb(180, 45, 45, 45));

            container.Items.Add(new UIRectangle(new Point(0, UI.HEIGHT / 2 - 40), new Size(UI.WIDTH, 45), TopColor));
            container.Items.Add(new UIText(_headerCaption.ToUpper(), new Point(UI.WIDTH / 2, UI.HEIGHT / 2 - 40 + 5), HeaderScale, HeaderColor, 0, true));

            container.Items.Add(new UIRectangle(new Point(0, UI.HEIGHT / 2 - 40 + 45), new Size(UI.WIDTH, 20), SelectedIndex == 0 ? SelectedItemColor : UnselectedItemColor));
            container.Items.Add(new UIText("- " + _yesText + " -", new Point(UI.WIDTH / 2, UI.HEIGHT / 2 - 40 + 45), 0.3f, SelectedIndex == 0 ? SelectedTextColor : UnselectedTextColor, 0, true));

            container.Items.Add(new UIRectangle(new Point(0, UI.HEIGHT / 2 - 40 + 65), new Size(UI.WIDTH, 20), SelectedIndex == 1 ? SelectedItemColor : UnselectedItemColor));
            container.Items.Add(new UIText("- " + _noText + " -", new Point(UI.WIDTH / 2, UI.HEIGHT / 2 - 40 + 65), 0.3f, SelectedIndex == 1 ? SelectedTextColor : UnselectedTextColor, 0, true));

            container.Draw();
        }
Exemplo n.º 2
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            if (anyThreadStalled && warningTriangleMessage != "")
            {
                Vectangle warningRect = GetWarningRect();
                spriteBatch.Draw(TextureCache.warning, warningRect, Color.White);

                if (showErrorMessage)
                {
                    Vector2 messageSize = Game1.font.MeasureString(warningTriangleMessage);
                    if (messageSize.X > warningRect.Left)
                    {
                        spriteBatch.Draw(TextureCache.white, Game1.font.GetStringBounds(warningTriangleMessage, warningRect.TopRight, TextAlignment.LEFT).Bloat(2), new Color(0.25f, 0, 0, 0.5f));
                        spriteBatch.DrawString(Game1.font, warningTriangleMessage, warningRect.TopRight, Color.Yellow);
                    }
                    else
                    {
                        spriteBatch.Draw(TextureCache.white, Game1.font.GetStringBounds(warningTriangleMessage, warningRect.TopLeft, TextAlignment.RIGHT).Bloat(2), new Color(0.25f, 0, 0, 0.5f));
                        spriteBatch.DrawString(Game1.font, warningTriangleMessage, warningRect.TopLeft, TextAlignment.RIGHT, Color.Yellow);
                    }
                }
            }

            if (selected)
            {
                ui.Draw(spriteBatch);

                Rectangle dragBoxRect = GetDragBox();

                if (commands.Count > 0)
                {
                    int     recordingDurationFrames = commands.Last().time;
                    string  durationStr             = "(" + PlatformLevel.TimeToString(recordingDurationFrames) + " secs)";
                    Vector2 textPos = new Vector2((int)bounds.CenterX, (int)(bounds.Top) - 15);
                    spriteBatch.DrawString(Game1.font, durationStr, textPos, TextAlignment.CENTER, Color.White);
                }

/*                string text = "" + numCores;
 *              Vector2 textSize = Game1.font.MeasureString(text);
 *              spriteBatch.Draw(TextureCache.outlined_square, dragBoxRect, numCores > DEFAULT_NUM_CORES? Color.Orange: Color.Gray);
 *              spriteBatch.DrawString(Game1.font, text, new Vector2((int)(dragBoxRect.Center.X - textSize.X / 2), (int)(dragBoxRect.Center.Y - textSize.Y / 2)), Color.Black);*/
            }
        }
Exemplo n.º 3
0
        public void DrawAtPosition(Vector3 position, float distFromCamera, int stackedIdx = 0)
        {
            var scale = 3.0f / distFromCamera;

            for (int i = 0; i < _lines.Length; i++)
            {
                _lines[i].Scale    = scale * 0.37f;
                _lines[i].Position = new Point((int)(10 * scale), (int)((5 + 20 * i) * scale));
            }

            _container.Size = new Size((int)(200 * scale), (int)(90 * scale));

            DrawPos = new Vector3(position.X - 0.87f, position.Y, position.Z + 0.37f * stackedIdx);

            Function.Call(Hash.SET_DRAW_ORIGIN, DrawPos.X, DrawPos.Y, DrawPos.Z, 0);

            _container.Draw();

            Function.Call(Hash.CLEAR_DRAW_ORIGIN);
        }
        public void Update(int gameTime)
        {
            if (gameTime > _shownTime + TextActiveTime && !_stayOnScreen)
            {
                if (_backsplash.Color.A > 0)
                {
                    _backsplash.Color = Color.FromArgb(Math.Max(0, _backsplash.Color.A - 2), _backsplash.Color);
                }

                for (int i = 0; i < _text.Length; i++)
                {
                    if (_text[i].Color.A > 0)
                    {
                        _text[i].Color = Color.FromArgb(Math.Max(0, _text[i].Color.A - 4), _text[i].Color);
                    }
                }
            }

            else
            {
                if (_startFromTop)
                {
                    for (int i = _text.Length - 1; i > -1; i--)
                    {
                        _text[i].Caption = _messageQueue[i + _scrollIndex] ?? string.Empty;
                    }
                }

                else
                {
                    for (int i = _text.Length - 1; i > -1; i--)
                    {
                        _text[i].Caption = _messageQueue[((_messageQueue.Length - 1) - i) + _scrollIndex] ?? string.Empty;
                    }
                }
            }

            _backsplash.Draw();
        }
Exemplo n.º 5
0
        protected override void Setup()
        {
            var screenResolution = NativeFunctions.GetScreenResolution();

            ScreenHeight = (int)screenResolution.Y;
            ScreenWidth  = (int)screenResolution.X;

            _mContainer = new UIContainer(
                new Point(0, 0), new Size(ScreenWidth, ScreenHeight));

            OnDrawingTickAsObservable
            .Subscribe(_ => _mContainer.Draw());

            var harlThinned = CreateTickAsObservable(TimeSpan.FromMilliseconds(50));

            harlThinned
            .Where(_ => PlayerPed.IsSafeExist() && PlayerPed.Health < alertHelthValue && PlayerPed.IsAlive)
            .Subscribe(_ =>
            {
                //体力が減ったら画面を点滅させる
                time     += 1;
                var alpha = offset + amplitude * Math.Abs(Math.Sin(omega * time));

                _mContainer.Items.Clear();
                var rect = new UIRectangle(new Point(0, 0), new Size(ScreenWidth, ScreenHeight),
                                           Color.FromArgb((int)alpha, 255, 0, 0));
                _mContainer.Items.Add(rect);
            });

            harlThinned
            .Select(_ => PlayerPed.IsSafeExist() && PlayerPed.Health < alertHelthValue)
            .DistinctUntilChanged()
            .Where(x => !x)
            .Subscribe(_ =>
            {
                time = 0;
                _mContainer.Items.Clear();
            });
        }
        /// <summary>
        /// Update and draw the this <see cref="FrontendInput"/> box.
        /// </summary>
        public void Update(int gameTime)
        {
            if (_active)
            {
                Game.DisableAllControlsThisFrame(0);

                _text.Caption = _str;

                _cursor.Position = new Point(14 + _currentTextWidth, 7);

                if (gameTime - _lastCursorPulse > CursorPulseSpeed && _text.Color.A > 0)
                {
                    _cursorState = !_cursorState;

                    _cursor.Color = _cursorState ? Color.FromArgb(255, _cursor.Color) : Color.FromArgb(0, _cursor.Color);

                    _lastCursorPulse = gameTime;
                }

                _backsplash.Draw();
            }
        }
Exemplo n.º 7
0
        public void ShowWarning(string text)
        {
            warningText.Caption = text;

            bool b = false;

            if (pulseIn)
            {
                /*   if (b |= (warningBackground.Color.A < MaxAlpha))
                 * {
                 *     warningBackground.Color = Color.FromArgb(Math.Min(MaxAlpha, warningBackground.Color.A + 6), warningBackground.Color);
                 * }*/
                if (b |= (warningText.Color.A < MaxAlpha))
                {
                    warningText.Color = Color.FromArgb(Math.Min(MaxAlpha, warningText.Color.A + 6), warningText.Color);
                }

                pulseIn = b;
            }

            else
            {
                /*    if (b |= (warningBackground.Color.A > MinAlpha))
                 *  {
                 *      warningBackground.Color = Color.FromArgb(Math.Max(MinAlpha, warningBackground.Color.A - 6), warningBackground.Color);
                 *  }
                 */
                if (b |= (warningText.Color.A > MinAlpha))
                {
                    warningText.Color = Color.FromArgb(Math.Max(MinAlpha, warningText.Color.A - 6), warningText.Color);
                }

                pulseIn = !b;
            }

            warningBackground.Draw();
        }
        /// <summary>
        /// Update and draw the this <see cref="FrontendInput"/> box.
        /// </summary>
        public void Update(int gameTime)
        {
            if (!_active)
            {
                return;
            }

            Game.DisableAllControlsThisFrame(0);

            _text.Caption = _str.Length > 0 ? _str : WatermarkText;

            _cursorRect.Position = new Point(14 + _currentTextWidth, 7);

            if (gameTime - _lastCursorPulse > CursorPulseSpeed && _text.Color.A > 0)
            {
                _cursorState = !_cursorState;

                _cursorRect.Color = _cursorState ? Color.FromArgb(255, _cursorRect.Color) : Color.FromArgb(0, _cursorRect.Color);

                _lastCursorPulse = gameTime;
            }

            _backgroundContainer.Draw();
        }
Exemplo n.º 9
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            ui.Draw(spriteBatch);
            if (countdown > 0)
            {
                spriteBatch.DrawString(font, "" + countdown, new Vector2(620, 420), Color.Black);
            }

            if (inputState.hoveringElement is ConvergeUIObject)
            {
                ((ConvergeUIObject)inputState.hoveringElement).DrawTooltip(spriteBatch);
            }
            else if (inputState.hoveringElement is ConvergeUIAbility)
            {
                ((ConvergeUIAbility)inputState.hoveringElement).DrawTooltip(spriteBatch);
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 10
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (factory.isBigFactory)
            {
                spriteBatch.Draw(TextureCache.levelbg, new Rectangle(0, 0, 550, 600), Color.White);
            }
            else
            {
                spriteBatch.Draw(TextureCache.levelbg, new Rectangle(0, 0, 400, 600), Color.White);
            }

            foreach (PlatformObject obj in objects)
            {
                obj.Draw(spriteBatch);
            }
            foreach (Projectile projectile in projectiles)
            {
                projectile.Draw(spriteBatch);
            }

            Vector2 panelPos = factory.isBigFactory ? new Vector2(175, 0): new Vector2(0, 0);

            spriteBatch.Draw(TextureCache.screw_panel, new Rectangle((int)panelPos.X, (int)panelPos.Y + 280, 215, 200), Color.White);

            if (timerRunning)
            {
                spriteBatch.Draw(TextureCache.record_icon, panelPos + new Vector2(20, 315), Color.White);
                spriteBatch.DrawString(Game1.font, "REC", panelPos + new Vector2(35, 315), Color.White);
            }
            spriteBatch.DrawString(Game1.font, TimeToString(currentTime), panelPos + new Vector2(145, 315), timerRunning ? Color.White: Color.Black);
            spriteBatch.Draw(timerRunning ? TextureCache.hourglass : TextureCache.hourglass_frozen, panelPos + new Vector2(115, 305), Color.White);

            ui.Draw(spriteBatch);

            int currentMultiplier = NumThreadsForTime(currentTime / 60.0f);

            int testTime       = ChemicalFactory.TIME_PER_CORE;
            int testMultiplier = NumThreadsForTime(testTime);
            int lastMultiplier = 0;

            Vector2 currentPos = panelPos + new Vector2(10, 400);

            while (true)
            {
                if (testMultiplier != lastMultiplier)
                {
                    spriteBatch.DrawString(Game1.font, (testMultiplier == 1) ? "Normal" : ("Under " + testTime + " seconds: " + testMultiplier + "x speed"), currentPos, (currentMultiplier == testMultiplier)? Color.White: Color.Black);
                    currentPos.Y  += 15;
                    lastMultiplier = testMultiplier;
                }
                if (testMultiplier == 1)
                {
                    break;
                }

                testTime      += ChemicalFactory.TIME_PER_CORE;
                testMultiplier = NumThreadsForTime(testTime);
            }

            int     runningCore = currentTime / (60 * ChemicalFactory.TIME_PER_CORE);
            Vector2 corePos     = panelPos + new Vector2(10, 350);

            for (int coreIndex = 0; coreIndex < 6; ++coreIndex)
            {
                if (runningCore > coreIndex)
                {
                    spriteBatch.Draw(TextureCache.cores[0], corePos, Color.White);
                    spriteBatch.Draw(TextureCache.core_fill, corePos, Color.White);
                }
                else if (runningCore == coreIndex)
                {
                    if (timerRunning)
                    {
                        spriteBatch.Draw(TextureCache.cores[currentTime / 2 % TextureCache.cores.Length], corePos, Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(TextureCache.cores[0], corePos, Color.White);
                    }

                    int   runningProgressFrames = currentTime - (coreIndex * 60 * 4);
                    float testAngle             = (float)(Math.PI * 2 * runningProgressFrames / (60 * 4));

                    Game1.instance.AddDrawInstruction(new CustomDrawInstruction_Clock(TextureCache.core_fill, corePos + new Vector2(16, 16), 16, Color.White, 0, testAngle));
                }
                else
                {
                    spriteBatch.Draw(TextureCache.cores[0], corePos, Color.Gray);
                }

                corePos.X += 32;
            }
        }
        public void Draw(UISpriteBatch SBatch, float FPS)
        {
            mainUI.Draw(SBatch);

            SBatch.DrawString(m_SprFontBig, "FPS: " + FPS.ToString(), new Vector2(0, 0), Color.Red);
        }
Exemplo n.º 12
0
        public void UpdateX()
        {
            Ped player = Game.Player.Character;

            Vehicle vehicle = player.CurrentVehicle;

            //Loot Interact
            var nearbyLoot = RPGInfo.NearbyLoot;
            var showingLoot = false;
            if (nearbyLoot != null)
            {
                if (nearbyLoot.Item.Type == ItemType.Money || nearbyLoot.Item.Type == ItemType.QuestItem)
                {
                    RPGMethods.Loot(nearbyLoot);
                }
                else if (ShowUI)
                {
                    var interactUI = new UIContainer(new Point(UI.WIDTH / 2 - 120, UI.HEIGHT - 100), new Size(240, 17), Color.FromArgb(70, 70, 200, 70));
                    interactUI.Items.Add(new UIText("Press E To Loot " + nearbyLoot.Name, new Point(240 / 2, 1), 0.25f, Color.White, 0, true));
                    interactUI.Draw();
                    showingLoot = true;
                }
            }

            if (CurrentDialog != null && !IsOpen(DialogMenu))
            {
                World.RenderingCamera = NpcCamera;
                OpenDialog();
            }

            if (!ShowUI || CurrentDialog != null) return;

            //NPC Interact
            if(!showingLoot && CurrentDialog == null && !Game.Player.Character.IsInCombat)
            {
                var nearestPed = RPGInfo.NearestPed;
                if (nearestPed != null)
                {
                    var npcObject = RPG.WorldData.Npcs.FirstOrDefault(n => n.IsQuestNpc && n.EntityHandle == nearestPed.Handle);
                    if (npcObject != null)
                    {
                        var interactUI = new UIContainer(new Point(UI.WIDTH / 2 - 120, UI.HEIGHT - 122), new Size(240, 17), Color.FromArgb(70, 190, 190, 190));
                        interactUI.Items.Add(new UIText("Press E to Interact with " + npcObject.Name, new Point(240 / 2, 1), 0.25f, Color.White, 0, true));
                        interactUI.Draw();
                    }
                }
            }

            if (vehicle != null)
            {
                var speed = ((int)(vehicle.Speed * 2.45)).ToString("000");
                new UIText(" MPH", new Point(RPGInfo.IsWideScreen ? 207 : 248, UI.HEIGHT - 41), 0.22f, Color.White, 0, false).Draw(); //55
                new UIText(speed, new Point(RPGInfo.IsWideScreen ? 192 : 233, UI.HEIGHT - 41), 0.22f, Color.White, 0, false).Draw(); //55
            }

            //Player text
            //new UIText(PlayerData.Name.ToLower() + " level " + PlayerData.Level + " criminal", new Point(51, UI.HEIGHT - 55), 0.25f, Color.White, 0, false).Draw();

            //Expbar
            var expBarUI = new UIContainer(new Point(0, UI.HEIGHT - 2), new Size(UI.WIDTH, 2), Color.FromArgb(180, 20, 20, 20));
            var percentExp = (float)PlayerData.Exp / PlayerData.ExpToLevel;
            expBarUI.Items.Add(new UIRectangle(new Point(0, 0), new Size((int)(percentExp * UI.WIDTH), 2), Color.FromArgb(220, 255, 255, 0)));

            expBarUI.Draw();

            #region "RPG Style UI"
            var borderColor = Color.FromArgb(255, 75, 75, 75);
            Point rectanglePoint;
            Point textPoint;

            switch(PlayerData.Setup.SafeArea)
            {
                case 0:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 63 : 63), UI.HEIGHT - 47);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 63 : 63), UI.HEIGHT - 48);
                    break;
                case 1:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 57 : 57), UI.HEIGHT - 43);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 57 : 57), UI.HEIGHT - 44);
                    break;
                case 2:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 51 : 50), UI.HEIGHT - 40); //
                    textPoint = new Point((RPGInfo.IsWideScreen ? 51 : 51), UI.HEIGHT - 41); //
                    break;
                case 3:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 45 : 45), UI.HEIGHT - 36);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 45 : 45), UI.HEIGHT - 37);
                    break;
                case 4:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 39 : 39), UI.HEIGHT - 33);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 39 : 39), UI.HEIGHT - 34);
                    break;
                case 5:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 32 : 32), UI.HEIGHT - 29);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 32 : 32), UI.HEIGHT - 30);
                    break;
                case 6:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 26 : 26), UI.HEIGHT - 26);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 26 : 26), UI.HEIGHT - 27);
                    break;
                case 7:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 19 : 19), UI.HEIGHT - 22);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 19 : 19), UI.HEIGHT - 23);
                    break;
                case 8:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 13 : 13), UI.HEIGHT - 18);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 13 : 13), UI.HEIGHT - 19);
                    break;
                case 9:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 6 : 6), UI.HEIGHT - 15);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 6 : 6), UI.HEIGHT - 16);
                    break;
                case 10:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), UI.HEIGHT - 10);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), (RPGInfo.IsWideScreen ? UI.HEIGHT - 11 : UI.HEIGHT - 12));
                    break;
                default:
                    rectanglePoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), UI.HEIGHT - 10);
                    textPoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), (RPGInfo.IsWideScreen ? UI.HEIGHT - 11 : UI.HEIGHT - 12));
                    break;
            }

            new UIRectangle(rectanglePoint, new Size(181, 10), borderColor).Draw(); //playerinfo
            new UIText(PlayerData.Name + " Level " + PlayerData.Level + " " + PlayerData.Class.ToString().Replace("_", " "), textPoint, 0.22f, Color.White, 0, false).Draw();

            var offset = ShowingSubtitle ? - 85 : 0;

            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 28 + offset), new Size(345, 10), Color.FromArgb(60, 0, 0, 0)).Draw();
            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 13 + offset), new Size(345, 10), Color.FromArgb(60, 0, 0, 0)).Draw();

            var hpText = string.Format("HP: {0}/{1}",Game.Player.Character.Health,Game.Player.Character.MaxHealth);
            var armorText = string.Format("Armor: {0}/{1}", Game.Player.Character.Armor, 100);
            var hp = ((float) Game.Player.Character.Health/Game.Player.Character.MaxHealth);
            var ap = ((float) Game.Player.Character.Armor/100);

            var hpColor = Color.FromArgb(120,33,149,34);
            if(hp < 0.2f)
            {
                hpColor = Color.FromArgb(120, 139, 0, 0);
            }
            else if(hp < 0.4f)
            {
                hpColor = Color.FromArgb(120, 255, 69, 0);
            }

            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 28 + offset), new Size((int)(hp * 345), 10), hpColor).Draw();
            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 13 + offset), new Size((int)(ap * 345), 10), Color.FromArgb(180, 30, 144, 255)).Draw();

            new UIText(hpText, new Point(UI.WIDTH / 2, UI.HEIGHT - 45 - 28 - 2 + offset), 0.22f, Color.White, 0, true).Draw();
            new UIText(armorText, new Point(UI.WIDTH / 2, UI.HEIGHT - 45 - 13 - 2 + offset), 0.22f, Color.White, 0, true).Draw();
            #endregion

            //Character window #2
            if (View.ActiveMenus > 0)
            {
                var charPanel = new UIContainer(new Point(UI.WIDTH - 300, View.MenuPosition.Y - 215), new Size(300, 200), Color.Gray);

                //todo: what should we draw here?

                //charPanel.Draw();
            }

            //Quest Tracker
            if(ShowQuestTracker)
            {
                GetQuestTracker().Draw();
            }

            //Skill bar
            if(ShowSkillBar)
            {
                var skillOffset = ShowingSubtitle ? -80 : 0;
                var skillBarUI = RPG.SkillHandler.GetSkillBar(skillOffset);
                skillBarUI.Draw();
            }
        }
Exemplo n.º 13
0
        public override void Draw(Size offset)
        {
            if (!RPGSettings.ShowUI) return;

            if (ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, offset.Height - UI.HEIGHT), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
            }

            var container = new UIContainer(new Point(UI.WIDTH/2 - 300, UI.HEIGHT - 150), new Size(600, 140));
            new UIRectangle(new Point(0, UI.HEIGHT - 150),new Size(UI.WIDTH,140), Color.FromArgb(70, 8, 8, 8)).Draw();
            var lines = RPGUI.FormatText(Caption, 90);

            container.Items.Add(new UIText(lines[0], new Point(301, 5 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
            container.Items.Add(new UIText(lines[0], new Point(300, 5), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            if(lines.Length >1)
            {
                container.Items.Add(new UIText(lines[1], new Point(301, 25 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
                container.Items.Add(new UIText(lines[1], new Point(300, 25), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            }

            for (int i = 0; i < 4; i++)
            {
                if (i > Items.Count - 1) break;

                var item = Items[i];
                var color = SelectedIndex == i ? Color.Orange : Color.White;
                var guessedWidth = (int)(6f * item.Caption.Length);
                guessedWidth -= item.Caption.Count(x => x == 'i' || x == 'l' || x == '!' || x == '\'' || x == ',' || x == '.' || x == 'I') * 4;
                guessedWidth -= item.Caption.Count(x => x == ' ') * 2;
                var pos = 268 - 10 - guessedWidth;
                switch(i)
                {
                    case 3:
                        container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 56), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                        container.Items.Add(new UIText(item.Caption, new Point(pos, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                        break;
                    case 0:
                        container.Items.Add(new UIText(item.Caption, new Point(341, 56), 0.4f, Color.FromArgb(180,0,0,0), Font.ChaletComprimeCologne, false));
                        container.Items.Add(new UIText(item.Caption, new Point(340, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                        break;
                    case 2:
                        container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                        container.Items.Add(new UIText(item.Caption, new Point(pos, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                        break;
                    case 1:
                        container.Items.Add(new UIText(item.Caption, new Point(341, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                        container.Items.Add(new UIText(item.Caption, new Point(340, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                        break;
                }
            }

            container.Draw();

            var colorA = SelectedIndex == 3 ? Color.Orange : Color.SteelBlue;
            var colorB = SelectedIndex == 0 ? Color.Orange : Color.SteelBlue;
            var colorC = SelectedIndex == 2 ? Color.Orange : Color.SteelBlue;
            var colorD = SelectedIndex == 1 ? Color.Orange : Color.SteelBlue;

            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100), 32, 32, colorA); //1
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100), 32, 32, colorB,90); //2
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100 + 32), 32, 32, colorC,270); //3
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100 + 32), 32, 32, colorD, 180); //4

            if(Items.Count > 3)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84), 20, 3, colorA); //1
            }

            if(Items.Count > 2)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84 + 30), 20, 3, colorC); //3
            }

            if(Items.Count > 0)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84), 20, 3, colorB); //2
            }

            if(Items.Count > 1)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84 + 30), 20, 3, colorD); //4
            }

            var bottomY = offset.Height + 70 + Items.Count * ItemHeight;
            if (HasFooter) bottomY += FooterHeight;
            bottomY += HeaderHeight;

            if(ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, bottomY), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
                new UIRectangle(new Point(offset.Width + 300, offset.Height - UI.HEIGHT), new Size(2, UI.HEIGHT * 2), Color.FromArgb(200, 8, 8, 8)).Draw();
            }
        }
Exemplo n.º 14
0
        protected override void Setup()
        {
            IsActive  = false;
            timerText = new TimerUiTextManager(this);

            #region ParunteScripts

            //RefrectionでParupunteScriptを継承しているクラスをすべて取得する
            _parupunteScritpts =
                Assembly.GetExecutingAssembly()
                .GetTypes()
                .Where(type => type.BaseType != null && type.BaseType == typeof(ParupunteScript))
                .Where(x =>
            {
                var attribute = x.GetCustomAttribute <ParupunteDebug>();
                return(attribute == null || !attribute.IsIgnore);
            })
                .ToArray();

            _debugParuputeScripts = _parupunteScritpts.Where(x =>
            {
                var attribute = x.GetCustomAttribute <ParupunteDebug>();
                return(attribute != null && attribute.IsDebug);
            }).ToArray();


            #endregion ParunteScripts

            #region Config

            SetConfigData(_parupunteScritpts);

            #endregion

            #region EventHook

            CreateInputKeywordAsObservable("rnt")
            .Where(_ => !IsActive)
            .Subscribe(_ => ParupunteStart(ChooseParupounteScript()));

            CreateInputKeywordAsObservable("snt")
            .Where(_ => IsActive)
            .Subscribe(_ => ParupunteStop());

            OnKeyDownAsObservable.Where(x => x.KeyCode == Keys.NumPad0)
            .ThrottleFirst(TimeSpan.FromSeconds(2f), InfernoScriptScheduler)
            .Subscribe(_ =>
            {
                if (IsActive)
                {
                    ParupunteStop();
                }
                else
                {
                    ParupunteStart(ChooseParupounteScript());
                }
            });

            //パルプンテが停止したタイミングで開放
            IsActiveAsObservable
            .Where(x => !x)
            .Subscribe(_ =>
            {
                foreach (var entity in _autoReleaseEntitiesList.Where(entity => entity.IsSafeExist()))
                {
                    entity.MarkAsNoLongerNeeded();
                }
                _autoReleaseEntitiesList.Clear();
            });

            var nextIsonoTime = Time;

            OnRecievedInfernoEvent
            .OfType <IEventMessage, IsonoMessage>()
            .Where(_ => (nextIsonoTime - Time).Ticks <= 0)
            .Retry()
            .Subscribe(c =>
            {
                var r = IsonoMethod(c.Command);
                if (r)
                {
                    nextIsonoTime = Time.Add(TimeSpan.FromSeconds(4));
                }
            });

            #endregion EventHook

            #region Drawer

            var screenResolution = NativeFunctions.GetScreenResolution();
            _screenHeight        = (int)screenResolution.Y;
            _screenWidth         = (int)screenResolution.X;
            _mainTextUiContainer = new UIContainer(
                new Point(0, 0), new Size(_screenWidth, _screenHeight));
            _subTextUiContainer = new UIContainer(
                new Point(0, 0), new Size(_screenWidth, _screenHeight));

            //テキストが更新されたら詰め直す
            timerText.OnSetTextAsObservable.Subscribe(_ =>
            {
                _mainTextUiContainer.Items.Clear();
                _mainTextUiContainer.Items.Add(timerText.Text);
            });
            //テキストが時間切れしたら消す
            OnThinnedTickAsObservable.Select(_ => timerText.IsEnabled)
            .DistinctUntilChanged()
            .Where(x => !x)
            .Subscribe(_ => _mainTextUiContainer.Items.Clear());

            this.OnDrawingTickAsObservable
            .Where(_ => _mainTextUiContainer.Items.Any() || _subTextUiContainer.Items.Any())
            .Subscribe(_ =>
            {
                _mainTextUiContainer.Draw();
                _subTextUiContainer.Draw();
            });

            #endregion Drawer
        }
Exemplo n.º 15
0
        private void OnTick(object sender, EventArgs e)
        {
            if (fadingMsg)
            {
                if (msgBox.Color.A > 10 || msgBox.Items[0].Color.A > 10)
                {
                    msgBox.Draw();
                    msgBox.Items[0].Draw();
                    msgBox.Color          = Color.FromArgb(msgBox.Color.A - 5, msgBox.Color.R, msgBox.Color.G, msgBox.Color.B);
                    msgBox.Items[0].Color = Color.FromArgb(msgBox.Color.A - 5, msgBox.Color.R, msgBox.Color.G, msgBox.Color.B);
                }
                else
                {
                    msgBox    = null;
                    fadingMsg = false;
                }
            }

            else if (msgTimer.Enabled)
            {
                if (Game.GameTime > msgTimer.Waiter)
                {
                    msgTimer.Enabled = false;
                    fadingMsg        = true;
                }

                else
                {
                    msgBox = new UIContainer(new Point(1100, 0), new Size(150, 34), Color.FromArgb(140, 0, 0, 0));
                    msgBox.Items.Add(new UIText(msgText, new Point(1121, 2), msgScale, Color.White));
                    msgBox.Draw();
                    msgBox.Items[0].Draw();
                }
            }

            splineCam.Update();
            selector.Update();

            if (!activePool.IsAnyMenuOpen())
            {
                if (selector.MainCamera.IsActive)
                {
                    if (Game.IsControlJustPressed(0, GTA.Control.SelectNextWeapon))
                    {
                        nodeDuration -= 100;
                        msgText       = string.Format("Duration: {0}", nodeDuration);
                        msgScale      = 0.4f;
                        msgTimer.Start();
                    }

                    else if (Game.IsControlJustPressed(0, GTA.Control.SelectPrevWeapon))
                    {
                        nodeDuration += 100;
                        msgText       = string.Format("Duration: {0}", nodeDuration);
                        msgScale      = 0.4f;
                        msgTimer.Start();
                    }

                    else if (Game.IsControlJustPressed(0, GTA.Control.ScriptRDown))
                    {
                        splineCam.AddNode(selector.MainCamera.Position, selector.MainCamera.Rotation, nodeDuration);
                        msgText  = string.Format("~e~New node: {0}", selector.MainCamera.Position);
                        msgScale = 0.3f;
                        msgTimer.Start();
                    }

                    else if (Game.IsControlJustPressed(0, GTA.Control.ScriptRRight))
                    {
                        ExitPointSelector();
                    }
                }
            }
            activePool.ProcessMenus();
        }
Exemplo n.º 16
0
        /// <summary>
        /// Update UI related items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTick(object sender, EventArgs e)
        {
            if (Enabled)
            {
                centerText.Caption = string.Format("{0} {1} {2} {3}", _uiText1, _uiText2, _uiText3, _uiText4);
                centerText.Draw();

                if (scaleformDisplayTimer.Enabled)
                {
                    scaleform.Render2D();

                    if (Game.GameTime > scaleformDisplayTimer.Waiter)
                    {
                        scaleform.CallFunction("TRANSITION_OUT");
                        scaleformDisplayTimer.Enabled = false;
                        scaleformFadeTimer.Start();
                    }
                }

                if (scaleformFadeTimer.Enabled)
                {
                    scaleform.Render2D();

                    if (Game.GameTime > scaleformFadeTimer.Waiter)
                    {
                        GameManager.StopScript();
                        scaleformFadeTimer.Enabled = false;
                    }
                }

                if (killInfoTimer.Enabled)
                {
                    killInfoUI.Draw();

                    if (Game.GameTime > killInfoTimer.Waiter)
                    {
                        if (killInfoUI.Color.A > 0)
                        {
                            killInfoUI.Color = Color.FromArgb(killInfoUI.Color.A - 5, killInfoUI.Color);
                        }
                        else
                        {
                            killInfoUI.Color      = Color.FromArgb(255, killInfoUI.Color);
                            killInfoTimer.Enabled = false;
                        }
                    }
                }

                for (int i = 0; i < Config.MaxTeams; i++)
                {
                    teamInfoHUD.Items[i] = new UIRectangle(new Point(50, 12 + (30 * i)), new Size(_teamScores[i], 11), Color.Orange);
                }

                if (GameManager.LocalPlayer.ManagedPed.IsAlive)
                {
                    for (int i = 0; i < Config.MaxTeams; i++)
                    {
                        if (System.IO.File.Exists(_teamImages[i]))
                        {
                            UI.DrawTexture(_teamImages[i], 0, 0, 100,
                                           new Point(teamInfoHUD.Position.X + 10, teamInfoHUD.Position.Y + 2 + 30 * i),
                                           new Size(24, 24));
                        }
                        else
                        {
                            var text = new UIText(_teamNames[i] + ":",
                                                  new Point(teamInfoHUD.Position.X + 10, teamInfoHUD.Position.Y + 2 + 30 * i),
                                                  0.4f, Color.White, Font.Monospace, false);

                            text.Draw();
                        }
                    }


                    teamInfoHUD.Draw();
                    DrawHUDIcons();
                }
            }

            rankBar.Update();
        }
Exemplo n.º 17
0
        /// <summary>
        ///     Draws the console on screen
        /// </summary>
        private void DrawConsole()
        {
            if (!_isHidden)
            {
                var offset = (UI.HEIGHT / 3) - 20;

                var console = new UIContainer(new Point(0, 0), new Size(UI.WIDTH, UI.HEIGHT / 3),
                                              ConsoleSettings.DefaultBgColor);
                var consoleText  = new UIContainer(new Point(0, 0), new Size(UI.WIDTH, offset));
                var consoleInput = new UIContainer(new Point(0, UI.HEIGHT / 3), new Size(UI.WIDTH, 20));

                // Draw console log
                var height = (offset / ConsoleSettings.NumLines);

                var start = _lines.Count - ConsoleSettings.NumLines + _lineOffset;
                if (start < 0)
                {
                    start = 0;
                }

                var amt = ConsoleSettings.NumLines;
                if (start + amt > _lines.Count)
                {
                    amt = _lines.Count - start;
                }

                var drawLines = _lines.GetRange(start, amt);
                for (var i = 0; i < drawLines.Count; i++)
                {
                    foreach (
                        var uit in
                        GetLargeStringUIText(drawLines[i].Key,
                                             new Point(5, (ConsoleSettings.NumLines * height) - (height * (drawLines.Count - i)) + 5),
                                             ConsoleSettings.FontSize,
                                             drawLines[i].Value, 0, false))
                    {
                        consoleText.Items.Add(uit);
                    }
                }

                // Draw scrollbar
                const int scrollBarWidth    = 8;
                const int scrollBarPadding  = 2;
                const int scrollBarVPadding = 6;

                var scrollMaxHeight = (offset - scrollBarVPadding);
                var scrollRatio     = Convert.ToDouble(ConsoleSettings.NumLines) / Convert.ToDouble(_lines.Count);
                var relLineHeight   = Convert.ToDouble(scrollMaxHeight) / Convert.ToDouble(_lines.Count);
                if (scrollRatio < 1)
                {
                    var scrollHeight = Convert.ToInt32(scrollRatio * scrollMaxHeight);
                    var yOffset      = Convert.ToInt32(((_lines.Count + _lineOffset) * relLineHeight) - scrollHeight);
                    if (yOffset + scrollHeight > scrollMaxHeight)
                    {
                        yOffset = scrollMaxHeight - scrollHeight;
                    }
                    console.Items.Add(
                        new UIRectangle(
                            new Point(UI.WIDTH - (scrollBarPadding + scrollBarWidth), yOffset + (scrollBarPadding / 2)),
                            new Size(scrollBarWidth, scrollHeight), Color.FromArgb(100, 118, 91, 227)));
                }

                // Draw version string
                console.Items.Add(new UIText(ConsoleSettings.Version,
                                             new Point(UI.WIDTH - 20 - scrollBarWidth - scrollBarPadding, (ConsoleSettings.NumLines * height) - 12),
                                             ConsoleSettings.FontSize,
                                             ConsoleSettings.DefaultTextColor, 0, false));

                // Draw Cursor and input
                consoleInput.Items.Add(new UIRectangle(new Point(0, -20), new Size(UI.WIDTH, 1),
                                                       Color.FromArgb(ConsoleSettings.Alpha, 255, 255, 255)));

                if (Game.GameTime - _lastBlinkTime > 600)
                {
                    _cursorChar    = _cursorChar == "" ? ConsoleSettings.CursorCharacter : "";
                    _lastBlinkTime = Game.GameTime;
                }

                var displayString = Input.Insert(Input.Length - _inputOffset, _cursorChar);

                foreach (
                    var uit in
                    GetLargeStringUIText(ConsoleSettings.PreString + displayString, new Point(5, offset + 3),
                                         ConsoleSettings.FontSize,
                                         Color.FromArgb(ConsoleSettings.TextAlpha, 255, 255, 255), 0, false))
                {
                    consoleText.Items.Add(uit);
                }

                console.Items.Add(consoleText);
                console.Items.Add(consoleInput);

                console.Draw();
            }
        }
Exemplo n.º 18
0
        public override void Update()
        {
            if (!CanRun)
            {
                return;
            }
            if (!_show)
            {
                return;
            }

            int showTime = TimeToShowMs / 14;
            int fadeTime = showTime / 8;

            if (HideOnlyWhenClosed)
            {
                CloseablePopups.Add(this);
            }

            while (_timeWaited < showTime && _show)
            {
                if (_timeWaited < fadeTime)
                {
                    if (FadeInPopup)
                    {
                        RPGUI.SetAlpha(_popup, Math.Min((int)(((float)_timeWaited / fadeTime) * 255), 255));
                    }
                }

                if (_timeWaited > showTime - fadeTime)
                {
                    if (HideOnlyWhenClosed || HideTillManuallyClosed)
                    {
                        while (_show && !Function.Call <bool>(Hash.IS_CUTSCENE_ACTIVE))
                        {
                            _popup.Draw();
                            Wait(0);
                        }
                    }

                    if (FadeOutPopup)
                    {
                        var timeOfFrame = _timeWaited - (showTime - fadeTime);
                        RPGUI.SetAlpha(_popup, Math.Min((int)(255 - (255 * ((float)timeOfFrame / fadeTime))), 0));
                    }
                }

                if (DoCustom != null)
                {
                    DoCustom.Invoke(_popup, _timeWaited, showTime, fadeTime);
                }

                _popup.Draw();

                _timeWaited++;
                Wait(0);
            }



            Finish();
        }
Exemplo n.º 19
0
        //private void ChangeVariation(int obj)
        //{
        //    var index = Mennu.SelectedIndex;
        //    var kvp = variations.ElementAt(index);
        //    var component = kvp.Key;
        //    Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, component, obj, 0,0);
        //}

        //private Menu Mennu;
        //Dictionary<int, int> variations = new Dictionary<int, int>();
        //
        //
        //private void SelectTile(int obj)
        //{
        //    throw new NotImplementedException();
        //}


        public override void Update()
        {
            if (Game.IsKeyPressed(Keys.F5))
            {
                //try
                //{

                //RPG.PlayerData.AddMoney(20120324);
                //var mmmmmenu = new TiledMenu("Select Your Gender",
                //    new TiledPanel("Male", new GTASprite("mptattoos1", "tattoo_drugdeal", Color.Red), Color.DodgerBlue, SelectTile, "Play as an XY chromosome."),
                //    new TiledPanel("Female", new GTASprite("mptattoos", "killplayerbountyhead", Color.Purple),Color.Pink, SelectTile, "Play as an XX chromosome."));
                //View.AddMenu(mmmmmenu);

                //variations = new Dictionary<int, int>();
                //for (int i = 0; i < 10 ; i++)
                //{
                //    var a = Function.Call<int>(Hash._0x5FAF9754E789FB47, Game.Player.Character, i);
                //    //if(a > 1)
                //    //{
                //    //    variations.Add(i,a);
                //        RPGLog.Log("Tried " + i + " got variations: " + a);
                //    //}
                //}
                //Function.Call(Hash.SET_PED_RANDOM_PROPS, Game.Player.Character);
                //Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character, 0, adasdasdasdij);
                //adasdasdasdij++;

//
//                    View.MenuPosition = new Point(UI.WIDTH/2 -  150, UI.HEIGHT - 300);
//                    Mennu.Width = 300;
//                    RPGUI.FormatMenu(Mennu);
//                    View.AddMenu(Mennu);

                //}
                //catch (Exception ex)
                //{
                //    RPGLog.Log(ex);
                //}

                //Wait(500);
                //try
                //{
                //    var outArg = new OutputArgument();
                //    var a =  Function.Call<Vector3>(Hash.GET_HUD_COMPONENT_POSITION, 15, outArg);
                //    RPG.Notify("a: " + a);
                //    RPG.Notify("a: " + outArg.GetResult<Vector3>());
                //
                //}
                //catch
                //{
                //
                //}

                //string s = Game.GetUserInput(100);
                //try
                //{
                //    var propName = s;
                //    Model m = propName;
                //    var p = World.CreateProp(m, Game.Player.Character.Position + Game.Player.Character.ForwardVector * 2, true, true);
                //    Wait(5000);
                //    if (p.Exists())
                //    {
                //        p.Delete();
                //    }
                //}
                //catch (Exception)
                //{
                //    RPG.Notify("err");
                //}
            }

            if (!Debug)
            {
                return;
            }
            var c = new UIContainer(new Point(UI.WIDTH - 305, UI.HEIGHT - 305), new Size(300, 300), Color.FromArgb(180, 50, 50, 50));

            var debug = "";

            debug += "player co-ordinates: " + VecStr(Game.Player.Character.Position) + "\n";
            debug += "- heading: " + Game.Player.Character.Heading + "\n";
            debug += "- rotation: " + VecStr(Game.Player.Character.Rotation) + "\n";
            debug += "- model hash: " + Game.Player.Character.Model.Hash + "\n";
            var v = new UIText(debug, new Point(0, 0), 0.25f, Color.White);

            if (Game.Player.Character.IsInVehicle())
            {
                debug += "vehicle model: " + Game.Player.Character.CurrentVehicle.Model.Hash + "\n";
                debug += "- heading: " + Game.Player.Character.CurrentVehicle.Heading + "\n";
                debug += "- rotation: " + VecStr(Game.Player.Character.CurrentVehicle.Rotation) + "\n";
            }

            foreach (var wep in RPG.PlayerData.Weapons)
            {
                debug += string.Format("Weapon: {0} [{1}] , Unlocked {2} \n", wep.WeaponName, wep.WeaponHash.ToString(), wep.Unlocked);
            }

            var lines = RPGUI.FormatText(debug, 99);

            for (int i = 0; i < lines.Length; i++)
            {
                var x = new UIText(lines[i], new Point(0, 0 + (30 * i)), 0.25f, Color.White);
                c.Items.Add(x);
            }

            c.Draw();
        }
Exemplo n.º 20
0
        protected override void Draw(GameTime gameTime)
        {
            if (gameTime.ElapsedGameTime.Milliseconds != 0)
            {
                frameCounter.Text = "FPS: " + Math.Round(1000 / gameTime.ElapsedGameTime.TotalMilliseconds);
            }

            RectF rect    = camera.GetRect();
            int   chunksX = (int)Math.Floor(rect.Width / Chunk.SIZE) + 2;
            int   chunksY = (int)Math.Floor(rect.Height / Chunk.SIZE) + 2;
            int   chunkX  = (int)Math.Floor(rect.X / Chunk.SIZE);
            int   chunkY  = (int)Math.Floor(rect.Y / Chunk.SIZE);

            if (enableLighting)
            {
                //Lighting
                //draw source texture
                GraphicsDevice.SetRenderTarget(rtLight);

                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp);
                for (int i = 0; i < chunksX; i++)
                {
                    for (int j = 0; j < chunksY; j++)
                    {
                        Texture2D tex = world.GetLightTexture(chunkX + i, chunkY + j);
                        if (tex != null)
                        {
                            spriteBatch.Draw(tex, new Vector2(i * Chunk.SIZE, j * Chunk.SIZE), Color.White);
                        }
                        else
                        {
                            spriteBatch.Draw(Textures.Error, new Vector2(i * Chunk.SIZE, j * Chunk.SIZE), Color.White);
                        }
                    }
                }
                spriteBatch.End();
                GraphicsDevice.SetRenderTarget(null);

                rtLight.GetData <Color>(lightSourceColor);
                rtLightSource.SetData <Color>(lightSourceColor);

                //ToDo: Lighting blur does not effect the blur placed after. So the corners aren't blurred. This is resulting in light sources looking like "stars".

                //---Blur horizontal---
                //Draw source
                GraphicsDevice.SetRenderTarget(rtLightBlur);
                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp);
                spriteBatch.Draw(rtLight, Vector2.Zero, Color.White);
                spriteBatch.End();
                //Blur source
                efGauss.Parameters["Size"]?.SetValue(chunksX * Chunk.SIZE);
                efGauss.Parameters["Direction"]?.SetValue(new Vector2(1, 0));
                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, efGauss, null);
                spriteBatch.Draw(rtLight, Vector2.Zero, Color.White);
                spriteBatch.End();
                GraphicsDevice.SetRenderTarget(null);

                //---Blur vertical---
                //Draw horizontal blurred
                GraphicsDevice.SetRenderTarget(rtLight);
                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp);
                spriteBatch.Draw(rtLightBlur, Vector2.Zero, Color.White);
                spriteBatch.End();
                //Blur horizontal blurred
                efGauss.Parameters["Size"]?.SetValue(chunksY * Chunk.SIZE);
                efGauss.Parameters["Direction"]?.SetValue(new Vector2(0, 1));
                spriteBatch.Begin(SpriteSortMode.BackToFront, blendStateLighten, SamplerState.PointClamp, null, null, efGauss, null);
                spriteBatch.Draw(rtLightSource, Vector2.Zero, Color.White);
                spriteBatch.End();
                GraphicsDevice.SetRenderTarget(null);
            }
            //World

            world.Render(spriteBatch);
            graphics.GraphicsDevice.Clear(Color.DeepSkyBlue);

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, camera.transform);
            world.Draw(spriteBatch);
            spriteBatch.End();

            if (enableLighting)
            {
                spriteBatch.Begin(SpriteSortMode.Immediate, blendStateMultiply, SamplerState.PointClamp, null, null, null, camera.transform);
                spriteBatch.Draw(rtLight, new Vector2(chunkX * Chunk.SIZE, chunkY * Chunk.SIZE), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
                spriteBatch.End();
            }

            //UI
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp);
            UIMaster.Draw(spriteBatch);
            if (enableLighting)
            {
                spriteBatch.Draw(rtLightSource, new Vector2(4, GraphicsDevice.Viewport.Height - rtLight.Height - 4), Color.White);
                spriteBatch.Draw(rtLightBlur, new Vector2(8 + rtLight.Width, GraphicsDevice.Viewport.Height - rtLight.Height - 4), Color.White);
                spriteBatch.Draw(rtLight, new Vector2(12 + rtLight.Width * 2, GraphicsDevice.Viewport.Height - rtLight.Height - 4), Color.White);
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 21
0
 public virtual void Render()
 {
     _uiContainer.Draw();
 }
Exemplo n.º 22
0
        public void UpdateX()
        {
            if (Function.Call <bool>(Hash.IS_CUTSCENE_ACTIVE))
            {
                return;
            }

            Ped player = Game.Player.Character;

            Vehicle vehicle = player.CurrentVehicle;

            //Loot Interact
            var nearbyLoot  = RPGInfo.NearbyLoot;
            var showingLoot = false;

            if (nearbyLoot != null)
            {
                if (nearbyLoot.Item.Type == ItemType.Money || nearbyLoot.Item.Type == ItemType.QuestItem)
                {
                    RPGMethods.Loot(nearbyLoot);
                }
                else if (RPGSettings.ShowUI)
                {
                    var interactUI = new UIContainer(new Point(UI.WIDTH / 2 - 120, UI.HEIGHT - 100), new Size(240, 17), Color.FromArgb(70, 70, 200, 70));
                    var lootStr    = RPG.UsingController ? "Hold (A) To Loot " : "Press E To Loot ";
                    interactUI.Items.Add(new UIText(lootStr + nearbyLoot.Name, new Point(240 / 2, 1), 0.25f, Color.White, 0, true));
                    interactUI.Draw();
                    showingLoot = true;
                }
            }


            if (CurrentDialog != null && !IsOpen(DialogMenu))
            {
                World.RenderingCamera = NpcCamera;
                OpenDialog();
            }

            //Controller Support
            var up       = Game.IsControlJustPressed(0, Control.ScriptPadUp);
            var down     = Game.IsControlJustPressed(0, Control.ScriptPadDown);
            var left     = Game.IsControlJustPressed(0, Control.ScriptPadLeft);
            var right    = Game.IsControlJustPressed(0, Control.ScriptPadRight);
            var back     = Game.IsControlJustPressed(0, Control.Reload);
            var interact = Game.IsControlJustPressed(0, Control.Sprint);

            var skillMod  = Game.IsControlPressed(0, Control.Jump);
            var hotkeyMod = Game.IsControlPressed(0, Control.Reload);

            if (interact)
            {
                if (CurrentDialog != null)
                {
                    DialogMenu.OnActivate();
                }
                else
                {
                    View.HandleActivate();
                }
            }
            if (back)
            {
                View.HandleBack();
            }

            if (!skillMod && !hotkeyMod)
            {
                if (left)
                {
                    if (CurrentDialog != null)
                    {
                        DialogMenu.OnChangeItem(false);
                    }
                    else
                    {
                        View.HandleChangeItem(false);
                    }
                }
                if (right)
                {
                    if (CurrentDialog != null)
                    {
                        DialogMenu.OnChangeItem(true);
                    }
                    else
                    {
                        View.HandleChangeItem(true);
                    }
                }
                if (up)
                {
                    if (CurrentDialog != null)
                    {
                        DialogMenu.OnChangeSelection(false);
                    }
                    else
                    {
                        View.HandleChangeSelection(false);
                    }
                }
                if (down)
                {
                    if (CurrentDialog != null)
                    {
                        DialogMenu.OnChangeSelection(true);
                    }
                    else
                    {
                        View.HandleChangeSelection(true);
                    }
                }
            }

            if (!RPGSettings.ShowUI || CurrentDialog != null)
            {
                return;
            }

            //NPC Interact
            if (!showingLoot && CurrentDialog == null && !Game.Player.Character.IsInCombat)
            {
                var nearestPed = RPGInfo.NearestPed;
                if (nearestPed != null)
                {
                    var npcObject = RPG.WorldData.Npcs.FirstOrDefault(n => n.IsQuestNpc && n.EntityHandle == nearestPed.Handle);
                    if (npcObject != null)
                    {
                        var interactUI  = new UIContainer(new Point(UI.WIDTH / 2 - 120, UI.HEIGHT - 122), new Size(240, 17), Color.FromArgb(70, 190, 190, 190));
                        var interactStr = RPG.UsingController ? "Hold (A) to Interact with " : "Press E to Interact with ";
                        interactUI.Items.Add(new UIText(interactStr + npcObject.Name, new Point(240 / 2, 1), 0.25f, Color.White, 0, true));
                        interactUI.Draw();
                    }
                }
            }


            //Player text
            //new UIText(PlayerData.Name.ToLower() + " level " + PlayerData.Level + " criminal", new Point(51, UI.HEIGHT - 55), 0.25f, Color.White, 0, false).Draw();

            //Expbar
            var expBarUI   = new UIContainer(new Point(0, UI.HEIGHT - 2), new Size(UI.WIDTH, 2), Color.FromArgb(180, 20, 20, 20));
            var percentExp = (float)PlayerData.Exp / PlayerData.ExpToLevel;

            expBarUI.Items.Add(new UIRectangle(new Point(0, 0), new Size((int)(percentExp * UI.WIDTH), 2), Color.FromArgb(220, 255, 255, 0)));

            expBarUI.Draw();

            #region "RPG Style UI"
            var   borderColor = Color.FromArgb(255, 75, 75, 75);
            Point rectanglePoint;
            Point textPoint;

            switch (RPGSettings.SafeArea)
            {
            case 0:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 63 : 63), UI.HEIGHT - 47);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 63 : 63), UI.HEIGHT - 48);
                break;

            case 1:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 57 : 57), UI.HEIGHT - 43);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 57 : 57), UI.HEIGHT - 44);
                break;

            case 2:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 51 : 50), UI.HEIGHT - 40); //
                textPoint      = new Point((RPGInfo.IsWideScreen ? 51 : 51), UI.HEIGHT - 41); //
                break;

            case 3:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 45 : 45), UI.HEIGHT - 36);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 45 : 45), UI.HEIGHT - 37);
                break;

            case 4:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 39 : 39), UI.HEIGHT - 33);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 39 : 39), UI.HEIGHT - 34);
                break;

            case 5:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 32 : 32), UI.HEIGHT - 29);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 32 : 32), UI.HEIGHT - 30);
                break;

            case 6:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 26 : 26), UI.HEIGHT - 26);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 26 : 26), UI.HEIGHT - 27);
                break;

            case 7:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 19 : 19), UI.HEIGHT - 22);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 19 : 19), UI.HEIGHT - 23);
                break;

            case 8:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 13 : 13), UI.HEIGHT - 18);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 13 : 13), UI.HEIGHT - 19);
                break;

            case 9:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 6 : 6), UI.HEIGHT - 15);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 6 : 6), UI.HEIGHT - 16);
                break;

            case 10:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), UI.HEIGHT - 10);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 0 : 0), (RPGInfo.IsWideScreen ? UI.HEIGHT - 11 : UI.HEIGHT - 12));
                break;

            default:
                rectanglePoint = new Point((RPGInfo.IsWideScreen ? 0 : 0), UI.HEIGHT - 10);
                textPoint      = new Point((RPGInfo.IsWideScreen ? 0 : 0), (RPGInfo.IsWideScreen ? UI.HEIGHT - 11 : UI.HEIGHT - 12));
                break;
            }

            if (vehicle != null)
            {
                var speed = ((int)(vehicle.Speed * 2.45)).ToString("000");
                new UIText(" MPH", new Point(RPGInfo.IsWideScreen ? textPoint.X + 156 : textPoint.X + 156, textPoint.Y), 0.22f, Color.White, 0, false).Draw(); //55
                new UIText(speed, new Point(RPGInfo.IsWideScreen ? textPoint.X + 141 : textPoint.X + 141, textPoint.Y), 0.22f, Color.White, 0, false).Draw();  //55
            }

            new UIRectangle(rectanglePoint, new Size(181, 10), borderColor).Draw(); //playerinfo
            new UIText(PlayerData.Name + " Level " + PlayerData.Level + " " + PlayerData.Class.ToString().Replace("_", " "), textPoint, 0.22f, Color.White, 0, false).Draw();


            var offset = RPGSettings.ShowingSubtitle ? -85 : 0;


            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 28 + offset), new Size(345, 10), Color.FromArgb(60, 0, 0, 0)).Draw();
            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 13 + offset), new Size(345, 10), Color.FromArgb(60, 0, 0, 0)).Draw();

            var hpText    = string.Format("HP: {0}/{1}", Game.Player.Character.Health, Game.Player.Character.MaxHealth);
            var armorText = string.Format("Armor: {0}/{1}", Game.Player.Character.Armor, 100);
            var hp        = ((float)Game.Player.Character.Health / Game.Player.Character.MaxHealth);
            var ap        = ((float)Game.Player.Character.Armor / 100);

            var hpColor = Color.FromArgb(120, 33, 149, 34);
            if (hp < 0.2f)
            {
                hpColor = Color.FromArgb(120, 139, 0, 0);
            }
            else if (hp < 0.4f)
            {
                hpColor = Color.FromArgb(120, 255, 69, 0);
            }

            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 28 + offset), new Size((int)(hp * 345), 10), hpColor).Draw();
            new UIRectangle(new Point(UI.WIDTH / 2 - 173, UI.HEIGHT - 45 - 13 + offset), new Size((int)(ap * 345), 10), Color.FromArgb(180, 30, 144, 255)).Draw();

            new UIText(hpText, new Point(UI.WIDTH / 2, UI.HEIGHT - 45 - 28 - 2 + offset), 0.22f, Color.White, 0, true).Draw();
            new UIText(armorText, new Point(UI.WIDTH / 2, UI.HEIGHT - 45 - 13 - 2 + offset), 0.22f, Color.White, 0, true).Draw();
            #endregion

            //Character window #2
            if (View.ActiveMenus > 0)
            {
                var charPanel = new UIContainer(new Point(UI.WIDTH - 300, View.MenuPosition.Y - 215), new Size(300, 200), Color.Gray);

                //todo: what should we draw here?

                //charPanel.Draw();
            }



            //Quest Tracker
            if (RPGSettings.ShowQuestTracker)
            {
                GetQuestTracker().Draw();
            }

            //Skill bar
            if (RPGSettings.ShowSkillBar)
            {
                var skillOffset = RPGSettings.ShowingSubtitle ? -80 : 0;
                var skillBarUI  = RPG.SkillHandler.GetSkillBar(skillOffset);
                skillBarUI.Draw();
            }
        }
Exemplo n.º 23
0
        public override void Draw(Size offset)
        {
            if (!RPGSettings.ShowUI)
            {
                return;
            }

            if (ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, offset.Height - UI.HEIGHT), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
            }

            var container = new UIContainer(new Point(UI.WIDTH / 2 - 300, UI.HEIGHT - 150), new Size(600, 140));

            new UIRectangle(new Point(0, UI.HEIGHT - 150), new Size(UI.WIDTH, 140), Color.FromArgb(70, 8, 8, 8)).Draw();
            var lines = RPGUI.FormatText(Caption, 90);

            container.Items.Add(new UIText(lines[0], new Point(301, 5 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
            container.Items.Add(new UIText(lines[0], new Point(300, 5), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            if (lines.Length > 1)
            {
                container.Items.Add(new UIText(lines[1], new Point(301, 25 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
                container.Items.Add(new UIText(lines[1], new Point(300, 25), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            }


            for (int i = 0; i < 4; i++)
            {
                if (i > Items.Count - 1)
                {
                    break;
                }

                var item         = Items[i];
                var color        = SelectedIndex == i ? Color.Orange : Color.White;
                var guessedWidth = (int)(6f * item.Caption.Length);
                guessedWidth -= item.Caption.Count(x => x == 'i' || x == 'l' || x == '!' || x == '\'' || x == ',' || x == '.' || x == 'I') * 4;
                guessedWidth -= item.Caption.Count(x => x == ' ') * 2;
                var pos = 268 - 10 - guessedWidth;
                switch (i)
                {
                case 3:
                    container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 56), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(pos, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 0:
                    container.Items.Add(new UIText(item.Caption, new Point(341, 56), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(340, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 2:
                    container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(pos, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 1:
                    container.Items.Add(new UIText(item.Caption, new Point(341, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(340, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;
                }
            }

            container.Draw();

            var colorA = SelectedIndex == 3 ? Color.Orange : Color.SteelBlue;
            var colorB = SelectedIndex == 0 ? Color.Orange : Color.SteelBlue;
            var colorC = SelectedIndex == 2 ? Color.Orange : Color.SteelBlue;
            var colorD = SelectedIndex == 1 ? Color.Orange : Color.SteelBlue;

            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100), 32, 32, colorA);           //1
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100), 32, 32, colorB, 90);        //2
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100 + 32), 32, 32, colorC, 270); //3
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100 + 32), 32, 32, colorD, 180);  //4

            if (Items.Count > 3)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84), 20, 3, colorA); //1
            }

            if (Items.Count > 2)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84 + 30), 20, 3, colorC); //3
            }

            if (Items.Count > 0)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84), 20, 3, colorB); //2
            }

            if (Items.Count > 1)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84 + 30), 20, 3, colorD); //4
            }

            var bottomY = offset.Height + 70 + Items.Count * ItemHeight;

            if (HasFooter)
            {
                bottomY += FooterHeight;
            }
            bottomY += HeaderHeight;

            if (ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, bottomY), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
                new UIRectangle(new Point(offset.Width + 300, offset.Height - UI.HEIGHT), new Size(2, UI.HEIGHT * 2), Color.FromArgb(200, 8, 8, 8)).Draw();
            }
        }
Exemplo n.º 24
0
        //private void ChangeVariation(int obj)
        //{
        //    var index = Mennu.SelectedIndex;
        //    var kvp = variations.ElementAt(index);
        //    var component = kvp.Key;
        //    Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, component, obj, 0,0);
        //}
        //private Menu Mennu;
        //Dictionary<int, int> variations = new Dictionary<int, int>();
        //
        //
        //private void SelectTile(int obj)
        //{
        //    throw new NotImplementedException();
        //}
        public override void Update()
        {
            if(Game.IsKeyPressed(Keys.F5))
            {
                //try
                //{

                    //RPG.PlayerData.AddMoney(20120324);
                    //var mmmmmenu = new TiledMenu("Select Your Gender",
                    //    new TiledPanel("Male", new GTASprite("mptattoos1", "tattoo_drugdeal", Color.Red), Color.DodgerBlue, SelectTile, "Play as an XY chromosome."),
                    //    new TiledPanel("Female", new GTASprite("mptattoos", "killplayerbountyhead", Color.Purple),Color.Pink, SelectTile, "Play as an XX chromosome."));
                    //View.AddMenu(mmmmmenu);

                    //variations = new Dictionary<int, int>();
                    //for (int i = 0; i < 10 ; i++)
                    //{
                    //    var a = Function.Call<int>(Hash._0x5FAF9754E789FB47, Game.Player.Character, i);
                    //    //if(a > 1)
                    //    //{
                    //    //    variations.Add(i,a);
                    //        RPGLog.Log("Tried " + i + " got variations: " + a);
                    //    //}
                    //}
                    //Function.Call(Hash.SET_PED_RANDOM_PROPS, Game.Player.Character);
                    //Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character, 0, adasdasdasdij);
                    //adasdasdasdij++;

            //
            //                    View.MenuPosition = new Point(UI.WIDTH/2 -  150, UI.HEIGHT - 300);
            //                    Mennu.Width = 300;
            //                    RPGUI.FormatMenu(Mennu);
            //                    View.AddMenu(Mennu);

                //}
                //catch (Exception ex)
                //{
                //    RPGLog.Log(ex);
                //}

                //Wait(500);
                //try
                //{
                //    var outArg = new OutputArgument();
                //    var a =  Function.Call<Vector3>(Hash.GET_HUD_COMPONENT_POSITION, 15, outArg);
                //    RPG.Notify("a: " + a);
                //    RPG.Notify("a: " + outArg.GetResult<Vector3>());
                //
                //}
                //catch
                //{
                //
                //}

                //string s = Game.GetUserInput(100);
                //try
                //{
                //    var propName = s;
                //    Model m = propName;
                //    var p = World.CreateProp(m, Game.Player.Character.Position + Game.Player.Character.ForwardVector * 2, true, true);
                //    Wait(5000);
                //    if (p.Exists())
                //    {
                //        p.Delete();
                //    }
                //}
                //catch (Exception)
                //{
                //    RPG.Notify("err");
                //}
            }

            if (!Debug) return;
            var c = new UIContainer(new Point(UI.WIDTH - 305, UI.HEIGHT - 305), new Size(300, 300), Color.FromArgb(180, 50, 50, 50));

            var debug = "";
            debug += "player co-ordinates: " + VecStr(Game.Player.Character.Position) + "\n";
            debug += "- heading: " + Game.Player.Character.Heading + "\n";
            debug += "- rotation: " + VecStr(Game.Player.Character.Rotation) + "\n";
            debug += "- model hash: " + Game.Player.Character.Model.Hash + "\n";
             var v = new UIText(debug,new Point(0, 0), 0.25f, Color.White);

            var cardebug = "";
             if (Game.Player.Character.IsInVehicle())
             {
                 cardebug += "vehicle model: " + Game.Player.Character.CurrentVehicle.Model.Hash + "\n";
                 cardebug += "- heading: " + Game.Player.Character.CurrentVehicle.Heading + "\n";
                 cardebug += "- rotation: " + VecStr(Game.Player.Character.CurrentVehicle.Rotation) + "\n";
             }
             var x = new UIText(cardebug, new Point(0, 200), 0.25f, Color.White);

            c.Items.Add(v);
            c.Items.Add(x);
            c.Draw();
        }
        /// <summary>
        ///     Draws the console on screen
        /// </summary>
        private void DrawConsole()
        {
            if (!_isHidden) {
                var offset = (UI.HEIGHT/3) - 20;

                var console = new UIContainer(new Point(0, 0), new Size(UI.WIDTH, UI.HEIGHT/3),
                    ConsoleSettings.DefaultBgColor);
                var consoleText = new UIContainer(new Point(0, 0), new Size(UI.WIDTH, offset));
                var consoleInput = new UIContainer(new Point(0, UI.HEIGHT/3), new Size(UI.WIDTH, 20));

                // Draw console log
                var height = (offset/ConsoleSettings.NumLines);

                var start = _lines.Count - ConsoleSettings.NumLines + _lineOffset;
                if (start < 0) start = 0;

                var amt = ConsoleSettings.NumLines;
                if (start + amt > _lines.Count) amt = _lines.Count - start;

                var drawLines = _lines.GetRange(start, amt);
                for (var i = 0; i < drawLines.Count; i++) {
                    foreach (
                        var uit in
                            GetLargeStringUIText(drawLines[i].Key,
                                new Point(5, (ConsoleSettings.NumLines*height) - (height*(drawLines.Count - i)) + 5),
                                ConsoleSettings.FontSize,
                                drawLines[i].Value, 0, false)) {
                        consoleText.Items.Add(uit);
                    }
                }

                // Draw scrollbar
                const int scrollBarWidth = 8;
                const int scrollBarPadding = 2;
                const int scrollBarVPadding = 6;

                var scrollMaxHeight = (offset - scrollBarVPadding);
                var scrollRatio = Convert.ToDouble(ConsoleSettings.NumLines)/Convert.ToDouble(_lines.Count);
                var relLineHeight = Convert.ToDouble(scrollMaxHeight)/Convert.ToDouble(_lines.Count);
                if (scrollRatio < 1) {
                    var scrollHeight = Convert.ToInt32(scrollRatio*scrollMaxHeight);
                    var yOffset = Convert.ToInt32(((_lines.Count + _lineOffset)*relLineHeight) - scrollHeight);
                    if (yOffset + scrollHeight > scrollMaxHeight) yOffset = scrollMaxHeight - scrollHeight;
                    console.Items.Add(
                        new UIRectangle(
                            new Point(UI.WIDTH - (scrollBarPadding + scrollBarWidth), yOffset + (scrollBarPadding/2)),
                            new Size(scrollBarWidth, scrollHeight), Color.FromArgb(100, 118, 91, 227)));
                }

                // Draw version string
                console.Items.Add(new UIText(ConsoleSettings.Version,
                    new Point(UI.WIDTH - 20 - scrollBarWidth - scrollBarPadding, (ConsoleSettings.NumLines*height) - 12),
                    ConsoleSettings.FontSize,
                    ConsoleSettings.DefaultTextColor, 0, false));

                // Draw Cursor and input
                consoleInput.Items.Add(new UIRectangle(new Point(0, -20), new Size(UI.WIDTH, 1),
                    Color.FromArgb(ConsoleSettings.Alpha, 255, 255, 255)));

                if (Game.GameTime - _lastBlinkTime > 600) {
                    _cursorChar = _cursorChar == "" ? ConsoleSettings.CursorCharacter : "";
                    _lastBlinkTime = Game.GameTime;
                }

                var displayString = Input.Insert(Input.Length - _inputOffset, _cursorChar);

                foreach (
                    var uit in
                        GetLargeStringUIText(ConsoleSettings.PreString + displayString, new Point(5, offset + 3),
                            ConsoleSettings.FontSize,
                            Color.FromArgb(ConsoleSettings.TextAlpha, 255, 255, 255), 0, false)) {
                    consoleText.Items.Add(uit);
                }

                console.Items.Add(consoleText);
                console.Items.Add(consoleInput);

                console.Draw();
            }
        }