示例#1
0
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

            if (commands.IsCommand(mess.FirstWord, commands.Exit) == false)
            {
                continue;
            }

            if (runtimeData.ContainsPlayer(mess.Sender))
            {
                var playerEnt = runtimeData.GetPlayer(mess.Sender);
                playerEnt.Set <PlayerExitCommandComponent>();
            }

            if (runtimeData.IsEscapedPlayer(mess.Sender))
            {
                var     e   = world.NewEntity();
                ref var err = ref e.Set <ErrorComponent>();
                err.Message = $"@{mess.Sender} already leave this level";
            }
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

            if (IsDirectionCommand(mess.FirstWord))
            {
                if (runtimeData.ContainsPlayer(mess.Sender))
                {
                    var dir = CommandToDirection(mess.FirstWord);

                    var playerEnt = runtimeData.GetPlayer(mess.Sender);

                    playerEnt.Set <TasksCompletedComponent>();
                    ref var tasks = ref playerEnt.Set <PlayerTasksComponent>();
                    if (tasks.List == null)
                    {
                        tasks.List = new List <Vector2Int>();
                    }
                    tasks.List.Clear();
                    tasks.List.Add(dir);
                    tasks.CurrentTask = 0;

                    if (mess.Args.Length > 0)
                    {
                        var words = mess.Args.Split(' ');
                        ParseDirections(words, tasks.List);
                    }
                }

                if (runtimeData.IsEscapedPlayer(mess.Sender))
                {
                    var     e   = world.NewEntity();
                    ref var err = ref e.Set <ErrorComponent>();
                    err.Message = $"@{mess.Sender} {gameData.Localizations.AlreadyEscaped}";
                }
示例#3
0
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);
            if (commands.IsCommand(mess.FirstWord, commands.Enter) == false)
            {
                continue;
            }

            if (runtimeData.IsEscapedPlayer(mess.Sender))
            {
                SendMessage($"{gameData.Localizations.TwitchUserPrefix}{mess.Sender} {gameData.Localizations.AlreadyEscaped}");
                continue;
            }

            if (runtimeData.ContainsPlayer(mess.Sender))
            {
                SendMessage($"{gameData.Localizations.TwitchUserPrefix}{mess.Sender} {gameData.Localizations.AlreadySpawned}");
                continue;
            }

            var     ent   = world.NewEntity();
            ref var spawn = ref ent.Set <PlayerSpawnComponent>();