Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        //attributes = Dataset.GetDataSetFeatures();

        //foreach (var field in Dataset.InputFields)
        //{
        //    GameObject.Destroy(field);
        //}
        //Dataset.InputFields = new List<InputField>();
        //Dataset.EditInputFields = new List<InputField>();

        //for (int i = 0; i < attributes.Count; i++)
        //{
        //    GameObject field = Instantiate(dataInput);
        //    field.transform.SetParent(featureNameHolder.transform);
        //    field.name = attributes[i] + "Field";
        //    field.GetComponent<InputField>().placeholder.GetComponent<Text>().text = attributes[i];
        //    Dataset.InputFields.Add(field.GetComponent<InputField>());
        //}
        //GameObject Button = Instantiate(dataInputButton);
        //Button.transform.SetParent(featureNameHolder.transform);
        //Button myButton = Button.GetComponent<Button>();
        //myButton.GetComponentInChildren<Text>().text = "Add";
        //myButton.onClick.AddListener(Dataset.InstantiateNewDataPoint);

        Button     changeKValue = GameObject.Find("ChangeK").GetComponent <Button>();
        InputField kInput       = (InputField)GameObject.Find("KInputField").GetComponent(typeof(InputField));

        changeKValue.onClick.AddListener(() => Dataset.ChangeKValue(kInput.text));

        Button changeKnnWeight = GameObject.Find("ChangeWeight").GetComponent <Button>();

        changeKnnWeight.onClick.AddListener(() => Knn.ChangeKnnState());

        Button changeKnnAlg = GameObject.Find("ChangeKnnAlg").GetComponent <Button>();

        changeKnnAlg.onClick.AddListener(() => Knn.ChangeKnnAlgorithm());

        GameObject.Find("CurrentK").GetComponent <Text>().text        = "K = " + Dataset.K.ToString();
        GameObject.Find("CurrentKnnState").GetComponent <Text>().text = "Weight =  " + Knn.currentState.ToString();
        GameObject.Find("CurrentKnnAlg").GetComponent <Text>().text   = "Algorithm =  " + Knn.currentAlg.ToString();

        CanvasGroup canvasGroupFeature = featureNameHolder.GetComponent <CanvasGroup>();

        canvasGroupFeature.interactable = false;
        canvasGroupFeature.alpha        = 0;

        CanvasGroup canvasGroupKNN = KNNSettings.GetComponent <CanvasGroup>();

        canvasGroupKNN.interactable = false;
        canvasGroupKNN.alpha        = 0;
    }