示例#1
0
        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;
        }
示例#2
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;
        }
示例#3
0
        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);
        }
示例#4
0
        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 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);
        }
示例#6
0
        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;
        }
示例#7
0
        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;
        }
示例#8
0
        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);
        }
示例#9
0
        public void PlayRemoveAnimation()
        {
            SequenceAnimation sequenceAnimation = new SequenceAnimation(Time.FromSeconds(1f), AnimationType.ONETIME);

            IAnimation animation = new PositionAnimation(this.Position, this.Position + new Vector2f(0, 50), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR);

            sequenceAnimation.AddAnimation(0, animation);

            animation = new ColorAnimation(new Color(255, 255, 255, 255), new Color(255, 255, 255, 0), Time.FromSeconds(0.9f), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequenceAnimation.AddAnimation(0.1f, animation);

            this.PlayAnimation(sequenceAnimation);
        }
示例#10
0
 static int Play(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SequenceAnimation obj = (SequenceAnimation)ToLua.CheckObject <SequenceAnimation>(L, 1);
         obj.Play();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 /// <summary>
 /// 清除当前
 /// </summary>
 void ClearCur()
 {
     if (curAnis != null)
     {
         //curAnis.Stop();
         curAnis = null;
     }
     if (aniParentObj != null)
     {
         aniParentObj.SetActive(false);
         aniParentObj = null;
     }
     isPlaying = false;
 }
示例#12
0
        public void HideStarEffect()
        {
            this.IsActive = false;

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(1), AnimationType.ONETIME);

            IAnimation anim = new ZoomAnimation(1, 0.1f, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);

            sequence.AddAnimation(0, anim);

            anim = new RotationAnimation(this.Rotation, this.Rotation + 60, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(0.01f, anim);

            this.PlayAnimation(sequence);
        }
    IEnumerator Play()
    {
        isPlaying = true;
        yield return(new WaitForSecondsRealtime(aniList[0].start_Time));

        Open();
        aniParentObj = transform.Find(aniList[0].aniType.ToString()).gameObject;
        curAnis      = aniParentObj.GetComponentInChildren <SequenceAnimation>();
        aniParentObj.SetActive(true);

        LoadIcon();

        curAnis.onPlayEndCall = OnPlayEnd;
        curAnis.Rewind();
        aniList[0].PlaySound();
    }
示例#14
0
        public HeaderEntity2D(ALayer2D parentLayer, Player player, Player opponent) : base(parentLayer)
        {
            this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 60);
            this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 60);
            this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 60);
            this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 60);

            this.Canevas  = new IntRect(0, 0, 2000, 500);
            this.Position = new Vector2f(-1000, -50);

            this.playerNameToIndex = new Dictionary <string, int>();

            this.UpdateTextOfParagraph(0, "start_player_turn", player.PlayerName);
            this.UpdateTextOfParagraph(1, "end_player_turn", player.PlayerName);
            this.textParagraph2Ds[0].UpdateParameterColor(0, player.PlayerColor);
            this.textParagraph2Ds[1].UpdateParameterColor(0, player.PlayerColor);
            this.playerNameToIndex.Add(player.PlayerName, 0);

            this.UpdateTextOfParagraph(2, "start_opponent_turn", opponent.PlayerName);
            this.UpdateTextOfParagraph(3, "end_opponent_turn", opponent.PlayerName);
            this.textParagraph2Ds[2].UpdateParameterColor(0, opponent.PlayerColor);
            this.textParagraph2Ds[3].UpdateParameterColor(0, opponent.PlayerColor);
            this.playerNameToIndex.Add(opponent.PlayerName, 2);

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME);

            IAnimation anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 0), Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_DEC);

            sequence.AddAnimation(0, anim);

            anim = new ColorAnimation(new Color(0, 0, 0, 0), new Color(0, 0, 0, 255), Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_DEC);
            sequence.AddAnimation(2, anim);

            anim = new ColorAnimation(new Color(0, 0, 0, 255), 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, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_DEC);
            sequence.AddAnimation(0, anim);

            anim = new ColorAnimation(new Color(0, 0, 0, 255), new Color(0, 0, 0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);
            sequence.AddAnimation(3, anim);
            this.animationsList.Add(sequence);

            this.IsActive = false;
        }
