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


C# IntRef类代码示例

本文整理汇总了C#中IntRef的典型用法代码示例。如果您正苦于以下问题:C# IntRef类的具体用法?C# IntRef怎么用?C# IntRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DrawItemInfo

 public void DrawItemInfo(int screenposX, int screenposY, Packet_Item item)
 {
     int sizex = dataItems.ItemSizeX(item);
     int sizey = dataItems.ItemSizeY(item);
     IntRef tw = new IntRef();
     IntRef th = new IntRef();
     float one = 1;
     game.platform.TextSize(dataItems.ItemInfo(item), 11 + one / 2, tw, th);
     tw.value += 6;
     th.value += 4;
     int w = game.platform.FloatToInt(tw.value + CellDrawSize * sizex);
     int h = game.platform.FloatToInt(th.value < CellDrawSize * sizey ? CellDrawSize * sizey + 4 : th.value);
     if (screenposX < w + 20) { screenposX = w + 20; }
     if (screenposY < h + 20) { screenposY = h + 20; }
     if (screenposX > game.Width() - (w + 20)) { screenposX = game.Width() - (w + 20); }
     if (screenposY > game.Height() - (h + 20)) { screenposY = game.Height() - (h + 20); }
     game.Draw2dTexture(game.WhiteTexture(), screenposX - w, screenposY - h, w, h, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
     game.Draw2dTexture(game.WhiteTexture(), screenposX - w + 2, screenposY - h + 2, w - 4, h - 4, null, 0, Game.ColorFromArgb(255, 105, 105, 105), false);
     FontCi font = new FontCi();
     font.family = "Arial";
     font.size = 10;
     game.Draw2dText(dataItems.ItemInfo(item), font, screenposX - tw.value + 4, screenposY - h + 2, null, false);
     Packet_Item item2 = new Packet_Item();
     item2.BlockId = item.BlockId;
     DrawItem(screenposX - w + 2, screenposY - h + 2, item2, 0, 0);
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:26,代码来源:GuiInventory.ci.cs

示例2: OnClientCommand

 public override bool OnClientCommand(Game game, ClientCommandArgs args)
 {
     if (args.command == "fps")
     {
         IntRef argumentsLength = new IntRef();
         string[] arguments = m.GetPlatform().StringSplit(args.arguments, " ", argumentsLength);
         if (m.GetPlatform().StringTrim(args.arguments) == "")
         {
             drawfpstext = true;
         }
         else if (arguments[0] == "1")
         {
             drawfpstext = true;
             drawfpsgraph = false;
         }
         else if (arguments[0] == "2")
         {
             drawfpstext = true;
             drawfpsgraph = true;
         }
         else
         {
             drawfpstext = false;
             drawfpsgraph = false;
         }
         return true;
     }
     return false;
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:29,代码来源:FpsHistoryGraph.ci.cs

示例3: BuildDebuggableObject

        private static NativeObject BuildDebuggableObject(XaeiOSObject xaeiosObject, VTable vtable, IntRef fieldCounter)
        {
            NativeObject debuggableObject = new NativeObject();

            // add fields from base class
            // update field counter along the way so that we know which slots correspond to which field names
            if (vtable != GetSystemObjectVTable())
            {
                debuggableObject[DebugBaseKey] = var.Cast<NativeObject>(BuildDebuggableObject(
                    xaeiosObject,
                    vtable.BaseVTable,
                    fieldCounter
                ));
            }

            // retreive debug information for class through vtable
            VTableDebugInfo debugInfo = vtable.DebugInfo;

            // apply debug information to object instance
            {
                debuggableObject["FullName"] = var.Cast<string>(debugInfo.FullName);

                // fields
                NativeArray<string> fieldNames = debugInfo.Fields;
                for (int i = 0; i < fieldNames.Length; i++)
                {
                    debuggableObject[fieldNames[i]] = xaeiosObject[fieldCounter.Value + i];
                }
                fieldCounter.Value += fieldNames.Length;
            }

            return debuggableObject;
        }
开发者ID:sidecut,项目名称:xaeios,代码行数:33,代码来源:ObjectDebugger.cs

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

示例5: GetOnTable

 public int[] GetOnTable(Vector3IntRef[] table, int tableCount, IntRef retCount)
 {
     int[] ontable = new int[2048];
     int ontableCount = 0;
     for (int i = 0; i < tableCount; i++)
     {
         Vector3IntRef v = table[i];
         int t = d_Map.GetBlock(v.X, v.Y, v.Z + 1);
         ontable[ontableCount++] = t;
     }
     retCount.value = ontableCount;
     return ontable;
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:13,代码来源:GuiCrafting.ci.cs

示例6: LineIntersection

    public BlockPosSide[] LineIntersection(DelegateIsBlockEmpty isEmpty, DelegateGetBlockHeight getBlockHeight, Line3D line, IntRef retCount)
    {
        lCount = 0;
        currentLine = line;
        currentHit[0] = 0;
        currentHit[1] = 0;
        currentHit[2] = 0;
        ListBox3d l1 = Search(PredicateBox3DHit.Create(this));
        for (int i = 0; i < l1.count; i++)
        {
            Box3D node = l1.arr[i];
            float[] hit = currentHit;
            float x = node.MinEdge[0];
            float y = node.MinEdge[2];
            float z = node.MinEdge[1];
            if (!isEmpty.IsBlockEmpty(platform.FloatToInt(x),platform.FloatToInt(y),platform.FloatToInt( z)))
            {
                Box3D node2 = new Box3D();
                node2.MinEdge = Vec3.CloneIt(node.MinEdge);
                node2.MaxEdge = Vec3.CloneIt(node.MaxEdge);
                node2.MaxEdge[1] = node2.MinEdge[1] + getBlockHeight.GetBlockHeight(platform.FloatToInt(x),platform.FloatToInt(y),platform.FloatToInt(z));

                BlockPosSide b = new BlockPosSide();
                float[] hit2 = new float[3];

                float[] dir = new float[3];
                dir[0] = line.End[0] - line.Start[0];
                dir[1] = line.End[1] - line.Start[1];
                dir[2] = line.End[2] - line.Start[2];
                bool ishit = Intersection.HitBoundingBox(node2.MinEdge, node2.MaxEdge, line.Start, dir, hit2);
                if (ishit)
                {
                    //hit2.pos = Vec3.FromValues(x, z, y);
                    b.blockPos = Vec3.FromValues(platform.FloatToInt(x), platform.FloatToInt(z), platform.FloatToInt(y));
                    b.collisionPos = hit2;
                    l[lCount++] = b;
                }
            }
        }
        BlockPosSide[] ll = new BlockPosSide[lCount];
        for (int i = 0; i < lCount; i++)
        {
            ll[i] = l[i];
        }
        retCount.value = lCount;
        return ll;
    }
开发者ID:samuto,项目名称:manicdigger,代码行数:47,代码来源:Collisions.ci.cs

示例7: GetTable

 public Vector3IntRef[] GetTable(int posx, int posy, int posz, IntRef retCount)
 {
     Vector3IntRef[] l = new Vector3IntRef[2048];
     int lCount = 0;
     Vector3IntRef[] todo = new Vector3IntRef[2048];
     int todoCount = 0;
     todo[todoCount++] = Vector3IntRef.Create(posx, posy, posz);
     for (; ; )
     {
         if (todoCount == 0 || lCount >= maxcraftingtablesize)
         {
             break;
         }
         Vector3IntRef p = todo[todoCount - 1];
         todoCount--;
         if (Vector3IntRefArrayContains(l, lCount, p))
         {
             continue;
         }
         l[lCount++] = p;
         Vector3IntRef a = Vector3IntRef.Create(p.X + 1, p.Y, p.Z);
         if (d_Map.GetBlock(a.X, a.Y, a.Z) == d_Data.BlockIdCraftingTable())
         {
             todo[todoCount++] = a;
         }
         Vector3IntRef b = Vector3IntRef.Create(p.X - 1, p.Y, p.Z);
         if (d_Map.GetBlock(b.X, b.Y, b.Z) == d_Data.BlockIdCraftingTable())
         {
             todo[todoCount++] = b;
         }
         Vector3IntRef c = Vector3IntRef.Create(p.X, p.Y + 1, p.Z);
         if (d_Map.GetBlock(c.X, c.Y, c.Z) == d_Data.BlockIdCraftingTable())
         {
             todo[todoCount++] = c;
         }
         Vector3IntRef d = Vector3IntRef.Create(p.X, p.Y - 1, p.Z);
         if (d_Map.GetBlock(d.X, d.Y, d.Z) == d_Data.BlockIdCraftingTable())
         {
             todo[todoCount++] = d;
         }
     }
     retCount.value = lCount;
     return l;
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:44,代码来源:GuiCrafting.ci.cs

示例8: WallSlide

    float[] tmpPlayerPosition; //Temporarily stores the player's position. Used in WallSlide()

    #endregion Fields

    #region Constructors

    public ScriptCharacterPhysics()
    {
        movedz = 0;
        curspeed = new Vector3Ref();
        jumpacceleration = 0;
        isplayeronground = false;
        acceleration = new Acceleration();
        jumpstartacceleration = 0;
        jumpstartaccelerationhalf = 0;
        movespeednow = 0;

        tmpPlayerPosition = new float[3];
        tmpBlockingBlockType = new IntRef();

        constGravity = 0.3f;
        constWaterGravityMultiplier = 3;
        constEnableAcceleration = true;
        constJump = 2.1f;
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:25,代码来源:CharacterPhysics.ci.cs

示例9: GetSavegames

 internal string[] GetSavegames(IntRef length)
 {
     string[] files = p.DirectoryGetFiles(p.PathSavegames(), length);
     string[] savegames = new string[length.value];
     int count = 0;
     for (int i = 0; i < length.value; i++)
     {
         if(StringEndsWith(files[i], ".mddbs"))
         {
             savegames[count++] = files[i];
         }
     }
     length.value = count;
     return savegames;
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:15,代码来源:MainMenu.ci.cs

示例10: Render

    public override void Render(float dt)
    {
        GamePlatform p = menu.p;

        float scale = menu.GetScale();

        menu.DrawBackground();
        menu.DrawText(title, 20 * scale, p.GetCanvasWidth() / 2, 10, TextAlign.Center, TextBaseline.Top);

        float leftx = p.GetCanvasWidth() / 2 - 128 * scale;
        float y = p.GetCanvasHeight() / 2 + 0 * scale;

        play.x = leftx;
        play.y = y + 100 * scale;
        play.sizex = 256 * scale;
        play.sizey = 64 * scale;
        play.fontSize = 14 * scale;

        newWorld.x = leftx;
        newWorld.y = y + 170 * scale;
        newWorld.sizex = 256 * scale;
        newWorld.sizey = 64 * scale;
        newWorld.fontSize = 14 * scale;

        modify.x = leftx;
        modify.y = y + 240 * scale;
        modify.sizex = 256 * scale;
        modify.sizey = 64 * scale;
        modify.fontSize = 14 * scale;

        back.x = 40 * scale;
        back.y = p.GetCanvasHeight() - 104 * scale;
        back.sizex = 256 * scale;
        back.sizey = 64 * scale;
        back.fontSize = 14 * scale;

        open.x = leftx;
        open.y = y + 0 * scale;
        open.sizex = 256 * scale;
        open.sizey = 64 * scale;
        open.fontSize = 14 * scale;

        if (savegames == null)
        {
            IntRef savegamesCount_ = new IntRef();
            savegames = menu.GetSavegames(savegamesCount_);
            savegamesCount = savegamesCount_.value;
        }

        for (int i = 0; i < 10; i++)
        {
            worldButtons[i].visible = false;
        }
        for (int i = 0; i < savegamesCount; i++)
        {
            worldButtons[i].visible = true;
            worldButtons[i].text = menu.p.FileName(savegames[i]);
            worldButtons[i].x = leftx;
            worldButtons[i].y = 100 + 100 * scale * i;
            worldButtons[i].sizex = 256 * scale;
            worldButtons[i].sizey = 64 * scale;
            worldButtons[i].fontSize = 14 * scale;
        }

        open.visible = menu.p.SinglePlayerServerAvailable();
        play.visible = false;
        newWorld.visible = false;
        modify.visible = false;
        for (int i = 0; i < savegamesCount; i++)
        {
            worldButtons[i].visible = false;
        }

        DrawWidgets();

        if (!menu.p.SinglePlayerServerAvailable())
        {
            menu.DrawText("Singleplayer is only available on desktop (Windows, Linux, Mac) version of game.", 16 * scale, menu.p.GetCanvasWidth() / 2, menu.p.GetCanvasHeight() / 2, TextAlign.Center, TextBaseline.Middle);
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:80,代码来源:Singleplayer.ci.cs

示例11: StringSubstring

    public static string StringSubstring(GamePlatform p, string a, int start, int count)
    {
        IntRef aLength = new IntRef();
        int[] aChars = p.StringToCharArray(a, aLength);

        int[] bChars = new int[count];
        for (int i = 0; i < count; i++)
        {
            bChars[i] = aChars[start + i];
        }
        return p.CharArrayToString(bChars, count);
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:12,代码来源:Misc.ci.cs

示例12: StringAppend

    public static string StringAppend(GamePlatform p, string a, string b)
    {
        IntRef aLength = new IntRef();
        int[] aChars = p.StringToCharArray(a, aLength);
        IntRef bLength = new IntRef();
        int[] bChars = p.StringToCharArray(b, bLength);

        int[] cChars = new int[aLength.value + bLength.value];
        for (int i = 0; i < aLength.value; i++)
        {
            cChars[i] = aChars[i];
        }
        for (int i = 0; i < bLength.value; i++)
        {
            cChars[i + aLength.value] = bChars[i];
        }
        return p.CharArrayToString(cChars, aLength.value + bLength.value);
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:18,代码来源:Misc.ci.cs

示例13: Create

 public static IntRef Create(int value_)
 {
     IntRef intref = new IntRef();
     intref.value = value_;
     return intref;
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:6,代码来源:Platform.ci.cs

示例14: Serialize

 public static byte[] Serialize(Packet_Server packet, IntRef retLength)
 {
     CitoMemoryStream ms = new CitoMemoryStream();
     Packet_ServerSerializer.Serialize(ms, packet);
     byte[] data = ms.ToArray();
     retLength.value = ms.Length();
     return data;
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:8,代码来源:Packets.ci.cs

示例15: OnKeyDown


//.........这里部分代码省略.........
            {
                game.typinglog[game.typinglogCount++] = game.GuiTypingBuffer;
                game.typinglogpos = game.typinglogCount;
                game.ClientCommand(game.GuiTypingBuffer);

                game.GuiTypingBuffer = "";
                game.IsTyping = false;

                game.GuiTyping = TypingState.None;
                game.platform.ShowKeyboard(false);
            }
            else if (game.GuiTyping == TypingState.None)
            {
                game.StartTyping();
            }
            else if (game.GuiTyping == TypingState.Ready)
            {
                game.platform.ConsoleWriteLine("Keyboard_KeyDown ready");
            }
            args.SetHandled(true);
            return;
        }
        if (game.GuiTyping == TypingState.Typing)
        {
            int key = eKey;
            if (key == game.GetKey(GlKeys.BackSpace))
            {
                if (StringTools.StringLength(game.platform, game.GuiTypingBuffer) > 0)
                {
                    game.GuiTypingBuffer = StringTools.StringSubstring(game.platform, game.GuiTypingBuffer, 0, StringTools.StringLength(game.platform, game.GuiTypingBuffer) - 1);
                }
                args.SetHandled(true);
                return;
            }
            if (game.keyboardStateRaw[game.GetKey(GlKeys.ControlLeft)] || game.keyboardStateRaw[game.GetKey(GlKeys.ControlRight)])
            {
                if (key == game.GetKey(GlKeys.V))
                {
                    if (game.platform.ClipboardContainsText())
                    {
                        game.GuiTypingBuffer = StringTools.StringAppend(game.platform, game.GuiTypingBuffer, game.platform.ClipboardGetText());
                    }
                    args.SetHandled(true);
                    return;
                }
            }
            if (key == game.GetKey(GlKeys.Up))
            {
                game.typinglogpos--;
                if (game.typinglogpos < 0) { game.typinglogpos = 0; }
                if (game.typinglogpos >= 0 && game.typinglogpos < game.typinglogCount)
                {
                    game.GuiTypingBuffer = game.typinglog[game.typinglogpos];
                }
                args.SetHandled(true);
            }
            if (key == game.GetKey(GlKeys.Down))
            {
                game.typinglogpos++;
                if (game.typinglogpos > game.typinglogCount) { game.typinglogpos = game.typinglogCount; }
                if (game.typinglogpos >= 0 && game.typinglogpos < game.typinglogCount)
                {
                    game.GuiTypingBuffer = game.typinglog[game.typinglogpos];
                }
                if (game.typinglogpos == game.typinglogCount)
                {
                    game.GuiTypingBuffer = "";
                }
                args.SetHandled(true);
            }
            //Handles player name autocomplete in chat
            if (eKey == game.GetKey(GlKeys.Tab) && game.platform.StringTrim(game.GuiTypingBuffer) != "")
            {
                IntRef partsLength = new IntRef();
                string[] parts = game.platform.StringSplit(game.GuiTypingBuffer, " ", partsLength);
                string completed = DoAutocomplete(parts[partsLength.value - 1]);
                if (completed == "")
                {
                    //No completion available. Abort.
                    args.SetHandled(true);
                    return;
                }
                else if (partsLength.value == 1)
                {
                    //Part is first word. Format as "<name>: "
                    game.GuiTypingBuffer = StringTools.StringAppend(game.platform, completed, ": ");
                }
                else
                {
                    //Part is not first. Just complete "<name> "
                    parts[partsLength.value - 1] = completed;
                    game.GuiTypingBuffer = StringTools.StringAppend(game.platform, game.platform.StringJoin(parts, " "), " ");
                }
                args.SetHandled(true);
                return;
            }
            args.SetHandled(true);
            return;
        }
    }
开发者ID:Matthewism,项目名称:manicdigger,代码行数:101,代码来源:GuiChat.ci.cs


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