Inheritance: MonoBehaviour
Exemplo n.º 1
0
	public void Init( UIScrollList _list, body2_SC_PRIVATESHOP_SEARCH_RESULT _item, delListBtnClicked _del)
	{
		m_SearchInfo = _item;
		m_Del = _del;
		
		listBtn.SetInputDelegate( OnListButton);
		_list.AddItem( container);
		
		Item item = ItemMgr.ItemManagement.GetItem( _item.sItem.nItemTableIdx);
		GameObject objIcon = item.GetIcon();
		objIcon = Instantiate( objIcon) as GameObject;
		objIcon.transform.parent = objSlot.transform;
		objIcon.transform.localPosition = Vector3.zero;
		
		count_ = objIcon.GetComponentInChildren<SpriteText>();
		if( count_ != null && m_SearchInfo.sItem.nOverlapped > 1)
			count_.Text = m_SearchInfo.sItem.nOverlapped.ToString();
		
		// item number must be added
		
		txt_Grade.Text = item.GetStrGrade();
		txt_Level.Text = item.ItemData.levelLimit.ToString();
		
		string str = m_SimpleName = AsTableManager.Instance.GetTbl_String(item.ItemData.nameId);
		if( m_SearchInfo.sItem.nStrengthenCount > 0)
			str = Color.white + "+" + m_SearchInfo.sItem.nStrengthenCount + " " + m_SimpleName;
		txt_Name.Text = str;

//		txt_Price.Text = _item.nItemGold.ToString();
		txt_Price.Text = _item.nItemGold.ToString("#,#0", CultureInfo.InvariantCulture);
		
		container.ScanChildren();
		container.GetScrollList().ClipItems();
	}
Exemplo n.º 2
0
	public void SetPotalNameShow( int _iPotalIdx)
	{
		Tbl_WarpData_Record record = AsTableManager.Instance.GetWarpDataRecord( _iPotalIdx);
		if( null == record)
			return;

		//if( record.getWarpMapId != TerrainMgr.Instance.GetCurMapID())
		//	return;

		if( false == record.IsNameExist())
			return;

		if( null == textPortalName)
		{
			GameObject temp = ResourceLoad.CreateGameObject( "UI/AsGUI/GUI_PortalNameShow");
			if( null == temp)
				return;

			textPortalName = temp.GetComponent<SpriteText>();
			if( null == textPortalName)
			{
				GameObject.DestroyObject( temp);
				return;
			}

			textPortalName.transform.parent = transform;
			//textPortalName.transform.localPosition = Vector3.zero;
			//textPortalName.transform.localRotation = Quaternion.identity;
			//textPortalName.transform.localScale = Vector3.one;

			textPortalName.Text = record.GetName();
			UpdateNamePosition();
		}
	}
Exemplo n.º 3
0
        public TimeSlider(Game game)
            : base(game) {

            frame = new Sprite(game, GraphicsCollection.GetPack("time-bar-bar2"));
            AddChild(frame);

            left = new PanelButton(game, PanelButtonType.TimeLeft);
            left.StackOrder = 1;
            left.YRelative = 4;
            left.XRelative = 4;
            AddChild(left);

            right = new PanelButton(game, PanelButtonType.TimeRight);
            right.XRelative = frame.Width - 12;
            right.YRelative = 4;
            AddChild(right);

            year = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            year.XRelative = 35;
            year.YRelative = 2;
            year.StackOrder = 2;
            AddChild(year);

            OnMousePress += new EventHandler<MouseEventArgs>(TimeSlider_OnMousePress);

            left.OnRelease += new EventHandler<ButtonEventArgs>(left_OnRelease);
            right.OnRelease += new EventHandler<ButtonEventArgs>(right_OnRelease);
        }
Exemplo n.º 4
0
	void Start () 
	{
		_currentTime = GameObject.Find("CurrentTime").GetComponent<SpriteText>();
		_duration = GameObject.Find("Duration").GetComponent<SpriteText>();
		
		_currentTime.text = "00:00";
		_duration.text = "00:00";
	}
Exemplo n.º 5
0
        public override void Load()
        {
            base.Load();

            Add(fpsText = new SpriteText());

            fpsText.Text = "...";
        }
Exemplo n.º 6
0
	void Start()
	{
		_toggle = GetComponent<UIStateToggleBtn>();
		_cameraText = GameObject.Find("\"Camera\"").GetComponent<SpriteText>();
		_targetText = GameObject.Find("\"Target\"").GetComponent<SpriteText>();
		
		_toggle.SetValueChangedDelegate(onClick);
	}
Exemplo n.º 7
0
        private void InitializeDrawElements()
        {
            var descriptor = GuiSystem.GetSkinItemDescriptor<TextBlockSkinItemDescriptor>();
            _spriteText = new SpriteText(descriptor.NormalFont);

            _spriteText.HorizontalAlignment = HorizontalAlignment;
            _spriteText.VerticalAlignment = VerticalAlignment;
        }
Exemplo n.º 8
0
	public void SetFontFromSystemLanguage( SpriteText spritetext, bool bOutLine = false)
	{
		if( null != spritetext)
		{
			if( true == bOutLine)
				spritetext.SetFont( fontText_Outline, fontMaterial_Outline);
			else
				spritetext.SetFont( fontText, fontMaterial);
		}
	}
	// Use this for initialization
	void Start () 
	{
		spriteText = GetComponent<SpriteText>();
		spriteText.Color = color;
		
		transform.Rotate(90f, 0f, 0f);
		
		alpha = alphaStart;
		timeAlive = 0f;
	}
Exemplo n.º 10
0
    public static List<string> ParseText(SpriteText spriteText, string text)
    {
        List<string> lines = new List<string>();

        SpriteFont font = spriteText.Font;
        float maxLineWidth = spriteText.LineWidth * font.PixelToUnits;
        float spaceWidth = GetWidth(font, ' ');
        int index = 0;
        bool splittedStart = false;

        SetBuffer(text.Length);
        int debugIter = 0;
        do
        {
            int wordsCount = 0;
            float lineWidth = 0.0f;
            string line = "";

            while (index < text.Length)
            {
                int storeIndex = index;
                string word = GetWord(text, ref index);
                float width = GetWidth(font, word);
                if (lineWidth + width > maxLineWidth)
                {
                    if (wordsCount == 0)
                    {
                        splittedStart = true;
                        line = SubWord(font, word, maxLineWidth);
                        index -= word.Length - line.Length;
                    }
                    else if (wordsCount == 1 && splittedStart)
                    {
                        word = line + word;
                        line = SubWord(font, word, maxLineWidth);
                        index -= word.Length - line.Length;
                    }
                    else
                    {
                        splittedStart = false;
                        index = storeIndex;
                    }
                    break;
                }
                wordsCount++;
                lineWidth += width + spaceWidth;
                line += word;
            }
            lines.Add(line);
        }
        while (index < text.Length && debugIter++ < 40);

        return lines;
    }
Exemplo n.º 11
0
        private void InitializeDrawElements()
        {
            var itemDescriptor = GuiSystem.GetSkinItemDescriptor<TextBoxSkinItemDescriptor>();

            _border = new NinePatchSprite(itemDescriptor.SkinTexture, itemDescriptor.NormalRectangle, itemDescriptor.Border);

            _spriteText = new SpriteText(itemDescriptor.NormalFont);
            _spriteText.HorizontalAlignment = HorizontalAlignment.Left; 

            _cursorAnimatorTimer = new ActionTimer(OnCursorAnimateTick, 0.5f, true);
            _cursorAnimatorTimer.Start();

            _inputController = new StringInputController(InputType.AlphaNumeric);
        }
Exemplo n.º 12
0
        public TimeTravelPanel(Game game)
            : base(game)
        {

            #region Elements
            frame = new Sprite(game, GraphicsCollection.GetPack("time-panel-frame"));

            AddChild(frame);

            spriteTextCurrentYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            spriteTextCurrentYear.Text = GameManager.CurrentYear.ToString();
            spriteTextCurrentYear.Tint = Color.WhiteSmoke;
            spriteTextCurrentYear.XRelative = 55;
            spriteTextCurrentYear.YRelative = 42;

            AddChild(spriteTextCurrentYear);

            minimize = new PanelButton(game, PanelButtonType.TimeMinimize);
            minimize.XRelative = -10;
            minimize.YRelative = 27;
            minimize.StackOrder = 1;
            minimize.OnMousePress += new EventHandler<Operation_Cronos.Input.MouseEventArgs>(minimize_OnMousePress);
            AddChild(minimize);

            upArrow = new PanelButton(game, PanelButtonType.TimeUpArrow);
            upArrow.StackOrder = 1;
            upArrow.XRelative = 95;
            upArrow.YRelative = 32;
            upArrow.OnMousePress += new EventHandler<Operation_Cronos.Input.MouseEventArgs>(upArrow_OnMousePress);
            AddChild(upArrow);

            downArrow = new PanelButton(game, PanelButtonType.TimeDownArrow);
            downArrow.XRelative = 97;
            downArrow.YRelative = 55;
            downArrow.StackOrder = 1;
            downArrow.OnPress += new EventHandler<ButtonEventArgs>(downArrow_OnPress);
            AddChild(downArrow);

            travel = new PanelButton(game, PanelButtonType.TimeTravelButton);
            travel.XRelative = 33;
            travel.YRelative = 80;
            travel.StackOrder = 1;
            travel.OnPress += new EventHandler<ButtonEventArgs>(travel_OnPress);
            AddChild(travel);

            #endregion

        }
Exemplo n.º 13
0
	private void ShowNextCount()
	{
		//TODO: Why can't spriteText be found in Start() or Awake()
		if(!spriteText)
		{
			spriteText = GetComponent("SpriteText") as SpriteText;
		}
		
		// update text
		string text = (currentCount == 0) ? "GO!" : currentCount.ToString();
		spriteText.Text = text;
		
		// perform animation
		iTween.ScaleBy(gameObject, iTween.Hash("amount", new Vector3(2.0f, 2.0f, 1.0f), "time", 1.0f, "oncomplete", "OnCount", "looptype", iTween.LoopType.loop));
		iTween.FadeTo(gameObject, iTween.Hash("alpha", 0.0f, "time", 1.0f, "looptype", iTween.LoopType.loop));
	}
Exemplo n.º 14
0
        public YearPanel(Game game)
            : base(game)
        {
            frame = new Sprite(game, GraphicsCollection.GetPack("year-panel-frame"));
            frame.YRelative = -7;
            AddChild(frame);

            reset = new PanelButton(game, PanelButtonType.YearReset);
            reset.XRelative = 245;
            reset.YRelative = 9;
            reset.OnRelease += new EventHandler<ButtonEventArgs>(reset_OnRelease);
            AddChild(reset);

            year = new SpriteText(game, FontsCollection.GetPack("Trebuchet MS 14").Font);
            year.XRelative = 173;
            year.YRelative = 5;
            year.Text = "2010";
            AddChild(year);

            population = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            population.XRelative = 400;
            population.YRelative = 5;
            population.TextAlignment = Align.Right;
            AddChild(population);

            money = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            money.YRelative = 5;
            money.XRelative = 25;
            AddChild(money);

            historicalPeriod = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font);
            historicalPeriod.XRelative = 170;
            historicalPeriod.YRelative = 30;
            AddChild(historicalPeriod);

            gologan = new Sprite(game, GraphicsCollection.GetPack("gologan"));
            gologan.YRelative = 5;
            gologan.XRelative = 10;
            gologan.StackOrder = 1;

            AddChild(gologan);

            smiley = new Sprite(game, GraphicsCollection.GetPack("smiley"));
            smiley.XRelative = 280;
            smiley.YRelative = 5;
            AddChild(smiley);
        }
Exemplo n.º 15
0
        public GraphPanel(Game game)
            : base(game)
        {
            topBar = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            topBar.Width = 300;
            topBar.Height = 2;
            topBar.XRelative = 120;
            topBar.YRelative = 99;
            topBar.Tint = Color.Orange;
            AddChild(topBar);

            bottomBar = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            bottomBar.Width = 300;
            bottomBar.Height = 2;
            bottomBar.XRelative = 120;
            bottomBar.YRelative = 201;
            bottomBar.Tint = Color.Orange;
            AddChild(bottomBar);

            startYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            startYear.XRelative = 120;
            startYear.YRelative = 180;
            AddChild(startYear);

            endYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            endYear.XRelative = 390;
            endYear.YRelative = 180;
            AddChild(endYear);

            //90, 440
            bars = new List<GraphBar>(300);
            for (int year = 0; year < 300; year++)
            {
                GraphBar bar = new GraphBar(game, 0);
                bar.XRelative = 200 + year;
                bar.YRelative = 200;
                bars.Add(bar);
                AddChild(bar);
            }

            selectedYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            selectedYear.XRelative = 130;
            selectedYear.YRelative = 55;
            
            AddChild(selectedYear);
        }
Exemplo n.º 16
0
        public OptionsSection()
        {
            Margin = new MarginPadding { Top = 20 };
            AutoSizeAxes = Axes.Y;
            RelativeSizeAxes = Axes.X;

            const int headerSize = 26, headerMargin = 25;
            const int borderSize = 2;
            AddInternal(new Drawable[]
            {
                new Box
                {
                    Colour = new Color4(0, 0, 0, 255),
                    RelativeSizeAxes = Axes.X,
                    Height = borderSize,
                },
                new Container
                {
                    Padding = new MarginPadding
                    {
                        Top = 20 + borderSize,
                        Left = OptionsOverlay.CONTENT_MARGINS,
                        Right = OptionsOverlay.CONTENT_MARGINS,
                        Bottom = 10,
                    },
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes = Axes.Y,
                    Children = new[]
                    {
                        headerLabel = new SpriteText
                        {
                            TextSize = headerSize,
                            Text = Header,
                        },
                        content = new FlowContainer
                        {
                            Margin = new MarginPadding { Top = headerSize + headerMargin },
                            Direction = FlowDirection.VerticalOnly,
                            Spacing = new Vector2(0, 50),
                            AutoSizeAxes = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        },
                    }
                },
            });
        }