示例#15
0
        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();
        }
示例#16
0
    static int get_SpriteArray(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation    obj = (SequenceAnimation)o;
            UnityEngine.Sprite[] ret = obj.SpriteArray;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index SpriteArray on a nil value"));
        }
    }
示例#17
0
    static int get_AnimRenderer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation          obj = (SequenceAnimation)o;
            UnityEngine.SpriteRenderer ret = obj.AnimRenderer;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AnimRenderer on a nil value"));
        }
    }
示例#18
0
    static int get_AnimSpeed(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation obj = (SequenceAnimation)o;
            float             ret = obj.AnimSpeed;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AnimSpeed on a nil value"));
        }
    }
示例#19
0
    static int set_PlayCount(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation obj = (SequenceAnimation)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.PlayCount = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index PlayCount on a nil value"));
        }
    }
示例#20
0
    static int set_AnimRenderer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation          obj  = (SequenceAnimation)o;
            UnityEngine.SpriteRenderer arg0 = (UnityEngine.SpriteRenderer)ToLua.CheckObject(L, 2, typeof(UnityEngine.SpriteRenderer));
            obj.AnimRenderer = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AnimRenderer on a nil value"));
        }
    }
示例#21
0
    static int set_AnimSpeed(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation obj  = (SequenceAnimation)o;
            float             arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.AnimSpeed = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AnimSpeed on a nil value"));
        }
    }
示例#22
0
    static int get_PlayCount(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation obj = (SequenceAnimation)o;
            int ret = obj.PlayCount;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index PlayCount on a nil value"));
        }
    }
示例#23
0
    static int set_SpriteArray(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SequenceAnimation    obj  = (SequenceAnimation)o;
            UnityEngine.Sprite[] arg0 = ToLua.CheckObjectArray <UnityEngine.Sprite>(L, 2);
            obj.SpriteArray = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index SpriteArray on a nil value"));
        }
    }
示例#24
0
        private void InitializeStartState()
        {
            this.DecoratorState = CardDecoratorState.START;

            if (this.parentLayer.TryGetTarget(out ALayer2D layer2D))
            {
                Vector2f fromPosition = (layer2D as BoardNotifLayer2D).GetPositionFrom((layer2D.GetEntityFromEntity2D(this) as CardEntityAwakenedDecorator).CardEntityDecorated.ParentLayer, this.initialPosition);

                SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(1), AnimationType.ONETIME);

                IAnimation animation = new ColorAnimation(new Color(255, 255, 255, 0), new Color(255, 255, 255, 255), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR);
                sequence.AddAnimation(0.01f, animation);

                animation = new PositionAnimation(fromPosition, new Vector2f(0, 0), Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);
                sequence.AddAnimation(0, animation);

                this.PlayAnimation(sequence);
            }
        }
示例#25
0
        protected virtual GameObjectAnimation GenerateDeathAnimation()
        {
            var seq_ani   = new SequenceAnimation();
            var death_ani = new TextureAnimation(this.Factory.LoadUnitTexture("death_default"), 5, 3);

            death_ani.Frames       = Enumerable.Range(1, 15).ToArray();
            death_ani.FrameRepeats = Enumerable.Repeat <int>(2, 15).ToArray();

            seq_ani.AddAnimation(death_ani);

            var dead_ani = new TextureAnimation(this.Factory.LoadUnitTexture("death_default"), 5, 3);

            dead_ani.Frames       = new int[] { 15 };
            dead_ani.FrameRepeats = Enumerable.Repeat <int>(2, 1).ToArray();
            dead_ani.AutoLooping  = true;
            seq_ani.AddAnimation(dead_ani);


            return(seq_ani);
        }
示例#26
0
        public EffectLabel2D(ALayer2D parentLayer)
            : base(parentLayer)
        {
            this.CreateTextParagraph2D(new Vector2f(0, 0), new Vector2f(0, 0), TextParagraph2D.Alignment.CENTER, 30);

            this.Canevas  = new IntRect(0, 0, 500, 500);
            this.Position = new Vector2f(-250, -50);

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), 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.5f, 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(5, anim);

            this.animationsList.Add(sequence);

            this.IsActive = false;
        }
