当前位置: 首页>>代码示例>>C#>>正文


C# AssetManager.GetTexture方法代码示例

本文整理汇总了C#中AssetManager.GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# AssetManager.GetTexture方法的具体用法?C# AssetManager.GetTexture怎么用?C# AssetManager.GetTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AssetManager的用法示例。


在下文中一共展示了AssetManager.GetTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BackgroundParticleSettings

 public BackgroundParticleSettings(AssetManager assets, int actNumber)
 {
     TextDictionary td = new TextDictionary(assets.GetText("particles"));
     string act = "act" + actNumber;
     numParticles = td.LookupInt32(act, "numParticles");
     if (numParticles > 0)
     {
         rotationRateRange = td.LookupVector2(act, "rotationRateRange");
         scaleRange = td.LookupVector2(act, "scaleRange");
         colorLow = td.LookupColor(act, "colorLow");
         colorHigh = td.LookupColor(act, "colorHigh");
         texture = assets.GetTexture(td.LookupString(act, "texture"));
         distance = td.LookupSingle(act, "dist");
     }
 }
开发者ID:kjin,项目名称:TubeRacer,代码行数:15,代码来源:BackgroundParticleSet.cs

示例2: Build

 public static AnimatedTexture Build(AssetManager assets, string assetName)
 {
     int columns = 1;
     int rows = 1;
     float scale = 1;
     TextDictionary td = assets.GetDictionary("graphics");
     if (td.CheckPropertyExists(assetName, "columns"))
         columns = td.LookupInt32(assetName, "columns");
     if (td.CheckPropertyExists(assetName, "rows"))
         rows = td.LookupInt32(assetName, "rows");
     if (td.CheckPropertyExists(assetName, "scale"))
         scale = td.LookupSingle(assetName, "scale");
     AnimatedTexture sprite = new AnimatedTexture(assetName, assets.GetTexture(assetName), columns, rows, scale);
     return sprite;
 }
开发者ID:kjin,项目名称:Ribbons,代码行数:15,代码来源:AnimatedTexture.cs

示例3: Initialize

        public override void Initialize(List<Option> options, AssetManager assets, string themeName)
        {
            TextDictionary assetDictionary = new TextDictionary(assets.GetText("cursor"));
            base.Initialize(options, assets, themeName);

            graphic = assets.GetTexture(assetDictionary.LookupString(themeName, "graphic"));
            try { color = new Color(assetDictionary.LookupVector4(themeName, "color")); }
            catch { color = new Color(assetDictionary.LookupVector3(themeName, "color")); }
            offset = assetDictionary.LookupVector2(themeName, "offset");
            //optional
            bool anchorParseSuccess = Enum.TryParse<Anchor>(assetDictionary.LookupString(themeName, "anchor"), out anchor);
            if (!anchorParseSuccess)
                anchor = Anchor.TopLeft;
            try { smoothness = assetDictionary.LookupSingle(themeName, "smoothness"); }
            catch { smoothness = 0f; }
        }
开发者ID:kjin,项目名称:TubeRacer,代码行数:16,代码来源:Cursor.cs

示例4: Build

        public static ParallaxBackgroundSet Build(AssetManager assets, Camera camera, Vector2 seamstressStart, string assetName)
        {
            TextDictionary assetDictionary = new TextDictionary(assets.GetText("parallax"));
            int layers = assetDictionary.LookupInt32(assetName, "layers");
            ParallaxBackground[] backgrounds = new ParallaxBackground[layers];
            BackgroundParticleSet particles = new BackgroundParticleSet(assets, camera.Dimensions, Convert.ToInt32(assetName.Substring(3)));
            int particleLayer = -1;
            for (int i = 0; i < layers; i++)
            {
                Texture2D tex;
                if (assetDictionary.CheckPropertyExists(assetName, "name" + i))
                    tex = assets.GetTexture(assetDictionary.LookupString(assetName, "name" + i));
                else
                    tex = assets.GetTexture(assetName + "_layer" + i);
                float dist, scale;
                Vector2 offset, velocity, repeat;
                Anchor anchor;
                try { dist = assetDictionary.LookupSingle(assetName, "dist" + i); }
                catch { dist = 1; }
                try { offset = assetDictionary.LookupVector2(assetName, "offset" + i); }
                catch { offset = Vector2.Zero; }
                try { velocity = assetDictionary.LookupVector2(assetName, "velocity" + i); }
                catch { velocity = Vector2.Zero; }
                try { scale = assetDictionary.LookupSingle(assetName, "scale" + i); }
                catch { scale = 1; }
                try { repeat = assetDictionary.LookupVector2(assetName, "repeat" + i); }
                catch { repeat = new Vector2(1, 0); }
                if (!assetDictionary.CheckPropertyExists(assetName, "anchor" + i) ||
                    !Enum.TryParse<Anchor>(assetDictionary.LookupString(assetName, "anchor" + i), out anchor))
                    anchor = Anchor.BottomLeft;
                backgrounds[i] = new ParallaxBackground(assets, tex, offset, velocity, dist, scale, anchor, repeat);
                if (dist > particles.Distance)
                    particleLayer = i;
            }
            ParallaxBackgroundSet pbs = new ParallaxBackgroundSet();
            pbs.backgrounds = backgrounds;
            pbs.camera = new Camera(camera.Dimensions, camera.Position, camera.Rotation, camera.Scale);
            pbs.color = assetDictionary.LookupColor(assetName, "color");
            pbs.particleLayer = particleLayer;
            pbs.particles = particles;
            pbs.seamstressStart = seamstressStart;

            return pbs;
        }
开发者ID:kjin,项目名称:TubeRacer,代码行数:44,代码来源:ParallaxBackground.cs


注:本文中的AssetManager.GetTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。