示例#1
0
        public List <PacketFromServer> CreateFill()
        {
            var p = new List <PacketFromServer>();

            //Create
            var sb = new ScoreboardObjective();

            sb.Board = Board;
            sb.Mode  = ScoreAction.Create;
            sb.Value = Title;
            sb.Type  = "integer";
            p.Add(sb);

            //Fill
            foreach (var i in Items)
            {
                var u = new ScoreboardUpdate();
                u.Board = Board;
                u.Name  = i.Name;
                u.Value = i.Score;
                p.Add(u);
            }

            //Show
            p.Add(new ScoreboardShow(Board, Position));
            return(p);
        }
示例#2
0
        private void Tile_Click(object sender, RoutedEventArgs e)
        {
            if (Window == null)
            {
                Window     = new CommandsGeneratorTemplate(this);
                Window.win = (Application.Current.MainWindow as IMainWindowCommands).AddWindow(Icon, Window, "命令生成器", this);
                Window.win.WindowClosed += Win_WindowClosed;
            }
            object content = null;
            string title   = (sender as Tile).Title;

            switch (title)
            {
            case "基础命令": content = new BasicCommands(Window); break;

            case "服务器命令": content = new ServerCommands(Window); break;

            case "实体命令": content = new EntityCommands(Window); break;

            case "玩家命令": content = new PlayerCommands(Window); break;

            case "Json书": content = new Book(Window); break;

            case "告示牌": content = new Sign(Window); break;

            case "消息文本": content = new Tellraw(Window); break;

            case "显示标题": content = new Title(Window); break;

            case "记分板目标": content = new ScoreboardObjective(Window); break;

            case "记分板玩家": content = new ScoreboardPlayers(Window); break;

            case "记分板队伍": content = new ScoreboardTeam(Window); break;

            case "物品NBT": content = new ItemNBT(Window); break;

            case "实体NBT": content = new EntityNBT(Window); break;

            case "物品与生成": content = new GetElement(); break;

            case "检测与执行": content = new ExecuteAndDetect(); break;

            case "方块NBT/放置填充方块": content = new SetBlocks(Window); break;

            case "村民交易": content = new VillagerTrade(Window); break;

            case "刷怪笼": content = new MobSpawner(Window); break;

            case "烟花": content = new Firework(Window); break;

            case "旗帜/盾牌": content = new Banners(Window); break;

            case "药水/药水箭": content = new Potion(Window); break;

            case "盔甲架": content = new ArmorStand(Window); break;
            }
            Window.AddPage(title, content);
        }
示例#3
0
        public ScoreboardObjective Remove()
        {
            var sb = new ScoreboardObjective();

            sb.Board = Board;
            sb.Mode  = ScoreAction.Remove;
            return(sb);
        }
示例#4
0
        public async Task CreateOrUpdateObjectiveAsync(IChatMessage title, DisplayType displayType = DisplayType.Integer)
        {
            var packet = new ScoreboardObjectivePacket
            {
                ObjectiveName = this.name,
                Mode          = this.Objective != null ? ScoreboardMode.Update : ScoreboardMode.Create,
                Value         = title,
                Type          = displayType
            };

            if (this.Objective != null)
            {
                await this.UpdateObjectiveAsync(packet);
            }
            else
            {
                this.Objective = new ScoreboardObjective
                {
                    ObjectiveName = this.name,
                    Value         = title,
                    DisplayType   = displayType
                };

                foreach (var(_, player) in this.server.OnlinePlayers)
                {
                    if (player.CurrentScoreboard == this)
                    {
                        await player.client.QueuePacketAsync(packet);

                        foreach (var score in this.scores.Select(x => x.Value).OrderByDescending(x => x.Value))
                        {
                            await player.client.QueuePacketAsync(new UpdateScore
                            {
                                EntityName    = score.DisplayText,
                                ObjectiveName = this.name,
                                Action        = 0,
                                Value         = score.Value
                            });
                        }
                    }
                }
            }
        }
 public void OnScoreboardObjective(ScoreboardObjective packet)
 {
 }
 private void InvokeScoreboardObjective(ScoreboardObjective packet)
 {
     packetListener.OnScoreboardObjective(packet);
 }