public void Handle(ICollidable player, ICollidable questionBlock, CollisionDirection.DirectionTag direction) { if (typeof(IMario).IsInstanceOfType(player) && typeof(AbstractQuestionBlock).IsInstanceOfType(questionBlock)) { this.player = (IMario)player; this.questionBlock = (AbstractQuestionBlock)questionBlock; //Console.WriteLine(questionBlock.GetHitBox().X + " " + questionBlock.GetHitBox().Y); switch (direction) { case CollisionDirection.DirectionTag.Top: this.player.SetYPosition(this.questionBlock.GetTopSide() - player.GetHeight()); this.player.Ground(); break; case CollisionDirection.DirectionTag.Bottom: this.player.SetYPosition(this.questionBlock.GetBottomSide() + 1); this.questionBlock.Bump(); this.questionBlock.EndBump(); break; case CollisionDirection.DirectionTag.Left: this.player.SetXPosition(this.questionBlock.GetLeftSide() - player.GetWidth()); break; case CollisionDirection.DirectionTag.Right: this.player.SetXPosition(this.questionBlock.GetRightSide() + 1); break; default: Console.WriteLine(Config.GetCollisionResolutionException() + GetType().ToString()); break; } } }
public static System.Web.WebPages.HelperResult Block(AbstractQuestionBlock block, BlockRenderContext context) { return(new System.Web.WebPages.HelperResult(__razor_helper_writer => { var mark = ""; var style = ""; QuizBlockData model = context.GetBlockData(block); if (model.QuizState != QuizState.NotPassed) { if (model.QuizModel != null && model.QuizModel.ResultsForQuizes != null) { bool res; res = model.QuizModel.ResultsForQuizes.TryGetValue(block.Id, out res) && res; mark = "glyphicon " + (res ? "glyphicon-ok" : "glyphicon-remove"); style = "color: " + (res ? "green" : "red"); } } WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<h4><i class=\""); WebViewPage.WriteTo(@__razor_helper_writer, mark); WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" style=\""); WebViewPage.WriteTo(@__razor_helper_writer, style); WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i> "); WebViewPage.WriteTo(@__razor_helper_writer, block.QuestionIndex); WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". "); WebViewPage.WriteTo(@__razor_helper_writer, block.Text.RenderTex()); WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n"); WebViewPage.WriteTo(@__razor_helper_writer, QuizBlock((dynamic)block, context)); WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<hr class=\"quiz-block-delimiter\" />\r\n"); })); }