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


C# Game.xcenter方法代码示例

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


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

示例1: DrawScreenshotFlash

 internal void DrawScreenshotFlash(Game game)
 {
     game.Draw2dTexture(game.WhiteTexture(), 0, 0, game.platform.GetCanvasWidth(), game.platform.GetCanvasHeight(), null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
     string screenshottext = "&0Screenshot";
     IntRef textWidth = new IntRef();
     IntRef textHeight = new IntRef();
     game.platform.TextSize(screenshottext, 50, textWidth, textHeight);
     FontCi font = new FontCi();
     font.family = "Arial";
     font.size = 50;
     game.Draw2dText(screenshottext, font, game.xcenter(textWidth.value), game.ycenter(textHeight.value), null, false);
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:12,代码来源:Screenshot.ci.cs

示例2: DrawCraftingRecipes

 internal void DrawCraftingRecipes(Game game)
 {
     currentRecipes = new int[1024];
     currentRecipesCount = 0;
     for (int i = 0; i < craftingrecipes2Count; i++)
     {
         Packet_CraftingRecipe r = craftingrecipes2[i];
         if (r == null)
         {
             continue;
         }
         bool next = false;
         //can apply recipe?
         for (int k = 0; k < r.IngredientsCount; k++)
         {
             Packet_Ingredient ingredient = r.Ingredients[k];
             if (ingredient == null)
             {
                 continue;
             }
             if (craftingblocksFindAllCount(craftingblocks, craftingblocksCount, ingredient.Type) < ingredient.Amount)
             {
                 next = true;
                 break;
             }
         }
         if (!next)
         {
             currentRecipes[currentRecipesCount++] = i;
         }
     }
     int menustartx = game.xcenter(600);
     int menustarty = game.ycenter(currentRecipesCount * 80);
     if (currentRecipesCount == 0)
     {
         game.Draw2dText1(game.language.NoMaterialsForCrafting(), game.xcenter(200), game.ycenter(20), 12, null, false);
         return;
     }
     for (int i = 0; i < currentRecipesCount; i++)
     {
         Packet_CraftingRecipe r = craftingrecipes2[currentRecipes[i]];
         for (int ii = 0; ii < r.IngredientsCount; ii++)
         {
             int xx = menustartx + 20 + ii * 130;
             int yy = menustarty + i * 80;
             game.Draw2dTexture(game.d_TerrainTextures.terrainTexture(), xx, yy, 32, 32, IntRef.Create(game.TextureIdForInventory[r.Ingredients[ii].Type]), game.texturesPacked(), Game.ColorFromArgb(255, 255, 255, 255), false);
             game.Draw2dText1(game.platform.StringFormat2("{0} {1}", game.platform.IntToString(r.Ingredients[ii].Amount), game.blocktypes[r.Ingredients[ii].Type].Name), xx + 50, yy, 12,
                IntRef.Create(i == craftingselectedrecipe ? Game.ColorFromArgb(255, 255, 0, 0) : Game.ColorFromArgb(255, 255, 255, 255)), false);
         }
         {
             int xx = menustartx + 20 + 400;
             int yy = menustarty + i * 80;
             game.Draw2dTexture(game.d_TerrainTextures.terrainTexture(), xx, yy, 32, 32, IntRef.Create(game.TextureIdForInventory[r.Output.Type]), game.texturesPacked(), Game.ColorFromArgb(255, 255, 255, 255), false);
             game.Draw2dText1(game.platform.StringFormat2("{0} {1}", game.platform.IntToString(r.Output.Amount), game.blocktypes[r.Output.Type].Name), xx + 50, yy, 12,
               IntRef.Create(i == craftingselectedrecipe ? Game.ColorFromArgb(255, 255, 0, 0) : Game.ColorFromArgb(255, 255, 255, 255)), false);
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:58,代码来源:GuiCrafting.ci.cs

示例3: CraftingMouse

 internal void CraftingMouse(Game game)
 {
     if (currentRecipes == null)
     {
         return;
     }
     int menustartx = game.xcenter(600);
     int menustarty = game.ycenter(currentRecipesCount * 80);
     if (game.mouseCurrentY >= menustarty && game.mouseCurrentY < menustarty + currentRecipesCount * 80)
     {
         craftingselectedrecipe = (game.mouseCurrentY - menustarty) / 80;
     }
     else
     {
         //craftingselectedrecipe = -1;
     }
     if (game.mouseleftclick)
     {
         if (currentRecipesCount != 0)
         {
             CraftingRecipeSelected(game, craftingTableposx, craftingTableposy, craftingTableposz, IntRef.Create(currentRecipes[craftingselectedrecipe]));
         }
         game.mouseleftclick = false;
         game.GuiStateBackToGame();
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:26,代码来源:GuiCrafting.ci.cs

示例4: OnNewFrameDraw2d

    public override void OnNewFrameDraw2d(Game game, float deltaTime)
    {
        if (game.guistate != GuiState.MapLoading)
        {
            return;
        }

        GamePlatform platform = game.platform;
        float one = 1;

        Width = platform.GetCanvasWidth();
        Height = platform.GetCanvasHeight();
        DrawBackground(game);

        string connecting = game.language.Connecting();
        if (game.issingleplayer && (!platform.SinglePlayerServerLoaded()))
        {
            connecting = "Starting game...";
        }
        if (game.maploadingprogress.ProgressStatus != null)
        {
            connecting = game.maploadingprogress.ProgressStatus;
        }

        if (game.invalidVersionDrawMessage != null)
        {
            game.Draw2dText(game.invalidVersionDrawMessage, game.fontMapLoading, game.xcenter(game.TextSizeWidth(game.invalidVersionDrawMessage, 14)), Height / 2 - 50, null, false);
            string connect = "Click to connect";
            game.Draw2dText(connect, game.fontMapLoading, game.xcenter(game.TextSizeWidth(connect, 14)), Height / 2 + 50, null, false);
            return;
        }

        IntRef serverNameWidth = new IntRef();
        IntRef serverNameHeight = new IntRef();
        platform.TextSize(game.ServerInfo.ServerName, 14, serverNameWidth, serverNameHeight);
        game.Draw2dText(game.ServerInfo.ServerName, game.fontMapLoading, game.xcenter(serverNameWidth.value), Height / 2 - 150, null, false);

        if (game.ServerInfo.ServerMotd != null)
        {
            IntRef serverMotdWidth = new IntRef();
            IntRef serverMotdHeight = new IntRef();
            platform.TextSize(game.ServerInfo.ServerMotd, 14, serverMotdWidth, serverMotdHeight);
            game.Draw2dText(game.ServerInfo.ServerMotd, game.fontMapLoading, game.xcenter(serverMotdWidth.value), Height / 2 - 100, null, false);
        }

        IntRef connectingWidth = new IntRef();
        IntRef connectingHeight = new IntRef();
        platform.TextSize(connecting, 14, connectingWidth, connectingHeight);
        game.Draw2dText(connecting, game.fontMapLoading, game.xcenter(connectingWidth.value), Height / 2 - 50, null, false);

        string progress = platform.StringFormat(game.language.ConnectingProgressPercent(), platform.IntToString(game.maploadingprogress.ProgressPercent));
        string progress1 = platform.StringFormat(game.language.ConnectingProgressKilobytes(), platform.IntToString(game.maploadingprogress.ProgressBytes / 1024));

        if (game.maploadingprogress.ProgressPercent > 0)
        {
            IntRef progressWidth = new IntRef();
            IntRef progressHeight = new IntRef();
            platform.TextSize(progress, 14, progressWidth, progressHeight);
            game.Draw2dText(progress, game.fontMapLoading, game.xcenter(progressWidth.value), Height / 2 - 20, null, false);

            IntRef progress1Width = new IntRef();
            IntRef progress1Height = new IntRef();
            platform.TextSize(progress1, 14, progress1Width, progress1Height);
            game.Draw2dText(progress1, game.fontMapLoading, game.xcenter(progress1Width.value), Height / 2 + 10, null, false);

            float progressratio = one * game.maploadingprogress.ProgressPercent / 100;
            int sizex = 400;
            int sizey = 40;
            game.Draw2dTexture(game.WhiteTexture(), game.xcenter(sizex), Height / 2 + 70, sizex, sizey, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
            int red = Game.ColorFromArgb(255, 255, 0, 0);
            int yellow = Game.ColorFromArgb(255, 255, 255, 0);
            int green = Game.ColorFromArgb(255, 0, 255, 0);
            int[] colors = new int[3];
            colors[0] = red;
            colors[1] = yellow;
            colors[2] = green;
            int c = InterpolationCi.InterpolateColor(platform, progressratio, colors, 3);
            game.Draw2dTexture(game.WhiteTexture(), game.xcenter(sizex), Height / 2 + 70, progressratio * sizex, sizey, null, 0, c, false);
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:80,代码来源:GuiMapLoading.ci.cs

示例5: DrawEnemyHealthUseInfo

 internal void DrawEnemyHealthUseInfo(Game game, string name, float progress, bool useInfo)
 {
     int y = useInfo ? 55 : 35;
     game.Draw2dTexture(game.WhiteTexture(), game.xcenter(300), 40, 300, y, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
     game.Draw2dTexture(game.WhiteTexture(), game.xcenter(300), 40, 300 * progress, y, null, 0, Game.ColorFromArgb(255, 255, 0, 0), false);
     FontCi font = new FontCi();
     font.family = "Arial";
     font.size = 14;
     IntRef w = new IntRef();
     IntRef h = new IntRef();
     game.platform.TextSize(name, 14, w, h);
     game.Draw2dText(name, font, game.xcenter(w.value), 40, null, false);
     if (useInfo)
     {
         name = game.platform.StringFormat(game.language.PressToUse(), "E");
         game.platform.TextSize(name, 10, w, h);
         FontCi font2 = new FontCi();
         font2.family = "Arial";
         font2.size = 10;
         game.Draw2dText(name, font2, game.xcenter(w.value), 70, null, false);
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:22,代码来源:Draw2dMisc.ci.cs


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