本文整理汇总了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");
}
}
示例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;
}
示例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; }
}
示例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;
}