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


C# Game.GetFileLength方法代码示例

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


在下文中一共展示了Game.GetFileLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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


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