Exemplo n.º 17
0
        public BeatmapSetHeader(WorkingBeatmap beatmap)
        {
            this.beatmap = beatmap;

            Children = new Drawable[]
            {
                new PanelBackground(beatmap)
                {
                    RelativeSizeAxes = Axes.Both,
                },
                new FlowContainer
                {
                    Direction = FlowDirection.VerticalOnly,
                    Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
                    AutoSizeAxes = Axes.Both,
                    Children = new[]
                    {
                        title = new SpriteText
                        {
                            Font = @"Exo2.0-BoldItalic",
                            Text = beatmap.BeatmapSetInfo.Metadata.Title,
                            TextSize = 22,
                            Shadow = true,
                        },
                        artist = new SpriteText
                        {
                            Margin = new MarginPadding { Top = -1 },
                            Font = @"Exo2.0-SemiBoldItalic",
                            Text = beatmap.BeatmapSetInfo.Metadata.Artist,
                            TextSize = 17,
                            Shadow = true,
                        },
                        new FlowContainer
                        {
                            Margin = new MarginPadding { Top = 5 },
                            AutoSizeAxes = Axes.Both,
                            Children = new[]
                            {
                                new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)),
                                new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)),
                            }
                        }
                    }
                }
            };
        }
	void Start()
	{		
		monsterScrollList = GameObject.Find("MonsterScrollList").GetComponent<UIScrollList>();
		statsPanel = GameObject.Find("MonsterInfoPanel").GetComponent<UIPanel>();
		
		magnitudeBar = statsPanel.transform.FindChild("damage").FindChild("damageBar").GetComponent<UIProgressBar>();
		attackSpeedBar = statsPanel.transform.FindChild("attackSpeed").FindChild("attackSpeedBar").GetComponent<UIProgressBar>();
		attackRangeBar = statsPanel.transform.FindChild("range").FindChild("rangeBar").GetComponent<UIProgressBar>();
		movementSpeedBar = statsPanel.transform.FindChild("moveSpeed").FindChild("moveSpeedBar").GetComponent<UIProgressBar>();
		healthBar = statsPanel.transform.FindChild("health").FindChild("healthBar").GetComponent<UIProgressBar>();
		spawnRate = statsPanel.transform.FindChild("spawnRate").GetComponent<SpriteText>();
		
		monsterName = statsPanel.transform.FindChild("name").GetComponent<SpriteText>();
		monsterSprite = statsPanel.transform.FindChild("sprite").GetComponent<tk2dSprite>();
		
		goldCost = statsPanel.transform.FindChild("goldCost").GetComponent<SpriteText>();
		
		confirmButton = statsPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
		confirmButtonImage = confirmButton.GetComponent<tk2dSprite>();
		
		monsterSaleConfirmationPanel = GameObject.Find("SellConfirmationPanel").GetComponent<UIPanel>();
		monsterSaleConfirmButton = monsterSaleConfirmationPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
		monsterSaleCancelButton = monsterSaleConfirmationPanel.transform.FindChild("cancelButton").GetComponent<UIButton>();
		monsterSaleConfirmButton.scriptWithMethodToInvoke = this;
		monsterSaleCancelButton.scriptWithMethodToInvoke = this;
		monsterSaleConfirmButton.methodToInvoke = "MonsterSaleConfirmed";
		monsterSaleCancelButton.methodToInvoke = "MonsterSaleCancelled";
				
		scrollListCamera = monsterScrollList.renderCamera;		
		
		levelManager = GameObject.Find("LevelManager").GetComponent<LevelManager>();
		
		listPanel = GameObject.Find("MonsterSelectionPanel").GetComponent<UIPanel>();
		
		Transform attackEffectParent = GameObject.Find("attackEffectIcons").transform.FindChild("icons");
		actionEffectIcons = attackEffectParent.GetComponentsInChildren<tk2dSprite>();	
		
		if (playerStatusManager == null)
			playerStatusManager = GameObject.Find("PlayerStatusManager").GetComponent<PlayerStatusManager>();
		
		entityFactory = EntityFactory.GetInstance();
		
		monsterSelectedCallback = null;
		
		LoadMonsterScrollPanel();
	}
	string RepairString(string _orgString, SpriteText _spriteText)
	{
		StringBuilder sb = new StringBuilder();

		Debug.LogWarning("Max width = " + _spriteText.maxWidth);

		string[] splits = _orgString.Split('\n');

		foreach (string sz in splits)
		{
			string szTemp = sz.Replace(" ", "");

			sb.Append(szTemp);
		}

		return sb.ToString();
	}
Exemplo n.º 20
0
        public ResearchPanel(Game game)
            : base(game)
        {
            selectedResearch = null;
            selectedMG = ConstructionType.None;

            timeline = new Sprite(game, GraphicsCollection.GetPack("control-research-timeline"));
            timeline.XRelative = 91;
            timeline.YRelative = 197;
            AddChild(timeline);

            ok = new ControlPanelButton(game, ControlPanelButtonType.ResearchOK);
            ok.XRelative = 413;
            ok.YRelative = 64;
            ok.IsVisible = false;
            ok.Enabled = false;
            ok.OnPress += new EventHandler<ButtonEventArgs>(ok_OnPress);
            AddChild(ok);

            name = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            name.Tint = Color.White;
            name.XRelative = 101;
            name.YRelative = 64;
            AddChild(name);

            description = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            description.Tint = Color.White;
            description.XRelative = 101;
            description.YRelative = 82;
            AddChild(description);

            price = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            price.Tint = Color.Lime;
            price.XRelative = 101;
            price.YRelative = 178;
            AddChild(price);

            year = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            year.Tint = Color.Lime;
            year.XRelative = 347;
            year.YRelative = 178;
            AddChild(year);

            icons = new List<ControlPanelButton>();
        }
Exemplo n.º 21
0
	public void SetText( SpriteText _text )
	{		
		left_.Anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_RIGHT;
		center_.Anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_CENTER;
		right_.Anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_LEFT;
		
		float width = _text.TotalWidth;
		Vector3 centerPt = center_.transform.localPosition;
		
		center_.width = width;
		
		left_.transform.localPosition = new Vector3( centerPt.x - ( width * 0.5f), 	centerPt.y, centerPt.z);
		right_.transform.localPosition = new Vector3( centerPt.x + ( width * 0.5f), 	centerPt.y, centerPt.z);
		
		left_.CalcSize();
		center_.CalcSize();
		right_.CalcSize();
	}
Exemplo n.º 22
0
 public SidebarButton()
 {
     Height = OptionsSidebar.default_width;
     RelativeSizeAxes = Axes.X;
     Children = new Drawable[]
     {
         backgroundBox = new Box
         {
             RelativeSizeAxes = Axes.Both,
             BlendingMode = BlendingMode.Additive,
             Colour = OsuColour.Gray(60),
             Alpha = 0,
         },
         new Container
         {
             Width = OptionsSidebar.default_width,
             RelativeSizeAxes = Axes.Y,
             Children = new[]
             {
                 drawableIcon = new TextAwesome
                 {
                     Anchor = Anchor.Centre,
                     Origin = Anchor.Centre,
                 },
             }
         },
         headerText = new SpriteText
         {
             Position = new Vector2(OptionsSidebar.default_width + 10, 0),
             Anchor = Anchor.CentreLeft,
             Origin = Anchor.CentreLeft,
         },
         selectionIndicator = new Box
         {
             Alpha = 0,
             RelativeSizeAxes = Axes.Y,
             Width = 5,
             Anchor = Anchor.CentreRight,
             Origin = Anchor.CentreRight,
         }
     };
 }
Exemplo n.º 23
0
        public MissionPanel(Game game)
            : base(game)
        {
            frame = new Sprite(game, GraphicsCollection.GetPack("mission-frame"));
            AddChild(frame);

            close = new ControlPanelButton(game, ControlPanelButtonType.Close);
            close.StackOrder = 3;
            close.XRelative = 428;
            close.YRelative = 7;
            close.OnMousePress+=new EventHandler<Operation_Cronos.Input.MouseEventArgs>(close_OnMousePress);
            AddChild(close);

            text = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font);
            text.StackOrder = 3;
            text.MaxLength = 350;
            text.XRelative = 30;
            text.YRelative = 50;
            AddChild(text);
        }
Exemplo n.º 24
0
        public Tooltip(Game game, int OneOfThreeSize)
            : base(game) 
        {
            if (OneOfThreeSize==3)
                Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_large"));
            if (OneOfThreeSize==2)
                Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_small"));
            if (OneOfThreeSize==1)
                Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_mini"));

            Background.StackOrder = 0;
            AddChild(Background);

            text = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font);
            text.StackOrder = 1;
            text.XRelative = 5;
            text.YRelative = 3;
            text.MaxLength = 350;

            AddChild(text);
        }
Exemplo n.º 25
0
        private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours)
        {
            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Masking      = true,
                    CornerRadius = 5,
                    EdgeEffect   = new EdgeEffect
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        title = new OsuSpriteText
                        {
                            Origin   = Anchor.BottomCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 40),
                            TextSize = 25,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-MediumItalic"
                        },
                        artist = new OsuSpriteText
                        {
                            Origin   = Anchor.TopCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 45),
                            TextSize = 15,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-BoldItalic"
                        },
                        new Container
                        {
                            Padding = new MarginPadding {
                                Bottom = progress_height
                            },
                            Height           = bottom_black_area_height,
                            RelativeSizeAxes = Axes.X,
                            Origin           = Anchor.BottomCentre,
                            Anchor           = Anchor.BottomCentre,
                            Children         = new Drawable[]
                            {
                                new FillFlowContainer <Button>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(5),
                                    Origin       = Anchor.Centre,
                                    Anchor       = Anchor.Centre,
                                    Children     = new[]
                                    {
                                        new Button
                                        {
                                            Action = prev,
                                            Icon   = FontAwesome.fa_step_backward,
                                        },
                                        playButton = new Button
                                        {
                                            Scale     = new Vector2(1.4f),
                                            IconScale = new Vector2(1.4f),
                                            Action    = () =>
                                            {
                                                if (current?.Track == null)
                                                {
                                                    return;
                                                }
                                                if (current.Track.IsRunning)
                                                {
                                                    current.Track.Stop();
                                                }
                                                else
                                                {
                                                    current.Track.Start();
                                                }
                                            },
                                            Icon = FontAwesome.fa_play_circle_o,
                                        },
                                        new Button
                                        {
                                            Action = next,
                                            Icon   = FontAwesome.fa_step_forward,
                                        },
                                    }
                                },
                                new Button
                                {
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.CentreRight,
                                    Position = new Vector2(-bottom_black_area_height / 2, 0),
                                    Icon     = FontAwesome.fa_bars,
                                },
                            }
                        },
                        progress = new DragBar
                        {
                            Origin        = Anchor.BottomCentre,
                            Anchor        = Anchor.BottomCentre,
                            Height        = progress_height,
                            Colour        = colours.Yellow,
                            SeekRequested = seek
                        }
                    }
                }
            };

            this.beatmaps = beatmaps;
            trackManager  = game.Audio.Track;
            preferUnicode = config.GetBindable <bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None);

            beatmapSource = game.Beatmap ?? new Bindable <WorkingBeatmap>();
            playList      = beatmaps.GetAllWithChildren <BeatmapSetInfo>();

            currentBackground = new MusicControllerBackground();
            dragContainer.Add(currentBackground);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Is called everytime a formatted text gets added to format it
 /// </summary>
 /// <param name="markers">A list of markers that tell the implementation how it should format the text</param>
 /// <param name="text">The <see cref="SpriteText"/> to format</param>
 protected abstract void FormatText(List <T> markers, SpriteText text);
Exemplo n.º 27
0
        private void load()
        {
            const int line_offset = 80;

            Rotation = -45;

            Children = new Drawable[]
            {
                lines = new Container <Box>
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        lineTopLeft = new Box
                        {
                            Origin   = Anchor.CentreLeft,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(-line_offset, -line_offset),
                            Rotation = 45,
                            Colour   = Color4.White.Opacity(180),
                        },
                        lineTopRight = new Box
                        {
                            Origin   = Anchor.CentreRight,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(line_offset, -line_offset),
                            Rotation = -45,
                            Colour   = Color4.White.Opacity(80),
                        },
                        lineBottomLeft = new Box
                        {
                            Origin   = Anchor.CentreLeft,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(-line_offset, line_offset),
                            Rotation = -45,
                            Colour   = Color4.White.Opacity(230),
                        },
                        lineBottomRight = new Box
                        {
                            Origin   = Anchor.CentreRight,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(line_offset, line_offset),
                            Rotation = 45,
                            Colour   = Color4.White.Opacity(130),
                        },
                    }
                },
                bigRing     = new Ring(RhythmicColors.FromHex(@"B6C5E9"), 0.85f),
                mediumRing  = new Ring(Color4.White.Opacity(130), 0.7f),
                smallRing   = new Ring(Color4.White, 0.6f),
                welcomeText = new SpriteText
                {
                    Anchor  = Anchor.Centre,
                    Origin  = Anchor.Centre,
                    Text    = "welcome",
                    Padding = new MarginPadding {
                        Bottom = 10
                    },
                    Font    = RhythmicFont.GetFont(size: 74),
                    Alpha   = 0,
                    Spacing = new Vector2(5),
                },
                new CircularContainer
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(logo_size),
                    Masking  = true,
                    Children = new Drawable[]
                    {
                        backgroundFill = new Box
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            RelativeSizeAxes = Axes.Both,
                            Height           = 0,
                            Colour           = RhythmicColors.FromHex(@"C6D8FF").Opacity(160),
                        },
                        foregroundFill = new Box
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Size             = Vector2.Zero,
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0,
                            Colour           = Color4.White,
                        },
                    }
                }
            };

            foreach (Box line in lines)
            {
                line.Size  = new Vector2(105, 1.5f);
                line.Alpha = 0;
            }

            Scale = new Vector2(0.5f);
        }
Exemplo n.º 28
0
            public ArcPath(bool raw, bool keepFraction, InputResampler inputResampler, Texture texture, Color4 colour, SpriteText output)
            {
                InputResampler = inputResampler;
                const int target_raw = 1024;

                RelativeSizeAxes = Axes.Both;
                Texture          = texture;
                Colour           = colour;

                for (int i = 0; i < target_raw; i++)
                {
                    float   x = (float)(Math.Sin(i / (double)target_raw * (Math.PI * 0.5)) * 200) + 50.5f;
                    float   y = (float)(Math.Cos(i / (double)target_raw * (Math.PI * 0.5)) * 200) + 50.5f;
                    Vector2 v = keepFraction ? new Vector2(x, y) : new Vector2((int)x, (int)y);
                    if (raw)
                    {
                        AddRawVertex(v);
                    }
                    else
                    {
                        AddSmoothedVertex(v);
                    }
                }

                output.Text += ": Smoothed=" + NumVertices + ", Raw=" + NumRaw;
            }
