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


C# Player.SendPos方法代码示例

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


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

示例1: Blockchange2

        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte Type)
        {
            ppos.x = p.pos[0];
            ppos.y = p.pos[1];
            ppos.z = p.pos[2];
            pllvl = p.level.name;
            blox[1].x = x;
            blox[1].y = y;
            blox[1].z = z;// jetz direction rausfinden und dann unten verwenden.
            int direction; //1 = 0,0,0 nach 1,0,0  2= 0,0,0 nach 0,1,0  3= 1,0,0 nach 0 und 4 = 010 nach 0
            if (blox[1].x > blox[0].x)
            {
                direction = 1;
                p.SendMessage("dir1");
            }
            else if (blox[1].x < blox[0].x)
            {
                direction = 3;
                p.SendMessage("dir3");
            }
            else if (blox[1].z > blox[0].z)
            {
                direction = 2;
                p.SendMessage("dir2");
            }
            else if (blox[1].z < blox[0].z)
            {
                direction = 4;
                p.SendMessage("dir4");
            }
            else
            {
                direction = 1;
                p.SendMessage("else");
            }

            String cinName = "";
            cinName = msg;
            using (Stream imageStreamSource = new FileStream("extra/images/" + msg + ".gif", FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                GifBitmapDecoder decoder = new GifBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                for (int i = 0; i < decoder.Frames.Count; i++)
                {
                    //saving all frames as pngs.
                    BitmapSource bitmapSource = decoder.Frames[i];
                    using (FileStream fs = new FileStream("extra/images/" + i.ToString() + ".bmp", FileMode.Create))
                    {
                        BmpBitmapEncoder encoder = new BmpBitmapEncoder();
                        encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
                        encoder.Save(fs);
                    }
                }
                using (System.Drawing.Bitmap tbmp = new System.Drawing.Bitmap("extra/images/0.bmp"))
                {
                    picHeight = tbmp.Height;
                    picWidth = tbmp.Width;
                    //create the new map...
                    Command.all.Find("newlvl").Use(p, "gtctempmap " + picWidth.ToString() + " " + picHeight.ToString() + " " + picWidth.ToString() + " space");
                    Command.all.Find("load").Use(p, "gtctempmap");
                    //moving the player to this map
                    Command.all.Find("move").Use(p, p.name + " gtctempmap");
                    System.Threading.Thread.Sleep(2000);
                    for (int i = 0; i < decoder.Frames.Count; i++)
                    {
                        p.SendMessage("Start processing Frame " + i);
                        workFrame(i, p, cinName, direction);
                        p.SendMessage("Done");
                    }
                    p.SendMessage("YAY! everything should be done");
                    Command.all.Find("move").Use(p, p.name + " " + pllvl);
                    unchecked { p.SendPos((byte)-1, ppos.x, ppos.y, ppos.z, 0, 0); }
                    Command.all.Find("deletelvl").Use(p, "gtctempmap");//deleting templvl
                    for (int i = 0; i < decoder.Frames.Count; i++)
                    {
                        File.Delete("extra/images/" + i.ToString() + ".bmp");
                    }
                }
            }
        }
开发者ID:PinEvil,项目名称:MCForge-Vanilla,代码行数:79,代码来源:CmdGifToCin.cs

示例2: Use


//.........这里部分代码省略.........
                }
            }

            else if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
            {
                if (par0 == "download")
                {
                    try
                    {
                        using (WebClient WEB = new WebClient())
                        {
                            WEB.DownloadFile("http://db.tt/R0x1MFS", "levels/countdown.mcf");
                            Player.SendMessage(p, "Downloaded map, now loading map and sending you to it.");
                        }
                    }
                    catch
                    {
                        Player.SendMessage(p, "Sorry, Downloading Failed. PLease try again later");
                        return;
                    }
                    Command.all.Find("load").Use(p, "countdown");
                    Command.all.Find("goto").Use(p, "countdown");
                    Thread.Sleep(1000);
                    // Sleep for a bit while they load
                    while (p.Loading) { Thread.Sleep(250); }
                    p.level.permissionbuild = LevelPermission.Nobody;
                    p.level.motd = "Welcome to the Countdown map!!!! -hax";
                    ushort x = System.Convert.ToUInt16(8);
                    ushort y = System.Convert.ToUInt16(23);
                    ushort z = System.Convert.ToUInt16(17);
                    x *= 32; x += 16;
                    y *= 32; y += 32;
                    z *= 32; z += 16;
                    unchecked { p.SendPos((byte)-1, x, y, z, p.rot[0], p.rot[1]); }
                }

                else if (par0 == "enable")
                {
                    if (CountdownGame.gamestatus == CountdownGameStatus.Disabled)
                    {
                        try
                        {
                            Command.all.Find("load").Use(null, "countdown");
                            CountdownGame.mapon = Level.Find("countdown");
                            CountdownGame.gamestatus = CountdownGameStatus.Enabled;
                            Player.GlobalMessage("Countdown has been enabled!!");
                        }
                        catch
                        {
                            Player.SendMessage(p, "Failed, have you downloaded the map yet??");
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "A Game is either already enabled or is already progress");
                        return;
                    }
                }

                else if (par0 == "disable")
                {

                    if (CountdownGame.gamestatus == CountdownGameStatus.AboutToStart || CountdownGame.gamestatus == CountdownGameStatus.InProgress)
                    {
                        Player.SendMessage(p, "Sorry, a game is currently in progress - please wait till its finished or use '/countdown cancel' to cancel the game");
                        return;
开发者ID:Goodlyay,项目名称:MCForge-Vanilla-Redux,代码行数:67,代码来源:CmdCountdown.cs


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