Beispiel #1
0
 private void Awake()
 {
     boxsLayout = transform.Find("BoxsLayout");
     scanline   = Camera.main.GetComponent <ScanningLine>();
     Instance   = this;
     bubble     = GameObject.Find("Player").transform.Find("bubble").gameObject;
 }
Beispiel #2
0
    public void UpdateFunctionsList()
    {
        //Search for a list of functions
        FunctionNames.Clear();
        foreach (string ScanningLine in Lines)
        {
            if (ScanningLine.Replace("\t", string.Empty).StartsWith("void ") || ScanningLine.Replace("\t", string.Empty).StartsWith("func ") || ScanningLine.Replace("\t", string.Empty).StartsWith("FuncList ") && ScanningLine.EndsWith(" {"))
            {
                FunctionNames.Add(ScanningLine.Replace("void ", string.Empty).Replace("func ", string.Empty).Replace("FuncList ", string.Empty).Replace(" {", string.Empty).Replace("\t", string.Empty));
            }
        }

        //Delete Existing Objects
        if (FunctionObjects != null)
        {
            for (int o = 0; o < CanvasPos.childCount; o++)
            {
                Destroy(CanvasPos.GetChild(o).gameObject);
            }
        }
        FunctionObjects.Clear();

        //Creating new ones (Yay!)
        for (int i = 0; i < FunctionNames.Count; i++)
        {
            GameObject CObject = (GameObject)Instantiate(TextPrefab, CanvasPos.position - (Vector3.up * i * DistanceBettweenBlocks), Quaternion.identity);
            CObject.transform.parent = CanvasPos;
            CObject.transform.GetChild(0).GetComponent <Text>().text = FunctionNames.ToArray()[i];

            CObject.GetComponent <Button>().onClick.AddListener(() => {
                ReadFunction(CObject.transform.GetChild(0).GetComponent <Text>().text);
            });

            FunctionObjects.Add(CObject);
        }
    }