Пример #1
0
    /// <inheritdoc/>
    public void Duplicate(ObjectProperties objectProperties)
    {
        CubeProperties cubeProperties = (CubeProperties)objectProperties;

        this.color = cubeProperties.color;

        CubeUI cui = FindObjectOfType(typeof(CubeUI)) as CubeUI;

        cui.Setup(gameObject, this.color);
    }
Пример #2
0
    /// <inheritdoc/>
    public bool SetupSerialziedData(SerObjectProperties serData)
    {
        SerCubeProperties serCubeProperties = (SerCubeProperties)serData;

        this.color = serCubeProperties.color;

        CubeUI cui = FindObjectOfType(typeof(CubeUI)) as CubeUI;

        cui.Setup(gameObject, this.color);

        return(true);
    }
Пример #3
0
    /// <inheritdoc/>
    public void Display(GameObject content)
    {
        int childs = content.transform.childCount;

        for (int i = childs - 1; i >= 0; i--)
        {
            Destroy(content.transform.GetChild(i).gameObject);
        }

        GameObject g = Instantiate(ui);

        g.transform.SetParent(content.transform);
        g.transform.GetChild(1).GetComponent <Dropdown>().value = color;
        g.transform.GetChild(1).GetComponent <Dropdown>().onValueChanged.AddListener(delegate
        {
            CubeUI cui = FindObjectOfType(typeof(CubeUI)) as CubeUI;
            System.Reflection.MethodInfo mi = cui.GetType().GetMethod("onChange");
            mi.Invoke(cui, new object[] { g.transform.GetChild(1).GetComponent <Dropdown>() });
        });
        // Set the position of the rectangle.
        g.GetComponent <RectTransform>().localPosition = new Vector3(120, -60, 0);
    }
Пример #4
0
 private void Start()
 {
     _cubeUi = gameObject.transform.root.gameObject.GetComponent <CubeUI>();
 }