本文整理汇总了C#中Game.GetFile方法的典型用法代码示例。如果您正苦于以下问题:C# Game.GetFile方法的具体用法?C# Game.GetFile怎么用?C# Game.GetFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.GetFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawSkySphere
internal void DrawSkySphere(Game game)
{
if (skyspheretexture == -1)
{
BitmapCi skysphereBmp = game.platform.BitmapCreateFromPng(game.GetFile("skysphere.png"), game.GetFileLength("skysphere.png"));
BitmapCi skysphereNightBmp = game.platform.BitmapCreateFromPng(game.GetFile("skyspherenight.png"), game.GetFileLength("skyspherenight.png"));
skyspheretexture = game.platform.LoadTextureFromBitmap(skysphereBmp);
skyspherenighttexture = game.platform.LoadTextureFromBitmap(skysphereNightBmp);
game.platform.BitmapDelete(skysphereBmp);
game.platform.BitmapDelete(skysphereNightBmp);
}
int texture = game.SkySphereNight ? skyspherenighttexture : skyspheretexture;
if (game.shadowssimple) //d_Shadows.GetType() == typeof(ShadowsSimple))
{
texture = skyspheretexture;
}
SkyTexture = texture;
Draw(game, game.currentfov());
}
示例2: DrawTestModel
void DrawTestModel(Game game, float deltaTime)
{
if (!game.ENABLE_DRAW_TEST_CHARACTER)
{
return;
}
if (testmodel == null)
{
testmodel = new AnimatedModelRenderer();
byte[] data = game.GetFile("player.txt");
int dataLength = game.GetFileLength("player.txt");
string dataString = game.platform.StringFromUtf8ByteArray(data, dataLength);
AnimatedModel model = AnimatedModelSerializer.Deserialize(game.platform, dataString);
testmodel.Start(game, model);
}
game.GLPushMatrix();
game.GLTranslate(game.map.MapSizeX / 2, game.blockheight(game.map.MapSizeX / 2, game.map.MapSizeY / 2 - 2, 128), game.map.MapSizeY / 2 - 2);
game.platform.BindTexture2d(game.GetTexture("mineplayer.png"));
testmodel.Render(deltaTime, 0, true, true, 1);
game.GLPopMatrix();
}
示例3: OnNewFrameDraw3d
public override void OnNewFrameDraw3d(Game game, float deltaTime)
{
if (ShouldDrawHand(game))
{
string img = HandImage2d(game);
if (img != null)
{
game.OrthoMode(game.Width(), game.Height());
if (lasthandimage != img)
{
lasthandimage = img;
byte[] file = game.GetFile(img);
BitmapCi bmp = game.platform.BitmapCreateFromPng(file, game.platform.ByteArrayLength(file));
if (bmp != null)
{
game.handTexture = game.platform.LoadTextureFromBitmap(bmp);
game.platform.BitmapDelete(bmp);
}
}
game.Draw2dTexture(game.handTexture, game.Width() / 2, game.Height() - 512, 512, 512, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
game.PerspectiveMode();
}
}
}
示例4: DrawSkySphere
internal void DrawSkySphere(Game game)
{
if (!started)
{
started = true;
BitmapCi skyBmp = game.platform.BitmapCreateFromPng(game.GetFile("sky.png"), game.GetFileLength("sky.png"));
BitmapCi glowBmp = game.platform.BitmapCreateFromPng(game.GetFile("glow.png"), game.GetFileLength("glow.png"));
skyPixels = new int[textureSize * textureSize * 4];
glowPixels = new int[textureSize * textureSize * 4];
game.platform.BitmapGetPixelsArgb(skyBmp, skyPixels);
game.platform.BitmapGetPixelsArgb(glowBmp, glowPixels);
game.platform.BitmapDelete(skyBmp);
game.platform.BitmapDelete(glowBmp);
}
game.platform.GLDisableAlphaTest();
game.platform.GlDisableDepthTest();
Draw(game, game.currentfov());
game.platform.GLEnableAlphaTest();
game.platform.GlEnableDepthTest();
}
示例5: DrawPlayers
internal void DrawPlayers(Game game, float dt)
{
game.totaltimeMilliseconds = game.platform.TimeMillisecondsFromStart();
for (int i = 0; i < game.entitiesCount; i++)
{
if (game.entities[i] == null)
{
continue;
}
if (game.entities[i].drawModel == null)
{
continue;
}
Entity p_ = game.entities[i];
if (i == game.LocalPlayerId && (!game.ENABLE_TPP_VIEW))
{
continue;
}
if ((p_.networkPosition != null) && (!p_.networkPosition.PositionLoaded))
{
continue;
}
if (!game.d_FrustumCulling.SphereInFrustum(p_.position.x, p_.position.y, p_.position.z, 3))
{
continue;
}
if (p_.drawModel.CurrentTexture == -1)
{
continue;
}
int cx = game.platform.FloatToInt(p_.position.x) / Game.chunksize;
int cy = game.platform.FloatToInt(p_.position.z) / Game.chunksize;
int cz = game.platform.FloatToInt(p_.position.y) / Game.chunksize;
if (game.map.IsValidChunkPos(cx, cy, cz))
{
if (!game.map.IsChunkRendered(cx, cy, cz))
{
continue;
}
}
float shadow = (one * game.GetLight(game.platform.FloatToInt(p_.position.x), game.platform.FloatToInt(p_.position.z), game.platform.FloatToInt(p_.position.y))) / Game.maxlight;
if (p_.playerDrawInfo == null)
{
p_.playerDrawInfo = new PlayerDrawInfo();
}
p_.playerDrawInfo.anim.light = shadow;
float FeetPosX = p_.position.x;
float FeetPosY = p_.position.y;
float FeetPosZ = p_.position.z;
AnimationHint animHint = game.entities[i].playerDrawInfo.AnimationHint_;
float playerspeed_;
if (i == game.LocalPlayerId)
{
if (game.player.playerDrawInfo == null)
{
game.player.playerDrawInfo = new PlayerDrawInfo();
}
Vector3Ref playerspeed = Vector3Ref.Create(game.playervelocity.X / 60, game.playervelocity.Y / 60, game.playervelocity.Z / 60);
float playerspeedf = playerspeed.Length() * (one * 15 / 10);
game.player.playerDrawInfo.moves = playerspeedf != 0;
playerspeed_ = playerspeedf;
}
else
{
playerspeed_ = (game.Length(p_.playerDrawInfo.velocityX, p_.playerDrawInfo.velocityY, p_.playerDrawInfo.velocityZ) / dt) * (one * 4 / 100);
}
{
if (p_.drawModel.renderer == null)
{
p_.drawModel.renderer = new AnimatedModelRenderer();
byte[] data = game.GetFile(p_.drawModel.Model_);
int dataLength = game.GetFileLength(p_.drawModel.Model_);
if (data != null)
{
string dataString = game.platform.StringFromUtf8ByteArray(data, dataLength);
AnimatedModel model = AnimatedModelSerializer.Deserialize(game.platform, dataString);
p_.drawModel.renderer.Start(game, model);
}
}
game.GLPushMatrix();
game.GLTranslate(FeetPosX, FeetPosY, FeetPosZ);
//game.GLRotate(PlayerInterpolate.RadToDeg(p_.position.rotx), 1, 0, 0);
game.GLRotate(PlayerInterpolate.RadToDeg(-p_.position.roty + Game.GetPi()), 0, 1, 0);
//game.GLRotate(PlayerInterpolate.RadToDeg(p_.position.rotz), 0, 0, 1);
game.platform.BindTexture2d(game.entities[i].drawModel.CurrentTexture);
p_.drawModel.renderer.Render(dt, PlayerInterpolate.RadToDeg(p_.position.rotx + Game.GetPi()), true, p_.playerDrawInfo.moves, shadow);
game.GLPopMatrix();
}
}
}
示例6: GetAudioData
AudioData GetAudioData(Game game, string sound)
{
if (!audioData.Contains(sound))
{
AudioData a = game.platform.AudioDataCreate(game.GetFile(sound), game.GetFileLength(sound));
audioData.Set(sound, a);
}
return audioData.GetById(audioData.GetId(sound));
}
示例7: LoadPlayerTextures
internal void LoadPlayerTextures(Game game)
{
if (!game.issingleplayer)
{
if (skinserverResponse.done)
{
skinserver = game.platform.StringFromUtf8ByteArray(skinserverResponse.value, skinserverResponse.valueLength);
}
else if (skinserverResponse.error)
{
skinserver = null;
}
else
{
return;
}
}
for (int i = 0; i < game.entitiesCount; i++)
{
Entity e = game.entities[i];
if (e == null) { continue; }
if (e.drawModel == null) { continue; }
if (e.drawModel.CurrentTexture != -1)
{
continue;
}
// a) download skin
if (!game.issingleplayer && e.drawModel.DownloadSkin && skinserver != null && e.drawModel.Texture_ == null)
{
if (e.drawModel.SkinDownloadResponse == null)
{
e.drawModel.SkinDownloadResponse = new HttpResponseCi();
string url = StringTools.StringAppend(game.platform, skinserver, StringTools.StringSubstringToEnd(game.platform, e.drawName.Name, 2));
url = StringTools.StringAppend(game.platform, url, ".png");
game.platform.WebClientDownloadDataAsync(url, e.drawModel.SkinDownloadResponse);
continue;
}
if (!e.drawModel.SkinDownloadResponse.error)
{
if (!e.drawModel.SkinDownloadResponse.done)
{
continue;
}
BitmapCi bmp_ = game.platform.BitmapCreateFromPng(e.drawModel.SkinDownloadResponse.value, e.drawModel.SkinDownloadResponse.valueLength);
if (bmp_ != null)
{
e.drawModel.CurrentTexture = game.GetTextureOrLoad(e.drawName.Name, bmp_);
game.platform.BitmapDelete(bmp_);
continue;
}
}
}
// b) file skin
if (e.drawModel.Texture_ == null)
{
e.drawModel.CurrentTexture = game.GetTexture("mineplayer.png");
continue;
}
byte[] file = game.GetFile(e.drawModel.Texture_);
if (file == null)
{
e.drawModel.CurrentTexture = 0;
continue;
}
BitmapCi bmp = game.platform.BitmapCreateFromPng(file, game.platform.ByteArrayLength(file));
if (bmp == null)
{
e.drawModel.CurrentTexture = 0;
continue;
}
e.drawModel.CurrentTexture = game.GetTextureOrLoad(e.drawModel.Texture_, bmp);
game.platform.BitmapDelete(bmp);
}
}