• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MCForge.Level类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: placeBlock

 public static void placeBlock(Level l, Player p, ushort x, ushort y, ushort z, ushort type)
 {
     if (p == null)
         l.Blockchange(x, y, z, type);
     else
         l.Blockchange(p, x, y, z, type);
 }
开发者ID:NorthPL,项目名称:MCForge-Vanilla-Redux,代码行数:7,代码来源:FindReference.cs


示例2: AddCactus

        public void AddCactus(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true)
        {
            byte height = (byte)Rand.Next(3, 6);
            ushort yy;

            for (yy = 0; yy <= height; yy++) {
                if (overwrite || Lvl.GetTile(z, (ushort)(y + yy), z) == Block.air)
                    if (blockChange) Lvl.Blockchange(x, (ushort)(y + yy), z, Block.green);
                    else Lvl.skipChange(x, (ushort)(y + yy), z, Block.green);
            }

            int inX = 0, inZ = 0;

            switch (Rand.Next(1, 3))
            {
                case 1: inX = -1; break;
                case 2:
                default: inZ = -1; break;
            }

            for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++)
            {
                if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air)
                    if (blockChange) Lvl.Blockchange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green);
                    else Lvl.skipChange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green);
            }
            for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++)
            {
                if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air)
                    if (blockChange) Lvl.Blockchange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green);
                    else Lvl.skipChange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green);
            }
        }
开发者ID:WanX,项目名称:MCaznowl-Build,代码行数:33,代码来源:MapGenerator.cs


示例3: Register

 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Level.OnLevelUnload method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnLevelUnloadEvent(method, priority, plugin));
     Organize();
 }
开发者ID:Cazzar,项目名称:MCaznowl-Build,代码行数:13,代码来源:OnLevelUnloadEvent.cs


示例4: Register

 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 /// <param name="bypass">Register more than one of the same event</param>
 public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false)
 {
     if (Find(plugin) != null)
         if (!bypass)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnLevelLoadedEvent(method, priority, plugin));
     Organize();
 }
开发者ID:xShOtDoOdx,项目名称:MCForge-MCLawl,代码行数:15,代码来源:OnLevelLoadedEvent.cs


示例5: CancelLevelEvent

 /// <summary>
 /// Cancel Level event
 /// </summary>
 /// <param name="e">The event to cancel</param>
 /// <param name="l">The level to cancel the event on</param>
 public static void CancelLevelEvent(LevelEvents e, Level l)
 {
     switch (e)
     {
         case LevelEvents.LevelUnload:
             break;
     }
 }
开发者ID:ProLoks,项目名称:MCForge-Vanilla,代码行数:13,代码来源:Plugin.Events.cs


示例6: Find

 public static Level Find(string levelName)
 {
     net.mcforge.world.Level temp = MCForge.Gui.Program.console.getServer().getLevelHandler().findLevel(levelName);
     if (temp == null)
         return null;
     Level l = new Level(temp);
     return l;
 }
开发者ID:B00mX0r,项目名称:MCForge-GUI,代码行数:8,代码来源:Level.cs


示例7: FoundCheck

 public string FoundCheck(Level level, bool check)
 {
     if (gettinginfo == false)
     {
         Level.SaveSettings(level);
     }
     if (check) return "&aON";
     else return "&cOFF";
 }
开发者ID:Techjar,项目名称:MCForge-Vanilla,代码行数:9,代码来源:CmdMap.cs


示例8: Call

 public static void Call(ushort x, ushort y, ushort z, byte time, string extra, Level l)
 {
     events.ForEach(delegate(OnPhysicsUpdateEvent p1)
     {
         try
         {
             p1.method(x, y, z, time, extra, l);
         }
         catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); }
     });
 }
开发者ID:NorthPL,项目名称:MCForge-Vanilla-Redux,代码行数:11,代码来源:OnPhysicsUpdate.cs


示例9: Call

 public static void Call(Level l)
 {
     events.ForEach(delegate(OnLevelLoadedEvent p1)
     {
         try
         {
             p1.method(l);
         }
         catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); }
     });
 }
开发者ID:xShOtDoOdx,项目名称:MCForge-MCLawl,代码行数:11,代码来源:OnLevelLoadedEvent.cs


示例10: CancelLevelEvent

        /// <summary>
        /// Cancel Level event
        /// </summary>
        /// <param name="e">The event to cancel</param>
        /// <param name="l">The level to cancel the event on</param>
        public static void CancelLevelEvent(LevelEvents e, Level l)
        {
            switch (e)
            {
                case LevelEvents.LevelUnload:
                    l.cancelunload = true;
                    break;
                case LevelEvents.LevelSave:
                    l.cancelsave1 = true;
                    break;

            }
        }