Exemplo n.º 29
0
        private void DefaultDraw(GameTime gameTime)
        {
            try
            {
                if (!ZoomLevelIsOne)
                {
                    GraphicsDevice.SetRenderTarget(screen);
                }

                GraphicsDevice.Clear(bgColor);
                if (options.showMenuBackground && activeClickableMenu != null && activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    activeClickableMenu.drawBackground(spriteBatch);
                    GraphicsEvents.InvokeOnPreRenderGuiEvent(this);
                    activeClickableMenu.draw(spriteBatch);
                    GraphicsEvents.InvokeOnPostRenderGuiEvent(this);
                    spriteBatch.End();
                    if (ZoomLevelIsOne)
                    {
                        return;
                    }

                    GraphicsDevice.SetRenderTarget(null);
                    GraphicsDevice.Clear(bgColor);
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                    spriteBatch.Draw(screen, Vector2.Zero, screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
                    spriteBatch.End();
                    return;
                }
                if (gameMode == 11)
                {
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    spriteBatch.DrawString(smoothFont, "Stardew Valley has crashed...", new Vector2(16f, 16f), Color.HotPink);
                    spriteBatch.DrawString(smoothFont, "Please send the error report or a screenshot of this message to @ConcernedApe. (http://stardewvalley.net/contact/)", new Vector2(16f, 32f), new Color(0, 255, 0));
                    spriteBatch.DrawString(smoothFont, parseText(errorMessage, smoothFont, graphics.GraphicsDevice.Viewport.Width), new Vector2(16f, 48f), Color.White);
                    spriteBatch.End();
                    return;
                }
                if (currentMinigame != null)
                {
                    currentMinigame.draw(spriteBatch);
                    if (globalFade && !menuUp && (!nameSelectUp || messagePause))
                    {
                        spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                        spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * ((gameMode == 0) ? (1f - fadeToBlackAlpha) : fadeToBlackAlpha));
                        spriteBatch.End();
                    }
                    if (!ZoomLevelIsOne)
                    {
                        GraphicsDevice.SetRenderTarget(null);
                        GraphicsDevice.Clear(bgColor);
                        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                        spriteBatch.Draw(screen, Vector2.Zero, screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
                        spriteBatch.End();
                    }
                    return;
                }
                if (showingEndOfNightStuff)
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    activeClickableMenu?.draw(spriteBatch);
                    spriteBatch.End();
                    if (ZoomLevelIsOne)
                    {
                        return;
                    }

                    GraphicsDevice.SetRenderTarget(null);
                    GraphicsDevice.Clear(bgColor);
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                    spriteBatch.Draw(screen, Vector2.Zero, screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
                    spriteBatch.End();
                    return;
                }
                if (gameMode == 6)
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    string text = "";
                    int    num  = 0;
                    while (num < gameTime.TotalGameTime.TotalMilliseconds % 999.0 / 333.0)
                    {
                        text += ".";
                        num++;
                    }
                    SpriteText.drawString(spriteBatch, "Loading" + text, 64, graphics.GraphicsDevice.Viewport.Height - 64, 999, -1, 999, 1f, 1f, false, 0, "Loading...");
                    spriteBatch.End();
                    if (!ZoomLevelIsOne)
                    {
                        GraphicsDevice.SetRenderTarget(null);
                        GraphicsDevice.Clear(bgColor);
                        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                        spriteBatch.Draw(screen, Vector2.Zero, screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
                        spriteBatch.End();
                    }
                    return;
                }
                if (gameMode == 0)
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                }
                else
                {
                    if (drawLighting)
                    {
                        GraphicsDevice.SetRenderTarget(lightmap);
                        GraphicsDevice.Clear(Color.White * 0f);
                        spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null);
                        spriteBatch.Draw(staminaRect, lightmap.Bounds, currentLocation.name.Equals("UndergroundMine") ? mine.getLightingColor(gameTime) : ((!ambientLight.Equals(Color.White) && (!isRaining || !currentLocation.isOutdoors)) ? ambientLight : outdoorLight));
                        for (int i = 0; i < currentLightSources.Count; i++)
                        {
                            if (Utility.isOnScreen(currentLightSources.ElementAt(i).position, (int)(currentLightSources.ElementAt(i).radius *tileSize * 4f)))
                            {
                                spriteBatch.Draw(currentLightSources.ElementAt(i).lightTexture, GlobalToLocal(viewport, currentLightSources.ElementAt(i).position) / options.lightingQuality, currentLightSources.ElementAt(i).lightTexture.Bounds, currentLightSources.ElementAt(i).color, 0f, new Vector2(currentLightSources.ElementAt(i).lightTexture.Bounds.Center.X, currentLightSources.ElementAt(i).lightTexture.Bounds.Center.Y), currentLightSources.ElementAt(i).radius / options.lightingQuality, SpriteEffects.None, 0.9f);
                            }
                        }
                        spriteBatch.End();
                        GraphicsDevice.SetRenderTarget(ZoomLevelIsOne ? null : screen);
                    }
                    if (bloomDay)
                    {
                        bloom?.BeginDraw();
                    }
                    GraphicsDevice.Clear(bgColor);
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    GraphicsEvents.InvokeOnPreRenderEvent(this);
                    background?.draw(spriteBatch);
                    mapDisplayDevice.BeginScene(spriteBatch);
                    currentLocation.Map.GetLayer("Back").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
                    currentLocation.drawWater(spriteBatch);
                    if (CurrentEvent == null)
                    {
                        using (List <NPC> .Enumerator enumerator = currentLocation.characters.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                NPC current = enumerator.Current;
                                if (current != null && !current.swimming && !current.hideShadow && !current.IsMonster && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current.getTileLocation()))
                                {
                                    spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current.position + new Vector2(current.sprite.spriteWidth * pixelZoom / 2f, current.GetBoundingBox().Height + (current.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current.yJumpOffset / 40f) * current.scale, SpriteEffects.None, Math.Max(0f, current.getStandingY() / 10000f) - 1E-06f);
                                }
                            }
                            goto IL_B30;
                        }
                    }
                    foreach (NPC current2 in CurrentEvent.actors)
                    {
                        if (!current2.swimming && !current2.hideShadow && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current2.getTileLocation()))
                        {
                            spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current2.position + new Vector2(current2.sprite.spriteWidth * pixelZoom / 2f, current2.GetBoundingBox().Height + (current2.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current2.yJumpOffset / 40f) * current2.scale, SpriteEffects.None, Math.Max(0f, current2.getStandingY() / 10000f) - 1E-06f);
                        }
                    }
IL_B30:
                    if (!player.swimming && !player.isRidingHorse() && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
                    {
                        spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, 0f);
                    }
                    currentLocation.Map.GetLayer("Buildings").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
                    mapDisplayDevice.EndScene();
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    if (CurrentEvent == null)
                    {
                        using (List <NPC> .Enumerator enumerator3 = currentLocation.characters.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                NPC current3 = enumerator3.Current;
                                if (current3 != null && !current3.swimming && !current3.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current3.getTileLocation()))
                                {
                                    spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current3.position + new Vector2(current3.sprite.spriteWidth * pixelZoom / 2f, current3.GetBoundingBox().Height + (current3.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current3.yJumpOffset / 40f) * current3.scale, SpriteEffects.None, Math.Max(0f, current3.getStandingY() / 10000f) - 1E-06f);
                                }
                            }
                            goto IL_F5F;
                        }
                    }
                    foreach (NPC current4 in CurrentEvent.actors)
                    {
                        if (!current4.swimming && !current4.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current4.getTileLocation()))
                        {
                            spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current4.position + new Vector2(current4.sprite.spriteWidth * pixelZoom / 2f, current4.GetBoundingBox().Height + (current4.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current4.yJumpOffset / 40f) * current4.scale, SpriteEffects.None, Math.Max(0f, current4.getStandingY() / 10000f) - 1E-06f);
                        }
                    }
IL_F5F:
                    if (!player.swimming && !player.isRidingHorse() && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
                    {
                        spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, Math.Max(0.0001f, player.getStandingY() / 10000f + 0.00011f) - 0.0001f);
                    }
                    if (displayFarmer)
                    {
                        player.draw(spriteBatch);
                    }
                    if ((eventUp || killScreen) && !killScreen)
                    {
                        currentLocation.currentEvent?.draw(spriteBatch);
                    }
                    if (player.currentUpgrade != null && player.currentUpgrade.daysLeftTillUpgradeDone <= 3 && currentLocation.Name.Equals("Farm"))
                    {
                        spriteBatch.Draw(player.currentUpgrade.workerTexture, GlobalToLocal(viewport, player.currentUpgrade.positionOfCarpenter), player.currentUpgrade.getSourceRectangle(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, (player.currentUpgrade.positionOfCarpenter.Y + tileSize * 3 / 4) / 10000f);
                    }
                    currentLocation.draw(spriteBatch);
                    if (eventUp && currentLocation.currentEvent?.messageToScreen != null)
                    {
                        drawWithBorder(currentLocation.currentEvent.messageToScreen, Color.Black, Color.White, new Vector2(graphics.GraphicsDevice.Viewport.TitleSafeArea.Width / 2 - borderFont.MeasureString(currentLocation.currentEvent.messageToScreen).X / 2f, graphics.GraphicsDevice.Viewport.TitleSafeArea.Height - tileSize), 0f, 1f, 0.999f);
                    }
                    if (player.ActiveObject == null && (player.UsingTool || pickingTool) && player.CurrentTool != null && (!player.CurrentTool.Name.Equals("Seeds") || pickingTool))
                    {
                        drawTool(player);
                    }
                    if (currentLocation.Name.Equals("Farm"))
                    {
                        drawFarmBuildings();
                    }
                    if (tvStation >= 0)
                    {
                        spriteBatch.Draw(tvStationTexture, GlobalToLocal(viewport, new Vector2(6 * tileSize + tileSize / 4, 2 * tileSize + tileSize / 2)), new Rectangle(tvStation * 24, 0, 24, 15), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-08f);
                    }
                    if (panMode)
                    {
                        spriteBatch.Draw(fadeToBlackRect, new Rectangle((int)Math.Floor((getOldMouseX() + viewport.X) / (double)tileSize) * tileSize - viewport.X, (int)Math.Floor((getOldMouseY() + viewport.Y) / (double)tileSize) * tileSize - viewport.Y, tileSize, tileSize), Color.Lime * 0.75f);
                        foreach (Warp current5 in currentLocation.warps)
                        {
                            spriteBatch.Draw(fadeToBlackRect, new Rectangle(current5.X * tileSize - viewport.X, current5.Y * tileSize - viewport.Y, tileSize, tileSize), Color.Red * 0.75f);
                        }
                    }
                    mapDisplayDevice.BeginScene(spriteBatch);
                    currentLocation.Map.GetLayer("Front").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
                    mapDisplayDevice.EndScene();
                    currentLocation.drawAboveFrontLayer(spriteBatch);
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    if (currentLocation.Name.Equals("Farm") && stats.SeedsSown >= 200u)
                    {
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(3 * tileSize + tileSize / 4, tileSize + tileSize / 3)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize + tileSize, 2 * tileSize + tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(5 * tileSize, 2 * tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(3 * tileSize + tileSize / 2, 3 * tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(5 * tileSize - tileSize / 4, tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize, 3 * tileSize + tileSize / 6)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                        spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize + tileSize / 5, 2 * tileSize + tileSize / 3)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
                    }
                    if (displayFarmer && player.ActiveObject != null && player.ActiveObject.bigCraftable && checkBigCraftableBoundariesForFrontLayer() && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), player.getStandingY()), viewport.Size) == null)
                    {
                        drawPlayerHeldObject(player);
                    }
                    else if (displayFarmer && player.ActiveObject != null && ((currentLocation.Map.GetLayer("Front").PickTile(new Location((int)player.position.X, (int)player.position.Y - tileSize * 3 / 5), viewport.Size) != null && !currentLocation.Map.GetLayer("Front").PickTile(new Location((int)player.position.X, (int)player.position.Y - tileSize * 3 / 5), viewport.Size).TileIndexProperties.ContainsKey("FrontAlways")) || (currentLocation.Map.GetLayer("Front").PickTile(new Location(player.GetBoundingBox().Right, (int)player.position.Y - tileSize * 3 / 5), viewport.Size) != null && !currentLocation.Map.GetLayer("Front").PickTile(new Location(player.GetBoundingBox().Right, (int)player.position.Y - tileSize * 3 / 5), viewport.Size).TileIndexProperties.ContainsKey("FrontAlways"))))
                    {
                        drawPlayerHeldObject(player);
                    }
                    if ((player.UsingTool || pickingTool) && player.CurrentTool != null && (!player.CurrentTool.Name.Equals("Seeds") || pickingTool) && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), (int)player.position.Y - tileSize * 3 / 5), viewport.Size) != null && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), player.getStandingY()), viewport.Size) == null)
                    {
                        drawTool(player);
                    }
                    if (currentLocation.Map.GetLayer("AlwaysFront") != null)
                    {
                        mapDisplayDevice.BeginScene(spriteBatch);
                        currentLocation.Map.GetLayer("AlwaysFront").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
                        mapDisplayDevice.EndScene();
                    }
                    if (toolHold > 400f && player.CurrentTool.UpgradeLevel >= 1 && player.canReleaseTool)
                    {
                        Color color = Color.White;
                        switch ((int)(toolHold / 600f) + 2)
                        {
                        case 1:
                            color = Tool.copperColor;
                            break;

                        case 2:
                            color = Tool.steelColor;
                            break;

                        case 3:
                            color = Tool.goldColor;
                            break;

                        case 4:
                            color = Tool.iridiumColor;
                            break;
                        }
                        spriteBatch.Draw(littleEffect, new Rectangle((int)player.getLocalPosition(viewport).X - 2, (int)player.getLocalPosition(viewport).Y - (player.CurrentTool.Name.Equals("Watering Can") ? 0 : tileSize) - 2, (int)(toolHold % 600f * 0.08f) + 4, tileSize / 8 + 4), Color.Black);
                        spriteBatch.Draw(littleEffect, new Rectangle((int)player.getLocalPosition(viewport).X, (int)player.getLocalPosition(viewport).Y - (player.CurrentTool.Name.Equals("Watering Can") ? 0 : tileSize), (int)(toolHold % 600f * 0.08f), tileSize / 8), color);
                    }
                    if (isDebrisWeather && currentLocation.IsOutdoors && !currentLocation.ignoreDebrisWeather && !currentLocation.Name.Equals("Desert") && viewport.X > -10)
                    {
                        foreach (WeatherDebris current6 in debrisWeather)
                        {
                            current6.draw(spriteBatch);
                        }
                    }
                    farmEvent?.draw(spriteBatch);
                    if (currentLocation.LightLevel > 0f && timeOfDay < 2000)
                    {
                        spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * currentLocation.LightLevel);
                    }
                    if (screenGlow)
                    {
                        spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, screenGlowColor * screenGlowAlpha);
                    }
                    currentLocation.drawAboveAlwaysFrontLayer(spriteBatch);
                    if (player.CurrentTool is FishingRod && ((player.CurrentTool as FishingRod).isTimingCast || (player.CurrentTool as FishingRod).castingChosenCountdown > 0f || (player.CurrentTool as FishingRod).fishCaught || (player.CurrentTool as FishingRod).showingTreasure))
                    {
                        player.CurrentTool.draw(spriteBatch);
                    }
                    if (isRaining && currentLocation.IsOutdoors && !currentLocation.Name.Equals("Desert") && !(currentLocation is Summit) && (!eventUp || currentLocation.isTileOnMap(new Vector2(viewport.X / tileSize, viewport.Y / tileSize))))
                    {
                        for (int j = 0; j < rainDrops.Length; j++)
                        {
                            spriteBatch.Draw(rainTexture, rainDrops[j].position, getSourceRectForStandardTileSheet(rainTexture, rainDrops[j].frame), Color.White);
                        }
                    }

                    spriteBatch.End();

                    //base.Draw(gameTime);

                    spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    if (eventUp && currentLocation.currentEvent != null)
                    {
                        foreach (NPC current7 in currentLocation.currentEvent.actors)
                        {
                            if (current7.isEmoting)
                            {
                                Vector2 localPosition = current7.getLocalPosition(viewport);
                                localPosition.Y -= tileSize * 2 + pixelZoom * 3;
                                if (current7.age == 2)
                                {
                                    localPosition.Y += tileSize / 2;
                                }
                                else if (current7.gender == 1)
                                {
                                    localPosition.Y += tileSize / 6;
                                }
                                spriteBatch.Draw(emoteSpriteSheet, localPosition, new Rectangle(current7.CurrentEmoteIndex * (tileSize / 4) % emoteSpriteSheet.Width, current7.CurrentEmoteIndex * (tileSize / 4) / emoteSpriteSheet.Width * (tileSize / 4), tileSize / 4, tileSize / 4), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, current7.getStandingY() / 10000f);
                            }
                        }
                    }
                    spriteBatch.End();
                    if (drawLighting)
                    {
                        spriteBatch.Begin(SpriteSortMode.Deferred, new BlendState
                        {
                            ColorBlendFunction    = BlendFunction.ReverseSubtract,
                            ColorDestinationBlend = Blend.One,
                            ColorSourceBlend      = Blend.SourceColor
                        }, SamplerState.LinearClamp, null, null);
                        spriteBatch.Draw(lightmap, Vector2.Zero, lightmap.Bounds, Color.White, 0f, Vector2.Zero, options.lightingQuality, SpriteEffects.None, 1f);
                        if (isRaining && currentLocation.isOutdoors && !(currentLocation is Desert))
                        {
                            spriteBatch.Draw(staminaRect, graphics.GraphicsDevice.Viewport.Bounds, Color.OrangeRed * 0.45f);
                        }
                        spriteBatch.End();
                    }
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    if (drawGrid)
                    {
                        int   num2 = -viewport.X % tileSize;
                        float num3 = -(float)viewport.Y % tileSize;
                        for (int k = num2; k < graphics.GraphicsDevice.Viewport.Width; k += tileSize)
                        {
                            spriteBatch.Draw(staminaRect, new Rectangle(k, (int)num3, 1, graphics.GraphicsDevice.Viewport.Height), Color.Red * 0.5f);
                        }
                        for (float num4 = num3; num4 < (float)graphics.GraphicsDevice.Viewport.Height; num4 += (float)tileSize)
                        {
                            spriteBatch.Draw(staminaRect, new Rectangle(num2, (int)num4, graphics.GraphicsDevice.Viewport.Width, 1), Color.Red * 0.5f);
                        }
                    }
                    if (currentBillboard != 0)
                    {
                        drawBillboard();
                    }

                    GraphicsEvents.InvokeOnPreRenderHudEventNoCheck(this);
                    if ((displayHUD || eventUp) && currentBillboard == 0 && gameMode == 3 && !freezeControls && !panMode)
                    {
                        GraphicsEvents.InvokeOnPreRenderHudEvent(this);
                        drawHUD();
                        GraphicsEvents.InvokeOnPostRenderHudEvent(this);
                    }
                    else if (activeClickableMenu == null && farmEvent == null)
                    {
                        spriteBatch.Draw(mouseCursors, new Vector2(getOldMouseX(), getOldMouseY()), getSourceRectForStandardTileSheet(mouseCursors, 0, 16, 16), Color.White, 0f, Vector2.Zero, 4f + dialogueButtonScale / 150f, SpriteEffects.None, 1f);
                    }
                    GraphicsEvents.InvokeOnPostRenderHudEventNoCheck(this);

                    if (hudMessages.Any() && (!eventUp || isFestival()))
                    {
                        for (int l = hudMessages.Count - 1; l >= 0; l--)
                        {
                            hudMessages[l].draw(spriteBatch, l);
                        }
                    }
                }
                farmEvent?.draw(spriteBatch);
                if (dialogueUp && !nameSelectUp && !messagePause && !(activeClickableMenu is DialogueBox))
                {
                    drawDialogueBox();
                }

                if (progressBar)
                {
                    spriteBatch.Draw(fadeToBlackRect, new Rectangle((graphics.GraphicsDevice.Viewport.TitleSafeArea.Width - dialogueWidth) / 2, graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - tileSize * 2, dialogueWidth, tileSize / 2), Color.LightGray);
                    spriteBatch.Draw(staminaRect, new Rectangle((graphics.GraphicsDevice.Viewport.TitleSafeArea.Width - dialogueWidth) / 2, graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - tileSize * 2, (int)(pauseAccumulator / pauseTime * dialogueWidth), tileSize / 2), Color.DimGray);
                }
                if (eventUp)
                {
                    currentLocation.currentEvent?.drawAfterMap(spriteBatch);
                }
                if (isRaining && currentLocation.isOutdoors && !(currentLocation is Desert))
                {
                    spriteBatch.Draw(staminaRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Blue * 0.2f);
                }
                if ((fadeToBlack || globalFade) && !menuUp && (!nameSelectUp || messagePause))
                {
                    spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * ((gameMode == 0) ? (1f - fadeToBlackAlpha) : fadeToBlackAlpha));
                }
                else if (flashAlpha > 0f)
                {
                    if (options.screenFlash)
                    {
                        spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.White * Math.Min(1f, flashAlpha));
                    }
                    flashAlpha -= 0.1f;
                }

                if ((messagePause || globalFade) && dialogueUp)
                {
                    drawDialogueBox();
                }

                foreach (var current8 in screenOverlayTempSprites)
                {
                    current8.draw(spriteBatch, true);
                }

                if (debugMode)
                {
                    spriteBatch.DrawString(smallFont, string.Concat(new object[]
                    {
                        panMode ? ((getOldMouseX() + viewport.X) / tileSize + "," + (getOldMouseY() + viewport.Y) / tileSize) : string.Concat("aplayer: ", player.getStandingX() / tileSize, ", ", player.getStandingY() / tileSize),
                        Environment.NewLine,
                        "debugOutput: ",
                        debugOutput
                    }), new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y), Color.Red, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.9999999f);
                }

                /*if (inputMode)
                 * {
                 *  spriteBatch.DrawString(smallFont, "Input: " + debugInput, new Vector2(tileSize, tileSize * 3), Color.Purple);
                 * }*/
                if (showKeyHelp)
                {
                    spriteBatch.DrawString(smallFont, keyHelpString, new Vector2(tileSize, viewport.Height - tileSize - (dialogueUp ? (tileSize * 3 + (isQuestion ? (questionChoices.Count * tileSize) : 0)) : 0) - smallFont.MeasureString(keyHelpString).Y), Color.LightGray, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.9999999f);
                }

                GraphicsEvents.InvokeOnPreRenderGuiEventNoCheck(this);
                if (activeClickableMenu != null)
                {
                    GraphicsEvents.InvokeOnPreRenderGuiEvent(this);
                    activeClickableMenu.draw(spriteBatch);
                    GraphicsEvents.InvokeOnPostRenderGuiEvent(this);
                }
                else
                {
                    farmEvent?.drawAboveEverything(spriteBatch);
                }
                GraphicsEvents.InvokeOnPostRenderGuiEventNoCheck(this);

                GraphicsEvents.InvokeOnPostRenderEvent(this);
                spriteBatch.End();

                GraphicsEvents.InvokeDrawInRenderTargetTick(this);

                if (!ZoomLevelIsOne)
                {
                    GraphicsDevice.SetRenderTarget(null);
                    GraphicsDevice.Clear(bgColor);
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                    spriteBatch.Draw(screen, Vector2.Zero, screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
                    spriteBatch.End();
                }

                GraphicsEvents.InvokeAfterDraw(this);
            }
            catch (Exception ex)
            {
                Logging.Log.Exception($"An error occured in the overridden draw loop", ex);
            }
        }
