<commit_before>﻿using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Linq;

/// <summary>
/// A node representing a state in the state machine.
/// It provides a window into the State by pairing the
/// MachineState Actions (runtime) and the NodeData (editor)
/// </summary>
public class StateNode : BaseNode {

    public string StateName = "New State";

    [XmlIgnore] public State State;

    private int selectedStateIndex;

    public override void SetupNode(BehaviourSet dataContainer)
    {
        base.SetupNode(dataContainer);
    }
    
    protected override void AddInterfaces()
    {
        AddInput(0);
    }

    private void SetInterfacePositions()
    {
        SetInterface(0, 1);
    }

    public override void Draw()
    {
        WindowTitle = State == null ? "New State" : StateName;
        nodeType = NodeTypes.State;

        if (State != null)
        {
            DisplayStateInfo();
            SetInterfacePositions();
            DrawInterfaces();
        }
        else
        {
            DisplayStateSelect();
        }
    }

    public void AddNewStateEvent(int id)
    {
        AddOutput(id);  // TODO: id will be > 0. If we're adding a new interface to the state node, we must change this as id could be 1
    }

    public void RemoveStateEvent(int id)
    {
        for (int i = 0; i < interfaces.Count; i++)
        {
            if (interfaces[i].ID == id)
            {
                interfaces.Remove(interfaces[id]);
            }
        }
    }
    
    private void DisplayStateInfo()
    {
        Transform.Width = 150f;<commit_msg>lol whoops. use index to delete the interface we found when the ID matches.<commit_after>﻿using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Linq;

/// <summary>
/// A node representing a state in the state machine.
/// It provides a window into the State by pairing the
/// MachineState Actions (runtime) and the NodeData (editor)
/// </summary>
public class StateNode : BaseNode {

    public string StateName = "New State";

    [XmlIgnore] public State State;

    private int selectedStateIndex;

    public override void SetupNode(BehaviourSet dataContainer)
    {
        base.SetupNode(dataContainer);
    }
    
    protected override void AddInterfaces()
    {
        AddInput(0);
    }

    private void SetInterfacePositions()
    {
        SetInterface(0, 1);
    }

    public override void Draw()
    {
        WindowTitle = State == null ? "New State" : StateName;
        nodeType = NodeTypes.State;

        if (State != null)
        {
            DisplayStateInfo();
            SetInterfacePositions();
            DrawInterfaces();
        }
        else
        {
            DisplayStateSelect();
        }
    }

    public void AddNewStateEvent(int id)
    {
        AddOutput(id);  // TODO: id will be > 0. If we're adding a new interface to the state node, we must change this as id could be 1
    }

    public void RemoveStateEvent(int id)
    {
        for (int i = 0; i < interfaces.Count; i++)
        {
            if (interfaces[i].ID == id)
            {
                interfaces.Remove(interfaces[i]);
                break;
            }
        }
    }
    
    private void DisplayStateInfo()
    {
        Transform.Width = 150f;
{'fraction_non_alphanumeric': 0.09297639608520437, 'fraction_numerical': 0.0051813471502590676, 'mean_word_length': 2.034934497816594, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7385771', 'n_tokens_mistral': 974, 'n_tokens_neox': 929, 'n_words': 299}