Exemple #1
0
    /// <summary>
    /// Create a new BE Variable based with name given in the variableNameInpu and set its value to 0
    /// </summary>
    public void CreateVariable()
    {
        variableNameInput = newVariablePanel.GetComponentInChildren <InputField>();

        string varName = variableNameInput.text.Replace(" ", "");

        if (varName != "")
        {
            InputField variableNameInput = newVariablePanel.GetComponentInChildren <InputField>();

            GameObject newVarWrapperPanel = Instantiate(Resources.Load(beController.templatePrefabsPath + "VariableWrapperPanel", typeof(GameObject)), newVariablePanel.parent) as GameObject;
            newVarWrapperPanel.transform.SetSiblingIndex(newVariablePanel.GetSiblingIndex() + 1);

            beController.SetVariable(variableNameInput.text, "0");
            GameObject newVar = Instantiate(newVariable, newVarWrapperPanel.transform);
            newVar.name = "OperationGetVariable";
            newVar.transform.GetChild(0).GetChild(0).GetComponent <InputField>().text = varName;
            newVar.transform.GetChild(0).GetChild(0).GetComponent <DynamicInputResize>().ExpandInputField();
            newVar.transform.SetSiblingIndex(1);
            CloseCreateVariablePanel();
        }
    }