Esempio n. 1
0
    protected override void OnInitialize()
    {
        Vector2 winSize = new Vector3( 312.0f, 265.0f );
        maxSize = winSize;
        minSize = winSize;        

        autoRepaintOnSceneChange = true;

        m_root = new Control();
        m_root.SetSize( 100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage );
        m_root.AddDecorator( new StackContent() );

        AddChild( m_root );

        // Input object field
        m_original = new ObjectField( typeof( GameObject ), true, null, "Original" );
        m_original.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_original.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_original.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_original );

        // Rotation pivot point
        m_pivot = new Vector3Field( Vector3.zero, "Pivot:" );
        m_pivot.SetHeight( 40.0f, Control.MetricsUnits.Pixel );
        m_pivot.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_pivot.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_pivot );

        // Transform control
        m_transform = new TransformControl();
        m_transform.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_transform.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_transform );

        // Count field
        m_count = new IntField( 1, "Duplicate Count:" );
        m_count.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_count.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_count.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_count );

        // Space field
        m_space = new EnumDropdown( Space.World, "Space:" );
        m_space.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_space.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_space.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_space );

        // Duplicate button
        m_duplicate = new Button( "Duplicate" );
        m_duplicate.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_duplicate.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_duplicate.Enabled = false;
        m_root.AddChild( m_duplicate );

        // Events
        m_original.ValueChange += m_original_ValueChange;
        m_count.ValueChange += m_count_ValueChange;
        m_duplicate.Clicked += m_duplicate_Clicked;

        SceneView.onSceneGUIDelegate += SceneViewGUI;
    }
Esempio n. 2
0
    protected override void OnInitialize()
    {
        Vector2 winSize = new Vector3(312.0f, 265.0f);

        maxSize = winSize;
        minSize = winSize;

        autoRepaintOnSceneChange = true;

        m_root = new Control();
        m_root.SetSize(100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage);
        m_root.AddDecorator(new StackContent());

        AddChild(m_root);

        // Input object field
        m_original = new ObjectField(typeof(GameObject), true, null, "Original");
        m_original.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_original.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_original.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_original);

        // Rotation pivot point
        m_pivot = new Vector3Field(Vector3.zero, "Pivot:");
        m_pivot.SetHeight(40.0f, Control.MetricsUnits.Pixel);
        m_pivot.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_pivot.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_pivot);

        // Transform control
        m_transform = new TransformControl();
        m_transform.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_transform.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_transform);

        // Count field
        m_count = new IntField(1, "Duplicate Count:");
        m_count.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_count.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_count.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_count);

        // Space field
        m_space = new EnumDropdown(Space.World, "Space:");
        m_space.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_space.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_space.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_space);

        // Duplicate button
        m_duplicate = new Button("Duplicate");
        m_duplicate.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_duplicate.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_duplicate.Enabled = false;
        m_root.AddChild(m_duplicate);

        // Events
        m_original.ValueChange += m_original_ValueChange;
        m_count.ValueChange    += m_count_ValueChange;
        m_duplicate.Clicked    += m_duplicate_Clicked;

        SceneView.onSceneGUIDelegate += SceneViewGUI;
    }