示例#1
0
    public void readDatabase()
    {
        ColorDB mColorDB = new ColorDB();

        System.Data.IDataReader reader = mColorDB.getAllData();

        List <ColorData> myList = new List <ColorData>();

        while (reader.Read())
        {
            ColorData entity = new ColorData(reader[0].ToString(),
                                             reader[1].ToString(),
                                             reader[2].ToString(),
                                             reader[3].ToString());

            Debug.Log("id: " + entity._id + "\tcolor: " + entity._color + "\tgroup: " + entity._type);
            myList.Add(entity);
        }
    }
    public void SetColors()
    {
        ColorDB mColorDB = new ColorDB();

        System.Data.IDataReader reader = mColorDB.getAllData();

        List <ColorData> myList = new List <ColorData>();

        while (reader.Read())
        {
            ColorData entity = new ColorData(reader[0].ToString(),
                                             reader[1].ToString(),
                                             reader[2].ToString(),
                                             reader[3].ToString());

            Debug.Log("id: " + entity._id + "\tcolor: " + entity._color + "\tgroup: " + entity._type);
            myList.Add(entity);
        }
        int i = 0;

        foreach (ColorData entity in myList)
        {
            if (i == 0)
            {
                closeColor = myList[i]._color;
                Debug.Log("Close color is " + myList[i]._color.ToString());
                closeCircle.material = mats[MatNum(myList[i]._color.ToString())];
            }
            else if (i == 1)
            {
                nearColor = myList[i]._color;
                Debug.Log("Near color is " + myList[i]._color.ToString());
                nearCircle.material = mats[MatNum(myList[i]._color.ToString())];
            }
            else
            {
                farColor = myList[i]._color;
                Debug.Log("Far color is " + myList[i]._color.ToString());
                farCircle.material = mats[MatNum(myList[i]._color.ToString())];
            }
            i++;
        }
    }
示例#3
0
    public void selectColor()
    {
        ColorDB mColorDB = new ColorDB();

        System.Data.IDataReader reader = mColorDB.getAllData();

        List <ColorData> myList = new List <ColorData>();

        while (reader.Read())
        {
            ColorData entity = new ColorData(reader[0].ToString(),
                                             reader[1].ToString(),
                                             reader[2].ToString(),
                                             reader[3].ToString());
            myList.Add(entity);
        }

        int count = myList.Count;

        string btn = EventSystem.current.currentSelectedGameObject.name;

        if (count == 0)
        {
            addColor("1", "Family", btn);
            txt.text = "Select a Color for Friends:";
        }
        else if (count == 1)
        {
            addColor("2", "Friends", btn);
            txt.text = "Select a Color for Strangers:";
        }
        else if (count == 2)
        {
            addColor("3", "Strangers", btn);
            SceneManager.LoadScene("UploadPicOrNotSection");
        }
        else
        {
            resetColors();
        }
        mColorDB.close();
    }