开发者ID:RedNoodle,项目名称:MCForge-Vanilla,代码行数:18,代码来源:Plugin.Events.cs


示例11: Start

 public void Start()
 {
     StartTimer = new System.Timers.Timer(1000);
     ZombieLevel = Level.Find("main");
     int loop = 6;
     StartTimer.Start(); StartTimer.Elapsed += delegate
     {
         Server.s.Log(loop + "");
         if (loop != 0)
         {
             int amountOfPlayers = PlayerCount();
             Player.players.ForEach(delegate(Player p)
             {
                 if (p.referee)
                     amountOfPlayers--;
             });
             //if (amountOfPlayers >= 2)
             //{
                 MoreThanTwoPlayers = true;
                 loop--;
                 Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival starts in " + loop + " seconds on level " +
                                      ZombieLevel.name + c.gray + " - ");
             /*}
             else
             {
                 if (MoreThanTwoPlayers)
                     Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival requires more than 2 non-referee players online to play" + c.gray + " - ");
                 MoreThanTwoPlayers = false;
             }*/
         }
         else
         {
             loop = 6;
             Server.ZombieRound = true;
             int randomMinutes = Random.Next(1, 4);
             Player.GlobalMessage(c.gray + " - " + "Zombie Survival has started on level " + ZombieLevel.name + " for " + randomMinutes + " minutes! Type /g " + ZombieLevel.name + " to join! " + c.gray + " - ");
             EndRoundTimer = new System.Timers.Timer((60000 * randomMinutes) - 30000);
             EndRoundTimer.Start();
             EndRoundTimer.Elapsed += delegate { EndRound(); };
             StartTimer.Stop();
             StartTimer.Dispose();
         }
     };
 }
开发者ID:Balthizar01,项目名称:MCForge-Vanilla-Redux,代码行数:44,代码来源:ZombieSurvival.cs


示例12: NegateEdge

        //Forces the edge of a map to slope lower for island map types
        float NegateEdge(ushort x, ushort y, Level Lvl)
        {
            float tempx = 0.0f, tempy = 0.0f;
            float temp;
            if (x != 0) { tempx = ((float)x / (float)Lvl.width) * 0.5f; }
            if (y != 0) { tempy = ((float)y / (float)Lvl.height) * 0.5f; }
            tempx = Math.Abs(tempx - 0.25f);
            tempy = Math.Abs(tempy - 0.25f);
            if (tempx > tempy)
            {
                temp = tempx - 0.15f;
            }
            else
            {
                temp = tempy - 0.15f;
            }

            //s.Log("temp = " + temp.ToString());
            if (temp > 0.0f) { return temp; }
            return 0.0f;
        }
开发者ID:Cazzar,项目名称:MCForge-Vanilla,代码行数:22,代码来源:MapGenerator.cs


示例13: OnLevelLoadedEvent

 internal OnLevelLoadedEvent(Level.OnLevelLoaded method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
开发者ID:xShOtDoOdx,项目名称:MCForge-MCLawl,代码行数:4,代码来源:OnLevelLoadedEvent.cs


示例14: addLevel

 public static void addLevel(Level level)
 {
     levels.Add(level);
 }
开发者ID:CrusaderV,项目名称:MCForge-Vanilla,代码行数:4,代码来源:Server.cs


示例15: GlobalBlockchange

 public static void GlobalBlockchange(Level level, ushort x, ushort y, ushort z, byte type)
 {
     players.ForEach(delegate(Player p) { if (p.level == level) { p.SendBlockchange(x, y, z, type); } });
 }
开发者ID:Dmitchell94,项目名称:MCForge-Vanilla-Original,代码行数:4,代码来源:Player.cs


示例16: Init

        internal static void Init()
        {
            StartListening();

            Mainlevel = Level.CreateLevel(new Point3(256, 256, 64), Level.LevelTypes.Flat);

            UpdateTimer = new System.Timers.Timer(100);
            UpdateTimer.Elapsed += delegate { Update(); };
            UpdateTimer.Start();

            HeartbeatTimer = new System.Timers.Timer(30000); //every 30 seconds
            HeartbeatTimer.Elapsed += delegate { Heartbeat.sendHeartbeat(); };
            HeartbeatTimer.Start();

            LoadAllDlls.Init();

            Log("[Important]: Server Started.", ConsoleColor.Black, ConsoleColor.White);
            Started = true;

            CmdReloadCmds reload = new CmdReloadCmds();
            reload.Initialize();

            //Create the directories we need...
            if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); Log("Created text directory...", ConsoleColor.White, ConsoleColor.Black); }
            if (!File.Exists("text/agreed.txt")) { File.Create("text/agreed.txt").Close(); Log("[File] Created agreed.txt", ConsoleColor.White, ConsoleColor.Black); }
            if (!File.Exists("text/jokermessages.txt"))
            {
                File.Create("text/jokermessages.txt").Close();
                Log("[File] Created jokermessages.txt", ConsoleColor.White, ConsoleColor.Black);
                string text = "I am a pony" + Environment.NewLine + "Rainbow Dash <3" + Environment.NewLine + "I like trains!";
                File.WriteAllText("text/jokermessages.txt", text);
                Log("[File] Added default messages to jokermessages.txt", ConsoleColor.White, ConsoleColor.Black);
            }
            try
            {
                string[] lines = File.ReadAllLines("text/agreed.txt");
                foreach (string pl in lines) { agreed.Add(pl); }
            }
            catch { Log("[Error] Error reading agreed players!", ConsoleColor.Red, ConsoleColor.Black); }
        }
