Пример #1
0
    // Apply a new finding to the Baby.
    public void addFinding(SyncListFinding newFinding, Location location)
    {
        // Only server can make (and push) changes to the baby.
        if (!isServer)
        {
            Debug.LogError("Refused non-server attempt to addFinding.");
            return;
        }

        string findingJson = JsonUtility.ToJson(newFinding);

        switch (location)
        {
        case Location.core:
            coreFindings.Add(findingJson);

            break;

        case Location.extremity:
            extremityFindings.Add(findingJson);
            break;

        default:
            Debug.LogError("Bad location type was specified.  Rejecting finding.");
            break;
        }

        Debug.Log("Finding added to baby.");
    }
Пример #2
0
    public void testRemoveFindings()
    //test that findings are being removed
    {
        var testBaby = new Baby();

        SyncListFinding testFinding       = new SyncListFinding();
        string          testFindingString = JsonUtility.ToJson(testFinding);

        testBaby.addFinding(testFinding, Location.core);

        Assert.True(testBaby.findingContains(testFindingString, Location.core), "Error, baby does not contain expected finding");

        testBaby.removeFinding(testFinding, Location.core);

        Assert.False(testBaby.findingContains(testFindingString, Location.core), "Error, expected finding to be deleted");
    }
Пример #3
0
    public void testAddFindingBaby()
    //test that findings ar being added to the baby
    {
        var testBaby = new Baby();

        SyncListFinding testFinding1 = new SyncListFinding();
        SyncListFinding testFinding2 = new SyncListFinding();

        string testFinding1String = JsonUtility.ToJson(testFinding1);
        string testFinding2String = JsonUtility.ToJson(testFinding2);


        testBaby.addFinding(testFinding1, Location.core);
        testBaby.addFinding(testFinding2, Location.extremity);

        var contentLength = testBaby.totalFindings();

        Assert.True(testBaby.totalFindings() == 2, "Error, the baby does not contain TestFinding");
    }
Пример #4
0
    public void add(SyncListFinding newFinding)
    {
        // Restrict color findings to one active color at a time.
        if (newFinding.colorJson != "0")
        {
            clear();
        }

        ListItem newPrefab = Instantiate(ListItemPrefab) as ListItem;

        newPrefab.transform.SetParent(scroller.content);
        newPrefab.transform.localPosition = Vector3.zero;
        newPrefab.transform.localScale    = Vector3.one;
        newPrefab.transform.localRotation = Quaternion.identity;
        newPrefab.setData(newFinding);

        itemPrefabs.Add(newPrefab);
        items.Add(newFinding);
    }
Пример #5
0
    // Return all Texture Findings
    public List <SyncListFinding> getTextures()
    {
        SimpleDataTable table = dbManager.QueryGeneric("SELECT * FROM SyncListFinding WHERE TexturePath <> 0");

        Debug.Log("Query Results: Row Count = " + table.rows.Count);

        List <SyncListFinding> textures = new List <SyncListFinding>();

        foreach (SimpleDataRow row in table.rows)
        {
            SyncListFinding item = new SyncListFinding();
            item.id          = int.Parse(row.fields[0].ToString());
            item.name        = row.fields[1].ToString();
            item.colorJson   = row.fields[2].ToString();
            item.texturePath = row.fields[3].ToString();

            textures.Add(item);
            Debug.Log("Item added: id = " + item.id + ", name: " + item.name + ", color: " + item.colorJson + ", texture: " + item.texturePath);
        }

        return(textures);
    }
Пример #6
0
 public void setCurrentFinding(SyncListFinding finding)
 {
     currentFinding = finding;
 }