Ejemplo n.º 1
0
    private void createSnippets()
    {
        SnippetHandler    snippetHandler    = new SnippetHandler();
        TagHandler        tagHandler        = new TagHandler(this);
        AssocationHandler assocationHandler = new AssocationHandler();

        Assets.Scripts.DataBase.Snippet[] snippetArr = snippetHandler.GetAllSnippets();

        snippetObjectDict = new Dictionary <int, GameObject>();

        foreach (Assets.Scripts.DataBase.Snippet snippet in snippetArr)
        {
            GameObject instantiatedSnippet = Instantiate(snippetPrefab) as GameObject;
            //instantiatedSnippet.tag = "group" + Random.Range(1, 2); //Temporary hack measure, randomly assign snippet to one of two groups

            SnippetState instSnippetState = instantiatedSnippet.GetComponent <SnippetState>();
            instSnippetState.loadState(tagHandler.GetTagBySnippetId(snippet.Snippet_Id),
                                       snippet,
                                       assocationHandler.GetAssociationViewForSnippet(snippet.Snippet_Id));

            instantiatedSnippet.name = instSnippetState.title;  //names each snippet by its title

            snippetObjectDict.Add(instSnippetState.id, instantiatedSnippet);
        }
    }
Ejemplo n.º 2
0
    public static Snippet CreateBlankSnippet(int board_id)
    {
        SnippetHandler snippetHandler = new SnippetHandler();

        //GUID is a unique code that is a placeholder for now
        Snippet snippet = snippetHandler.Post(new Snippet(-1, board_id, Guid.NewGuid().ToString()));//get the snippets id


        //create all the required fields
        Connection x = new Connection(snippet.Snippet_Id, 80, 0.ToString());
        Connection y = new Connection(snippet.Snippet_Id, 81, 0.ToString());
        Connection z = new Connection(snippet.Snippet_Id, 82, 0.ToString());

        Connection titleBar = new Connection(snippet.Snippet_Id, 83, "#0000ff");
        Connection content  = new Connection(snippet.Snippet_Id, 79, "Fill out text");
        Connection title    = new Connection(snippet.Snippet_Id, 78, "Placeholder Title");

        ConnectionHandler connectionHandler = new ConnectionHandler();

        connectionHandler.Post(x);
        connectionHandler.Post(y);
        connectionHandler.Post(z);
        connectionHandler.Post(titleBar);
        connectionHandler.Post(content);
        connectionHandler.Post(title);

        return(snippet);
    }
Ejemplo n.º 3
0
    public void deleteSnippet(SnippetState target)
    {
        SnippetHandler snippetHandler = new SnippetHandler();

        snippetHandler.Delete(target.GetBaseInterFace());
    }