private void OnTextUpdated(AObject arg1, AObject arg2, AObject arg3, Vector2f arg4) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; if (arg2 == null) { object2D.SetPosition(arg4); } else { AObject2D previousObject2D = this.mappingObjectToObject2D[arg2]; AObject2D associtedObject2D = null; if (arg3 != null) { associtedObject2D = this.mappingObjectToObject2D[arg3]; } FloatRect boundsPrevious = previousObject2D.TextGlobalBounds; float width = previousObject2D.TextGlobalBounds.Width; if (associtedObject2D != null) { width = associtedObject2D.TextGlobalBounds.Width; } float newPositionX = width + previousObject2D.Position.X; float newPositionY = arg4.Y; Vector2f newPosition = new Vector2f(newPositionX, newPositionY); object2D.SetPosition(newPosition); } }
public void Visit(AObject2D parentObject2D) { this.mutex.WaitOne(); parentObject2D.SetCanevas(this.animation[this.currentIndex]); this.mutex.ReleaseMutex(); }
private void OnObjectTextStateChanged(AObject arg1, bool arg2) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; if (object2D != null && object2D is ATokenObject2D) { object2D.SetTextState(arg2); } }
private void OnObjectDestroyed(ALayer arg1, AObject arg2) { if (this.mappingObjectToObject2D.ContainsKey(arg2)) { LayerObject2D layer = this.mappingLayerToLayerObject2D[arg1]; AObject2D object2D = this.mappingObjectToObject2D[arg2]; layer.RemoveObject2D(object2D); this.mappingObjectToObject2D.Remove(arg2); } }
public IAnimation GetAnimationFromAObject2D(AObject2D object2D) { IAnimation animation = null; if (this.animationsToPlay.ContainsKey(object2D)) { animation = this.animationsToPlay[object2D]; } return(animation); }
private void OnMouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { if (this.objectFocused != null) { AObject2D object2D = this.object2DManager.getObject2DFrom(this.objectFocused); FloatRect rect = object2D.SpriteGlobalBounds; Vector2f deltaSpriteText = object2D.DeltaSpriteText; this.officeWorld.OnMouseDragOnObject(this.objectFocused, new Vector2f(e.X - this.resolutionScreen.X / 2, e.Y - this.resolutionScreen.Y / 2), new Vector2f(rect.Width / 2 + deltaSpriteText.X, rect.Height / 2 + deltaSpriteText.Y)); } }
public void PlayAnimation(AObject2D object2D, ZoomAnimation animation) { animation.Reset(); if (this.animationsToPlay.ContainsKey(object2D)) { this.animationsToPlay[object2D] = animation; } else { this.animationsToPlay.Add(object2D, animation); } }
public void Run() { //var mode = new SFML.Window.VideoMode(800, 600); var window = new SFML.Graphics.RenderWindow(SFML.Window.VideoMode.FullscreenModes[0], "Repair Project", SFML.Window.Styles.Fullscreen); window.KeyPressed += Window_KeyPressed; window.MouseButtonPressed += OnMouseButtonPressed; window.MouseButtonReleased += OnMouseButtonReleased; window.MouseMoved += OnMouseMoved; //this.object2DManager.SizeScreen = window.GetView().Size; SFML.Graphics.View view = window.GetView(); this.resolutionScreen = new Vector2f(view.Size.X, view.Size.Y); view.Center = new Vector2f(0, 0); window.SetView(view); window.SetVerticalSyncEnabled(true); Clock clock = new Clock(); this.officeWorld.StartLevel(); // Start the game loop while (window.IsOpen) { Time deltaTime = clock.Restart(); // Game logic update this.officeWorld.UpdateLogic(deltaTime); window.Clear(); this.object2DManager.DrawIn(window); // Process events window.DispatchEvents(); AObject2D.UpdateZoomAnimationManager(deltaTime); // Finally, display the rendered frame on screen window.Display(); } this.object2DManager.Dispose(this.officeWorld); AObject2D.StopAnimationManager(); }
public IAnimation GetAnimationFromAObject2D(AObject2D object2D) { this.mutex.WaitOne(); IAnimation animation = null; if (this.animationsToPlay.ContainsKey(object2D)) { animation = this.animationsToPlay[object2D]; } this.mutex.ReleaseMutex(); return(animation); }
public void PlayAnimation(AObject2D object2D, IAnimation animation) { this.mutex.WaitOne(); animation.Reset(); if (this.animationsToPlay.ContainsKey(object2D)) { this.animationsToPlay[object2D] = animation; } else { this.animationsToPlay.Add(object2D, animation); } this.mutex.ReleaseMutex(); }
public void Run() { Clock clock = new Clock(); // Initialize the first world node of the game. this.World.InitializeGameNode(); // Start the game loop while (this.Window.IsOpen) { Time deltaTime = clock.Restart(); // Process events this.Window.DispatchEvents(); // Update Model Animations AObject.UpdateAnimationManager(deltaTime); // Game logic update this.World.UpdateLogic(null, deltaTime); // Update View Animations AObject2D.UpdateAnimationManager(deltaTime); // Draw window this.Window.Clear(); this.World2D.DrawIn(this.Window, deltaTime); // Update AI logic this.WorldAI.UpdateAI(deltaTime); // Finally, display the rendered frame on screen this.Window.Display(); } this.World.Dispose(); this.World2D.Dispose(); this.WorldAI.Dispose(); }
private void OnTextPositionChanged(AObject arg1, AObject arg2, Vector2f arg3) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; if (arg2 == null) { object2D.SetPosition(arg3); } else { AObject2D previousObject2D = this.mappingObjectToObject2D[arg2]; FloatRect bounds = previousObject2D.TextGlobalBounds; float newPositionX = bounds.Width + bounds.Left; float newPositionY = arg3.Y; Vector2f newPosition = new Vector2f(newPositionX, newPositionY); object2D.SetPosition(newPosition); } }
private void OnObjectAnimationChanged(AObject arg1, int arg2) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; object2D.PlayAnimation(arg2); }
private void OnObjectPositionChanged(AObject arg1, Vector2f arg2) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; object2D.SetPosition(arg2); }
private void OnObjectTextChanged(AObject arg1, string arg2) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; object2D.SetText(arg2); }
public void Visit(AObject2D parentObject2D) { parentObject2D.SetZoom(this.currentZoom); }
private void OnObjectCreated(ALayer arg1, AObject arg2) { LayerObject2D layer = this.mappingLayerToLayerObject2D[arg1]; List <Texture> listTextures = new List <Texture>(); if (this.mappingIdObjectToTextures.ContainsKey(arg2.Id)) { List <string> listPathTextures = this.mappingIdObjectToTextures[arg2.Id]; foreach (string path in listPathTextures) { listTextures.Add(this.textureManager.GetTexture(path)); } } List <Font> listFonts = new List <Font>(); if (this.mappingIdObjectToFonts.ContainsKey(arg2.Id)) { List <string> listPathFonts = this.mappingIdObjectToFonts[arg2.Id]; foreach (string path in listPathFonts) { listFonts.Add(this.fontManager.GetFont(path)); } } AObject2D object2D = null; switch (arg2.Id) { case "arrow": object2D = new ArrowObject2D(); break; case "bubbleHeader": object2D = new BubbleHeaderObject2D(); break; case "bubbleTuto": object2D = new BubbleTutoObject2D(); break; case "bubble": object2D = new BubbleObject2D(); break; case "office": object2D = new OfficeObject2D(); break; case "result": object2D = new ResultObject2D(); break; case "darkOffice": object2D = new DarkOfficeObject2D(); break; case "patient": object2D = new PatientObject2D(); break; case "toubib": object2D = new ToubibObject2D(); break; case "queueDream": object2D = new QueueDreamObject2D(); break; case "queueTalk": object2D = new QueueTalkObject2D(); break; case "notebook": object2D = new NotebookObject2D(); break; case "test": object2D = new TestObject2D(); break; case "timer": object2D = new TimerObject2D(); break; case "normalToken": object2D = new NormalTokenObject2D(); break; case "answerToken": object2D = new AnswerTokenObject2D(); break; case "timerToken": object2D = new TimerTokenObject2D(); break; case "fieldToken": object2D = new FieldTokenObject2D(); break; case "sanctuaryToken": object2D = new SanctuaryTokenObject2D(); break; case "headerToken": object2D = new HeaderTokenObject2D(); break; } if (object2D != null) { object2D.AssignTextures(listTextures); object2D.AssignFonts(listFonts); this.mappingObjectToObject2D.Add(arg2, object2D); layer.AddObject2D(object2D); } }
private void OnObjectFocusChanged(AObject arg1, bool arg2) { AObject2D object2D = this.mappingObjectToObject2D[arg1]; object2D.SetFocus(arg2); }
public void Run() { var mode = new SFML.Window.VideoMode(800, 600); //var window = new SFML.Graphics.RenderWindow(SFML.Window.VideoMode.FullscreenModes[0], "Pokemon Union", SFML.Window.Styles.Fullscreen); var window = new SFML.Graphics.RenderWindow(mode, "Pokemon Union"); window.KeyPressed += Window_KeyPressed; window.MouseButtonPressed += OnMouseButtonPressed; window.MouseButtonReleased += OnMouseButtonReleased; window.MouseMoved += OnMouseMoved; //this.object2DManager.SizeScreen = window.GetView().Size; SFML.Graphics.View view = window.GetView(); view.Size = new Vector2f(400, 300); this.resolutionScreen = new Vector2f(view.Size.X, view.Size.Y); view.Center = new Vector2f(9492, -12595); this.SetView(window, view); window.SetVerticalSyncEnabled(true); Clock clock = new Clock(); this.landWorld.OnFocusAreaChanged(view.Center / MODEL_TO_VIEW, this.resolutionScreen / MODEL_TO_VIEW); // Start the game loop while (window.IsOpen) { Time deltaTime = clock.Restart(); // Game logic update this.landWorld.UpdateLogic(null, deltaTime); // Draw window AObject2D.UpdateZoomAnimationManager(deltaTime); window.Clear(); this.landWorld2D.DrawIn(window, ref this.boundsView); // Process events window.DispatchEvents(); //// To remove after. //if (Keyboard.IsKeyPressed(Keyboard.Key.Z)) //{ // view.Center += new Vector2f(0, -2f); //} //else if(Keyboard.IsKeyPressed(Keyboard.Key.S)) //{ // view.Center += new Vector2f(0, 2f); //} //if (Keyboard.IsKeyPressed(Keyboard.Key.D)) //{ // view.Center += new Vector2f(2f, 0); //} //else if (Keyboard.IsKeyPressed(Keyboard.Key.Q)) //{ // view.Center += new Vector2f(-2f, 0); //} //// Console.WriteLine(view.Center.X + " : " + view.Center.Y); //this.landWorld.OnFocusAreaChanged(view.Center / MODEL_TO_VIEW, this.resolutionScreen / MODEL_TO_VIEW, 0); //this.SetView(window, view); // Finally, display the rendered frame on screen window.Display(); } this.landWorld2D.Dispose(this.landWorld); this.landWorld.Dispose(); AObject2D.StopAnimationManager(); }