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


C# RealmTime类代码示例

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


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

示例1: Tick

        public override void Tick(RealmTime time)
        {
            if (t/500 == p)
            {
                Owner.BroadcastPacket(new ShowEffectPacket
                {
                    EffectType = EffectType.Trap,
                    Color = new ARGB(0xff9000ff),
                    TargetId = Id,
                    PosA = new Position {X = radius/2}
                }, null);
                p++;
                if (p == LIFETIME*2)
                {
                    Explode(time);
                    return;
                }
            }
            t += time.thisTickTimes;

            bool monsterNearby = false;
            if (player.PvP)
                this.AOE(radius/2, true, enemy =>
                {
                    var plr = (enemy as Player);
                    if (!plr.PvP || (plr.PvP && plr.Team != 0 && plr.Team == player.Team) || plr == player)
                        return;
                    monsterNearby = true;
                });
            this.AOE(radius/2, false, enemy => monsterNearby = true);
            if (monsterNearby)
                Explode(time);

            base.Tick(time);
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:35,代码来源:Trap.cs

示例2: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (player.Guild != "")
         try
         {
             var saytext = string.Join(" ", args);
             if ((from w in player.Manager.Worlds let world = w.Value where w.Key != 0 from i in world.Players.Where(i => i.Value.Guild == player.Guild) select world).Any())
             {
                 if (saytext.Equals(" ") || saytext == "")
                 {
                     player.SendHelp("Usage: /guild <text>");
                     return false;
                 }
                 player.Manager.Chat.SayGuild(player, saytext.ToSafeText());
                 return true;
             }
         }
         catch(Exception e)
         {
             player.SendError(e.ToString());
             player.SendInfo("Cannot guild chat!");
             return false;
         }
     else
         player.SendInfo("You need to be in a guild to use guild chat!");
     return false;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:27,代码来源:GuildCommands.cs

示例3: PlayerText

        public void PlayerText(RealmTime time, PlayerTextPacket pkt)
        {
            if (pkt.Text[0] == '/')
            {
                string[] x = pkt.Text.Trim().Split(' ');
                ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
                //CommandManager.Execute(this, time, pkt.Text); // Beta Processor
            }
            else
            {
                string txt = Encoding.ASCII.GetString(
                    Encoding.Convert(
                        Encoding.UTF8,
                        Encoding.GetEncoding(
                            Encoding.ASCII.EncodingName,
                            new EncoderReplacementFallback(string.Empty),
                            new DecoderExceptionFallback()
                            ),
                        Encoding.UTF8.GetBytes(pkt.Text)
                    )
                );
                if (txt != "")
                {
                    //Removing unwanted crashing characters from strings
                    string chatColor = "";
                    if (Client.Account.Rank > 3)
                        chatColor = "@";
                    else if (Client.Account.Rank == 3)
                        chatColor = "#";

                    foreach (var i in RealmManager.Worlds)
                    {
                        if (i.Key != 0)
                        {
                            i.Value.BroadcastPacket(new TextPacket()
                            {
                                Name = chatColor + Name,
                                ObjectId = Id,
                                Stars = Stars,
                                BubbleTime = 5,
                                Recipient = "",
                                Text = txt,
                                CleanText = txt
                            }, null);
                        }
                    }
                    foreach (var e in Owner.Enemies)
                    {
                        foreach (var b in e.Value.CondBehaviors)
                        {
                            if (b.Condition == BehaviorCondition.OnChat)
                            {
                                b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text);
                                b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text, this);
                            }
                        }
                    }
                }
            }
        }
开发者ID:Club559,项目名称:Mining,代码行数:60,代码来源:Player.Chat.cs