Exemplo n.º 30
0
        public override void draw(SpriteBatch b)
        {
            if (!Game1.dialogueUp && !Game1.globalFade)
            {
                b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);

                if (this.Scale > .9f)
                {
                    SpriteText.drawStringWithScrollCenteredAt(b, "PelicanFiber 3.0 (a subsidiary of JojaNet, Inc.)", Game1.viewport.Width / 2, (int)(this.yPositionOnScreen * this.Scale));
                }
                else
                {
                    SpriteText.drawStringWithScrollCenteredAt(b, "PelicanFiber 3.0 (a subsidiary of JojaNet, Inc.)", Game1.viewport.Width / 2, (int)(this.yPositionOnScreen * this.Scale) + 25);
                }

                Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true);

                if (this.Scale < 1.0f)
                {
                    SpriteText.drawStringHorizontallyCenteredAt(b, "Click a Link Below to Shop Online", Game1.viewport.Width / 2, (int)(this.yPositionOnScreen + 92 * this.Scale) + 35);
                }
                else
                {
                    SpriteText.drawStringHorizontallyCenteredAt(b, "Click a Link Below to Shop Online", Game1.viewport.Width / 2, (int)(this.yPositionOnScreen + 92 * this.Scale));
                }

                Game1.dayTimeMoneyBox.drawMoneyBox(b);
                foreach (ClickableTextureComponent textureComponent in this.LinksToVisit)
                {
                    textureComponent.draw(b);
                }

                SpriteText.drawStringHorizontallyCenteredAt(b, "Blacksmith", (int)(this.xPositionOnScreen + 182 * this.Scale), (int)(this.yPositionOnScreen + 381 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Animals", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 381 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Produce", (int)(this.xPositionOnScreen + 714 * this.Scale), (int)(this.yPositionOnScreen + 381 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Carpentry", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 381 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Recipes", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 381 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Upgrades", (int)(this.xPositionOnScreen + 182 * this.Scale), (int)(this.yPositionOnScreen + 211 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Supplies", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 211 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                //SpriteText.drawStringHorizontallyCenteredAt(b, "Produce", (int)(this.xPositionOnScreen + 714 * scale), (int)(this.yPositionOnScreen + 381 * scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Buildings", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 211 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Fish", (int)(this.xPositionOnScreen + 182 * this.Scale), (int)(this.yPositionOnScreen + 643 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Dining", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 643 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Imports", (int)(this.xPositionOnScreen + 714 * this.Scale), (int)(this.yPositionOnScreen + 643 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Adventure", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 643 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Bundles", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 643 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);


                SpriteText.drawStringHorizontallyCenteredAt(b, "Wizard", (int)(this.xPositionOnScreen + 182 * this.Scale), (int)(this.yPositionOnScreen + 905 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Hats", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 905 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Hospital", (int)(this.xPositionOnScreen + 714 * this.Scale), (int)(this.yPositionOnScreen + 905 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Krobus", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 905 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Artifacts", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 905 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Dwarf", (int)(this.xPositionOnScreen + 182 * this.Scale), (int)(this.yPositionOnScreen + 1167 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Qi", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 1167 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Oaisis", (int)(this.xPositionOnScreen + 714 * this.Scale), (int)(this.yPositionOnScreen + 1167 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Joja", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 1167 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Foraged", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 997 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "by", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 1082 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Leah", (int)(this.xPositionOnScreen + 1246 * this.Scale), (int)(this.yPositionOnScreen + 1167 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 1);



                SpriteText.drawStringHorizontallyCenteredAt(b, "Blacksmith", (int)(this.xPositionOnScreen + 180 * this.Scale), (int)(this.yPositionOnScreen + 379 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Animals", (int)(this.xPositionOnScreen + 446 * this.Scale), (int)(this.yPositionOnScreen + 379 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Produce", (int)(this.xPositionOnScreen + 712 * this.Scale), (int)(this.yPositionOnScreen + 379 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Carpentry", (int)(this.xPositionOnScreen + 978 * this.Scale), (int)(this.yPositionOnScreen + 379 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Recipes", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 379 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);


                SpriteText.drawStringHorizontallyCenteredAt(b, "Upgrades", (int)(this.xPositionOnScreen + 180 * this.Scale), (int)(this.yPositionOnScreen + 209 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Supplies", (int)(this.xPositionOnScreen + 446 * this.Scale), (int)(this.yPositionOnScreen + 209 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                //SpriteText.drawStringHorizontallyCenteredAt(b, "Produce", (int)(this.xPositionOnScreen + 712 * scale), (int)(this.yPositionOnScreen + 379 * scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Buildings", (int)(this.xPositionOnScreen + 978 * this.Scale), (int)(this.yPositionOnScreen + 209 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Fish", (int)(this.xPositionOnScreen + 180 * this.Scale), (int)(this.yPositionOnScreen + 641 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Dining", (int)(this.xPositionOnScreen + 446 * this.Scale), (int)(this.yPositionOnScreen + 641 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Imports", (int)(this.xPositionOnScreen + 712 * this.Scale), (int)(this.yPositionOnScreen + 641 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Adventure", (int)(this.xPositionOnScreen + 978 * this.Scale), (int)(this.yPositionOnScreen + 641 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Bundles", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 641 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);


                SpriteText.drawStringHorizontallyCenteredAt(b, "Wizard", (int)(this.xPositionOnScreen + 180 * this.Scale), (int)(this.yPositionOnScreen + 903 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Hats", (int)(this.xPositionOnScreen + 446 * this.Scale), (int)(this.yPositionOnScreen + 903 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Hospital", (int)(this.xPositionOnScreen + 712 * this.Scale), (int)(this.yPositionOnScreen + 903 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Krobus", (int)(this.xPositionOnScreen + 978 * this.Scale), (int)(this.yPositionOnScreen + 903 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Artifacts", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 903 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Dwarf", (int)(this.xPositionOnScreen + 180 * this.Scale), (int)(this.yPositionOnScreen + 1165 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Qi", (int)(this.xPositionOnScreen + 448 * this.Scale), (int)(this.yPositionOnScreen + 1165 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Oaisis", (int)(this.xPositionOnScreen + 714 * this.Scale), (int)(this.yPositionOnScreen + 1165 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Joja", (int)(this.xPositionOnScreen + 980 * this.Scale), (int)(this.yPositionOnScreen + 1165 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Foraged", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 995 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "by", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 1080 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);
                SpriteText.drawStringHorizontallyCenteredAt(b, "Leah", (int)(this.xPositionOnScreen + 1244 * this.Scale), (int)(this.yPositionOnScreen + 1165 * this.Scale), 999999, -1, 999999, 1, 0.88f, false, 4);

                this.upperRightCloseButton.draw(b);
            }
            this.drawMouse(b);
        }
Exemplo n.º 31
0
        // Token: 0x06000CC2 RID: 3266 RVA: 0x00103ED0 File Offset: 0x001020D0
        public void draw(SpriteBatch b)
        {
            b.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
            b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, Game1.graphics.GraphicsDevice.Viewport.Height), new Color(38, 0, 7));
            b.Draw(Game1.mouseCursors, Utility.getTopLeftPositionForCenteringOnScreen(57 * Game1.pixelZoom, 13 * Game1.pixelZoom, 0, -4 * Game1.tileSize), new Rectangle?(new Rectangle(441, 424, 57, 13)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
            for (int i = 0; i < 3; i++)
            {
                b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 28 * Game1.pixelZoom + i * 26 * Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 32 * Game1.pixelZoom)), new Rectangle?(new Rectangle(306, 320, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                float faceValue = (this.slots[i] + 1f) % 8f;
                int   previous  = this.getIconIndex(((int)faceValue + 8 - 1) % 8);
                int   current   = this.getIconIndex((previous + 1) % 8);
                b.Draw(Game1.objectSpriteSheet, new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 28 * Game1.pixelZoom + i * 26 * Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 32 * Game1.pixelZoom)) - new Vector2(0f, (float)(-(float)Game1.tileSize) * (faceValue % 1f)), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, previous, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                b.Draw(Game1.objectSpriteSheet, new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 28 * Game1.pixelZoom + i * 26 * Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 32 * Game1.pixelZoom)) - new Vector2(0f, (float)Game1.tileSize - (float)Game1.tileSize * (faceValue % 1f)), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, current, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 33 * Game1.pixelZoom + i * 26 * Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 48 * Game1.pixelZoom)), new Rectangle?(new Rectangle(415, 385, 26, 48)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
            }
            if (this.showResult)
            {
                SpriteText.drawString(b, "+" + this.payoutModifier * (float)this.currentBet, Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 93 * Game1.pixelZoom, this.spinButton10.bounds.Y - Game1.tileSize + Game1.pixelZoom * 2, 9999, -1, 9999, 1f, 1f, false, -1, "", 4);
            }
            b.Draw(Game1.mouseCursors, new Vector2((float)this.spinButton10.bounds.X, (float)this.spinButton10.bounds.Y), new Rectangle?(new Rectangle(441, 385, 26, 13)), Color.White * ((!this.spinning && Game1.player.clubCoins >= 10) ? 1f : 0.5f), 0f, Vector2.Zero, (float)Game1.pixelZoom * this.spinButton10.scale, SpriteEffects.None, 0.99f);
            b.Draw(Game1.mouseCursors, new Vector2((float)this.spinButton100.bounds.X, (float)this.spinButton100.bounds.Y), new Rectangle?(new Rectangle(441, 398, 31, 13)), Color.White * ((!this.spinning && Game1.player.clubCoins >= 100) ? 1f : 0.5f), 0f, Vector2.Zero, (float)Game1.pixelZoom * this.spinButton100.scale, SpriteEffects.None, 0.99f);
            b.Draw(Game1.mouseCursors, new Vector2((float)this.doneButton.bounds.X, (float)this.doneButton.bounds.Y), new Rectangle?(new Rectangle(441, 411, 24, 13)), Color.White * ((!this.spinning) ? 1f : 0.5f), 0f, Vector2.Zero, (float)Game1.pixelZoom * this.doneButton.scale, SpriteEffects.None, 0.99f);
            SpriteText.drawStringWithScrollBackground(b, "  " + Game1.player.clubCoins, Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 94 * Game1.pixelZoom, Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 30 * Game1.pixelZoom, "", 1f, -1);
            Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 - 94 * Game1.pixelZoom + Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 30 * Game1.pixelZoom + Game1.pixelZoom)), new Rectangle(211, 373, 9, 10), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, false, 1f, -1, -1, 0.35f);
            Vector2 basePos = new Vector2((float)(Game1.graphics.GraphicsDevice.Viewport.Width / 2 + 50 * Game1.pixelZoom), (float)(Game1.graphics.GraphicsDevice.Viewport.Height / 2 - 88 * Game1.pixelZoom));

            IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(375, 357, 3, 3), (int)basePos.X, (int)basePos.Y, Game1.tileSize * 6, Game1.tileSize * 11, Color.White, (float)Game1.pixelZoom, true);
            b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2), (float)(Game1.pixelZoom * 2)), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(7), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
            SpriteText.drawString(b, "x2", (int)basePos.X + Game1.tileSize * 3 + Game1.pixelZoom * 4, (int)basePos.Y + Game1.pixelZoom * 6, 9999, -1, 99999, 1f, 0.88f, false, -1, "", 4);
            b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2), (float)(Game1.pixelZoom * 2 + (Game1.tileSize + Game1.pixelZoom))), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(7), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
            b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2 + (Game1.tileSize + Game1.pixelZoom)), (float)(Game1.pixelZoom * 2 + (Game1.tileSize + Game1.pixelZoom))), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(7), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
            SpriteText.drawString(b, "x3", (int)basePos.X + Game1.tileSize * 3 + Game1.pixelZoom * 4, (int)basePos.Y + (Game1.tileSize + Game1.pixelZoom) + Game1.pixelZoom * 6, 9999, -1, 99999, 1f, 0.88f, false, -1, "", 4);
            for (int j = 0; j < 8; j++)
            {
                int which = j;
                if (j == 5)
                {
                    which = 7;
                }
                else if (j == 7)
                {
                    which = 5;
                }
                b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2), (float)(Game1.pixelZoom * 2 + (j + 2) * (Game1.tileSize + Game1.pixelZoom))), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(which), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2 + (Game1.tileSize + Game1.pixelZoom)), (float)(Game1.pixelZoom * 2 + (j + 2) * (Game1.tileSize + Game1.pixelZoom))), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(which), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                b.Draw(Game1.objectSpriteSheet, basePos + new Vector2((float)(Game1.pixelZoom * 2 + 2 * (Game1.tileSize + Game1.pixelZoom)), (float)(Game1.pixelZoom * 2 + (j + 2) * (Game1.tileSize + Game1.pixelZoom))), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.getIconIndex(which), 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.99f);
                int payout = 0;
                switch (j)
                {
                case 0:
                    payout = 5;
                    break;

                case 1:
                    payout = 30;
                    break;

                case 2:
                    payout = 80;
                    break;

                case 3:
                    payout = 120;
                    break;

                case 4:
                    payout = 200;
                    break;

                case 5:
                    payout = 500;
                    break;

                case 6:
                    payout = 1000;
                    break;

                case 7:
                    payout = 2500;
                    break;
                }
                SpriteText.drawString(b, "x" + payout, (int)basePos.X + Game1.tileSize * 3 + Game1.pixelZoom * 4, (int)basePos.Y + (j + 2) * (Game1.tileSize + Game1.pixelZoom) + Game1.pixelZoom * 6, 9999, -1, 99999, 1f, 0.88f, false, -1, "", 4);
            }
            IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(379, 357, 3, 3), (int)basePos.X - Game1.tileSize * 10, (int)basePos.Y, Game1.tileSize * 16, Game1.tileSize * 11, Color.Red, (float)Game1.pixelZoom, false);
            for (int k = 1; k < 8; k++)
            {
                IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(379, 357, 3, 3), (int)basePos.X - Game1.tileSize * 10 - Game1.pixelZoom * k, (int)basePos.Y - Game1.pixelZoom * k, Game1.tileSize * 16 + Game1.pixelZoom * 2 * k, Game1.tileSize * 11 + Game1.pixelZoom * 2 * k, Color.Red * (1f - (float)k * 0.15f), (float)Game1.pixelZoom, false);
            }
            for (int l = 0; l < 17; l++)
            {
                IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(147, 472, 3, 3), (int)basePos.X - Game1.tileSize * 10 + Game1.pixelZoom * 2, (int)basePos.Y + l * Game1.pixelZoom * 3 + Game1.pixelZoom * 3, (int)((float)Game1.tileSize * 9.5f - (float)(l * Game1.tileSize) * 1.2f + (float)(l * l * Game1.pixelZoom) * 0.7f), Game1.pixelZoom, new Color(l * 25, (l > 8) ? (l * 10) : 0, 255 - l * 25), (float)Game1.pixelZoom, false);
            }
            if (!Game1.options.hardwareCursor)
            {
                b.Draw(Game1.mouseCursors, new Vector2((float)Game1.getMouseX(), (float)Game1.getMouseY()), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 0, 16, 16)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 1f);
            }
            b.End();
        }
