public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

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

            if (runtimeData.ContainsPlayer(mess.Sender))
            {
                var playerEnt = runtimeData.GetPlayer(mess.Sender);
                //		ref var player = ref playerEnt.Set<PlayerComponent>();
                ref var skinChanger = ref playerEnt.Set <UseCommand>();
            }
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

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

            if (!runtimeData.IsSavedPlayer(mess.Sender))
            {
                SendMessage($"@{mess.Sender} , your character not spawned. Type {commands.Enter[0]}");
            }
            else if (string.IsNullOrEmpty(mess.Args))
            {
                if (runtimeData.IsSavedPlayer(mess.Sender))
                {
                    var playerStats = runtimeData.GetSavedPlayer(mess.Sender);
                    var hats        = PrintHatsList(playerStats);
                    var text        = playerStats.Hats.Count == 0 ? "no have hats." : $"your hats: {hats}";
                    SendMessage($"@{playerStats.Name} {text}");
                }
            }
            else if (int.TryParse(mess.Args, out var hatIndex))
            {
                --hatIndex;

                if (runtimeData.ContainsPlayer(mess.Sender))
                {
                    var playerEnt = runtimeData.GetPlayer(mess.Sender);

                    ref var hatChanger = ref playerEnt.Set <ChangeHatComponent>();
                    hatChanger.HatIndex = hatIndex;
                }
                else
                {
                    var playerStats = runtimeData.GetSavedPlayer(mess.Sender);
                    playerStats.CurrentHatIndex = hatIndex;
                }
            }
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

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

            if (runtimeData.ContainsPlayer(mess.Sender))
            {
                if (ColorUtility.TryParseHtmlString(mess.Args, out var color))
                {
                    var     playerEnt = runtimeData.GetPlayer(mess.Sender);
                    ref var player    = ref playerEnt.Set <PlayerComponent>();
                    //		player.Stats.SkinColor = color;
                    ref var skinChanger = ref playerEnt.Set <SkinColorChangerComponent>();
                    skinChanger.Color = color;
                }
Пример #4
0
    public void Run()
    {
        foreach (var i in filter)
        {
            ref var mess = ref filter.Get1(i);

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

            if (runtimeData.ContainsPlayer(mess.Sender))
            {
                if (float.TryParse(mess.Args, out var size))
                {
                    var     playerEnt = runtimeData.GetPlayer(mess.Sender);
                    ref var player    = ref playerEnt.Set <PlayerComponent>();
                    player.Stats.HeadSize = size;
                    ref var headSize = ref playerEnt.Set <HeadSizeChangerComponent>();
                    headSize.Size = size;
                }
Пример #5
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}";
                }