开发者ID:hirsty,项目名称:MCForge-Vanilla-1,代码行数:40,代码来源:Server.cs


示例17: PlayerBot

        public PlayerBot(string n, Level l, ushort x, ushort y, ushort z, byte rotx, byte roty)
        {
            name = n;
            color = "&1";
            id = FreeId();

            DisplayName = n;
            SkinName = n;

            level = l;
            pos = new ushort[3] { x, y, z }; rot = new byte[2] { rotx, roty };
            GlobalSpawn();

            foreach (Player p in Player.players)
            {
                if (p.level == level)
                {
                    Player.SendMessage(p, color + name + Server.DefaultColor + ", the bot, has been added.");
                }
            }

            botTimer.Elapsed += delegate
            {
                int currentNum, foundNum = (32 * 75);
            //    Random rand = new Random();

                x = (ushort)Math.Round((decimal)pos[0] / (decimal)32);
                y = (ushort)((pos[1] - 33) / 32);
                z = (ushort)Math.Round((decimal)pos[2] / (decimal)32);

                if (kill)
                {
                    foreach (Player p in Player.players)
                    {
                        if ((ushort)(p.pos[0] / 32) == x)
                        {
                            if (Math.Abs((ushort)(p.pos[1] / 32) - y) < 2)
                            {
                                if ((ushort)(p.pos[2] / 32) == z)
                                {
                                    p.HandleDeath(Block.Zero);
                                }
                            }
                        }
                    }
                }

                if (Waypoints.Count < 1)
                {
                    if (hunt)
                        Player.players.ForEach(delegate(Player p)
                        {
                            if (p.level == level && !p.invincible)
                            {
                                currentNum = Math.Abs(p.pos[0] - pos[0]) + Math.Abs(p.pos[1] - pos[1]) + Math.Abs(p.pos[2] - pos[2]);
                                if (currentNum < foundNum)
                                {
                                    foundNum = currentNum;
                                    foundPos = p.pos;
                                    foundRot = p.rot;
                                    movement = true;
                                    rot[1] = (byte)(Block.maxblocks - foundRot[1]);
                                    if (foundRot[0] < 128) rot[0] = (byte)(foundRot[0] + 128);
                                    else rot[0] = (byte)(foundRot[0] - 128);
                                }
                            }
                        });
                }
                else
                {
                    bool skip = false;
                    movement = false;

                retry: switch (Waypoints[currentPoint].type)
                    {
                        case "walk":
                            foundPos[0] = Waypoints[currentPoint].x;
                            foundPos[1] = Waypoints[currentPoint].y;
                            foundPos[2] = Waypoints[currentPoint].z;
                            movement = true;

                            if ((ushort)(pos[0] / 32) == (ushort)(Waypoints[currentPoint].x / 32))
                            {
                                if ((ushort)(pos[2] / 32) == (ushort)(Waypoints[currentPoint].z / 32))
                                {
                                    rot[0] = Waypoints[currentPoint].rotx;
                                    rot[1] = Waypoints[currentPoint].roty;
                                    currentPoint++;
                                    movement = false;

                                    if (currentPoint == Waypoints.Count) currentPoint = 0;
                                    if (!skip) { skip = true; goto retry; }
                                }
                            }
                            break;
                        case "teleport":
                            pos[0] = Waypoints[currentPoint].x;
                            pos[1] = Waypoints[currentPoint].y;
                            pos[2] = Waypoints[currentPoint].z;
                            rot[0] = Waypoints[currentPoint].rotx;
//.........这里部分代码省略.........
开发者ID:NorthPL,项目名称:MCForge-Vanilla-Redux,代码行数:101,代码来源:PlayerBot.cs


示例18: Setup

        public static void Setup(Level level, bool resetTeams = false)
        {
            if (resetTeams)
            {
                CTFTeam tempRed = redTeam;
                CTFTeam tempBlue = blueTeam;
                redTeam = new CTFTeam("&c", Block.red);
                blueTeam = new CTFTeam("&9", Block.deepblue);
                tempRed.Replace(redTeam);
                tempBlue.Replace(blueTeam);
            }

            currLevel = level;
            redTeam.spawn = currLevel.redSpawn;
            redTeam.spawnrot = currLevel.redRotation;
            redTeam.flagBase = currLevel.redFlag;
            blueTeam.spawn = currLevel.blueSpawn;
            blueTeam.spawnrot = currLevel.blueRotation;
            blueTeam.flagBase = currLevel.blueFlag;
            redTeam.flagLocation = redTeam.flagBase;
            blueTeam.flagLocation = blueTeam.flagBase;

            Server.s.Log("CTF set up, waiting for players...");

            GameStart();
        }
开发者ID:Goodlyay,项目名称:MCForge-Vanilla-Redux,代码行数:26,代码来源:CTF.cs


示例19: TreeCheck

 //return true if tree is near
 private bool TreeCheck(Level Lvl, ushort x, ushort z, ushort y, short dist)
 {
     byte foundTile;
     for (short xx = (short)-dist; xx <= +dist; ++xx)
     {
         for (short yy = (short)-dist; yy <= +dist; ++yy)
         {
             for (short zz = (short)-dist; zz <= +dist; ++zz)
             {
                 foundTile = Lvl.GetTile((ushort)(x + xx), (ushort)(z + zz), (ushort)(y + yy));
                 if (foundTile == Block.trunk || foundTile == Block.green)
                 {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:Cazzar,项目名称:MCForge-Vanilla,代码行数:20,代码来源:MapGenerator.cs


示例20: editPropertiesToolStripMenuItem_Click

 //Ok actually i deleted this.......................... but it's still needed for the other stuff (like cliking on the cell etc.)
 private void editPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Level l = GetSelectedLevelTab();
     if (l != null)
     {
         prpertiesoflvl = l;
         MOTDtxt.Text = l.motd;
         physlvlnumeric.Value = l.physics;
         grasschk.Checked = l.GrassGrow;
         chatlvlchk.Checked = l.worldChat;
         Killerbloxchk.Checked = l.Killer;
         SurvivalStyleDeathchk.Checked = l.Death;
         finitechk.Checked = l.finite;
         edgewaterchk.Checked = l.edgeWater;
         if (Server.UseTextures)
             WoM.Enabled = true;
         if (l.ai == true)
         {
             Aicombo.SelectedItem = "Hunt";
         }
         else
         {
             Aicombo.SelectedItem = "Flee";
         }
         Gunschk.Checked = l.guns;
         Fallnumeric.Value = l.fall;
         drownNumeric.Value = l.drown;
         LoadOnGotoChk.Checked = l.loadOnGoto;
         UnloadChk.Checked = l.unload;
         chkRndFlow.Checked = l.randomFlow;
         leafDecayChk.Checked = l.leafDecay;
         TreeGrowChk.Checked = l.growTrees;
         AutoLoadChk.Checked = false;
         if (File.Exists("text/autoload.txt"))
         {
             using (StreamReader r = new StreamReader("text/autoload.txt"))
             {
                 string line;
                 while ((line = r.ReadLine()) != null)
                 {
                     if (line.Contains(l.name) || line.Contains(l.name.ToLower()))
                     {
                         AutoLoadChk.Checked = true;
                     }
                 }
             }
         }
     }
     else
         WoM.Enabled = false;
     UpdateMapList("'");
     return;
 }
开发者ID:RedNoodle,项目名称:MCForge-Vanilla,代码行数:54,代码来源:Window.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MCForge.Player类代码示例发布时间:2022-05-26
下一篇:
C# MCDeamon.Player类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap