示例#1
0
        public List <ImageCompositionDynamic.Item> Init(ImageCompositionCustom composition, string name, Vector2Int textureSize, List <object> variables, ResourceCache resourceCache)
        {
            this.composition = composition;
            this.textureSize = textureSize;
            identityMul      = new Material("Atlas/Identity", "Atlas/IdentityMul")
            {
                blendingFactorSource      = OpenTK.Graphics.OpenGL4.BlendingFactor.One,
                blendingFactorDestination = OpenTK.Graphics.OpenGL4.BlendingFactor.OneMinusSrcAlpha
            };
            matrixUVMul = new Material("Atlas/MatrixUV", "Atlas/IdentityMul")
            {
                blendingFactorSource      = OpenTK.Graphics.OpenGL4.BlendingFactor.One,
                blendingFactorDestination = OpenTK.Graphics.OpenGL4.BlendingFactor.OneMinusSrcAlpha
            };
            identityDiv = new Material("Atlas/Identity", "Atlas/IdentityDiv");
            clear       = new Material("Atlas/Identity", "Atlas/Clear");

            deTrain = ImageCompositionStaticSimplex.GetComposition("Images/bg/train_animation/de_train.png", resourceCache);
            var ret = new List <ImageCompositionDynamic.Item>
            {
                new ImageCompositionDynamic.Item(deTrain)
            };

            trainBacks = new ImageComposition[9];
            for (int i = 0; i < trainBacks.Length; i++)
            {
                trainBacks[i] = ImageCompositionStaticSimplex.GetComposition($"Images/bg/train_animation/train_back_{i + 1}.png", resourceCache);
                ret.Add(new ImageCompositionDynamic.Item(trainBacks[i]));
            }
            return(ret);
        }
示例#2
0
        public List <ImageCompositionDynamic.Item> Init(ImageCompositionCustom composition, string name, Vector2Int textureSize, List <object> variables, ResourceCache resourceCache)
        {
            this.composition = composition;
            this.textureSize = textureSize;
            identityMul      = new Material("Atlas/Identity", "Atlas/IdentityMul")
            {
                blendingFactorSource      = OpenTK.Graphics.OpenGL4.BlendingFactor.One,
                blendingFactorDestination = OpenTK.Graphics.OpenGL4.BlendingFactor.OneMinusSrcAlpha
            };
            matrixMul = new Material("Atlas/Matrix", "Atlas/IdentityMul")
            {
                blendingFactorSource      = OpenTK.Graphics.OpenGL4.BlendingFactor.One,
                blendingFactorDestination = OpenTK.Graphics.OpenGL4.BlendingFactor.OneMinusSrcAlpha
            };
            identityDiv = new Material("Atlas/Identity", "Atlas/IdentityDiv");
            clear       = new Material("Atlas/Identity", "Atlas/Clear");

            if (!ImageComposition.TryGetComposition("train tun", out tunAnim))
            {
                var files = FileManager.DataGetFiles("Images/bg/train_animation/tun", "*.png");
                var list  = new List <ImageCompositionFrameAnimation.FrameItemPrototype>(files.Length);
                for (int i = 0; i < files.Length; i++)
                {
                    list.Add(new ImageCompositionFrameAnimation.FrameItemPrototype(ImageCompositionStaticSimplex.GetComposition(files[i], resourceCache), 0.03f));
                }
                tunAnim = new ImageCompositionFrameAnimation("train tun", new Vector2Int((int)(textureSize.x / 2520f * 1920f), textureSize.y), list);
            }
            deTrain = ImageCompositionStaticSimplex.GetComposition("Images/bg/train_animation/de_train2.png", resourceCache);
            var ret = new List <ImageCompositionDynamic.Item>
            {
                new ImageCompositionDynamic.Item(deTrain),
                new ImageCompositionDynamic.Item(tunAnim)
            };

            return(ret);
        }