示例#27
0
        public EffectBanner2D(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(0, 0);

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME);

            IAnimation anim = new ZoomAnimation(0, 1, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR);

            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(1, 0, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(5, anim);

            this.animationsList.Add(sequence);

            this.IsActive = false;
        }
示例#28
0
    public override void OnInspectorGUI()
    {
        if (Application.isPlaying)
        {
            DrawDefaultInspector();
            return;
        }

        SequenceAnimation item = (SequenceAnimation)target;

        item.spritePath = EditorGUILayout.TextField("Resource Path", item.spritePath);
        item.fps        = EditorGUILayout.Slider("FPS", item.fps, 0, 124);
        item.autoPlay   = EditorGUILayout.Toggle("Auto Play", item.autoPlay);
        item.loop       = EditorGUILayout.Toggle("Loop", item.loop);
        item.renderType = (SequenceAnimation.RenderType)EditorGUILayout.EnumPopup(item.renderType);

        switch (item.renderType)
        {
        case SequenceAnimation.RenderType.AUTO:
            item.sprite  = (SpriteRenderer)EditorGUILayout.ObjectField(item.sprite, typeof(SpriteRenderer), true);
            item.texture = (Texture2D)EditorGUILayout.ObjectField(item.texture, typeof(Texture2D), true);
            item.image   = (Image)EditorGUILayout.ObjectField(item.image, typeof(Image), true);
            break;

        case SequenceAnimation.RenderType.SPRITE:
            item.sprite = (SpriteRenderer)EditorGUILayout.ObjectField(item.sprite, typeof(SpriteRenderer), true);
            break;

        case SequenceAnimation.RenderType.TEXTURE:
            item.texture = (Texture2D)EditorGUILayout.ObjectField(item.texture, typeof(Texture2D), true);
            break;

        case SequenceAnimation.RenderType.IMAGE:
            item.image = (Image)EditorGUILayout.ObjectField(item.image, typeof(Image), true);
            break;
        }
    }
示例#29
0
        public CardHalo2D(IObject2DFactory factory, ALayer2D parentLayer, CardEntity2D parentCard) :
            base(parentLayer, factory, false)
        {
            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\CardHalo.frag");

            Texture distortionMap = factory.GetTextureById("distorsionTexture");

            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.SpriteColor          = Color.Yellow;
            this.ObjectSprite.Texture = factory.GetTextureById("starHaloTexture");

            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(ZOOM_AWAKENED, ZOOM_AWAKENED + .5f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR);

            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(ZOOM_AWAKENED + .5f, ZOOM_AWAKENED, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(2, anim);

            this.animationsList.Add(sequence);

            this.Initialize(parentCard);
        }
示例#30
0
    static void CreateSequenceAnimation()
    {
        //获取在Project视图中选择的所有游戏对象
        Object[] SelectedAsset = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);

        List <GameObject> prefabList = new List <GameObject>();

        foreach (Object obj in SelectedAsset)
        {
            if (obj is GameObject)
            {
                prefabList.Add((GameObject)obj);
            }
        }
        for (int i = 0; i < prefabList.Count; i++)
        {
            GameObject        obj  = prefabList[i];
            SequenceAnimation anim = obj.GetComponent <SequenceAnimation>();
            int      count         = anim.SpriteArray.Length;
            Sprite[] sprites       = new Sprite[count];
            for (int k = 0; k < count; k++)
            {
                string ss = "Assets/Animation/" + obj.name + "/" + obj.name + "000" + k + ".png";
                if (k > 9)
                {
                    ss = "Assets/Animation/" + obj.name + "/" + obj.name + "00" + k + ".png";
                }
                Object sp = UnityEditor.AssetDatabase.LoadAssetAtPath(ss, typeof(Sprite));
                sprites[k] = sp as Sprite;
            }
            anim.SpriteArray = sprites;
            //obj.name
        }
        AssetDatabase.SaveAssets();
        Debug.Log("CreateSequenceAnimation Complete!");
    }