示例4: Death

 public void Death(RealmTime time)
 {
     counter.Death(time);
     if (CurrentState != null)
         CurrentState.OnDeath(new BehaviorEventArgs(this, time));
     Owner.LeaveWorld(this);
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:7,代码来源:Enemy.cs

示例5: Process

        protected override bool Process(Player player, RealmTime time, string args)
        {
            int index = args.IndexOf(' ');
            int num;
            string name = args;

            if (args.IndexOf(' ') > 0 && int.TryParse(args.Substring(0, args.IndexOf(' ')), out num)) //multi
                name = args.Substring(index + 1);
            else
                num = 1;

            ushort objType;
            if (!player.Manager.GameData.IdToObjectType.TryGetValue(name, out objType) ||
                !player.Manager.GameData.ObjectDescs.ContainsKey(objType))
            {
                player.SendError("Unknown entity!");
                return false;
            }

            for (int i = 0; i < num; i++)
            {
                var entity = Entity.Resolve(player.Manager, objType);
                entity.Move(player.X, player.Y);
                player.Owner.EnterWorld(entity);
            }
            return true;
        }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:27,代码来源:AdminCommands.cs

示例6: Tick

 public override void Tick(RealmTime time)
 {
     base.Tick(time);
     if (MainPlayer == null)
         return;
     if (Cleared)
         return;
     bool foundBoss = false;
     foreach (var i in Enemies.Values)
         if (i.ObjectDesc != null && i.ObjectDesc.ObjectId == FloorBosses[Floor])
             foundBoss = true;
     if(foundBoss)
         return;
     if(MainPlayer.Floors < Floor)
     {
         if (Floor == Tower.FLOORS)
             foreach (var i in Manager.Clients.Values)
                 if (i.Player != null)
                     i.Player.SendInfo(MainPlayer.Name + " has cleared the tower!");
         MainPlayer.Floors = Floor;
         MainPlayer.SaveToCharacter();
         MainPlayer.Client.Save();
     }
     Cleared = true;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:25,代码来源:Tower.cs

示例7: Process

 protected override bool Process(Player player, RealmTime time, string[] args)
 {
     if (args.Length == 0)
     {
         player.SendHelp("Usage: /addeff <Effectname or Effectnumber>");
         return false;
     }
     try
     {
         player.ApplyConditionEffect(new ConditionEffect
         {
             Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[0].Trim(), true),
             DurationMS = -1
         });
         {
             player.SendInfo("Success!");
         }
     }
     catch
     {
         player.SendError("Invalid effect!");
         return false;
     }
     return true;
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:25,代码来源:AdminCommands.cs

示例8: Process

        protected override bool Process(Player player, RealmTime time, string args)
        {
            Command[] cmds = player.Manager.Commands.Commands.Values
                .Where(x => x.HasPermission(player))
                .ToArray();

            int curPage = (args != "") ? Convert.ToInt32(args) : 1;
            double maxPage = Math.Floor((double) cmds.Length/10);

            if (curPage > maxPage + 1)
                curPage = (int) maxPage + 1;
            if (curPage < 1)
                curPage = 1;

            var sb = new StringBuilder(string.Format("Commands <Page {0}/{1}>: \n", curPage, maxPage + 1));

            int y = (curPage - 1) * 10;
            int z = y + 10;

            int commands = cmds.Length;
            if (z > commands)
            {
                z = commands;
            }

            for (int i = y; i < z; i++)
            {
                sb.Append(string.Format("[/{0}{1}]{2}", cmds[i].CommandName, (cmds[i].CommandUsage != "" ? " " + cmds[i].CommandUsage : null), (cmds[i].CommandDesc != "" ? ": " + cmds[i].CommandDesc : null)) + "\n");
            }
            player.SendHelp(sb.ToString());
            return true;
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:32,代码来源:WorldCommand.cs

示例9: Tick

        public override void Tick(RealmTime time)
        {
            if (t / 500 == p)
            {
                Owner.BroadcastPacket(new ShowEffectPacket()
                {
                    EffectType = EffectType.Trap,
                    Color = new ARGB(0xff9000ff),
                    TargetId = Id,
                    PosA = new Position() { X = radius / 2 }
                }, null);
                p++;
                if (p == LIFETIME * 2)
                {
                    Explode(time);
                    return;
                }
            }
            t += time.thisTickTimes;

            bool monsterNearby = false;
            Behavior.AOE(Owner, this, radius / 2, false, enemy => monsterNearby = true);
            if (monsterNearby)
                Explode(time);

            base.Tick(time);
        }
开发者ID:Zeroeh,项目名称:PrivateServerOld,代码行数:27,代码来源:Trap.cs

示例10: Tick

        public override void Tick(RealmTime time)
        {
            base.Tick(time); //normal world tick

            CheckDupers();
            UpdatePortals();
        }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:Nexus.cs

示例11: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (player.HasConditionEffect(ConditionEffects.Paused))
     {
         player.ApplyConditionEffect(new ConditionEffect()
         {
             Effect = ConditionEffectIndex.Paused,
             DurationMS = 0
         });
         player.SendInfo("Game resumed.");
         return true;
     }
     else
     {
         if (player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>().Any())
         {
             player.SendError("Not safe to pause.");
             return false;
         }
         else
         {
             player.ApplyConditionEffect(new ConditionEffect()
             {
                 Effect = ConditionEffectIndex.Paused,
                 DurationMS = -1
             });
             player.SendInfo("Game paused.");
             return true;
         }
     }
 }
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:31,代码来源:WorldCommand.cs

示例12: Tick

        public override void Tick(RealmTime time)
        {
            base.Tick(time);
            CheckOutOfBounds();

            if (CheckPopulation())
            {
                if (ready)
                {
                    if (waiting) return;
                    ready = false;
                    wave++;
                    foreach (KeyValuePair<int, Player> i in Players)
                    {
                        i.Value.Client.SendPacket(new ArenaNextWavePacket
                        {
                            Type = wave
                        });
                    }
                    waiting = true;
                    Timers.Add(new WorldTimer(5000, (world, t) =>
                    {
                        ready = false;
                        Spawn();
                        waiting = false;
                    }));
                }
                ready = true;
            }
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:30,代码来源:Arena.cs

示例13: Process

 protected override bool Process(Player player, RealmTime time, string[] args)
 {
     if (player.HasConditionEffect(ConditionEffectIndex.Paused))
     {
         player.ApplyConditionEffect(new ConditionEffect
         {
             Effect = ConditionEffectIndex.Paused,
             DurationMS = 0
         });
         player.SendInfo("Game resumed.");
     }
     else
     {
         foreach (Enemy i in player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>())
         {
             if (i.ObjectDesc.Enemy)
             {
                 player.SendInfo("Not safe to pause.");
                 return false;
             }
         }
         player.ApplyConditionEffect(new ConditionEffect
         {
             Effect = ConditionEffectIndex.Paused,
             DurationMS = -1
         });
         player.SendInfo("Game paused.");
     }
     return true;
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:30,代码来源:WorldCommand.cs

示例14: Tick

 public override void Tick(RealmTime time)
 {
     if (t/500 == p2)
     {
         Owner.BroadcastPacket(new ShowEffectPacket
         {
             EffectType = EffectType.Trap,
             Color = new ARGB(0xffd700),
             TargetId = Id,
             PosA = new Position {X = radius}
         }, null);
         p2++;
         //Stuff
     }
     if (t/2000 == p)
     {
         var pkts = new List<Packet>();
         BehaviorBase.AOE(Owner, this, radius, true,
             player => { Player.ActivateHealHp(player as Player, amount, pkts); });
         pkts.Add(new ShowEffectPacket
         {
             EffectType = EffectType.AreaBlast,
             TargetId = Id,
             Color = new ARGB(0xffd700),
             PosA = new Position {X = radius}
         });
         Owner.BroadcastPackets(pkts, null);
         p++;
     }
     t += time.thisTickTimes;
     base.Tick(time);
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:32,代码来源:Halo.cs

示例15: Execute

        public bool Execute(Player player, RealmTime time, string args)
        {
            if (!HasPermission(player))
            {
                player.SendInfo("You are not an Admin");
                return false;
            }

            try
            {
                string[] a = args.Split(' ');
                bool success = Process(player, time, a);
                if (success)
                player.Manager.Database.DoActionAsync(db =>
                {
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "insert into commandlog (command, args, player) values (@command, @args, @player);";
                    cmd.Parameters.AddWithValue("@command", CommandName);
                    cmd.Parameters.AddWithValue("@args", args);
                    cmd.Parameters.AddWithValue("@player", $"{player.AccountId}:{player.Name}");
                    cmd.ExecuteNonQuery();
                });
                return success;
            }
            catch (Exception ex)
            {
                logger.Error("Error when executing the command.", ex);
                player.SendError("Error when executing the command.");
                return false;
            }
        }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:31,代码来源:Command.cs


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