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

C# realm.World类代码示例

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

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



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

示例1: AddWorld

 public static World AddWorld(World world)
 {
     world.Id = Interlocked.Increment(ref nextWorldId);
     Worlds[world.Id] = world;
     if (world is GameWorld)
         Monitor.WorldAdded(world);
     return world;
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:8,代码来源:RealmManager.cs


示例2: WorldClosed

 public void WorldClosed(World world)
 {
     lock (worldLock)
     {
         var portal = portals[world];
         nexus.LeaveWorld(portal);
         portals.Remove(world);
     }
 }
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:9,代码来源:RealmPortalMonitor.cs


示例3: AddWorld

 public World AddWorld(World world)
 {
     if (world.Manager != null)
         throw new InvalidOperationException("World already added.");
     world.Id = Interlocked.Increment(ref nextWorldId);
     Worlds[world.Id] = world;
     OnWorldAdded(world);
     return world;
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:9,代码来源:RealmManager.cs


示例4: HasPlayerNearby

 public static bool HasPlayerNearby(World world, double x, double y)
 {
     foreach (var i in world.PlayersCollision.HitTest(x, y, 16))
     {
         var d = Dist(i.X, i.Y, x, y);
         if (d < 16*16)
             return true;
     }
     return false;
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:10,代码来源:Behavior.cs


示例5: WorldClosed

 public void WorldClosed(World world)
 {
     lock (worldLock)
     {
         Portal portal = portals[world];
         nexus.LeaveWorld(portal);
         portals.Remove(world);
         log.InfoFormat("World {0}({1}) closed.", world.Id, world.Name);
     }
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:10,代码来源:RealmPortalMonitor.cs


示例6: Tick

 public bool Tick(World world, RealmTime time)
 {
     remain -= time.thisTickTimes;
     if (remain < 0)
     {
         cb(world, time);
         return true;
     }
     return false;
 }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:10,代码来源:WorldTimer.cs


示例7: WorldRemoved

        public void WorldRemoved(World world)
        {
            //lock (worldLock)
            //{
            var portal = portals[world];
            nexus.LeaveWorld(portal);
            portals.Remove(world);

            //}
        }
开发者ID:BlackRayquaza,项目名称:PhoenixRealms,代码行数:10,代码来源:RealmPortalMonitor.cs


示例8: Oryx

 public void Oryx(World world, string text)
 {
     world.BroadcastPacket(new TextPacket()
     {
         BubbleTime = 0,
         Stars = -1,
         Name = "#Oryx the Mad God",
         Text = text
     }, null);
 }
开发者ID:xzyio,项目名称:Rotmg-PServer,代码行数:10,代码来源:ChatManager.cs


示例9: Oryx

 public void Oryx(World world, string text)
 {
     world.BroadcastPacket(new TextPacket()
     {
         BubbleTime = 0,
         Stars = -1,
         Name = "#Oryx the Mad God",
         Text = text.ToSafeText()
     }, null);
     logger.InfoFormat("[{0}({1})] <Oryx the Mad God> {2}", world.Name, world.Id, text);
 }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:11,代码来源:ChatManager.cs


示例10: BehaveWall

 public void BehaveWall(Player killer, Wall w, World wallWorld)
 {
     this.Host = w;
     BehaviorCondition cond = BehaviorCondition.OnDeath;
     if (cond == BehaviorCondition.OnDeath)
     {
         wOwner = wallWorld;
         var dat = new Tuple<Player, int>[]{
                 new Tuple<Player, int>(killer, 500)
             };
         Dictionary<Player, List<Item>> items = new Dictionary<Player, List<Item>>();
         ProcessPublicBags(rand, dat);
         ProcessSoulBags(rand, dat);
     }
 }
开发者ID:Club559,项目名称:Mining,代码行数:15,代码来源:LootBehavior.cs


示例11: WorldAdded

 public void WorldAdded(World world)
 {
     lock (worldLock)
     {
         var pos = GetRandPosition();
         var portal = new Portal(0x0712, null)
         {
             Size = 80,
             WorldInstance = world,
             Name = world.Name
         };
         portal.Move(pos.X + 0.5f, pos.Y + 0.5f);
         nexus.EnterWorld(portal);
         portals.Add(world, portal);
     }
 }
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:16,代码来源:RealmPortalMonitor.cs


示例12: WorldOpened

 public void WorldOpened(World world)
 {
     lock (worldLock)
     {
         var pos = GetRandPosition();
         var portal = new Portal(0x71c, null)
         {
             Size = 150,
             WorldInstance = world,
             Name = world.Name
         };
         portal.Move(pos.X, pos.Y);
         nexus.EnterWorld(portal);
         portals.Add(world, portal);
     }
 }
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:16,代码来源:RealmPortalMonitor.cs


示例13: WorldAdded

 public void WorldAdded(World world)
 {
     lock (worldLock)
     {
         Position pos = GetRandPosition();
         var portal = new Portal(manager, 0x0712, null)
         {
             Size = 80,
             WorldInstance = world,
             Name = world.Name
         };
         portal.Move(pos.X + 0.5f, pos.Y + 0.5f);
         nexus.EnterWorld(portal);
         portals.Add(world, portal);
         log.InfoFormat("World {0}({1}) added.", world.Id, world.Name);
     }
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:17,代码来源:RealmPortalMonitor.cs


示例14: WorldOpened

 public void WorldOpened(World world)
 {
     lock (worldLock)
     {
         var pos = GetRandPosition();
         var portal = new Portal(manager, 0x71c, null)
         {
             Size = 150,
             WorldInstance = world,
             Name = world.Name
         };
         portal.Move(pos.X, pos.Y);
         nexus.EnterWorld(portal);
         portals.Add(world, portal);
         log.InfoFormat("World {0}({1}) opened.", world.Id, world.Name);
     }
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:17,代码来源:RealmPortalMonitor.cs


示例15: Tick

 public bool Tick(World world, RealmTime time)
 {
     if (destroy)
     {
         world.Timers.Remove(this);
         return true;
     }
     remain -= time.thisTickTimes;
     if (remain < 0)
     {
         try
         {
             cb(world, time);
         }
         catch (Exception ex)
         {
             logger.Error(ex);
         }
         return true;
     }
     return false;
 }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:22,代码来源:WorldTimer.cs


示例16: CloseWorld

 public static void CloseWorld(World world)
 {
     Monitor.WorldRemoved(world);
 }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:4,代码来源:RealmManager.cs


示例17: Init

 public virtual void Init(World owner)
 {
     Owner = owner;
 }
开发者ID:HamSammich,项目名称:rotmg_svr,代码行数:4,代码来源:Entity.cs


示例18: AOE

 //Null for player
 public static void AOE(World world, Position pos, float radius, bool players, Action<Entity> callback)
 {
     if (players)
         foreach (var i in world.PlayersCollision.HitTest(pos.X, pos.Y, radius))
         {
             var d = Dist(i.X, i.Y, pos.X, pos.Y);
             if (d < radius)
                 callback(i);
         }
     else
         foreach (var i in world.EnemiesCollision.HitTest(pos.X, pos.Y, radius))
         {
             if (!(i is Enemy)) continue;
             var d = Dist(i.X, i.Y, pos.X, pos.Y);
             if (d < radius)
                 callback(i);
         }
 }
开发者ID:Club559,项目名称:Mining,代码行数:19,代码来源:Behavior.cs


示例19: WorldRemoved

 public void WorldRemoved(World world)
 {
     lock (worldLock)
     {
         if (!portals.ContainsKey(world))
             return;
         Portal portal = portals[world];
         nexus.LeaveWorld(portal);
         portals.Remove(world);
         log.InfoFormat("World {0}({1}) removed.", world.Id, world.Name);
     }
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:12,代码来源:RealmPortalMonitor.cs


示例20: GenRandomRoom

 public static bool GenRandomRoom(World world, float x, float y, Wall theWall)
 {
     try
     {
         Random rand = new Random();
         if (rand.Next(1, 60) != 1)
             return false;
         //Console.Out.WriteLine("Generating room...");
         List<string> dirs = new List<string>();
         for (int tx = -1; tx <= 1; tx++)
             for (int ty = -1; ty <= 1; ty++)
             {
                 WmapTile targetTile = world.Map[(int)x + tx, (int)y + ty];
                 WmapTile thisTile = world.Map[(int)x, (int)y];
                 if (targetTile.TileId == 0xff)
                 {
                     if (tx == -1 && ty == 0)
                         dirs.Add("left");
                     else if (tx == 1 && ty == 0)
                         dirs.Add("right");
                     else if (tx == 0 && ty == 1)
                         dirs.Add("down");
                     else if (tx == 0 && ty == -1)
                         dirs.Add("up");
                 }
             }
         if (dirs.Count < 1)
             return false;
         dirs.Shuffle();
         //Console.Out.WriteLine("Room direction: " + dirs.First());
         float mainX = x;
         float mainY = y;
         float entranceX = x;
         float entranceY = y;
         switch (dirs.First())
         {
             case "up":
                 mainX = x - 6; mainY = y - 8;
                 entranceY = y - 1; break;
             case "down":
                 mainX = x - 6; mainY = y + 1;
                 entranceY = y + 1; break;
             case "left":
                 mainX = x - 12; mainY = y - 3;
                 entranceX = x - 1; break;
             case "right":
                 mainX = x + 1; mainY = y - 3;
                 entranceX = x + 1; break;
         }
         List<WmapTile> addedTiles = new List<WmapTile>();
         for (int ty = (int)mainY; ty <= mainY + 7; ty++)
             for (int tx = (int)mainX; tx <= mainX + 11; tx++)
             {
                 WmapTile tTile = world.Map[tx, ty];
                 if (tTile.TileId != 0xff || tTile.ObjType != 0)
                 {
                     //Console.Out.WriteLine("Found collision while generating room!");
                     return false;
                 }
                 tTile.TileId = world.Map[(int)x, (int)y].TileId;
                 addedTiles.Add(tTile);
             }
         //Console.Out.WriteLine("Generated tiles, placing...");
         int tileNum = 0;
         for (int ty = (int)mainY; ty <= mainY + 7; ty++)
             for (int tx = (int)mainX; tx <= mainX + 11; tx++)
             {
                 WmapTile ctile = addedTiles[tileNum];
                 if ((tx == (int)mainX || tx == (int)mainX + 11 || ty == (int)mainY || ty == (int)mainY + 7) && !(tx == entranceX && ty == entranceY))
                 {
                     //Console.Out.WriteLine("Placed wall");
                     Wall e = new Wall(theWall.ObjectType, XmlDatas.TypeToElement[theWall.ObjectType]);
                     e.Move(tx, ty);
                     world.EnterWorld(e);
                     ctile.ObjType = theWall.ObjectType;
                 }
                 else
                 {
                     //Console.Out.WriteLine("Placed treasure");
                     if (rand.Next(1, 30) == 1)
                     {
                         Entity e = Entity.Resolve(XmlDatas.IdToType["Coral Gift"]);
                         e.Move(tx + 0.5f, ty + 0.5f);
                         world.EnterWorld(e);
                         ctile.ObjType = XmlDatas.IdToType["Coral Gift"];
                     }
                 }
                 world.Map[tx, ty] = ctile;
             }
         //Console.Out.WriteLine("Placed tiles!");
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:97,代码来源:GenLogic.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# entities.Player类代码示例发布时间:2022-05-26
下一篇:
C# realm.RealmTime类代码示例发布时间: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