Exemplo n.º 1
0
    void Start()
    {
        gc       = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        checkers = new List <IPropertyChecker>();
        //generate all checks
        checkers.Add(new PropertyCheckers.Identity());
        foreach (string property in gc.pieceInfo.properties.Keys)
        {
            foreach (string value in gc.pieceInfo.properties[property])
            {
                checkers.Add(new PropertyCheckers.PropertyHasValue(property, value));
            }
        }
        //TODO - piece specific properties e.g. face value etc.

        //generate the selectable list
        for (int i = 0; i < checkers.Count; i++)
        {
            IPropertyChecker check    = checkers[i];
            DropDownListItem listItem = Instantiate(listItemPrefab).GetComponent <DropDownListItem>();
            listItem.transform.SetParent(dropDownList);
            listItem.Init(this, check.ToString(), i);
        }

        /*
         * //add the negations of each property
         * for(int i = 0; i < checkers.Count; i++) {
         *      IPropertyChecker check = new PropertyCheckers.Not(checkers[i]);
         *      DropDownListItem listItem = Instantiate(listItemPrefab).GetComponent<DropDownListItem>();
         *      listItem.transform.SetParent(dropDownList);
         *      listItem.Init(this, check.ToString(), i);
         *
         * }
         */

        dropDownList.gameObject.SetActive(false);

        selectedItemIndex = -1;
    }