Exemplo n.º 32
0
	/*
		public Vector3 pos;
		public Vector3 scale;
		public Quaternion rot;
	*/

	// Mirrors the specified SpriteText's settings
	public virtual void Mirror(SpriteText s)
	{
		text = s.text;
		font = s.font;
		offsetZ = s.offsetZ;
		characterSize = s.characterSize;
		characterSpacing = s.characterSpacing;
		lineSpacing = s.lineSpacing;
		anchor = s.anchor;
		alignment = s.alignment;
		tabSize = s.tabSize;
		color = s.color;
		maxWidth = s.maxWidth;
		pixelPerfect = s.pixelPerfect;
		renderCamera = s.renderCamera;
		hideAtStart = s.hideAtStart;
	}
Exemplo n.º 33
0
	// Returns true if any of the settings do not match:
	public virtual bool DidChange(SpriteText s)
	{
		if (s.text != text)
			return true;
		if (s.font != font)
			return true;
		if (s.offsetZ != offsetZ)
			return true;
		if (s.characterSize != characterSize)
			return true;
		if (s.characterSpacing != characterSpacing)
			return true;
		if (s.lineSpacing != lineSpacing)
			return true;
		if (s.anchor != anchor)
			return true;
		if (s.alignment != alignment)
			return true;
		if (s.tabSize != tabSize)
			return true;
		if (s.color.r != color.r ||
			s.color.g != color.g ||
			s.color.b != color.b ||
			s.color.a != color.a)
			return true;
		if (maxWidth != s.maxWidth)
			return true;
		if (s.pixelPerfect != pixelPerfect)
		{
			s.SetCamera(s.renderCamera);
			return true;
		}
		if (s.renderCamera != renderCamera)
		{
			s.SetCamera(s.renderCamera);
			return true;
		}
		if (s.hideAtStart != hideAtStart)
		{
			s.Hide(s.hideAtStart);
			return true;
		}

		return false;
	}
Exemplo n.º 34
0
        public InputBox(Game game)
            : base(game)
        {

            background = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            cursor = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            leftBorder = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            leftBorder.XRelative = 0;
            rightBorder = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            topBorder = new Sprite(game, GraphicsCollection.GetPack("pixel"));
            topBorder.YRelative = 0;
            bottomBorder = new Sprite(game, GraphicsCollection.GetPack("pixel"));

            text = new SpriteText(game, FontsCollection.GetPack("Courier New 14").Font);


            #region Default style
            VerticalPadding = 5;
            SidePadding = 5;
            TextColor = Color.Black;
            BorderColor = Color.Black;
            BorderWidth = 1;
            #endregion

            background.StackOrder = 0;
            leftBorder.StackOrder = rightBorder.StackOrder = topBorder.StackOrder = bottomBorder.StackOrder = 1;
            text.StackOrder = 3;
            text.XRelative = SidePadding;
            text.YRelative = VerticalPadding;

            //text used only for initialization, needed to measure text height
            text.Text = "Init";

            Height = text.Height + 2 * VerticalPadding;

            cursor.Tint = Color.Black;
            cursor.Height = text.Height;
            cursor.Width = 2;
            cursor.YRelative = VerticalPadding;
            cursor.XRelative = SidePadding;
            cursor.StackOrder = 4;
            cursor.AnimationSpeed = 10;
            cursor.Visible = false;
            cursor.OnFirstFrame += new EventHandler(cursor_OnFirstFrame);

            #region Component init
            Components.Add(background);
            Components.Add(cursor);
            //Components.Add(leftBorder);
            //Components.Add(rightBorder);
            Components.Add(topBorder);
            Components.Add(bottomBorder);
            Components.Add(text);

            UpdateComponentsX();
            UpdateComponentsY();
            #endregion

            text.Text = String.Empty;
        }
Exemplo n.º 35
0
            private void load()
            {
                SpriteText playbackSpeedDisplay;

                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black,
                    },
                    new Container
                    {
                        Padding          = new MarginPadding(10),
                        RelativeSizeAxes = Axes.Both,
                        Child            = new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.AutoSize),
                                new Dimension(GridSizeMode.Distributed),
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new FillFlowContainer
                                    {
                                        Spacing          = new Vector2(5),
                                        Direction        = FillDirection.Horizontal,
                                        RelativeSizeAxes = Axes.Y,
                                        AutoSizeAxes     = Axes.X,
                                        Children         = new Drawable[]
                                        {
                                            new SpriteText
                                            {
                                                Padding = new MarginPadding(5),
                                                Text    = "Current Assembly:"
                                            },
                                            AssemblyDropdown = new BasicDropdown <Assembly>
                                            {
                                                Width = 300,
                                            },
                                            RunAllSteps = new BasicCheckbox
                                            {
                                                LabelText    = "Run all steps",
                                                AutoSizeAxes = Axes.Y,
                                                Width        = 140,
                                                Anchor       = Anchor.CentreLeft,
                                                Origin       = Anchor.CentreLeft,
                                            },
                                        }
                                    },
                                    new GridContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        ColumnDimensions = new[]
                                        {
                                            new Dimension(GridSizeMode.AutoSize),
                                            new Dimension(GridSizeMode.Distributed),
                                            new Dimension(GridSizeMode.AutoSize),
                                        },
                                        Content = new[]
                                        {
                                            new Drawable[]
                                            {
                                                new SpriteText
                                                {
                                                    Padding = new MarginPadding(5),
                                                    Text    = "Rate:"
                                                },
                                                RateAdjustSlider = new BasicSliderBar <double>
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4.MediumPurple,
                                                    SelectionColor   = Color4.White,
                                                },
                                                playbackSpeedDisplay = new SpriteText
                                                {
                                                    Padding = new MarginPadding(5),
                                                },
                                            }
                                        }
                                    }
                                }
                            },
                        },
                    },
                };

                RateAdjustSlider.Current.ValueChanged += v => playbackSpeedDisplay.Text = v.ToString("0%");
            }
Exemplo n.º 36
0
        public override void draw(SpriteBatch b)
        {
            if (!this.OnFarm && !Game1.dialogueUp && !Game1.globalFade)
            {
                b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                SpriteText.drawStringWithScrollBackground(b, "Livestock:", this.xPositionOnScreen + Game1.tileSize * 3 / 2, this.yPositionOnScreen);
                Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true);
                Game1.dayTimeMoneyBox.drawMoneyBox(b);
                foreach (ClickableTextureComponent textureComponent in this.AnimalsToPurchase)
                {
                    textureComponent.draw(b, ((Object)textureComponent.item).Type != null ? Color.Black * 0.4f : Color.White, 0.87f);
                }

                this.BackButton.draw(b);
            }
            else if (!Game1.globalFade && this.OnFarm)
            {
                string s = "Choose a " + this.AnimalBeingPurchased.buildingTypeILiveIn.Value + " for your new " + this.AnimalBeingPurchased.type.Value.Split(' ').Last();
                SpriteText.drawStringWithScrollBackground(b, s, Game1.viewport.Width / 2 - SpriteText.getWidthOfString(s) / 2, Game1.tileSize / 4);
                if (this.NamingAnimal)
                {
                    b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                    Game1.drawDialogueBox(Game1.viewport.Width / 2 - Game1.tileSize * 4, Game1.viewport.Height / 2 - Game1.tileSize * 3 - Game1.tileSize / 2, Game1.tileSize * 8, Game1.tileSize * 3, false, true);
                    Utility.drawTextWithShadow(b, "Name your new animal: ", Game1.dialogueFont, new Vector2(Game1.viewport.Width / 2 - Game1.tileSize * 4 + Game1.tileSize / 2 + 8, Game1.viewport.Height / 2 - Game1.tileSize * 2 + 8), Game1.textColor);
                    this.TextBox.Draw(b);
                    this.DoneNamingButton.draw(b);
                    this.RandomButton.draw(b);
                }
            }
            if (!Game1.globalFade)
            {
                OkButton?.draw(b);
            }
            if (this.Hovered != null)
            {
                if (((Object)this.Hovered.item).Type != null)
                {
                    IClickableMenu.drawHoverText(b, Game1.parseText(((Object)this.Hovered.item).Type, Game1.dialogueFont, Game1.tileSize * 5), Game1.dialogueFont);
                }
                else
                {
                    SpriteText.drawStringWithScrollBackground(b, this.Hovered.hoverText, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize, this.yPositionOnScreen + this.height + -Game1.tileSize / 2 + IClickableMenu.spaceToClearTopBorder / 2 + 8, "Truffle Pig");
                    SpriteText.drawStringWithScrollBackground(b, "$" + this.Hovered.name + "g", this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize * 2, this.yPositionOnScreen + this.height + Game1.tileSize + IClickableMenu.spaceToClearTopBorder / 2 + 8, "$99999g", Game1.player.Money >= Convert.ToInt32(this.Hovered.name) ? 1f : 0.5f);
                    IClickableMenu.drawHoverText(b, Game1.parseText(this.GetAnimalDescription(this.Hovered.hoverText), Game1.smallFont, Game1.tileSize * 5), Game1.smallFont, 0, 0, -1, this.Hovered.hoverText);
                }
            }
            this.drawMouse(b);
        }
