예제 #1
0
 /**
  * Fills a given panel with a list of booleanTerm-objects.
  * If the List is empty, the panel is empty.
  * @param   panel           The panel in which to insert Textobjects with given boolean terms.
  * @param   booleanTerms    A list of boolean terms which then will be converted to text and added to a Textobject.
  */
 public static void FillTable(GameObject panel, List <KVHandler.BooleanTerm> booleanTerms)
 {
     panel.GetComponent <GridLayoutGroup>().constraintCount = 1;
     panel.GetComponent <GridLayoutGroup>().cellSize        = new Vector2(250, 50);
     foreach (Transform child in panel.transform)
     {
         Destroy(child.gameObject);
     }
     foreach (KVHandler.BooleanTerm booleanTerm in booleanTerms)
     {
         GameObject  temp          = AddTextToPanel(panel, booleanTerm.expression + " v", Color.black);
         UIClickable tempClickable = temp.AddComponent <UIClickable>();
         tempClickable._booleanTerm = booleanTerm;
     }
 }
예제 #2
0
    ////////////////////////////////////////////////////////////////////////////////////////////
    // Harvest Bool Input-Behaviour Methods

    public void SetElement(InputAction.CallbackContext context)
    {
        Ray        ray = _camera.go.GetComponent <Camera>().ScreenPointToRay(Mouse.current.position.ReadValue());
        RaycastHit hit;

        Physics.Raycast(ray, out hit);
        Vector2Int  temp          = _mainGrid.grid.GetCoordinate(hit.point);
        KVelement   selection     = hit.collider.gameObject.GetComponent <KVelement>();
        UIClickable tempClickable = hit.collider.gameObject.GetComponent <UIClickable>();

        if (temp.x >= 0)
        {
            if (selection != null)
            {
                AudioManager.instance.PlaySound(clips[1]);
                selection.SetSetting();
            }
        }
    }
예제 #3
0
    private void Testitest(InputAction.CallbackContext context)
    {
        //Set up the new Pointer Event
        PointerEventData     pointerData = new PointerEventData(EventSystem.current);
        List <RaycastResult> results     = new List <RaycastResult>();

        //Raycast using the Graphics Raycaster and mouse click position
        pointerData.position = Mouse.current.position.ReadValue();
        raycaster.Raycast(pointerData, results);

        //For every result returned, output the name of the GameObject on the Canvas hit by the Ray
        foreach (RaycastResult result in results)
        {
            UIClickable tempClickable = result.gameObject.GetComponent <UIClickable>();
            if (tempClickable)
            {
                _kVbooleanTerms.booleanTerms.Remove(tempClickable._booleanTerm);
                UITableFiller.FillTable(_kVPanel, _kVbooleanTerms.booleanTerms);
            }
        }
    }
예제 #4
0
 public void AddUIClickable(UIClickable ui)
 {
     clickables.Add(ui);
 }