public HudScore() { Graphic = TextScore; X = Game.Instance.Width - 100; Y = 10; TextScore.DefaultShadowX = 1; TextScore.DefaultShadowY = 1; TextScore.TextAlign = TextAlign.Right; TextScore.TextWidth = 200; EventRouter.Subscribe(Events.ScoreUpdated, (EventRouter.Event e) => { var score = e.GetData <float>(0); var scoreMultiplier = e.GetData <float>(1); TextScore.String = string.Format("{0:0,0} x {1:0,0}", score, scoreMultiplier); TextScore.X = -120; }); EventRouter.Subscribe(Events.ShowFinalScore, (EventRouter.Event e) => { var score = e.GetData <float>(0); TextScore.DefaultCharColor = Color.Gold; TextScore.String = string.Format("{0:0,0}", score); }); EventRouter.Subscribe(Events.GameStarted, (EventRouter.Event e) => { TextScore.DefaultCharColor = Color.White; }); Layer = -1000; }
public GameManager() : base() { Session = Game.Instance.Session(0); AddComponent(GameStateMachine); Session.LoadData(); BestScore = float.Parse(Session.GetData("best", "0")); EventRouter.Subscribe(Events.FlippyFlipped, (EventRouter.Event e) => { ScoreMultiplier += 1; }); EventRouter.Subscribe(Events.FlippyDied, (EventRouter.Event e) => { GameStateMachine.ChangeState(GameState.End); }); EventRouter.Subscribe(Events.UpdateBestScore, (EventRouter.Event e) => { Session.Data["best"] = BestScore.ToString(); Session.SaveData(); }); R = Game.Instance.Color.R; G = Game.Instance.Color.G; B = Game.Instance.Color.B; }
public HudHighScore() { AddGraphic(TextScore); TextScore.DefaultShadowX = 1; TextScore.DefaultShadowY = 1; TextScore.X = 10; TextScore.Y = 10; EventRouter.Subscribe(Events.UpdateBestScore, (EventRouter.Event e) => { var score = e.GetData <float>(0); var last = e.GetData <float>(1); if (last > 0) { TextScore.String = string.Format("BEST {0:0,0} LAST {1:0,0}", score, last); } else { if (score > 0) { TextScore.String = string.Format("BEST {0:0,0}", score); } } }); }
public ConfigurationManager() { this.pendingQueue = new List <IConfiguration>(); this.resolvedDependencies = new Dictionary <DependencyName, object>(); EventRouter.Subscribe <DependencyEvent, DependencyInfo>(this.DependencyResolvedHandler); }
public Wall(float x, float y) : base(x, y) { Graphic = Image; SetHitbox(40, 480, (int)Tags.Wall); X = 700; Layer = 10; Image.OutlineColor = new Color("364298"); Image.OutlineThickness = 4; if (Y < 0) { Tween(this, new { Y = Y }, 40).From(new { Y = Y - 480 }).Ease(Ease.ElasticOut); } else { Tween(this, new { Y = Y }, 40).From(new { Y = Y + 480 }).Ease(Ease.ElasticOut); } EventRouter.Subscribe(Events.FlippyDied, HandleDeath); }
public HudTitleInfo() { TextTitle.X = Game.Instance.HalfWidth; TextDetails.X = Game.Instance.HalfWidth; TextWebzone.X = Game.Instance.HalfWidth; TextTitle.DefaultShadowX = 3; TextTitle.DefaultShadowY = 3; TextTitle.DefaultSineAmpY = 10; TextTitle.DefaultSineRateY = 10; TextTitle.DefaultOffsetAmount = 5; TextDetails.DefaultShadowX = 1; TextDetails.DefaultShadowY = 1; TextDetails.DefaultSineAmpX = 1; TextDetails.DefaultSineAmpY = 2; TextDetails.DefaultSineRateX = 5; TextDetails.DefaultSineRateY = 5; TextWebzone.DefaultCharColor = new Color("749ace"); TextTitle.Refresh(); TextDetails.Refresh(); TextWebzone.Refresh(); TextTitle.Y = 200; TextDetails.Y = 300; TextWebzone.Y = 460; TextTitle.CenterOrigin(); TextDetails.CenterOrigin(); TextWebzone.CenterOrigin(); AddGraphics(TextTitle, TextDetails, TextWebzone); EventRouter.Subscribe(Events.GameStarted, (EventRouter.Event e) => { Tween(this, new { Y = 480 }, 30).Ease(Ease.BackIn); }); }
private void HookEvents() { EventRouter.Subscribe <PageChangeEvent, PageOption>(this.PageChangeEventHandler); }