Exemplo n.º 37
0
        public override void Reset()
        {
            base.Reset();

            const int width           = 20;
            Texture   gradientTexture = new Texture(width, 1, true);

            byte[] data = new byte[width * 4];
            for (int i = 0; i < width; ++i)
            {
                float brightness = (float)i / (width - 1);
                int   index      = i * 4;
                data[index + 0] = (byte)(brightness * 255);
                data[index + 1] = (byte)(brightness * 255);
                data[index + 2] = (byte)(brightness * 255);
                data[index + 3] = 255;
            }
            gradientTexture.SetData(new TextureUpload(data));

            SpriteText arc1Text, arc2Text, arc3Text;
            SpriteText drawText;

            Add(new Container
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    arc1Text = new SpriteText
                                    {
                                        Text     = "Raw Arc",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new ArcPath(true, new InputResampler(), gradientTexture, Color4.Green, arc1Text),
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    arc2Text = new SpriteText
                                    {
                                        Text     = "Smoothed Arc",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new ArcPath(false, new InputResampler(), gradientTexture, Color4.Blue, arc2Text),
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    arc3Text = new SpriteText
                                    {
                                        Text     = "Smoothed Raw Arc",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new ArcPath(true, new InputResampler
                                    {
                                        ResampleRawInput = true
                                    }, gradientTexture, Color4.Red, arc3Text),
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    drawText = new SpriteText
                                    {
                                        Text     = "Custom Smoothed Drawn: Smoothed=0, Raw=0",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new DrawablePath
                                    {
                                        DrawText         = drawText,
                                        RelativeSizeAxes = Axes.Both,
                                        Texture          = gradientTexture,
                                        Colour           = Color4.White,
                                        InputResampler   = new InputResampler()
                                        {
                                            ResampleRawInput = true
                                        },
                                    },
                                }
                            },
                        }
                    }
                }
            });
        }
Exemplo n.º 38
0
        private void load()
        {
            Children = new Drawable[]
            {
                dragContainer = new DragContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay(screen)
                        {
                            RelativeSizeAxes = Axes.X,
                            Y            = player_height + 10,
                            OrderChanged = playlistOrderChanged
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Colour = Color4.Black.Opacity(40),
                                Type   = EdgeEffectType.Shadow,
                                Offset = new Vector2(0, 2),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                background = new Background(),
                                title      = new SpriteText
                                {
                                    Origin   = Anchor.BottomLeft,
                                    Anchor   = Anchor.TopLeft,
                                    Position = new Vector2(10, 40),
                                    Font     = RhythmicFont.GetFont(size: 30, weight: FontWeight.SemiBold),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                artist = new SpriteText
                                {
                                    Origin   = Anchor.TopLeft,
                                    Anchor   = Anchor.TopLeft,
                                    Position = new Vector2(10, 45),
                                    Font     = RhythmicFont.GetFont(size: 20),
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                prevButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = prev,
                                                    Icon   = FontAwesome.Solid.StepBackward,
                                                },
                                                playButton = new MusicIconButton
                                                {
                                                    Anchor    = Anchor.Centre,
                                                    Origin    = Anchor.Centre,
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = play,
                                                    Icon      = FontAwesome.Regular.PlayCircle,
                                                },
                                                nextButton = new MusicIconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = () => next(),
                                                    Icon   = FontAwesome.Solid.StepForward,
                                                },
                                            }
                                        },
                                        playlistButton = new MusicIconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.Solid.Bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new ProgressBar
                                {
                                    Origin     = Anchor.BottomCentre,
                                    Anchor     = Anchor.BottomCentre,
                                    Height     = progress_height,
                                    FillColour = RhythmicColors.Orange,
                                    OnSeek     = attemptSeek
                                }
                            },
                        },
                    }
                }
            };

            playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? RhythmicColors.Orange : Color4.White, 200, Easing.OutQuint);
        }
Exemplo n.º 39
0
 private TextColumn(string title, SpriteText text, float?minWidth = null)
     : base(title, text, minWidth)
 {
     this.text = text;
 }
Exemplo n.º 40
0
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            Height           = 80;
            Masking          = true;
            BorderThickness  = 3f;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.SlateGray,
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    nameText = new SpriteText
                                    {
                                        Margin = new MarginPadding(2)
                                        {
                                            Left = 5
                                        },
                                        Text = Event.Name.Value,
                                        Font = new FontUsage(size: 35),
                                    },
                                    new SpriteText //ToDo: fijate que esto, como que no se que iria aqui
                                    {
                                        Anchor = Anchor.BottomLeft,
                                        Origin = Anchor.BottomLeft,
                                        Margin = new MarginPadding {
                                            Left = 5, Right = 2, Top = 2, Bottom = 7
                                        },
                                        Text = @"Aquí debería haber información del evento, pero soy demasiado lento como para poder hacer eso",
                                        Font = new FontUsage(size: 20),
                                    },
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = new IconButton(FontAwesome.Solid.Edit)
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Action = () => eventOverlay.ShowEvent(Event),
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = new IconButton(FontAwesome.Solid.TrashAlt)
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Action = () => eventsScreen.RemoveEvent(Event),
                                },
                            },
                        },
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.Relative, 0.85f),
                        new Dimension(GridSizeMode.Relative, 0.075f),
                        new Dimension(),
                    },
                },
            };

            nameText.Current.BindTo(Event.Name);
        }
Exemplo n.º 41
0
        public ToolbarButton()
        {
            Width            = WIDTH;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                HoverBackground = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(80).Opacity(180),
                    BlendingMode     = BlendingMode.Additive,
                    Alpha            = 0,
                },
                Flow = new FillFlowContainer
                {
                    Direction = FillDirection.Horizontal,
                    Spacing   = new Vector2(5),
                    Anchor    = Anchor.TopCentre,
                    Origin    = Anchor.TopCentre,
                    Padding   = new MarginPadding {
                        Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2
                    },
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        DrawableIcon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            Origin   = Anchor.Centre,
                            TextSize = 20
                        },
                        DrawableText = new OsuSpriteText
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                        },
                    },
                },
                tooltipContainer = new FillFlowContainer
                {
                    Direction        = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
                    Anchor           = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
                    Origin           = TooltipAnchor,
                    Position         = new Vector2((TooltipAnchor & Anchor.x0) > 0 ? 5 : -5, 5),
                    Alpha            = 0,
                    Children         = new[]
                    {
                        tooltip1 = new OsuSpriteText
                        {
                            Anchor   = TooltipAnchor,
                            Origin   = TooltipAnchor,
                            Shadow   = true,
                            TextSize = 22,
                            Font     = @"Exo2.0-Bold",
                        },
                        tooltip2 = new OsuSpriteText
                        {
                            Anchor   = TooltipAnchor,
                            Origin   = TooltipAnchor,
                            Shadow   = true,
                            TextSize = 16
                        }
                    }
                }
            };
        }
Exemplo n.º 42
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public DownloadableMapset(DownloadScrollContainer container, JToken mapset)
        {
            Container = container;
            Mapset    = mapset;
            MapsetId  = (int)Mapset["id"];

            Size  = new ScalableVector2(container.Width, HEIGHT);
            Tint  = Color.Black;
            Alpha = IsAlreadyOwned ? 0.25f : 0.45f;

            Banner = new Sprite
            {
                Parent    = this,
                X         = 0,
                Size      = new ScalableVector2(900 / 3.6f, Height),
                Alignment = Alignment.MidLeft,
                Alpha     = 0
            };

            AlreadyOwned = new SpriteText(Fonts.SourceSansProBold, "Already Owned", 13)
            {
                Parent    = Banner,
                Alignment = Alignment.MidCenter,
                UsePreviousSpriteBatchOptions = true
            };

            // Check if the mapset is already owned.
            var set = MapDatabaseCache.FindSet(MapsetId);

            IsAlreadyOwned     = set != null;
            AlreadyOwned.Alpha = IsAlreadyOwned ? 1 : 0;

            Progress = new ProgressBar(new Vector2(Width - Banner.Width, Height), 0, 100, 0, Color.Transparent, Colors.MainAccent)
            {
                Parent    = this,
                X         = Banner.X + Banner.Width,
                ActiveBar =
                {
                    UsePreviousSpriteBatchOptions = true,
                    Alpha                         = 0.60f
                },
            };

            Title = new SpriteText(Fonts.SourceSansProBold, $"{Mapset["title"]}", 13)
            {
                Parent = this,
                X      = Banner.X + Banner.Width + 15,
                Y      = 6,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            Artist = new SpriteText(Fonts.SourceSansProBold, $"{Mapset["artist"]}", 12)
            {
                Parent = this,
                X      = Title.X,
                Y      = Title.Y + Title.Height,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            var gameModes = Mapset["game_modes"].ToList();
            var modes     = new List <string>();

            if (gameModes.Contains(1))
            {
                modes.Add("4K");
            }

            if (gameModes.Contains(2))
            {
                modes.Add("7K");
            }

            Modes = new SpriteText(Fonts.SourceSansProBold, string.Join(" & ", modes), 11)
            {
                Parent = this,
                X      = Artist.X,
                Y      = Artist.Y + Artist.Height + 2,
                Alpha  = IsAlreadyOwned ? 0.65f : 1,
            };

            Creator = new SpriteText(Fonts.SourceSansProSemiBold, $"Created By: {Mapset["creator_username"]}", 11)
            {
                Parent    = this,
                Alignment = Alignment.BotRight,
                Position  = new ScalableVector2(-10, -5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
            };

            var badge = new BannerRankedStatus
            {
                Parent    = this,
                Alignment = Alignment.TopRight,
                Position  = new ScalableVector2(-10, 5),
                Alpha     = IsAlreadyOwned ? 0.65f : 1,
            };

            var screen = (DownloadScreen)container.View.Screen;

            badge.UpdateMap(new Map {
                RankedStatus = screen.CurrentRankedStatus
            });
            FetchMapsetBanner();

            Clicked += (sender, args) => OnClicked();
        }
Exemplo n.º 43
0
        public override void Reset()
        {
            base.Reset();

            const int width           = 2;
            Texture   gradientTexture = new Texture(width, 1, true);

            byte[] data = new byte[width * 4];
            for (int i = 0; i < width; ++i)
            {
                float brightness = (float)i / (width - 1);
                int   index      = i * 4;
                data[index + 0] = (byte)(brightness * 255);
                data[index + 1] = (byte)(brightness * 255);
                data[index + 2] = (byte)(brightness * 255);
                data[index + 3] = 255;
            }
            gradientTexture.SetData(new TextureUpload(data));

            SpriteText[] text = new SpriteText[6];

            Cell(0, 0).Add(new Drawable[]
            {
                text[0] = createLabel("Raw"),
                new ArcPath(true, true, new InputResampler(), gradientTexture, Color4.Green, text[0]),
            });

            Cell(0, 1).Add(new Drawable[]
            {
                text[1] = createLabel("Rounded (resembles mouse input)"),
                new ArcPath(true, false, new InputResampler(), gradientTexture, Color4.Blue, text[1]),
            });

            Cell(0, 2).Add(new Drawable[]
            {
                text[2] = createLabel("Custom: Smoothed=0, Raw=0"),
                new UserDrawnPath
                {
                    DrawText         = text[2],
                    RelativeSizeAxes = Axes.Both,
                    Texture          = gradientTexture,
                    Colour           = Color4.White,
                },
            });

            Cell(1, 0).Add(new Drawable[]
            {
                text[3] = createLabel("Smoothed raw"),
                new ArcPath(false, true, new InputResampler(), gradientTexture, Color4.Green, text[3]),
            });

            Cell(1, 1).Add(new Drawable[]
            {
                text[4] = createLabel("Smoothed rounded"),
                new ArcPath(false, false, new InputResampler(), gradientTexture, Color4.Blue, text[4]),
            });

            Cell(1, 2).Add(new Drawable[]
            {
                text[5] = createLabel("Smoothed custom: Smoothed=0, Raw=0"),
                new SmoothedUserDrawnPath
                {
                    DrawText         = text[5],
                    RelativeSizeAxes = Axes.Both,
                    Texture          = gradientTexture,
                    Colour           = Color4.White,
                    InputResampler   = new InputResampler(),
                },
            });

            Cell(2, 0).Add(new Drawable[]
            {
                text[3] = createLabel("Force-smoothed raw"),
                new ArcPath(false, true, new InputResampler()
                {
                    ResampleRawInput = true
                }, gradientTexture, Color4.Green, text[3]),
            });

            Cell(2, 1).Add(new Drawable[]
            {
                text[4] = createLabel("Force-smoothed rounded"),
                new ArcPath(false, false, new InputResampler()
                {
                    ResampleRawInput = true
                }, gradientTexture, Color4.Blue, text[4]),
            });

            Cell(2, 2).Add(new Drawable[]
            {
                text[5] = createLabel("Force-smoothed custom: Smoothed=0, Raw=0"),
                new SmoothedUserDrawnPath
                {
                    DrawText         = text[5],
                    RelativeSizeAxes = Axes.Both,
                    Texture          = gradientTexture,
                    Colour           = Color4.White,
                    InputResampler   = new InputResampler()
                    {
                        ResampleRawInput = true
                    },
                },
            });
        }
Exemplo n.º 44
0
        /// <summary>
        /// The menu's draw method
        /// </summary>
        /// <param name="b">SpriteBatch component from the game.</param>
        public override void draw(SpriteBatch b)
        {
            // invoke the base class draw method
            base.draw(b);

            // if we are fading then don't bother drawing
            if (Game1.globalFade)
            {
                return;
            }

            // get cursor tile location
            var tileLocation = new Vector2(
                (Game1.viewport.X + Game1.getOldMouseX(false)) / Game1.tileSize,
                (Game1.viewport.Y + Game1.getOldMouseY(false)) / Game1.tileSize
                );

            // start drawing in world and not UI
            Game1.StartWorldDrawInUI(b);

            // draw a tree if we have one
            if (selectedTree != null)
            {
                selectedTree.draw(b, tileLocation);

                for (int y = 0; y < 3; y++)
                {
                    for (int x = 0; x < 3; x++)
                    {
                        Vector2 tile = tileLocation;
                        tile.X += -1 + x;
                        tile.Y += -1 + y;

                        // draw the selection box
                        b.Draw(
                            Game1.mouseCursors,
                            Game1.GlobalToLocal(Game1.viewport, tile * Game1.tileSize),
                            validSpot[x + y * 3] ? greenSquare : redSquare,
                            Color.White,
                            0.0f,
                            Vector2.Zero,
                            Game1.pixelZoom,
                            SpriteEffects.None,
                            0.999f
                            );
                    }
                }
            }

            // stop drawing in world
            Game1.EndWorldDrawInUI(b);

            // draw the cancel button
            cancelButton.draw(b);
            // draw the flip button
            flipButton.draw(b);

            // draw the scroll with text
            var t = selectedTree != null ? placementText : defaultText;

            SpriteText.drawStringWithScrollBackground(b, t, Game1.uiViewport.Width / 2 - SpriteText.getWidthOfString(t) / 2, 16);

            // draw the cursor
            drawMouse(b);
        }
Exemplo n.º 45
0
        public OnScreenDisplay()
        {
            RelativeSizeAxes = Axes.Both;

            Children = new Drawable[]
            {
                box = new Container
                {
                    Origin = Anchor.Centre,
                    RelativePositionAxes = Axes.Both,
                    Position             = new Vector2(0.5f, 0.75f),
                    Masking      = true,
                    AutoSizeAxes = Axes.X,
                    Height       = height_contracted,
                    Alpha        = 0,
                    CornerRadius = 20,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4.Black,
                            Alpha            = 0.7f,
                        },
                        new Container // purely to add a minimum width
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Width            = 240,
                            RelativeSizeAxes = Axes.Y,
                        },
                        textLine1 = new OsuSpriteText
                        {
                            Padding  = new MarginPadding(10),
                            Font     = @"Exo2.0-Black",
                            Spacing  = new Vector2(1, 0),
                            TextSize = 14,
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                        },
                        textLine2 = new OsuSpriteText
                        {
                            TextSize = 24,
                            Font     = @"Exo2.0-Light",
                            Padding  = new MarginPadding {
                                Left = 10, Right = 10
                            },
                            Anchor = Anchor.Centre,
                            Origin = Anchor.BottomCentre,
                        },
                        new FillFlowContainer
                        {
                            Anchor       = Anchor.BottomCentre,
                            Origin       = Anchor.BottomCentre,
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Children     = new Drawable[]
                            {
                                optionLights = new FillFlowContainer <OptionLight>
                                {
                                    Padding = new MarginPadding {
                                        Top = 20, Bottom = 5
                                    },
                                    Spacing      = new Vector2(5, 0),
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.TopCentre,
                                    Origin       = Anchor.TopCentre,
                                    AutoSizeAxes = Axes.Both
                                },
                                textLine3 = new OsuSpriteText
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,
                                    Margin = new MarginPadding {
                                        Bottom = 15
                                    },
                                    Font     = @"Exo2.0-Bold",
                                    TextSize = 12,
                                    Alpha    = 0.3f,
                                },
                            }
                        }
                    }
                },
            };
        }
