Exemplo n.º 1
0
        public override void onControlDropped(GuiControl control, string dropPoint)
        {
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            string     srcBtn = control["dragSourceControl"];
            GuiControl dstBtn = this;
            GuiControl stack  = this.getParent();

            // Not dropped on a valid Button.
            // Really this shouldnt happen since we are in a callback on our specialized
            // EPainterIconBtn namespace.

            if (stack != dstBtn.getParent() || stack != "EPainterStack".getID())
            {
                console.print("Not dropped on valid control");
                return;
            }
            // Dropped on the original control, no order change.
            // Simulate a click on the control, instead of a drag/drop.
            if (srcBtn == dstBtn)
            {
                dstBtn.call("performClick");
                return;
            }

            int dstIndex = stack.getObjectIndex(dstBtn);

            ETerrainEditor.reorderMaterial(stack.getObjectIndex(srcBtn), dstIndex);

            // select the button/material we just reordered.

            stack.getObject((uint)dstIndex).call("performClick");
        }