unity3D技术之gui.dragwindow 拖动窗口 -

发布时间 : 星期三 文章unity3D技术之gui.dragwindow 拖动窗口 -更新完毕开始阅读

parameters参数 position

the part of the window that can be dragged. this is clipped to the actual window. 能拖动窗口部分的位置,这是被修剪到实际窗口。 returns

rect- the rectangle the window is at. 返回 rect类型,窗口所在的矩形。 description描述

make a window draggable.

创建一个可拖动窗口。

insert a call to this function inside your window code to make a window draggable. 在你的窗口代码,插入调用到这个函数,来创建一个可拖动窗口。 c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publicrectwindowrect = newrect(20, 20, 120, 50); void ongui() {

windowrect =gui.window(0, windowrect, domywindow, \}

void domywindow(int windowid) {

gui.dragwindow(newrect(0, 0, 10000, 20)); } }

var windowrect :rect=rect(20, 20, 120, 50); function ongui () {

//注册一个窗口

windowrect =gui.window(0, windowrect, domywindow, \}

//创建窗口内容

function domywindow (windowid : int) {

//创建一个10000x20像素很长的矩形

//这样做可以你调整窗口大小而不用在修改这个值,20就是标题栏的高度,这个范围是可以拖动的

gui.dragwindow(rect(0,0, 10000, 20)); } · static functiondragwindow() : void description描述

if you want to have the entire window background to act as a drag area, use the version of dragwindow that takes no parameters and put it at the end of the window function.

如果你想将完整的窗口背景作为拖动区域,使用dragwindow不带参数的版本,放在窗口函数的末尾。

this will mean that any other controls will get precedence and the dragging will only be activated

if nothing else has mouse focus.

这将意味着,任何其他控件将会得到优先,拖动将仅在如果没有别的鼠标焦点被激活。 另见:dragwindow,bringwindowtofront,bringwindowtoback c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publicrectwindowrect = newrect(20, 20, 120, 50); void ongui() {

windowrect =gui.window(0, windowrect, domywindow, \}

void domywindow(int windowid) {

gui.button(newrect(10, 20, 100, 20), \gui.dragwindow(); } }

var windowrect :rect=rect(20, 20, 120, 50); function ongui () { //注册一个窗口

windowrect =gui.window(0, windowrect, domywindow, \}

// 制作窗口内容

function domywindow (windowid : int) {

gui.button(rect(10,20,100,20), \// insert a huge dragging area at the end.

// this gets clipped to the window (like all other controls) so you can never drag the window from outside it.

//在末尾插入一个很大的可拖动区域,这得到被修剪的窗口(像其他控件一样),因此你永远无法从外面拖动窗口。 gui.dragwindow(); *

联系合同范文客服:xxxxx#qq.com(#替换为@)