Exemplo n.º 46
0
        public ProfileHeader(User user)
        {
            RelativeSizeAxes = Axes.X;
            Height           = cover_height + info_height;

            Children = new Drawable[]
            {
                coverContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = cover_height,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f))
                        },
                        new Container
                        {
                            Anchor       = Anchor.BottomLeft,
                            Origin       = Anchor.BottomLeft,
                            X            = UserProfileOverlay.CONTENT_X_MARGIN,
                            Y            = -20,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new UpdateableAvatar
                                {
                                    User         = user,
                                    Size         = new Vector2(avatar_size),
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    Masking      = true,
                                    CornerRadius = 5,
                                    EdgeEffect   = new EdgeEffectParameters
                                    {
                                        Type   = EdgeEffectType.Shadow,
                                        Colour = Color4.Black.Opacity(0.25f),
                                        Radius = 4,
                                    },
                                },
                                new Container
                                {
                                    Anchor       = Anchor.BottomLeft,
                                    Origin       = Anchor.BottomLeft,
                                    X            = avatar_size + 10,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        supporterTag = new CircularContainer
                                        {
                                            Anchor          = Anchor.BottomLeft,
                                            Origin          = Anchor.BottomLeft,
                                            Y               = -75,
                                            Size            = new Vector2(25, 25),
                                            Masking         = true,
                                            BorderThickness = 3,
                                            BorderColour    = Color4.White,
                                            Alpha           = 0,
                                            Children        = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Alpha            = 0,
                                                    AlwaysPresent    = true
                                                },
                                                new SpriteIcon
                                                {
                                                    Icon   = FontAwesome.fa_heart,
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Size   = new Vector2(12),
                                                }
                                            }
                                        },
                                        new LinkFlowContainer.ProfileLink(user)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Y      = -48,
                                        },
                                        countryFlag = new DrawableFlag(user.Country?.FlagName)
                                        {
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft,
                                            Width  = 30,
                                            Height = 20
                                        }
                                    }
                                }
                            }
                        },
                        colourBar = new Box
                        {
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft,
                            X      = UserProfileOverlay.CONTENT_X_MARGIN,
                            Height = 5,
                            Width  = info_width,
                            Alpha  = 0
                        }
                    }
                },
                infoTextLeft = new OsuTextFlowContainer(t =>
                {
                    t.TextSize = 14;
                    t.Alpha    = 0.8f;
                })
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                infoTextRight = new LinkFlowContainer(t =>
                {
                    t.TextSize = 14;
                    t.Font     = @"Exo2.0-RegularItalic";
                })
                {
                    X                = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20,
                    Y                = cover_height + 20,
                    Width            = info_width,
                    AutoSizeAxes     = Axes.Y,
                    ParagraphSpacing = 0.8f,
                    LineSpacing      = 0.2f
                },
                new Container
                {
                    X = -UserProfileOverlay.CONTENT_X_MARGIN,
                    RelativeSizeAxes = Axes.Y,
                    Width            = 280,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = level_position,
                            Height   = level_height,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                levelBadge = new Sprite
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Height = 50,
                                    Width  = 50,
                                    Alpha  = 0
                                },
                                levelText = new OsuSpriteText
                                {
                                    Anchor   = Anchor.TopCentre,
                                    Origin   = Anchor.TopCentre,
                                    Y        = 11,
                                    TextSize = 20
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Y        = cover_height,
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.BottomCentre,
                            Height   = cover_height - level_height - level_position - 5,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.5f),
                                    RelativeSizeAxes = Axes.Both
                                },
                                scoreText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                scoreNumberText = new FillFlowContainer <SpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Horizontal = 20, Vertical = 18
                                    },
                                    Spacing = new Vector2(0, 2)
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -64,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSSPlus = new GradeBadge("SSPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeSS = new GradeBadge("SS")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                },
                                new FillFlowContainer <GradeBadge>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Anchor       = Anchor.BottomCentre,
                                    Origin       = Anchor.BottomCentre,
                                    Y            = -18,
                                    Spacing      = new Vector2(20, 0),
                                    Children     = new[]
                                    {
                                        gradeSPlus = new GradeBadge("SPlus")
                                        {
                                            Alpha = 0
                                        },
                                        gradeS = new GradeBadge("S")
                                        {
                                            Alpha = 0
                                        },
                                        gradeA = new GradeBadge("A")
                                        {
                                            Alpha = 0
                                        },
                                    }
                                }
                            }
                        },
                        chartContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Anchor           = Anchor.BottomCentre,
                            Origin           = Anchor.BottomCentre,
                            Height           = info_height - 15,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = Color4.Black.Opacity(0.25f),
                                    RelativeSizeAxes = Axes.Both
                                }
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 47
0
 // Token: 0x06001079 RID: 4217 RVA: 0x0015393C File Offset: 0x00151B3C
 public override void drawAboveAlwaysFrontLayer(SpriteBatch b)
 {
     base.drawAboveAlwaysFrontLayer(b);
     SpriteText.drawStringWithScrollBackground(b, "  " + Game1.player.clubCoins, Game1.tileSize, Game1.tileSize / 4, "", 1f, -1);
     Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(Game1.tileSize + Game1.pixelZoom), (float)(Game1.tileSize / 4 + Game1.pixelZoom)), new Rectangle(211, 373, 9, 10), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, false, 1f, -1, -1, 0.35f);
 }
Exemplo n.º 48
0
        static bool Prefix(SpriteBatch b, ref ShippingMenu __instance)
        {
            List <int>          categoryTotals  = ModEntry.ModHelper.Reflection.GetField <List <int> >(__instance, "categoryTotals").GetValue();
            List <List <Item> > categoryItems   = ModEntry.ModHelper.Reflection.GetField <List <List <Item> > >(__instance, "categoryItems").GetValue();
            List <MoneyDial>    categoryDials   = ModEntry.ModHelper.Reflection.GetField <List <MoneyDial> >(__instance, "categoryDials").GetValue();
            int          introTimer             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "introTimer").GetValue();
            int          categoryLabelsWidth    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "categoryLabelsWidth").GetValue();
            int          plusButtonWidth        = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "plusButtonWidth").GetValue();
            int          itemSlotWidth          = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "itemSlotWidth").GetValue();
            int          itemAndPlusButtonWidth = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "itemAndPlusButtonWidth").GetValue();
            int          totalWidth             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "totalWidth").GetValue();
            int          centerX                    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "centerX").GetValue();
            int          centerY                    = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "centerY").GetValue();
            int          outroFadeTimer             = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "outroFadeTimer").GetValue();
            int          outroPauseBeforeDateChange = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "outroPauseBeforeDateChange").GetValue();
            int          finalOutroTimer            = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "finalOutroTimer").GetValue();
            int          smokeTimer                 = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "smokeTimer").GetValue();
            int          dayPlaqueY                 = ModEntry.ModHelper.Reflection.GetField <int>(__instance, "dayPlaqueY").GetValue();
            float        weatherX                   = ModEntry.ModHelper.Reflection.GetField <float>(__instance, "weatherX").GetValue();
            bool         outro        = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "outro").GetValue();
            bool         newDayPlaque = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "newDayPlaque").GetValue();
            bool         savedYet     = ModEntry.ModHelper.Reflection.GetField <bool>(__instance, "savedYet").GetValue();
            SaveGameMenu saveGameMenu = ModEntry.ModHelper.Reflection.GetField <SaveGameMenu>(__instance, "saveGameMenu").GetValue();

            if (Game1.wasRainingYesterday)
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)introTimer / 3500.0));
                int num1 = -244;
                while (num1 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num1 + (float)((double)weatherX / 2.0 % 244.0), 32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.DarkSlateGray * 1f * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                    num1 += 244;
                }
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                int num2 = -244;
                while (num2 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num2 + weatherX % 244f, -32f), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.SlateGray * 0.85f * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f);
                    num2 += 244;
                }
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
                int num3 = -244;
                while (num3 < Game1.viewport.Width + 244)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)num3 + (float)((double)weatherX * 1.5 % 244.0), (float)sbyte.MinValue), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.LightSlateGray * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f);
                    num3 += 244;
                }
            }
            else
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Rectangle(2556, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)introTimer / 3500.0));
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                if (Game1.dayOfMonth == 28)
                {
                    b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.viewport.Width - 176), 4f), new Rectangle?(new Rectangle(642, 835, 43, 43)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                }
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 192)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.FlipHorizontally, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(2556f, (float)(Game1.viewport.Height - 128)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                b.Draw(Game1.mouseCursors, new Vector2(160f, (float)(Game1.viewport.Height - 128 + 16 + 8)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)introTimer / 3500.0), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
            }
            if (!outro && !Game1.wasRainingYesterday)
            {
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
            }
            if (__instance.currentPage == -1)
            {
                SpriteText.drawStringWithScrollCenteredAt(b, Utility.getYesterdaysDate(), Game1.viewport.Width / 2, __instance.categories[0].bounds.Y - 128, "", 1f, -1, 0, 0.88f, false);
                int num    = -20;
                int index1 = 0;
                foreach (ClickableTextureComponent category in __instance.categories)
                {
                    if (introTimer < 2500 - index1 * 500)
                    {
                        Vector2 vector2 = category.getVector2() + new Vector2(12f, -8f);
                        if (category.visible)
                        {
                            category.draw(b);
                            b.Draw(Game1.mouseCursors, vector2 + new Vector2(-104f, (float)(num + 4)), new Rectangle?(new Rectangle(293, 360, 24, 24)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                            categoryItems[index1][0].drawInMenu(b, vector2 + new Vector2(-88f, (float)(num + 16)), 1f, 1f, 0.9f, false);
                        }
                        IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), (int)((double)vector2.X + (double)-itemSlotWidth - (double)categoryLabelsWidth - 12.0), (int)((double)vector2.Y + (double)num), categoryLabelsWidth, 104, Color.White, 4f, false);
                        SpriteText.drawString(b, category.hoverText, (int)vector2.X - itemSlotWidth - categoryLabelsWidth + 8, (int)vector2.Y + 4, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        for (int index2 = 0; index2 < 6; ++index2)
                        {
                            b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-itemSlotWidth - 192 - 24 + index2 * 6 * 4), 12f), new Rectangle?(new Rectangle(355, 476, 7, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                        }
                        categoryDials[index1].draw(b, vector2 + new Vector2((float)(-itemSlotWidth - 192 - 48 + 4), 20f), categoryTotals[index1]);
                        b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-itemSlotWidth - 64 - 4), 12f), new Rectangle?(new Rectangle(408, 476, 9, 11)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f);
                    }
                    ++index1;
                }
                if (introTimer <= 0)
                {
                    __instance.okButton.draw(b);
                }
            }
            else
            {
                IClickableMenu.drawTextureBox(b, 0, 0, Game1.viewport.Width, Game1.viewport.Height, Color.White);
                Vector2 location = new Vector2((float)(__instance.xPositionOnScreen + 32), (float)(__instance.yPositionOnScreen + 32));
                for (int index = __instance.currentTab * 9; index < __instance.currentTab * 9 + 9; ++index)
                {
                    if (categoryItems[__instance.currentPage].Count > index)
                    {
                        categoryItems[__instance.currentPage][index].drawInMenu(b, location, 1f, 1f, 1f, true);
                        if (LocalizedContentManager.CurrentLanguageLatin)
                        {
                            SpriteText.drawString(b, categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : ""), (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            string s   = ".";
                            int    num = 0;
                            while (num < __instance.width - 96 - SpriteText.getWidthOfString(categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : "") + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))))
                            {
                                s   += " .";
                                num += SpriteText.getWidthOfString(" .");
                            }
                            SpriteText.drawString(b, s, (int)location.X + 80 + SpriteText.getWidthOfString(categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : "")), (int)location.Y + 8, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack)), (int)location.X + __instance.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))), (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        }
                        else
                        {
                            string s1 = categoryItems[__instance.currentPage][index].DisplayName + (categoryItems[__instance.currentPage][index].Stack > 1 ? " x" + (object)categoryItems[__instance.currentPage][index].Stack : ".");
                            string s2 = Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)(getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack));
                            int    x  = (int)location.X + __instance.width - 64 - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((getPrice(categoryItems[__instance.currentPage][index]) * categoryItems[__instance.currentPage][index].Stack))));
                            SpriteText.getWidthOfString(s1 + s2);
                            while (SpriteText.getWidthOfString(s1 + s2) < 1123)
                            {
                                s1 += " .";
                            }
                            if (SpriteText.getWidthOfString(s1 + s2) >= 1155)
                            {
                                s1 = s1.Remove(s1.Length - 1);
                            }
                            SpriteText.drawString(b, s1, (int)location.X + 64 + 12, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                            SpriteText.drawString(b, s2, x, (int)location.Y + 12, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1);
                        }
                        location.Y += 68f;
                    }
                }
                __instance.backButton.draw(b);
                if (__instance.showForwardButton())
                {
                    __instance.forwardButton.draw(b);
                }
            }
            if (outro)
            {
                b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.Black * (float)(1.0 - (double)outroFadeTimer / 800.0));
                SpriteText.drawStringWithScrollCenteredAt(b, newDayPlaque ? Utility.getDateString(0) : Utility.getYesterdaysDate(), Game1.viewport.Width / 2, dayPlaqueY, "", 1f, -1, 0, 0.88f, false);
                foreach (TemporaryAnimatedSprite animation in __instance.animations)
                {
                    animation.draw(b, true, 0, 0, 1f);
                }
                if (finalOutroTimer > 0)
                {
                    b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * (float)(1.0 - (double)finalOutroTimer / 2000.0));
                }
            }
            if (saveGameMenu != null)
            {
                saveGameMenu.draw(b);
            }
            if (Game1.options.SnappyMenus && (introTimer > 0 || outro))
            {
                return(false);
            }
            __instance.drawMouse(b);
            return(false);
        }
        public TestSceneSliderBar()
        {
            sliderBarValue = new BindableDouble
            {
                MinValue = -10,
                MaxValue = 10
            };
            sliderBarValue.ValueChanged += sliderBarValueChanged;

            Add(new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Padding          = new MarginPadding(5),
                Spacing          = new Vector2(5, 5),
                Children         = new Drawable[]
                {
                    sliderBarText = new SpriteText
                    {
                        Text = $"Value of Bindable: {sliderBarValue.Value}",
                    },
                    new SpriteText
                    {
                        Text = "BasicSliderBar:",
                    },
                    sliderBar = new TestSliderBar
                    {
                        Size             = new Vector2(200, 50),
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                    new SpriteText
                    {
                        Text = "w/ RangePadding:",
                    },
                    new BasicSliderBar <double>
                    {
                        Size             = new Vector2(200, 10),
                        RangePadding     = 20,
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                    new SpriteText
                    {
                        Text = "w/ TransferValueOnCommit:",
                    },
                    transferOnCommitSliderBar = new BasicSliderBar <double>
                    {
                        TransferValueOnCommit = true,
                        Size             = new Vector2(200, 10),
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                }
            });
        }
Exemplo n.º 50
0
            public ArcPath(bool raw, InputResampler inputResampler, Texture texture, Color4 colour, SpriteText output)
            {
                InputResampler = inputResampler;
                const int target_raw = 1024;

                RelativeSizeAxes = Axes.Both;
                Texture          = texture;
                Colour           = colour;

                for (int i = 0; i < target_raw; i++)
                {
                    float x = (float)(Math.Sin(i / (double)target_raw * (Math.PI * 0.5)) * 200) + 50.5f;
                    float y = (float)(Math.Cos(i / (double)target_raw * (Math.PI * 0.5)) * 200) + 50.5f;
                    if (!raw)
                    {
                        x = (int)x;
                        y = (int)y;
                    }
                    AddSmoothedVertex(new Vector2(x, y));
                }

                output.Text += ": Smoothed=" + NumVertices + ", Raw=" + NumRaw;
            }
Exemplo n.º 51
0
        /// <summary>
        ///     Ctor -
        /// </summary>
        /// <param name="screen"></param>
        internal SongInformation(GameplayScreen screen)
        {
            Screen = screen;

            Size  = new ScalableVector2(750, 150);
            Tint  = Colors.MainAccentInactive;
            Alpha = 0;

            // Create watching text outside of replay mode because other text relies on it.
            Watching = new SpriteText(Fonts.SourceSansProSemiBold, $"Watching {(screen.InReplayMode ? Screen.LoadedReplay.PlayerName : "")}", 13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = 25,
                Alpha     = 0
            };

            Title = new SpriteText(Fonts.SourceSansProSemiBold, $"{Screen.Map.Artist} - {Screen.Map.Title}", 13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = Watching.Y + TextYSpacing + TextYSpacing,
                Alpha     = 0,
            };

            Difficulty = new SpriteText(Fonts.SourceSansProSemiBold, $"[{Screen.Map.DifficultyName}]", 13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = Title.Y + TextYSpacing + TextYSpacing * 0.85f,
                Alpha     = 0
            };

            Creator = new SpriteText(Fonts.SourceSansProSemiBold, $"Mapped By: \"{Screen.Map.Creator}\"", 13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = Difficulty.Y + TextYSpacing + TextYSpacing * 0.80f,
                Alpha     = 0
            };

            var difficulty = (float)MapManager.Selected.Value.DifficultyFromMods(ModManager.Mods);

            Rating = new SpriteText(Fonts.SourceSansProSemiBold,
                                    $"Difficulty: {StringHelper.AccuracyToString(difficulty).Replace("%", "")}",
                                    13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = Creator.Y + TextYSpacing + TextYSpacing * 0.75f,
                Alpha     = 0,
                Tint      = ColorHelper.DifficultyToColor(difficulty)
            };

            // Get a formatted string of the activated mods.
            var modsString = "Mods: " + (ModManager.CurrentModifiersList.Count > 0 ? $"{ModHelper.GetModsString(ModManager.Mods)}" : "None");

            Mods = new SpriteText(Fonts.SourceSansProSemiBold, modsString, 13)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = Rating.Y + TextYSpacing + TextYSpacing * 0.7f,
                Alpha     = 0
            };
        }
Exemplo n.º 52
0
        private void DropCube()
        {
            Child = sim = new RigidBodySimulation {
                RelativeSizeAxes = Axes.Both
            };

            RigidBodyContainer <Drawable> rbc = new RigidBodyContainer <Drawable>
            {
                Child = new Box
                {
                    Anchor  = Anchor.Centre,
                    Origin  = Anchor.Centre,
                    Size    = new Vector2(150, 150),
                    Texture = texture,
                },
                Position = new Vector2(500, 500),
                Size     = new Vector2(200, 200),
                Rotation = 45,
                Masking  = true,
            };

            sim.Add(rbc);

            FillFlowContainer flow;

            AddRange(new Drawable[]
            {
                new ScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        flow = new FillFlowContainer
                        {
                            Anchor           = Anchor.TopLeft,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Direction        = FillDirection.Vertical,
                        }
                    }
                }
            });

            SpriteText test = new SpriteText
            {
                Text             = @"You are now entering completely darkness...",
                Font             = "Exo2.0-Regular",
                AllowMultiline   = true,
                RelativeSizeAxes = Axes.X,
                TextSize         = 25
            };

            flow.Add(test);

            flow.Add(new SpriteText
            {
                Text             = @"That just used the font " + test.Font + "!",
                Font             = "Exo2.0-RegularItalic",
                AllowMultiline   = true,
                RelativeSizeAxes = Axes.X,
                TextSize         = 25
            });
        }
