Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

pukpukpuk/DataFeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DataFeed is a reimagining of the standard Unity console.

The functionality of DataFeed is divided into two windows:

  1. Log viewer window
  2. Command input window (Auxiliary to the first and optional)

Window Features

Log Viewer Window

Logs are displayed in a practical table format


Support for customizable layers and tags for logs and filtering entries by them

  

Auxiliary optional entries:

  • Entry indicating a significant time difference between entries (useful for turn-based games)


  • Entry combining non-passed filter entries into a collapsible group


Log export to .xlsx and .csv is accessible by console window menu.


  • The exported logs will be located in the ProjectFolder/Logs folder.
  • Default font for .xlsx tables is Consolas, you can change it in the DataFeed config.

Command Input Window

In addition to the command input line, it has a completion list. The list consists of two parts:

  1. Left - displays completions based on existing commands and their arguments.
  2. Right - displays a list of suitable commands based on previously entered commands.


In addition to mouse clicks, the list fully supports keyboard control:

  1. Shift+U - Focus on input window
  2. Tab - Toggle focus between input line and list
  3. Arrows - Move through the completion list
  4. uhjk - Alternative to Arrows. You can change these keys in the config

Usage Guide

How to send messages to the console?

DataFeed class is responsible for console message output:

DataFeed.Log("Hello World!");
DataFeed.LogLayer("Hello World!", "Game", tag:"SomeTag");

Where is the config?

You can access config file by following Tools/Pukpukpuk/Open DataFeed Config in Unity menu bar.

The config is located here: Assets/Plugins/Pukpukpuk/DataFeed/Resources/DataFeed/

How to use start-up commands?

You can write a sequence of commands that will be executed when you start the game (works only in the editor). Field for this sequence located in the config.


You must call this sequence execution manually at end of the game initialization with this code:

DataFeed.ExecuteStartUpCommands();

How to make own commands?

Each command must inherit the Pukpukpuk.DataFeed.Input.Command class and have Pukpukpuk.DataFeed.Input.CommandInfo attribute. There is no need to register the command additionally.

The operation of the command is specified in the Execute_hided() method, and the list of completions in GetCompletions(). Other information is specified in the xml-comments of the Command class.

Command code example:

using System.Collections.Generic;
using System.Linq;
using Pukpukpuk.DataFeed.Input;

// False means that the command can be called not only while game is running
[CommandInfo("sum", false)]
public class SumCommand : Command
{
    private static readonly List<string> SuggestedNumbers = new() {"1", "2", "3"};
    
    // Command must return an output message after end of its work. 
    protected override string Execute_hided(string[] args, out bool isError)
    {
        // If isError is true, command output will be marked as error.
        isError = true;
        if (args.Length == 0) return "Not enough arguments!";

        var result = 0;
        foreach (var arg in args) 
        {
            if (!int.TryParse(arg, out var i))
            {
                return "One of the arguments is not an integer!";
            }

            result += i;
        }

        isError = false;
        return $"Sum: {result}";
    }

    public override List<string> GetCompletions(
        string lastArgument, 
        int lastArgumentIndex, 
        List<string> args)
    {
        return SuggestedNumbers
            .Where(number => !args.Contains(number))
            .ToList();
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages