public StarEffect2D(IObject2DFactory factory, ALayer2D parentLayer, CardEntityAwakenedDecorator2D parentCardDecorator2D) : base(parentLayer, factory, false) { this.Position = parentCardDecorator2D.Position; this.ObjectSprite.Texture = factory.GetTextureById("starEffectTexture"); this.ObjectSprite.Origin = new SFML.System.Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2); // Active animation SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(4), AnimationType.ONETIME); IAnimation anim = new ZoomAnimation(0.1f, 1, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(0, anim); //anim = new ZoomAnimation(1, 0.1f, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); //sequence.AddAnimation(5, anim); anim = new RotationAnimation(0, 360, Time.FromSeconds(6), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0.01f, anim); this.animationsList.Add(sequence); this.IsActive = false; }
//protected override Vector2f DefaultViewSize //{ // set // { // if (value != this.DefaultViewSize) // { // base.DefaultViewSize = value; // IntRect endTurnButtonCanvevas = this.endTurnButton.Canevas; // this.endTurnButton.Position = new Vector2f(-endTurnButtonCanvevas.Width / 2, this.DefaultViewSize.Y / 2 - endTurnButtonCanvevas.Height); // IntRect effectBehaviorLabelCanvevas = this.effectBehaviorLabel2D.Canevas; // this.effectBehaviorLabel2D.StartingPosition = new Vector2f(-this.DefaultViewSize.X / 2 - effectBehaviorLabelCanvevas.Width, 0); // } // } //} public BoardNotifLayer2D(World2D world2D, IObject2DFactory factory, BoardNotifLayer layer) : base(world2D, factory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); this.hittableEntities2D = new List <AEntity2D>(); this.awakenedBannerLabel2D = new AwakenedBannerLabel2D(this); this.effectBanner2D = new EffectBanner2D(this); this.effectLabel2D = new EffectLabel2D(this); this.endTurnButton = new EndTurnButton2D(this); this.effectBehaviorLabel2D = new EffectBehaviorLabel2D(this); this.pendingRemovingCardEntities = new List <CardEntity2D>(); this.cardsHand = new List <CardEntity2D>(); layer.CardCreated += OnCardCreated; layer.CardRemoved += OnCardRemoved; layer.CardPicked += OnCardPicked; layer.CardUnpicked += OnCardUnpicked; layer.CardFocused += OnCardFocused; layer.CardAwakened += OnCardAwakened; layer.NotifBehaviorStarted += OnNotifBehaviorStarted; layer.NotifBehaviorPhaseChanged += OnNotifBehaviorPhaseChanged; layer.NotifBehaviorUseChanged += OnNotifBehaviorUseChanged; layer.NotifBehaviorEnded += OnNotifBehaviorEnded; }
public ACharacterEntity2D(IObject2DFactory factory, ACharacterEntity characterEntity) : base() { characterEntity.PositionUpdated += this.OnPositionUpdated; this.characterEntity = characterEntity; }
public T_TeleEntity2D(IObject2DFactory factory, ALayer2D layer2D, T_TeleEntity entity) : base(layer2D, factory, entity) { this.Position = entity.Position; this.Rotation = entity.Rotation; this.ObjectSprite.Texture = factory.GetTextureById("TVTexture"); this.ObjectSprite.TextureRect = new SFML.Graphics.IntRect(0, 0, 86, 76); this.ObjectSprite.Origin = new SFML.System.Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(20), AnimationType.LOOP); IAnimation anim = new ZoomAnimation(1, 2, Time.FromSeconds(10), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(2, 1, Time.FromSeconds(10), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(10, anim); anim = new FrameAnimation(new SFML.Graphics.IntRect[] { new SFML.Graphics.IntRect(0, 0, 86, 76), new SFML.Graphics.IntRect(86, 0, 86, 76) }, Time.FromSeconds(2), AnimationType.LOOP, InterpolationMethod.LINEAR); sequence.AddAnimation(10.01f, anim); this.animationsList.Add(sequence); this.PlayAnimation(0); }
public override void InitializeLayer(IObject2DFactory factory) { base.InitializeLayer(factory); this.imageBackground2D.ObjectSprite.Texture = null; this.imageBackground2D.DisplayImage((this.parentLayer as ImageBackgroundLayer).CurrentImageId); }
public virtual void Dispose() { AObject2D.animationManager.StopAnimation(this); AObject2D.soundMusicPlayer.DisposeAudioObject2D(this); this.parentFactory = null; }
public BackgroundLayer2D(World2D world2D, IObject2DFactory factory, BackgroundLayer layer) : base(world2D, factory, layer) { this.Area = (factory as BackgroundLayer2DFactory).Area; this.nameToTiles = new Dictionary <string, TileBackgoundObject2D>(); }
public BoardPlayerLayer2D(World2D world2D, IObject2DFactory factory, BoardPlayerLayer layer) : base(world2D, factory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); this.hittableEntities2D = new List <AEntity2D>(); layer.CardDrawn += OnCardDrawn; layer.NbCardsToDrawChanged += OnNbCardToDrawsChanged; layer.CardFocused += OnCardFocused; layer.CardPicked += OnCardPicked; layer.CardUnpicked += OnCardUnpicked; layer.PileFocusedChanged += OnPileFocusedChanged; layer.CardDestroyed += OnCardDestroyed; // layer.CardResurrected += OnCardResurrected; layer.SourceCardEntitiesSet += OnSourceCardEntitiesSet; //this.cardToolTip = new CardToolTip(this); //this.endTurnButton = new EndTurnButton2D(this); this.scoreLabel = new ScoreLabel2D(this); this.cardsDeck = new List <CardEntity2D>(); this.cardsCemetery = new List <CardEntity2D>(); this.cardsHand = new List <CardEntity2D>(); this.pileFocused = BoardPlayerLayer.PileFocused.NONE; layer.BoardToLayerPositionConverter = this; }
public BoardBannerLayer2D(World2D world2D, IObject2DFactory factory, BoardBannerLayer layer) : base(world2D, factory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); layer.PlayerScoreUpdated += OnPlayerScoreUpdated; layer.TurnCountChanged += OnTurnCountChanged; this.bannerEntity2D = new BannerEntity2D(this); this.endLevelBanner2D = new EndLevelBanner2D(this); this.returnMenuButton2D = new ReturnMenuButton2D(this); this.returnMenuButton2D.Position = new Vector2f(-200, this.endLevelBanner2D.Canevas.Height / 2 - this.returnMenuButton2D.Canevas.Height / 2 - 20); this.replayMenuButton2D = new ReplayMenuButton2D(this); this.replayMenuButton2D.Position = new Vector2f(200, this.endLevelBanner2D.Canevas.Height / 2 - this.returnMenuButton2D.Canevas.Height / 2 - 20); this.hittableEntities2D = new List <AEntity2D>(); this.turnBanner2D = new TurnBanner2D(this); this.cardsToPlaceBanner2D = new CardsToPlaceBanner2D(this); this.domainToolTip = new DomainToolTip2D(this); this.cardFocusedLayers = new HashSet <ICardFocusedLayer>(); this.domainsLayers = new HashSet <IDomainsLayer>(); this.scoreLayers = new Dictionary <string, IScoreLayer>(); }
public ALayer2D(World2D world2D, IObject2DFactory layerFactory, ALayer layer) : base(layerFactory) { this.parentFactory = layerFactory; this.ChildrenLayer2D = new List <ALayer2D>(); this.view = new SFML.Graphics.View(); this.defaultViewSize = new Vector2f(-1, -1); this.Position = new Vector2f(0, 0); this.Area = new Vector2i(0, 0); this.objectToObject2Ds = new Dictionary <AEntity, AEntity2D>(); this.object2DToObjects = new Dictionary <AEntity2D, AEntity>(); //this.focusedEntity2Ds = new HashSet<IHitRect>(); this.world2D = new WeakReference <World2D>(world2D); this.zoom = 1; this.parentLayer = layer; this.parentLayer.EntityAdded += OnEntityAdded; this.parentLayer.EntityRemoved += OnEntityRemoved; this.parentLayer.PositionChanged += OnPositionChanged; this.parentLayer.RotationChanged += OnRotationChanged; this.parentLayer.EntityPropertyChanged += OnEntityPropertyChanged; this.parentLayer.LevelStateChanged += OnLevelStateChanged; }
private void OnChunkAdded(ILandChunk obj) { this.chunkResourcesLoader.LoadChunkResources(obj); IObject2DFactory landChunk2DFactory = LandWorld2D.MappingObjectModelView[obj.GetType()]; this.landChunksDictionary.Add(obj, landChunk2DFactory.CreateObject2D(this, obj) as LandChunk2D); }
public override void InitializeLayer(IObject2DFactory factory) { base.InitializeLayer(factory); this.startButton.Position = new Vector2f(0, -100); this.player1DeckBuildingButton.Position = new Vector2f(0, 0); this.player2DeckBuildingButton.Position = new Vector2f(0, 100); }
public ImageBackgroundLayer2D(World2D world2D, IObject2DFactory layerFactory, ALayer layer) : base(world2D, layerFactory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); this.imageBackground2D = new ImageBackgroundObject2D(this); (layer as ImageBackgroundLayer).CurrentImageIdChanged += this.OnCurrentImageIdChanged; }
public AEntity2D(ALayer2D parentLayer, IObject2DFactory factory, bool isActive) : base(factory) { this.parentLayer = new WeakReference <ALayer2D>(parentLayer); this.sprite = new Sprite(); this.Priority = 0; this.IsActive = isActive; }
public override void InitializeLayer(IObject2DFactory factory) { base.InitializeLayer(factory); this.LevelTurnPhase = TurnPhase.VOID; BoardBannerLayer boardBannerLayer = this.parentLayer as BoardBannerLayer; this.headerEntity2D = new HeaderEntity2D(this, boardBannerLayer.Player, boardBannerLayer.Opponent); this.scoreDomainLabel2D = new ScoreDomainLabel2D(this, boardBannerLayer.Player, boardBannerLayer.Opponent); this.turnBanner2D.ResetTurn(boardBannerLayer.MaxTurnCount); this.cardsToPlaceBanner2D.ResetTurn(); this.domainToolTip.HideToolTip(); this.cardFocused = null; this.domainLayerFocused = null; this.cardFocusedLayers.Clear(); this.domainsLayers.Clear(); this.scoreLayers.Clear(); if (this.world2D.TryGetTarget(out World2D world2D)) { foreach (ALayer2D layer in world2D.LayersList) { ICardFocusedLayer cardFocusedLayer = layer as ICardFocusedLayer; if (cardFocusedLayer != null) { this.cardFocusedLayers.Add(cardFocusedLayer); } IDomainsLayer domainLayer = layer as IDomainsLayer; if (domainLayer != null) { this.domainsLayers.Add(domainLayer); domainLayer.StartDomainEvaluated += OnStartDomainsEvaluated; domainLayer.DomainEvaluated += OnDomainEvaluated; domainLayer.EndDomainEvaluated += OnEndDomainsEvaluated; domainLayer.DomainFocusedChanged += OnDomainFocusedChanged; domainLayer.NbCardsToPlaceChanged += OnNbCardsToPlaceChanged; } IScoreLayer scoreLayer = layer as IScoreLayer; if (scoreLayer != null) { this.scoreLayers.Add(scoreLayer.PlayerName, scoreLayer); } } } }
private void OnLayerAdded(ALayer layerToAdd) { this.layerResourcesLoader.LoadLayerResources(layerToAdd); this.layerSoundsLoader.LoadLayerSounds(layerToAdd); IObject2DFactory layer2DFactory = World2D.MappingObjectModelView[layerToAdd.GetType()]; ALayer2D layer2D = layer2DFactory.CreateObject2D(this, layerToAdd) as ALayer2D; this.LayersDictionary.Add(layerToAdd, layer2D); }
public void OnEntityAdded(ILandChunk landChunk, IEntity entity) { IObject2DFactory entityFactory = LandWorld2D.MappingObjectModelView[entity.GetType()]; if (this.landWorld2D.TryGetTarget(out LandWorld2D world2D)) { world2D.ResourcesLoader.LoadEntitiesResources(entity); this.entitiesToEntities2D.Add(entity, entityFactory.CreateObject2D(world2D, entity) as AEntity2D); } }
public AltitudeObject2D(IObject2DFactory factory, AltitudeLandObject landObject) { Texture texture = factory.GetTextureByIndex(0); this.ObjectSprite = new Sprite(texture, this.GetTransitionTextureCoord(landObject.LandTransition)); this.ObjectSprite.Position = this.ObjectSprite.Position; this.ObjectSprite.Scale = new Vector2f(0.5f, 0.5f); this.Position = new Vector2f(landObject.Position.X, landObject.Position.Y); }
public StarEntity2D(IObject2DFactory factory, ALayer2D parentLayer, StarEntity entity) : base(parentLayer, factory, entity) { Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\StarFrag.frag"); Texture distortionMap = factory.GetTextureById("distortionTexture"); distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); shader.SetUniform("distortionMapTexture", distortionMap); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.isFocused = true; this.IsFocused = false; this.SetCardSocketed(entity.CardSocketed); this.ObjectSprite.Texture = factory.GetTextureById("starTexture"); this.ObjectSprite.Origin = new SFML.System.Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2); // Active animation SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(4), AnimationType.LOOP); IAnimation anim = new ZoomAnimation(1, 1.5f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(1.5f, 1, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(2, anim); this.animationsList.Add(sequence); // Start : Transitioning active animation Random rand = new Random(); float startTime = (float)(rand.NextDouble() * 2); sequence = new SequenceAnimation(Time.FromSeconds(startTime + 2), AnimationType.ONETIME); anim = new ZoomAnimation(0, 0, Time.FromSeconds(startTime), AnimationType.ONETIME, InterpolationMethod.STEP); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(0f, 1f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(startTime, anim); this.animationsList.Add(sequence); this.InitializeState(entity); }
public WaterObject2D(IObject2DFactory factory, WaterLandObject landObject) { Texture texture = factory.GetTextureByIndex(0); this.textureRect = this.GetTransitionTextureCoord(landObject.LandTransition); this.ObjectSprite = new Sprite(texture, this.textureRect); this.ObjectSprite.Position = this.ObjectSprite.Position; this.ObjectSprite.Color = new Color(255, 255, 255, 127); this.ObjectSprite.Scale = new Vector2f(0.5f, 0.5f); this.Position = new Vector2f(landObject.Position.X, landObject.Position.Y); }
public MenuTextLayer2D(World2D world2D, IObject2DFactory layerFactory, ALayer layer) : base(world2D, layerFactory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); this.LevelTurnPhase = TurnPhase.VOID; this.titleText2D = new TextCanevas2D(this); this.titleText2D.Position = new Vector2f(-5000, -800); this.titleText2D.Canevas = new IntRect(0, 0, 10000, 1000); this.titleText2D.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 1000); this.titleText2D.UpdateTextOfParagraph(0, "menu_title"); }
public AEntity2D(ALayer2D parentLayer, IObject2DFactory factory, AEntity entity) : base(factory) { this.parentLayer = new WeakReference <ALayer2D>(parentLayer); this.sprite = new Sprite(); this.Priority = 10; this.Position = entity.Position; this.Rotation = entity.Rotation; this.IsActive = entity.IsActive; }
public override void InitializeLayer(IObject2DFactory factory) { base.InitializeLayer(factory); this.Position = this.parentLayer.Position; this.Rotation = this.parentLayer.Rotation; foreach (string texturePath in factory.TexturesPath) { string idTexture = Path.GetFileNameWithoutExtension(texturePath); this.nameToTiles.Add(idTexture, new TileBackgoundObject2D(this, factory.GetTextureById(idTexture), idTexture)); } }
public override void InitializeLayer(IObject2DFactory factory) { this.cardsHand.Clear(); base.InitializeLayer(factory); this.cardFocused = null; this.cardAwakened = null; this.pendingRemovingCardEntities.Clear(); this.LevelTurnPhase = TurnPhase.VOID; this.IsRunningBehavior = false; }
public virtual void InitializeLayer(IObject2DFactory factory) { this.defaultViewSize = new Vector2f(-1, -1); this.mustUpdateMousePosition = false; //this.focusedEntity2Ds.Clear(); this.focusedGraphicEntity2D = null; this.selectedGraphicEntity2D = null; foreach (AEntity entity in this.parentLayer.Entities) { this.AddEntity(entity); } }
public CJStarDomain2D(ALayer2D layer2D, IObject2DFactory factory, CJStarDomain entity) : base(layer2D, factory, entity) { // TO REMOVE //this.Test(); //this.widthRatio = 0; //this.heightRatio = 0; this.targetedColor = Color.Black; Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\StarDomain.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture.Repeated = true; distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.isFocused = true; this.IsFocused = false; this.Priority = entity.Priority; this.domainStars = entity.Domain.Select(pElem => layer2D.GetEntity2DFromEntity(pElem) as StarEntity2D).ToList(); this.isFilled = entity.IsFilled; shader.SetUniform("isFilled", this.isFilled); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME); IAnimation anim = new ZoomAnimation(1f, 2f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(2f, 1f, Time.FromSeconds(3), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(2, anim); this.animationsList.Add(sequence); this.UpdateScaling(entity); this.StartNotActiveState(); }
public CJMenuLayer2D(World2D world2D, IObject2DFactory factory, CJMenuLayer layer) : base(world2D, factory, layer) { this.Area = new Vector2i(int.MaxValue, int.MaxValue); this.startButton = new CJStartButton2D(this); this.player1DeckBuildingButton = new CJDeckBuildingButton2D(this, "start_deck_building1"); this.player2DeckBuildingButton = new CJDeckBuildingButton2D(this, "start_deck_building2"); this.focusableEntities = new List <AEntity2D>() { this.startButton, this.player1DeckBuildingButton, this.player2DeckBuildingButton }; }
public MountainElementObject2D(IObject2DFactory factory, MountainElementLandObject landObject) : base() { Texture texture = factory.GetTextureByIndex(0); // Random random = new Random(landObject.Position.X - landObject.Position.Y * landObject.Position.Y); int elementIndex = landObject.ElementIndex; //if (landObject.LandMountainType == MountainType.DRY) //{ // elementIndex = 0; //} this.ObjectSprite = new Sprite(texture, new IntRect(elementIndex * 2 * MainWindow.MODEL_TO_VIEW, 0 * MainWindow.MODEL_TO_VIEW, 2 * MainWindow.MODEL_TO_VIEW, 2 * MainWindow.MODEL_TO_VIEW)); this.ObjectSprite.Scale = new Vector2f(0.5f, 0.5f); this.Position = new Vector2f(landObject.Position.X, landObject.Position.Y); }
public GrassElementObject2D(IObject2DFactory factory, GrassElementLandObject landObject) : base() { Texture texture = factory.GetTextureByIndex((int)landObject.LandGrassType); // Random random = new Random(landObject.Position.X - landObject.Position.Y * landObject.Position.Y); int elementIndex = landObject.ElementIndex; if (landObject.LandGrassType == GrassType.DRY) { elementIndex = 0; } this.ObjectSprite = new Sprite(texture, new IntRect(elementIndex * 2 * MainWindow.MODEL_TO_VIEW, 0 * MainWindow.MODEL_TO_VIEW, 2 * MainWindow.MODEL_TO_VIEW, 2 * MainWindow.MODEL_TO_VIEW)); this.ObjectSprite.Scale = new Vector2f(0.5f, 0.5f); this.Position = new Vector2f(landObject.Position.X, landObject.Position.Y); }
public override void InitializeLayer(IObject2DFactory factory) { this.cardsDeck.Clear(); this.cardsCemetery.Clear(); this.cardsHand.Clear(); this.maxPriority = 0; this.nbCardsToDraw = 0; this.currentCooldownDraw = 0; this.LevelTurnPhase = TurnPhase.VOID; this.cardDrawn = null; this.cardFocused = null; this.sourceCardEntities = null; //this.cardPicked = null; this.pileFocused = (this.parentLayer as BoardPlayerLayer).CardPileFocused; base.InitializeLayer(factory); BoardPlayerLayer parentBoardPlayerLayer = (this.parentLayer as BoardPlayerLayer); this.scoreLabel.DisplayScore(parentBoardPlayerLayer.IndexPlayer, parentBoardPlayerLayer.SupportedPlayer); this.scoreLabel.Score = 0; foreach (AEntity2D entity in this.objectToObject2Ds.Values) { if (entity is CardEntity2D) { CardEntity2D cardEntity2D = entity as CardEntity2D; cardEntity2D.Priority = this.maxPriority++; this.cardsDeck.Add(cardEntity2D); } } }