Exemplo n.º 53
0
        public TwoLayerButton()
        {
            Size = SIZE_RETRACTED;

            Children = new Drawable[]
            {
                c2 = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.4f,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes  = Axes.Both,
                            Shear             = new Vector2(shear, 0),
                            Masking           = true,
                            MaskingSmoothness = 2,
                            EdgeEffect        = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.2f),
                                Offset = new Vector2(2, 0),
                                Radius = 2,
                            },
                            Children = new[]
                            {
                                IconLayer = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    EdgeSmoothness   = new Vector2(2, 0),
                                },
                            }
                        },
                        bouncingIcon = new BouncingIcon
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                        },
                    }
                },
                c1 = new Container
                {
                    Origin           = Anchor.TopRight,
                    Anchor           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.6f,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes  = Axes.Both,
                            Shear             = new Vector2(shear, 0),
                            Masking           = true,
                            MaskingSmoothness = 2,
                            EdgeEffect        = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.2f),
                                Offset = new Vector2(2, 0),
                                Radius = 2,
                            },
                            Children = new[]
                            {
                                TextLayer = new Box
                                {
                                    Origin           = Anchor.TopLeft,
                                    Anchor           = Anchor.TopLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    EdgeSmoothness   = new Vector2(2, 0),
                                },
                            }
                        },
                        text = new OsuSpriteText
                        {
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre,
                        }
                    }
                },
            };
        }
Exemplo n.º 54
0
 private void load()
 {
     InternalChild = JudgementBody = new Container
     {
         Anchor           = Anchor.Centre,
         Origin           = Anchor.Centre,
         RelativeSizeAxes = Axes.Both,
         Child            = new SkinnableDrawable(new GameplaySkinComponent <HitResult>(Result.Type), _ => JudgementText = new OsuSpriteText
         {
             Text   = Result.Type.GetDescription().ToUpperInvariant(),
             Font   = OsuFont.Numeric.With(size: 20),
             Colour = judgementColour(Result.Type),
             Scale  = new Vector2(0.85f, 1),
         }, confineMode: ConfineMode.NoScaling)
     };
 }
Exemplo n.º 55
0
	/// <summary>
	/// Duplicates the settings of another SpriteText object.
	/// </summary>
	/// <param name="s">The SpriteText object to be copied.</param>
	public virtual void Copy(SpriteText s)
	{
		offsetZ = s.offsetZ;
		characterSize = s.characterSize;
		lineSpacing = s.lineSpacing;
		lineSpaceSize = s.lineSpaceSize;
		anchor = s.anchor;
		alignment = s.alignment;
		tabSize = s.tabSize;
		multiline = s.multiline;
		maxWidth = s.maxWidth;
		removeUnsupportedCharacters = s.removeUnsupportedCharacters;
		parseColorTags = s.parseColorTags;
		password = s.password;
		maskingCharacter = s.maskingCharacter;
		ignoreClipping = s.ignoreClipping;

		texture = s.texture;
		SetPixelToUV(texture);
		
		font = s.font;
		spriteFont = FontStore.GetFont(font);

		lineSpaceSize = lineSpacing * spriteFont.LineHeight * worldUnitsPerTexel;
		
		color = s.color;
		text = s.text;
		ProcessString(text);
		pixelPerfect = s.pixelPerfect;
		dynamicLength = s.dynamicLength;
		SetCamera(s.renderCamera);
		hideAtStart = s.hideAtStart;
		m_hidden = s.m_hidden;
		Hide(m_hidden);
	}
Exemplo n.º 56
0
        public PopupDialog()
        {
            RelativeSizeAxes = Axes.Both;

            Children = new Drawable[]
            {
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    Width            = 0.4f,
                    Alpha            = 0f,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            EdgeEffect       = new EdgeEffect
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.5f),
                                Radius = 8,
                            },
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.FromHex(@"221a21"),
                                },
                                new Triangles
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    ColourLight      = OsuColour.FromHex(@"271e26"),
                                    ColourDark       = OsuColour.FromHex(@"1e171e"),
                                    TriangleScale    = 4,
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.BottomCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Position         = new Vector2(0f, -50f),
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0f, 10f),
                            Children         = new Drawable[]
                            {
                                new Container
                                {
                                    Origin = Anchor.TopCentre,
                                    Anchor = Anchor.TopCentre,
                                    Size   = ringSize,
                                    Margin = new MarginPadding
                                    {
                                        Bottom = 30,
                                    },
                                    Children = new Drawable[]
                                    {
                                        ring = new CircularContainer
                                        {
                                            Origin          = Anchor.Centre,
                                            Anchor          = Anchor.Centre,
                                            Masking         = true,
                                            BorderColour    = Color4.White,
                                            BorderThickness = 5f,
                                            Children        = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4.Black.Opacity(0),
                                                },
                                                iconText = new TextAwesome
                                                {
                                                    Origin   = Anchor.Centre,
                                                    Anchor   = Anchor.Centre,
                                                    Icon     = FontAwesome.fa_close,
                                                    TextSize = 50,
                                                },
                                            },
                                        },
                                    },
                                },
                                header = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Text     = @"Header",
                                    TextSize = 25,
                                    Shadow   = true,
                                },
                                body = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Text     = @"Body",
                                    TextSize = 18,
                                    Shadow   = true,
                                },
                            },
                        },
                        buttonsContainer = new FillFlowContainer <PopupDialogButton>
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.TopCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                        },
                    },
                },
            };
        }
Exemplo n.º 57
0
	// Validates certain settings:
	public virtual bool Validate(SpriteText s)
	{
		return true;
	}
Exemplo n.º 58
0
        public TreeContainer()
        {
            Masking      = true;
            CornerRadius = 5;
            Position     = new Vector2(100, 100);

            AutoSizeAxes = Axes.X;
            Height       = height;

            Color4      buttonBackground            = new Color4(50, 50, 50, 255);
            Color4      buttonBackgroundHighlighted = new Color4(80, 80, 80, 255);
            const float button_width = width / 3 - 1;

            Button propertyButton;

            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    Colour           = new Color4(15, 15, 15, 255),
                    RelativeSizeAxes = Axes.Both,
                    Depth            = 0
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        titleBar = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Size             = new Vector2(1, 25),
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.BlueViolet,
                                },
                                new SpriteText
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Text   = "draw visualiser (Ctrl+F1 to toggle)",
                                    Alpha  = 0.8f,
                                },
                            }
                        },
                        new Container //toolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Size             = new Vector2(1, 40),
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Colour           = new Color4(20, 20, 20, 255),
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Spacing          = new Vector2(1),
                                    Children         = new Drawable[]
                                    {
                                        new Button
                                        {
                                            BackgroundColour = buttonBackground,
                                            Size             = new Vector2(button_width, 1),
                                            RelativeSizeAxes = Axes.Y,
                                            Text             = @"choose target",
                                            Action           = delegate { ChooseTarget?.Invoke(); }
                                        },
                                        new Button
                                        {
                                            BackgroundColour = buttonBackground,
                                            Size             = new Vector2(button_width, 1),
                                            RelativeSizeAxes = Axes.Y,
                                            Text             = @"up one parent",
                                            Action           = delegate { GoUpOneParent?.Invoke(); },
                                        },
                                        propertyButton = new Button
                                        {
                                            BackgroundColour = buttonBackground,
                                            Size             = new Vector2(button_width, 1),
                                            RelativeSizeAxes = Axes.Y,
                                            Text             = @"view properties",
                                            Action           = delegate { ToggleProperties?.Invoke(); },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Direction        = FillDirection.Horizontal,
                    Padding          = new MarginPadding {
                        Top = 65
                    },
                    Children = new Drawable[]
                    {
                        scroll = new ScrollContainer
                        {
                            Padding          = new MarginPadding(10),
                            RelativeSizeAxes = Axes.Y,
                            Width            = width
                        },
                        PropertyDisplay = new PropertyDisplay()
                    }
                },
                waitingText = new SpriteText
                {
                    Text   = @"Waiting for target selection...",
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                }
            });

            PropertyDisplay.StateChanged += (c, v) => propertyButton.BackgroundColour = v == Visibility.Visible ? buttonBackgroundHighlighted : buttonBackground;
        }
Exemplo n.º 59
0
	void Awake()
	{
		txt = gameObject.GetComponentInChildren<SpriteText>();
		if( null != txt)
			txt.Text = "";
	}
Exemplo n.º 60
0
        private void load(OsuGameBase game, OsuColour colours, LocalisationEngine localisation)
        {
            this.localisation = localisation;

            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay
                        {
                            RelativeSizeAxes = Axes.X,
                            Y = player_height + 10,
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(40),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                background = new Background(),
                                title      = new OsuSpriteText
                                {
                                    Origin   = Anchor.BottomCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 40),
                                    TextSize = 25,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-MediumItalic"
                                },
                                artist = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 45),
                                    TextSize = 15,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-BoldItalic"
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                prevButton = new IconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = prev,
                                                    Icon   = FontAwesome.fa_step_backward,
                                                },
                                                playButton = new IconButton
                                                {
                                                    Anchor    = Anchor.Centre,
                                                    Origin    = Anchor.Centre,
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = play,
                                                    Icon      = FontAwesome.fa_play_circle_o,
                                                },
                                                nextButton = new IconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = next,
                                                    Icon   = FontAwesome.fa_step_forward,
                                                },
                                            }
                                        },
                                        playlistButton = new IconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.fa_bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new ProgressBar
                                {
                                    Origin     = Anchor.BottomCentre,
                                    Anchor     = Anchor.BottomCentre,
                                    Height     = progress_height,
                                    FillColour = colours.Yellow,
                                    OnSeek     = progress => current?.Track.Seek(progress)
                                }
                            },
                        },
                    }
                }
            };

            beatmapBacking.BindTo(game.Beatmap);

            playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
        }