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; }
public ACJButton2D(ALayer2D parentLayer, int width, string idLabel) : base(parentLayer) { this.bannerShape = new RectangleShape(new Vector2f(width, 75)); this.SpriteColor = new Color(128, 128, 128, 255); this.Position = new Vector2f(0, 0); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(0, idLabel); IAnimation showAnimation = new ColorAnimation(new Color(0, 0, 0, 0), new Color(128, 128, 128, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(showAnimation); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(2), AnimationType.LOOP); IAnimation focusedAnimation = new ColorAnimation(new Color(128, 128, 128, 255), new Color(255, 255, 255, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, focusedAnimation); focusedAnimation = new ColorAnimation(new Color(255, 255, 255, 255), new Color(128, 128, 128, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(1, focusedAnimation); this.animationsList.Add(sequence); IAnimation hideAnimation = new ColorAnimation(new Color(128, 128, 128, 255), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(hideAnimation); this.IsActive = true; }
public ScoreDomainPlayerLabel2D(ALayer2D parentLayer, int indexPlayer, Player player) : base(parentLayer) { this.score = -1; this.SpriteColor = new Color(0, 0, 0, 255); this.Canevas = new IntRect(0, 0, 200, 200); if (indexPlayer == 0) { this.offsetX = -200; } else { this.offsetX = 200; } this.offsetY = 40; this.CreateTextParagraph2D(new Vector2f(0, 10), new Vector2f(0, 0), Text2D.TextParagraph2D.Alignment.CENTER, 20); this.CreateTextParagraph2D(new Vector2f(0, 80), new Vector2f(0, 0), Text2D.TextParagraph2D.Alignment.CENTER, 20); this.CreateTextParagraph2D(new Vector2f(0, 30), new Vector2f(0, 0), Text2D.TextParagraph2D.Alignment.CENTER, 40); this.CreateTextParagraph2D(new Vector2f(0, 40), new Vector2f(0, 0), Text2D.TextParagraph2D.Alignment.CENTER, 25); this.UpdateTextOfParagraph(2, "field_title"); if (indexPlayer == 0) { this.UpdateTextOfParagraph(0, "score_domain_player_label", player.PlayerName); } else { this.UpdateTextOfParagraph(0, "score_domain_opponent_label", player.PlayerName); } this.textParagraph2Ds[0].UpdateParameterColor(0, player.PlayerColor); if (indexPlayer == 0) { this.UpdateTextOfParagraph(1, "score_domain_player_content"); } else { this.UpdateTextOfParagraph(1, "score_domain_opponent_content"); } this.UpdateTextOfParagraph(3, "score_domain_temporary_content"); this.IsActive = false; IAnimation anim = new PositionAnimation(this.Position, new Vector2f(-this.offsetX, 0), Time.FromSeconds(1f), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(anim); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(1), AnimationType.ONETIME); anim = new ColorAnimation(new Color(0, 0, 0, 255), new Color(0, 0, 0, 0), Time.FromSeconds(1f), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, anim); anim = new PositionAnimation(this.Position, this.Position + new Vector2f(0, 200), Time.FromSeconds(1f), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0.001f, anim); this.animationsList.Add(sequence); }
public bool OnMouseReleased(ALayer2D parentLayer, ControlEventType eventType) { if (parentLayer.FocusedGraphicEntity2D == this) { Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D boardPlayerLayer2D = parentLayer as Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D; if (boardPlayerLayer2D != null && boardPlayerLayer2D.LevelTurnPhase == Model.Node.TestWorld.TurnPhase.MAIN) { Vector2i mousePosition = parentLayer.MousePosition; mousePosition.Y -= (int)(this.Bounds.Height / 2); if (eventType == ControlEventType.MOUSE_LEFT_CLICK) { parentLayer.SendEventToWorld(Model.Event.EventType.PICK_CARD, parentLayer.GetEntityFromEntity2D(this), mousePosition.X + ":" + mousePosition.Y); } } Layer2D.BoardNotifLayer2D.BoardNotifLayer2D boardNotifLayer2D = parentLayer as Layer2D.BoardNotifLayer2D.BoardNotifLayer2D; if (boardNotifLayer2D != null && boardNotifLayer2D.LevelTurnPhase == Model.Node.TestWorld.TurnPhase.MAIN) { Vector2i mousePosition = parentLayer.MousePosition; mousePosition.Y -= (int)(this.Bounds.Height / 2); if (eventType == ControlEventType.MOUSE_LEFT_CLICK) { parentLayer.SendEventToWorld(Model.Event.EventType.PICK_CARD, parentLayer.GetEntityFromEntity2D(this), mousePosition.X + ":" + mousePosition.Y); } } } return(true); }
public EndLevelBanner2D(ALayer2D parentLayer) : base(parentLayer) { this.paragraphRows = new List <List <TextParagraph2D> >(); this.bannerShape = new RectangleShape(new Vector2f(1000, 1000)); this.bannerShape.FillColor = new Color(0, 0, 0, 200); this.Position = new Vector2f(0, 0); this.isDraw = false; IAnimation anim = new ZoomAnimation(0, 1, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(anim); anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(anim); anim = new ZoomAnimation(1, 2, Time.FromSeconds(3), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(anim); this.State = BannerState.START; this.IsActive = false; }
public bool OnMouseClicked(ALayer2D parentLayer, ControlEventType eventType) { if (parentLayer is BoardGameLayer2D) { if (parentLayer.FocusedGraphicEntity2D == this) { if (eventType == ControlEventType.MOUSE_LEFT_CLICK) { BoardGameLayer2D boardGameLayer2D = (parentLayer as BoardGameLayer2D); if (boardGameLayer2D.CardPicked != null) { StarEntity starEntity = parentLayer.GetEntityFromEntity2D(this) as StarEntity; CardEntity cardEntity = parentLayer.GetEntityFromEntity2D(boardGameLayer2D.CardPicked) as CardEntity; if (starEntity.CanSocketCard(cardEntity)) { boardGameLayer2D.SendEventToWorld(Model.Event.EventType.SOCKET_CARD, starEntity, null); } } else if (boardGameLayer2D.SourceCardEntities2D != null && boardGameLayer2D.SourceCardEntities2D.Count > 0) { StarEntity starEntity = parentLayer.GetEntityFromEntity2D(this) as StarEntity; boardGameLayer2D.SendEventToWorld(Model.Event.EventType.PICK_CARD, starEntity.CardSocketed, null); } } } } return(true); }
public BannerEntity2D(ALayer2D parentLayer) : base(parentLayer, null, false) { this.bannerShape = new RectangleShape(new Vector2f(3000, 200)); this.bannerShape.Origin = new Vector2f(this.bannerShape.Size.X / 2, this.bannerShape.Size.Y / 2); this.bannerShape.FillColor = new Color(0, 0, 0, 128); this.Position = new Vector2f(-this.bannerShape.Size.X, 0); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME); IAnimation anim = new PositionAnimation(new Vector2f(-this.bannerShape.Size.X, 0), new Vector2f(0, 0), Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_DEC); sequence.AddAnimation(0, anim); anim = new ColorAnimation(new Color(0, 0, 0, 128), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(5, anim); this.animationsList.Add(sequence); sequence = new SequenceAnimation(Time.FromSeconds(4), AnimationType.ONETIME); anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 128), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(0, anim); anim = new ColorAnimation(new Color(0, 0, 0, 128), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(3, anim); this.animationsList.Add(sequence); anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 128), Time.FromSeconds(0.5f), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(anim); anim = new ColorAnimation(new Color(0, 0, 0, 128), new Color(0, 0, 0, 0), Time.FromSeconds(0.5f), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(anim); }
private void InitializeScoreDomainLabel(ALayer2D parentLayer, Player player1, Player player2) { this.playerNameToScoreDomain2D = new Dictionary <string, ScoreDomainPlayerLabel2D>(); this.playerNameToScoreDomain2D.Add(player1.PlayerName, new ScoreDomainPlayerLabel2D(parentLayer, 0, player1)); this.playerNameToScoreDomain2D.Add(player2.PlayerName, new ScoreDomainPlayerLabel2D(parentLayer, 1, player2)); }
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 AwakenedBannerLabel2D(ALayer2D parentLayer) : base(parentLayer) { this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 60); this.Canevas = new IntRect(0, 0, 2000, 0); this.Position = new Vector2f(-1000, -50); this.UpdateTextOfParagraph(0, "awakened_label"); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(5), AnimationType.ONETIME); IAnimation anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, anim); this.animationsList.Add(sequence); anim = new ZoomAnimation(0f, 1, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_DEC); sequence.AddAnimation(1f, anim); anim = new ZoomAnimation(1f, 10, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(3, anim); anim = new ColorAnimation(new Color(0, 0, 0, 255), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(4f, anim); this.animationsList.Add(sequence); this.IsActive = false; }
public override void OnMouseFocused(ALayer2D parentLayer, ControlEventType eventType) { base.OnMouseFocused(parentLayer, eventType); this.Zoom = 1; this.PlayAnimation(1); }
public void OnMouseFocused(ALayer2D parentLayer, ControlEventType eventType) { CJStarDomain domainEntity = parentLayer.GetEntityFromEntity2D(this) as CJStarDomain; if (domainEntity != null) { parentLayer.SendEventToWorld(Model.Event.EventType.FOCUS_DOMAIN_BOARD, domainEntity, null); } }
public override void OnMouseUnFocused(ALayer2D parentLayer, ControlEventType eventType) { if (this.isActive) { AObject2D.animationManager.StopAnimation(this); this.SpriteColor = new Color(0, 0, 0, 255); } }
public void OnMouseFocused(ALayer2D parentLayer, ControlEventType eventType) { StarEntity starEntity = parentLayer.GetEntityFromEntity2D(this) as StarEntity; if (starEntity.CardSocketed != null) { parentLayer.SendEventToWorld(Model.Event.EventType.FOCUS_CARD_BOARD, starEntity.CardSocketed, null); } }
public ImageBackgroundObject2D(ALayer2D parentLayer) : base(parentLayer, null, true) { this.nextImageId = null; this.ImageTransitionState = TransitionState.FINISHED; this.ObjectSprite.Texture = null; }
public override bool OnMouseReleased(ALayer2D parentLayer, ControlEventType eventType) { if (parentLayer.FocusedGraphicEntity2D == this) { } this.Zoom = 1f; return(false); }
public void OnMouseUnFocused(ALayer2D parentLayer, ControlEventType eventType) { parentLayer.SendEventToWorld(Model.Event.EventType.FOCUS_CARD_HAND, null, null); Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D boardPlayerLayer2D = parentLayer as Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D; if (boardPlayerLayer2D == null || boardPlayerLayer2D.SourceCardEntities2D == null || boardPlayerLayer2D.SourceCardEntities2D.Count == 0) { this.IsFocused = false; } }
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); } } } }
public TileBackgoundObject2D(ALayer2D layer2D, Texture texture, string textureName) : base(layer2D, null, true) { string[] token = textureName.Split(','); int coordX = int.Parse(token[0]); int coordY = int.Parse(token[1]); this.ObjectSprite.Texture = texture; this.Position = new SFML.System.Vector2f(coordX * texture.Size.X, coordY * texture.Size.Y); }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is CardEntityAwakenedDecorator) { CardEntityAwakenedDecorator entity = obj as CardEntityAwakenedDecorator; return(new CardEntityAwakenedDecorator2D(this, layer2D, entity)); } return(null); }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is ToolTipEntity) { ToolTipEntity entity = obj as ToolTipEntity; return(new CardToolTip2D(layer2D)); } return(null); }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is CardEntity) { CardEntity entity = obj as CardEntity; return(new CardEntity2D(this, layer2D, entity)); } return(null); }
public EndTurnButton2D(ALayer2D parentLayer) : base(parentLayer) { this.bannerShape = new RectangleShape(new Vector2f(200, 75)); this.SpriteColor = new Color(0, 0, 0, 255); this.Position = new Vector2f(0, 0); this.idLabelToIndex = new Dictionary <string, int>(); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(0, "end_turn"); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(1, "pass_action"); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(2, "destroy_action"); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(3, "convert_action"); this.CreateTextParagraph2D(new Vector2f(0, 25), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 20); this.UpdateTextOfParagraph(4, "addPoints_action"); this.idLabelToIndex.Add("DeleteCardNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.DeleteCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.DeleteCardNotifBehavior.DeleteState.PICK_CARD), 1); this.idLabelToIndex.Add("DeleteCardNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.DeleteCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.DeleteCardNotifBehavior.DeleteState.CAN_DELETE_CARD), 2); this.idLabelToIndex.Add("ConvertCardNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState.PICK_CARD), 1); this.idLabelToIndex.Add("ConvertCardNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState.CAN_DELETE_CARD), 3); this.idLabelToIndex.Add("AddPointsNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState.PICK_CARD), 1); this.idLabelToIndex.Add("AddPointsNotifBehavior." + Enum.GetName(typeof(Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState), Model.Layer.BoardNotifLayer.Behavior.ConvertCardNotifBehavior.DeleteState.CAN_DELETE_CARD), 4); IAnimation showAnimation = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(showAnimation); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(2), AnimationType.LOOP); IAnimation focusedAnimation = new ColorAnimation(new Color(0, 0, 0, 255), new Color(125, 125, 125, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, focusedAnimation); focusedAnimation = new ColorAnimation(new Color(125, 125, 125, 255), new Color(0, 0, 0, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(1, focusedAnimation); this.animationsList.Add(sequence); IAnimation hideAnimation = new ColorAnimation(new Color(0, 0, 0, 255), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(hideAnimation); IAnimation labelChangedAnimation = new ZoomAnimation(2, 1, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); this.animationsList.Add(labelChangedAnimation); this.isActive = false; }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is StarLinkEntity) { StarLinkEntity entity = obj as StarLinkEntity; return(new StarLinkEntity2D(layer2D, this, entity)); } return(null); }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is CJStarDomain) { CJStarDomain entity = obj as CJStarDomain; return(new CJStarDomain2D(layer2D, this, entity)); } return(null); }
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 override bool OnMouseClicked(ALayer2D parentLayer, ControlEventType eventType) //{ // return base.OnMouseClicked(; //} public override bool OnMouseReleased(ALayer2D parentLayer, ControlEventType eventType) { if (parentLayer.FocusedGraphicEntity2D == this) { base.OnMouseReleased(parentLayer, eventType); parentLayer.SendEventToWorld(Model.Event.EventType.LEVEL_CHANGE, null, "CardBoardLevel"); } this.Zoom = 1f; return(false); }
public override bool OnMouseReleased(ALayer2D parentLayer, ControlEventType eventType) { if (parentLayer.FocusedGraphicEntity2D == this) { base.OnMouseReleased(parentLayer, eventType); (parentLayer as BoardBannerLayer2D).ChangeLevel("StartPageLevel"); } this.Zoom = 1f; return(false); }
public bool IsFocusable(ALayer2D parentLayer) { Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D boardPlayerLayer2D = parentLayer as Layer2D.BoardPlayerLayer2D.BoardPlayerLayer2D; if (boardPlayerLayer2D != null) { return(this.cooldownFocus <= 0 && boardPlayerLayer2D.LevelTurnPhase == Model.Node.TestWorld.TurnPhase.MAIN); } Layer2D.BoardNotifLayer2D.BoardNotifLayer2D boardNotifLayer2D = parentLayer as Layer2D.BoardNotifLayer2D.BoardNotifLayer2D; if (boardNotifLayer2D != null) { return(this.cooldownFocus <= 0 && boardNotifLayer2D.LevelTurnPhase == Model.Node.TestWorld.TurnPhase.MAIN); } return(false); }
public AAudioObject2D(ALayer2D parentLayer, IObject2D owner) : base(parentLayer, null, true) { this.Owner = owner; this.Owner.PropertyChanged += this.OnOwnerPropertyChanged; parentLayer.ViewChanged += this.OnViewChanged; IAnimation fadeInAnimation = new AudioVolumeAnimation(0, VOLUME, SFML.System.Time.FromSeconds(FADE_PERIOD), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(fadeInAnimation); IAnimation fadeOutAnimation = new AudioVolumeAnimation(VOLUME, 0, SFML.System.Time.FromSeconds(FADE_PERIOD), AnimationType.ONETIME, InterpolationMethod.LINEAR); this.animationsList.Add(fadeOutAnimation); }