private void btn_FinnishQuiz_Click(object sender, RoutedEventArgs e) { TimeSpan testDuration = TimeSpan.FromSeconds((SelectedQuiz.TimeToComplete * 60) - time); _timer.Stop(); if (SelectedQuiz.ShowResult == true) { MessageBox.Show("Thanks for doing the Quiz your score is : " + CurrentPoints.Sum().ToString()); } else { MessageBox.Show("Your teacher will get back to you with a result"); } UtilityTestVerktyg.Quizzes.Remove(UtilityTestVerktyg.SelectedQuiz); var userGrade = new Grade { CompletionDate = DateTime.Now, QuizId = SelectedQuizId, UserId = LoggedInUserId, UserScore = CurrentPoints.Sum(), UserGrade = (CurrentPoints.Sum() > QuizLength / 2) ? "G" : "IG", TimeToComplete = testDuration.ToString(@"mm\:ss") }; Repo.SaveUserQuizScore(userGrade); this.Close(); }
//moves shape down public string[][] moveDown(string[][] grid) { Point[] pts = CurrentPoints; foreach (Point p in CurrentPoints) { if (p.Y >= 0) { grid[p.Y][p.X] = ""; } } if (canMoveBelow(CurrentPoints, grid)) { for (int x = 0; x < CurrentPoints.Count(); x++) { CurrentPoints[x].Y += 1; Point p = CurrentPoints[x]; if (p.Y >= 0) { grid[p.Y][p.X] = ShapeColor; } } } else { foreach (Point p in pts) { if (p.Y >= 0) { grid[p.Y][p.X] = ShapeColor; } } } return(grid); }
public void AddPoints(Player player, CurrentPoints points) { GuiPlayerPoints element = new GuiPlayerPoints(new PlayerPoints(player, points)); element.useText(viewType); playersPoints.Add(element); reducedTexts = new string[reducedTexts.Length+1]; }
void Start() { healthMesh.text = health.ToString(); CuP = GM.GetComponent <CurrentPoints> (); CuC = GM.GetComponent <CurrentColor> (); CuS = GM.GetComponent <CurrentSpeed> (); }
//moves shape right public string[][] moveRight(string[][] grid) { foreach (Point p in CurrentPoints) { if (p.Y >= 0) { grid[p.Y][p.X] = ""; } } Point[] pts = CurrentPoints; if (canMoveRight(CurrentPoints, grid)) { for (int x = 0; x < CurrentPoints.Count(); x++) { if (CurrentPoints[x].X < 19) { CurrentPoints[x].X += 1; Point p = CurrentPoints[x]; grid[p.Y][p.X] = ShapeColor; } } } else { foreach (Point p in pts) { if (p.Y >= 0) { grid[p.Y][p.X] = ShapeColor; } } } return(grid); }
public void AddPoints(Player player, CurrentPoints points) { GuiPlayerPoints element = new GuiPlayerPoints(new PlayerPoints(player, points)); element.useText(viewType); playersPoints.Add(element); reducedTexts = new string[reducedTexts.Length + 1]; }
public void ReportMatchEnd(CurrentPoints points, bool isMultiplayer) { run(() => { new SocialActionReportToEvents(points, isMultiplayer).Report(); new SocialActionReportToAchievements(points, isMultiplayer).Report(); new SocialActionReportToLeaderboards(points.GetPoints()).Report(); }); }
public void ReportMatchEnd(CurrentPoints points, bool isMultiplayer) { run(() => { new SocialActionReportToEvents(points, isMultiplayer).Report(); new SocialActionReportToAchievements(points, isMultiplayer).Report(); new SocialActionReportToLeaderboards(points.GetPoints()).Report(); }); }
protected virtual void OnPropertyChanged(string propertyName) { try { CurrentPoints.Clear(); CurrentPoints.Add(new KeyValuePair <double, double>(N * M, N)); CurrentPoints.Add(new KeyValuePair <double, double>(N * M, M)); } catch (Exception) { } if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } }
public MovementManager(Station firstStation, Station lastStation, Route route, Movement firstMovement, Movement normalMovement, Movement goOutMovement, TrainPassengers passengers, TimeCounter timeCounter, CurrentPoints points, GuiManager gui, GuiRendererControl backToMenuButton, GuiRendererControl showRankingButton, bool isLocal, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network) { this.firstStation = firstStation; this.lastStation = lastStation; this.route = route; this.movement = firstMovement; this.normalMovement = normalMovement; this.goOutMovement = goOutMovement; this.passengers = passengers; this.timeCounter = timeCounter; this.points = points; this.gui = gui; this.backToMenuButton = backToMenuButton; this.showRankingButton = showRankingButton; this.isLocal = isLocal; this.playersPoints = playersPoints; this.network = network; }
public MovementManager(Station firstStation, Station lastStation, Route route, Movement firstMovement, Movement normalMovement, Movement goOutMovement, TrainPassengers passengers, TimeCounter timeCounter, CurrentPoints points, GuiManager gui, GuiRendererControl backToMenuButton, GuiRendererControl showRankingButton, bool isLocal, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network) { this.firstStation = firstStation; this.lastStation = lastStation; this.route = route; this.movement = firstMovement; this.normalMovement = normalMovement; this.goOutMovement = goOutMovement; this.passengers = passengers; this.timeCounter = timeCounter; this.points = points; this.gui = gui; this.backToMenuButton = backToMenuButton; this.showRankingButton = showRankingButton; this.isLocal = isLocal; this.playersPoints = playersPoints; this.network = network; }
private void QuizWindowClosed(object sender, EventArgs e) { if (!Repo.DoesGradeExcist(SelectedQuizId, LoggedInUserId)) { Quizzes.Remove(UtilityTestVerktyg.SelectedQuiz); var userGrade = new Grade { CompletionDate = DateTime.Now, QuizId = SelectedQuizId, UserId = LoggedInUserId, UserScore = CurrentPoints.Sum(), UserGrade = (CurrentPoints.Sum() > QuizLength / 2) ? "G" : "IG" }; Repo.SaveUserQuizScore(userGrade); } UtilityTestVerktyg.GetUserGrade(LoggedInUserId); lv_Result.ItemsSource = UtilityTestVerktyg.UserGrades; UtilityTestVerktyg.SelectedQuiz = null; }
public PlayerPoints(Player player, CurrentPoints points) { this.player = player; this.points = points; }
private MovementManager getMovementFor(Train train, bool isLocalTrain, NetworkTrainPlayer networkPlayer, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network) { float rotationSpeed = train.RotationSpeed; float translationSpeed = train.TranslationSpeed * GameMapSizeFactor.GetFactorForCurrentMapRelativeToFirstMap(); int maxPassengers = train.MaxPassengers; Transform mover = train.transform.parent ?? train.transform; TransformOperations.To(mover).SetRotationTo(FirstStation.transform.position); Route route = new Route(); route.Add(null); route.Add(FirstStation); if (isLocalTrain) { FirstStation.StartHighlight(); } Player player = networkPlayer == null ? PlayerFactory.CreateLocal(train) : networkPlayer; TrainPassengersLimit trainPassengersLimit = TrainPassengersLimitFactory.Get(TrainPassengersLimitType); trainPassengersLimit.SetLimit(maxPassengers); TrainPassengers passengers = new TrainPassengers(trainPassengersLimit, player); TimeCounter timeCounter = new TimeCounter(); timeCounters.Add(timeCounter); CurrentPoints points = new CurrentPoints(CurrentMap.GetCurrentMap(), passengers, timeCounter); playersPoints.AddPoints(player, points); GuiButtonRendererControl backToMenuButton = null; GuiButtonRendererControl showRankingButton = null; Movement firstMovement, normalMovement, goOutMovement; if (isLocalTrain) { Camera camera = Camera.main; Vector3 cameraOffset = -(mover.position - camera.transform.position); firstMovement = new ParallelMovement() .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationStartStepType, TERRESTRIAL, cameraOffset)); //firstMovement.Update(FirstStation.transform.position); normalMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new ParallelMovement() .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationDefaultStepType, TERRESTRIAL, cameraOffset))); goOutMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)); MapCamera trainCamera = new TrainCamera(Camera.main); MapCamera freeCamera = new FreeCamera(Camera.main); CameraManager cameraManager = new CameraManager(trainCamera); backToMenuButton = new GuiButtonRendererControl(() => Application.LoadLevel(SceneNames.MENU)); showRankingButton = new GuiButtonRendererControl(() => SocialManager.ForegroundActions.ShowLeaderboard(CurrentMap.GetCurrentMap())); GuiButtonRendererControl setTrainCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(trainCamera)); GuiButtonRendererControl setFreeCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(freeCamera)); gui.AddElement(new GuiHudElement(passengers, timeCounter)); gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Train\nCam", GuiPosition.DOWN_LEFT, setTrainCameraButton)); gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Free\nCam", GuiPosition.DOWN_RIGHT, setFreeCameraButton)); input.AddLocal(route, cameraManager); input.AddButtons(backToMenuButton, showRankingButton, setTrainCameraButton, setFreeCameraButton); } else { firstMovement = new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL); //firstMovement.Update(FirstStation.transform.position); goOutMovement = normalMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)); networkPlayer.SetRoute(route); } return new MovementManager(FirstStation, LastStation, route, firstMovement, normalMovement, goOutMovement, passengers, timeCounter, points, gui, backToMenuButton, showRankingButton, isLocalTrain, playersPoints, network); }
public PlayerPoints(Player player, CurrentPoints points) { this.player = player; this.points = points; }
//rotates shape public string[][] rotateShape(string[][] grid) { if (_xType == 6) { return(grid); } bool shifting = GetAsyncKeyState(VK_LSHIFT) < 0 || GetAsyncKeyState(VK_RSHIFT) < 0; foreach (Point p in CurrentPoints) { if (p.Y >= 0) { grid[p.Y][p.X] = ""; } } if (RotationIndex == 4) { RotationIndex = 0; } Point[] pts = (Point[])CurrentPoints.Clone(); if (!shifting) { for (int x = 0; x < pts.Count(); x++) { pts[x].Offset(rotationOffsets[_xType][RotationIndex][x]); } if (shapeIsClear(pts, grid)) { _currentPoints = pts; RotationIndex += 1; } } else { if (RotationIndex == 0) { RotationIndex = 3; } else { RotationIndex -= 1; } for (int x = 0; x < pts.Count(); x++) { pts[x].Offset(negatePoint(rotationOffsets[_xType][RotationIndex][x])); } if (shapeIsClear(pts, grid)) { _currentPoints = pts; } } foreach (Point p in CurrentPoints) { if (p.Y >= 0) { grid[p.Y][p.X] = ShapeColor; } } return(grid); }
public Window3() { var brush = (Path)FindResource("WQ"); brush.Stroke = Brushes.LightGray;//new SolidColorBrush(Color.FromRgb(255, 255, 255)); brush.Opacity = 0.1; //brush.StrokeThickness = 1; canvas.Children.Add(brush); //var brush = (Brush)FindResource("MyGridBrushResource"); //canvas.Children.Add(brush); SizeToContent = SizeToContent.WidthAndHeight; this.Content = canvas; Button btn_test = new Button() { Content = "test" }; InitializeComponent(); var random = new Random(); var points = new List <Point>(); var heights = new List <double>(); var length = 0; var interval = width / (pageSize - 1); var totalLength = interval * totalCount; var alpha = height / totalLength; totalCount = ys.Count; pageSize = totalCount; var min = ys.Min(); var max = ys.Max(); for (int i = 0; i < ys.Count; i++) { var y = height - (ys[i] - min) / (max - min) * height; points.Add(new Point(width / ys.Count * i, y)); } //heights = heights.OrderByDescending(it => it).ToList(); //for (int i = 0; i < heights.Count; i++) //{ // points.Add(new Point(interval * i, heights[i])); //} //for (int i = 1; i < points.Count - 1; i++) //{ // var item = points[i]; // var t1 = (points[i].X - points[i - 1].X) / (points[i].Y - points[i - 1].Y); // var t2 = (points[i + 1].X - points[i].X) / (points[i + 1].Y - points[i].Y); // if (Math.Abs(t1 - t2) <= 10) // { // item.Y = item.Y - 50; // } //} //Polyline //Polyline polyline = new Polyline() { }; //StreamGeometry stream = new StreamGeometry(); //using (var ctx = stream.Open()) //{ // ctx.BeginFigure(points[0], false, false); // ctx.PolyLineTo(points, true, true); // ctx.Close(); //} //Path myPath = new Path(); //myPath.StrokeThickness = 1; //myPath.Stroke = Brushes.DarkRed; //canvas.Children.Add(myPath); //myPath.Fill = Brushes.Red; DrawingGroup drawingGroup = new DrawingGroup(); //GeometryGroup geometryGroup = new GeometryGroup() { FillRule = FillRule.Nonzero}; //Polyline polyline = new Polyline() { Stroke = Brushes.Red }; PathGeometry pathGeometry = new PathGeometry() { FillRule = FillRule.Nonzero }; pathGeometry.Figures.Add(pathFigure); PathGeometry pathGeometry2 = new PathGeometry() { FillRule = FillRule.Nonzero }; pathGeometry2.Figures.Add(pathFigure2); //geometryGroup.Children.Add(pathGeometry); //geometryGroup.Children.Add(pathGeometry2); LinearGradientBrush trendGradientBrush = new LinearGradientBrush() { StartPoint = new Point(0, 1), EndPoint = new Point(0, 0) }; trendGradientBrush.GradientStops.Add(new GradientStop() { Offset = 0, Color = Color.FromRgb(248, 50, 47) }); trendGradientBrush.GradientStops.Add(new GradientStop() { Offset = 0.5, Color = Color.FromRgb(248, 101, 68) }); trendGradientBrush.GradientStops.Add(new GradientStop() { Offset = 1, Color = Color.FromRgb(248, 101, 68) }); LinearGradientBrush backGradientBrush = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) }; backGradientBrush.GradientStops.Add(new GradientStop() { Offset = 0, Color = Color.FromRgb(249, 111, 56) }); var stop = new GradientStop() { Offset = 0.5, Color = Color.FromRgb(248, 50, 47) }; backGradientBrush.GradientStops.Add(stop); this.RegisterName("backGradientStop", stop); backGradientBrush.GradientStops.Add(new GradientStop() { Offset = 1, Color = Color.FromRgb(248, 50, 47) }); //DoubleAnimation offsetAnimation = new DoubleAnimation(); //offsetAnimation.From = 0.5; //offsetAnimation.To = 0.8; //offsetAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(during * totalCount)); //Storyboard.SetTargetName(offsetAnimation, "backGradientStop"); //Storyboard.SetTargetProperty(offsetAnimation, new PropertyPath(GradientStop.OffsetProperty)); //mainStoryborad.Children.Add(offsetAnimation); //GeometryDrawing line = new GeometryDrawing() { Geometry = pathGeometry, Pen = new Pen(Brushes.DarkRed, 0) }; var highlight = new SolidColorBrush(Color.FromRgb(249, 111, 56)); Path path = new Path() { Stroke = new SolidColorBrush(Color.FromArgb(30, 239, 215, 0) /*Color.FromArgb(255, 239, 215, 0)*/), StrokeThickness = 3 }; path.Effect = new BlurEffect() { Radius = 2, RenderingBias = RenderingBias.Performance, KernelType = KernelType.Gaussian }; //new BlurEffect() { Radius = 20, KernelType = KernelType.Gaussian }; GeometryDrawing polygon = new GeometryDrawing() { Geometry = pathGeometry2, Brush = trendGradientBrush, Pen = new Pen(highlight, 1) }; path.Data = pathGeometry; //path.; //geometryDrawing.Geometry = pathGeometry; //drawingGroup.Children.Add(line); drawingGroup.Children.Add(polygon); DrawingImage drawingImage = new DrawingImage(); drawingImage.Drawing = drawingGroup; Image image = new Image() { Source = drawingImage }; //btn_test.Effect = new BlurEffect() { Radius=5, KernelType= KernelType.Box }; //image.LayoutTransform = new RotateTransform(180, 0.5, 0.5); canvas.Children.Add(image); canvas.Children.Add(path); canvas.Background = backGradientBrush; Canvas.SetBottom(image, 0); //pathFigure.Segments.Add(new LineSegment(points[0], false)); //pathFigure.Segments.Add(new LineSegment(points[1], false)); //pathFigure.Segments.Add(new LineSegment(points[2], false)); //myPath.Data = drawingImage; //pathFigure.StartPoint = new Point(0,0); //var lineSegment = new LineSegment(points[0], true); //var startSegment = new LineSegment(points[0], true); //pathFigure.Segments.Add(startSegment); //RegisterName("lineSegment" + i, startSegment); //for (int i = 0; i < 200 - 1; ++) //{ // PointAnimation pointAnimation = new PointAnimation(points[i], points[i + 1], new Duration(TimeSpan.FromMilliseconds(1000))); // pointAnimation.BeginTime = TimeSpan.FromMilliseconds(i * 1010); // pointAnimation.Completed += (sender, e) => // { // startSegment = new LineSegment(points[i + 1], true); // pathFigure.Segments.Add(startSegment); // }; // Storyboard.SetTargetName(pointAnimation, "lineSegment" + i); // Storyboard.SetTargetProperty(pointAnimation, new PropertyPath(LineSegment.PointProperty)); // storyboard.Children.Add(pointAnimation); // //storyboard.FillBehavior = FillBehavior.HoldEnd; //storyboard.Begin(canvas); //} //canvas.Children.Add(polyline); //polyline.Points.Add(points[0]); //polyline.Points.Add(points[0]); //RegisterName("hevoPolyline", polyline); //var dx = new DoubleAnimation(); //dx.From = points[0].X; //dx.To = points[0 + 1].X; //dx.Duration = TimeSpan.FromMilliseconds(10000); //dx.BeginTime = TimeSpan.FromMilliseconds(10000 * 0); ////dx.Completed += (sender, e) => { polyline.Points.Add(points[0 + 1]); }; //Storyboard.SetTarget(dx, polyline); //GeometryGroup geometryGroup = new GeometryGroup(); //Path path = new Path(); //path.Data = geometryGroup; //Storyboard.SetTargetProperty(dx, new PropertyPath("Points[" + (1) + "].X")); //storyboard.Children.Add(dx); //var dx = new PointAnimation(); //dx.From = points[0]; //dx.To = points[0 + 1]; //dx.Duration = TimeSpan.FromMilliseconds(10000); //dx.BeginTime = TimeSpan.FromMilliseconds(10000 * 0); ////dx.Completed += (sender, e) => { polyline.Points.Add(points[0 + 1]); }; //Storyboard.SetTarget(dx, polyline); //Storyboard.SetTargetProperty(dx, new PropertyPath("Points[" + (1) + "]")); //storyboard.Children.Add(dx); //for (int i = 0; i < 200 - 1; i++) //{ // var dx = new DoubleAnimation(); // dx.From = points[i].X; // dx.To = points[i + 1].X; // dx.Duration = TimeSpan.FromMilliseconds(10000); // dx.BeginTime = TimeSpan.FromMilliseconds(10000 * i); // dx.Completed += (sender, e) => { polyline.Points.Add(points[i + 1]); }; // Storyboard.SetTargetName(dx, "hevoPolyline"); // Storyboard.SetTargetProperty(dx, new PropertyPath("Points[" + (i) + "].X")); // storyboard.Children.Add(dx); // var dy = new DoubleAnimation(); // dy.From = points[i].Y; // dy.To = points[i + 1].Y; // dy.Duration = TimeSpan.FromMilliseconds(10000); // dy.BeginTime = TimeSpan.FromMilliseconds(10000 * i); // dy.Completed += (sender, e) => { polyline.Points.Add(points[i + 1]); }; // Storyboard.SetTargetName(dy, "hevoPolyline"); // Storyboard.SetTargetProperty(dy, new PropertyPath("Points[" + (i) + "].Y")); // storyboard.Children.Add(dy); //} DoubleAnimation leftAnimation1 = new DoubleAnimation(); leftAnimation1.From = 0; leftAnimation1.To = -totalLength + interval + width; leftAnimation1.Duration = new Duration(TimeSpan.FromMilliseconds(during * totalCount)); mainStoryborad.Children.Add(leftAnimation1); Storyboard.SetTarget(leftAnimation1, image); Storyboard.SetTargetProperty(leftAnimation1, new PropertyPath(Canvas.LeftProperty)); DoubleAnimation leftAnimation2 = new DoubleAnimation(); leftAnimation2.From = 0; leftAnimation2.To = -totalLength + interval + width; leftAnimation2.Duration = new Duration(TimeSpan.FromMilliseconds(during * totalCount)); mainStoryborad.Children.Add(leftAnimation2); Storyboard.SetTarget(leftAnimation2, path); Storyboard.SetTargetProperty(leftAnimation2, new PropertyPath(Canvas.LeftProperty)); //AddPoint(points[0]); //Fill //Polygon polygon = new Polygon(); ////polygon.se //polygon.Margin = new Thickness(0, 50, 0, 0); //canvas.Children.Add(polygon); //polygon.Points.Add(new Point(0, 0)); //polygon.Points.Add(new Point(0, 0)); //polygon.Fill = Brushes.Black; pathFigure2.StartPoint = new Point(0, height); var first_seg = new LineSegment(new Point(0, height), false) { }; RegisterName("first_seg", first_seg); RegisterName("pathFigure2", pathFigure2); pathFigure2.Segments.Add(first_seg); pathFigure2.Segments.Add(new LineSegment(points[0], false) { }); //pathFigure2.Segments.Add(new LineSegment(points[1], false)); //pathFigure2.Segments.Add(new LineSegment(points[2], false)); trendStoryboard.Completed += (sender, e) => { if (CurrentPoints.Count == pageSize) { } if (CurrentPoints.Any()) { //pathFigure2.Segments.Add(new LineSegment(CurrentPoints.Last(), false)); } }; var j = 0; Timer timer = new Timer(); timer.Interval = during + pause; timer.Elapsed += (sender, e) => { Dispatcher.BeginInvoke(new Action(() => { if (j == pageSize) { //mainStoryborad.Begin(canvas); } if (j == points.Count) { timer.Stop(); return; } AddPoint(points[j]); j++; })); }; canvas.Children.Add(btn_test); timer.Start(); btn_test.Click += (sender, e) => { //polygon.Points.Add(points[j]); AddPoint(points[j]); j++; }; }
private MovementManager getMovementFor(Train train, bool isLocalTrain, NetworkTrainPlayer networkPlayer, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network) { float rotationSpeed = train.RotationSpeed; float translationSpeed = train.TranslationSpeed * GameMapSizeFactor.GetFactorForCurrentMapRelativeToFirstMap(); int maxPassengers = train.MaxPassengers; Transform mover = train.transform.parent ?? train.transform; TransformOperations.To(mover).SetRotationTo(FirstStation.transform.position); Route route = new Route(); route.Add(null); route.Add(FirstStation); if (isLocalTrain) { FirstStation.StartHighlight(); } Player player = networkPlayer == null?PlayerFactory.CreateLocal(train) : networkPlayer; TrainPassengersLimit trainPassengersLimit = TrainPassengersLimitFactory.Get(TrainPassengersLimitType); trainPassengersLimit.SetLimit(maxPassengers); TrainPassengers passengers = new TrainPassengers(trainPassengersLimit, player); TimeCounter timeCounter = new TimeCounter(); timeCounters.Add(timeCounter); CurrentPoints points = new CurrentPoints(CurrentMap.GetCurrentMap(), passengers, timeCounter); playersPoints.AddPoints(player, points); GuiButtonRendererControl backToMenuButton = null; GuiButtonRendererControl showRankingButton = null; Movement firstMovement, normalMovement, goOutMovement; if (isLocalTrain) { Camera camera = Camera.main; Vector3 cameraOffset = -(mover.position - camera.transform.position); firstMovement = new ParallelMovement() .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationStartStepType, TERRESTRIAL, cameraOffset)); //firstMovement.Update(FirstStation.transform.position); normalMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new ParallelMovement() .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationDefaultStepType, TERRESTRIAL, cameraOffset))); goOutMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)); MapCamera trainCamera = new TrainCamera(Camera.main); MapCamera freeCamera = new FreeCamera(Camera.main); CameraManager cameraManager = new CameraManager(trainCamera); backToMenuButton = new GuiButtonRendererControl(() => Application.LoadLevel(SceneNames.MENU)); showRankingButton = new GuiButtonRendererControl(() => SocialManager.ForegroundActions.ShowLeaderboard(CurrentMap.GetCurrentMap())); GuiButtonRendererControl setTrainCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(trainCamera)); GuiButtonRendererControl setFreeCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(freeCamera)); gui.AddElement(new GuiHudElement(passengers, timeCounter)); gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Train\nCam", GuiPosition.DOWN_LEFT, setTrainCameraButton)); gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Free\nCam", GuiPosition.DOWN_RIGHT, setFreeCameraButton)); input.AddLocal(route, cameraManager); input.AddButtons(backToMenuButton, showRankingButton, setTrainCameraButton, setFreeCameraButton); } else { firstMovement = new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL); //firstMovement.Update(FirstStation.transform.position); goOutMovement = normalMovement = new SequentialMovement() .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL)) .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL)); networkPlayer.SetRoute(route); } return(new MovementManager(FirstStation, LastStation, route, firstMovement, normalMovement, goOutMovement, passengers, timeCounter, points, gui, backToMenuButton, showRankingButton, isLocalTrain, playersPoints, network)); }
public SocialActionReportToAchievements(CurrentPoints points, bool isMultiplayer) { this.points = points; this.isMultiplayer = isMultiplayer; }
private static void ProcessList(string customerUrl, string customerName) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Start Porcessing Points. Customer: {0}", customerName); Console.ResetColor(); PointDbEntities db = new PointDbEntities(); var currentPointsList = new List <CurrentPoints>(); try { Driver.Navigate().GoToUrl(customerUrl); var table = Driver.FindElementByXPath("//table"); var rows = table.FindElements(By.TagName("td")); int i = 0; for (int z = 0; z < rows.Count;) { CurrentPoints cPoint = new CurrentPoints(); for (int a = 0; a < 4; a++) { if (a == 0) { cPoint.Adress = rows[z].Text.ToString(); } else if (a == 1) { cPoint.GLN = rows[z].Text.ToString(); } else if (a == 3) { cPoint.Id = Guid.NewGuid(); cPoint.Customer = customerName; currentPointsList.Add(cPoint); Console.WriteLine("{0} Add point: adress {1}, Gln {2}, Customer {3}", i, cPoint.Adress, cPoint.GLN, cPoint.Customer); TotalPointCounter++; } z++; } i++; } db.CurrentPoints.AddRange(currentPointsList); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error!!! {0}", ex.Message); Console.WriteLine(ex.StackTrace); Console.ResetColor(); } try { db.SaveChanges(); } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } throw raise; } }