protected override void SetCoin(long coin) { if (CoinLabel == null) { return; } base.SetCoin(coin); var tempStr = "¥" + (coin < 9999999999 ? CoinLabel.Content.PadLeft(10, '0') : "9999999999").ToString(); CoinLabel.Text(tempStr); }
// Use this for initialization protected override void SetCoin(long coin) { if (CoinLabel == null) { return; } base.SetCoin(coin); string tempStr = "¥" + YxUtiles.GetShowNumberForm(coin); CoinLabel.Text(tempStr); }
public override void Load( ) { base.Load( ); map = new Map(this, new Container(new Margin(0f, 1f, 0f, .3f), MarginType.Relative, Position.Left | Position.Top), -10); stageProgressBar = new ProgressBar(this, new Container(new Margin(0f, 1f, 0.9875f, 0.0125f), MarginType.Relative), 10) { Max = 5, Value = 1 }; multiplierBar = new ProgressBar(this, new Container(new Margin(0, 1f, 0, 0.0125f), MarginType.Relative), 50) { Max = 10, Value = multiplier, Color = Color.Gold }; healthLeftBar = new ProgressBar(this, new Container(new Margin(0f, 1f, 0.3f, 0.05f), MarginType.Relative), 50) { Max = 1, Value = 1, Color = new Color(255, 20, 20, 255) }; goldLabelAligner = new Aligner(this, new Container(new Margin(0.2f, 0f, 0f, 0f), MarginType.Absolute, Position.Left | Position.Top, Position.Left | Position.Top)); damageLabelAligner = new Aligner(this, new Container(new Margin(0, 0.2f, 0f, 0f), MarginType.Absolute, Position.Right | Position.Top, Position.Right | Position.Top)); swoosh = new Swoosh(this, new Container(new Margin(0.4f, 0.4f, 0.05f, 0.6f), MarginType.Absolute, Position.Top, Position.Top), 1); CoinLabel goldLabel = new CoinLabel(this, new Container(new Margin(0, 0.025f), MarginType.Absolute, anchor: Position.Center | Position.Top, dock: Position.Center | Position.Bottom, relative: multiplierBar), 0.05f, 75, Label.TextAlignment.Left); Label stageLabel = new Label(this, new Container(new Margin(0.025f, 0.025f), MarginType.Absolute, anchor: Position.Top | Position.Right, dock: Position.Right | Position.Bottom, relative: multiplierBar), 0.09f, Manager.State.Stage.ToString( ), new Color(100, 100, 100, 100), 75, Label.TextAlignment.Right); Manager.State.StageChanged += (newStage) => { stageLabel.Text = newStage.ToString( ); }; targetArea = new TargetArea(this, new Container(new Margin(0f, 1f, 0.35f, 0.625f), MarginType.Relative, Position.Left | Position.Top), 0, ChallengeProgressCallback, GetTapChallenge); countdown = new Countdown(this, new Container(new Margin(0f, 1f, 0.35f, 0.625f), MarginType.Relative), 10, 0.2f, 3); countdown.Finished += () => { Start( ); }; EntityRenderer.VertexSize = map.Container.Height / 3f; Prepare( ); countdown.Start( ); }
public MainMenuScreen( ) { Label timeLabel = new Label(this, new Container(new Margin(0f, 0f, 0.05f, 0f), MarginType.Absolute, Position.Top | Position.Center, Position.Top | Position.Center), 0.2f, "TIME", new Color(18, 196, 98), 10, Label.TextAlignment.Center); Label titanLabel = new Label(this, new Container(new Margin(0f, 0f, 0.05f, 0f), MarginType.Absolute, anchor: Position.Top | Position.Center, dock: Position.Bottom | Position.Center, relative: timeLabel), 0.2f, "TITAN", new Color(18, 196, 98), 10, Label.TextAlignment.Center); Label stageValueLabel = new Label(this, new Container(new Margin(0.05f, 0.05f), MarginType.Absolute, anchor: Position.Bottom | Position.Right, dock: Position.Right | Position.Bottom), 0.1f, Manager.State.Stage.ToString( ), new Color(100, 100, 100), 10, Label.TextAlignment.Right); Manager.State.StageChanged += (newStage) => { stageValueLabel.Text = newStage.ToString( ); }; Label stageLabel = new Label(this, new Container(new Margin(0.01f, 0f), MarginType.Relative, Position.Right | Position.Bottom, Position.Left | Position.Bottom, stageValueLabel), 0.05f, "STAGE", new Color(100, 100, 100), 10); CoinLabel goldLabel = new CoinLabel(this, new Container(new Margin(0f, 0.025f), MarginType.Absolute, anchor: Position.Bottom | Position.Right, dock: Position.Right | Position.Top, relative: stageValueLabel), 0.1f, 15, Label.TextAlignment.Right); Label damageValueLabel = new Label(this, new Container(new Margin(0f, 0.025f), MarginType.Absolute, anchor: Position.Bottom | Position.Right, dock: Position.Right | Position.Top, relative: goldLabel), 0.1f, Manager.State.Damage.ToString("0.0"), new Color(100, 100, 100), 10, Label.TextAlignment.Right); Manager.State.DamageChanged += (newDamage) => { damageValueLabel.Text = newDamage.ToString("0.0"); }; Label damageLabel = new Label(this, new Container(new Margin(0.01f, 0f), MarginType.Relative, Position.Right | Position.Bottom, Position.Left | Position.Bottom, damageValueLabel), 0.05f, "DMG", new Color(100, 100, 100), 10 ); PlayButton playButton = new PlayButton(this, new Container(new Margin(0.15f, 0.15f, 22f / 14f * 0.15f, 22f / 14f * 0.15f), MarginType.Absolute, Position.Center, Position.Center), 0); playButton.Release += () => { GameplayScreen gameplayScreen = new GameplayScreen( ); gameplayScreen.Load( ); Screen.Active = gameplayScreen; }; Button increaseDamageButton = new Button(this, new Container(new Margin(0f, 0.4f, 0.4f, 0f), MarginType.Absolute, Position.Left | Position.Bottom, Position.Left | Position.Bottom), "inc dmg\n4\n1000gold\n(btn is a\nplaceholder)", 0.05f, 8, Color.White); increaseDamageButton.Click += () => { Manager.State.Damage *= 1.025f; Manager.State.Gold -= 1000; }; Button resetButton = new Button(this, new Container(new Margin(0f, 0.4f, 0.1f, 0f), MarginType.Absolute, Position.Left | Position.Bottom, Position.Left | Position.Top, relative: increaseDamageButton), "reset", 0.05f, 9, Color.Red); resetButton.Click += () => { Manager.State.Stage = 0; Manager.State.Damage = 2.3f; Manager.State.Gold = 0; }; }
void Start() { c_Label = FindObjectOfType <CoinLabel>(); }