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


C# Game.GetFile方法代码示例

本文整理汇总了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());
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:19,代码来源:SkySphereStatic.ci.cs

示例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();
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:21,代码来源:DrawTestModel.ci.cs

示例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();
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:24,代码来源:DrawHand2d.ci.cs

示例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();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:21,代码来源:SkySphereAnimated.ci.cs

示例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();
            }
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:92,代码来源:DrawPlayers.ci.cs

示例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));
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:9,代码来源:Audio.ci.cs

示例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);
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:75,代码来源:LoadPlayerTextures.ci.cs


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