1 usingSystem.Collections;2 usingSystem.Collections.Generic;3 usingUnityengine;4 5 Public classClick001:monobehaviour {6 Public BOOLWindowshow =false;7 PrivateRect rect =NewRect ( -, +, Max, Max);8 9 PublicRenderer rend;Ten One Public intfontSize; A PublicFontStyle FontStyle; - Publicrectoffset margin; - Publicrectoffset padding; the Publicfont font; - - - + voidStart () - { + //Get renderer Components Arend = getcomponent<renderer>(); at } - - - voidOngui () - { - in //Window ID window Size window callback (define in-window view) window caption - if(windowshow) to { +GUI.skin.window.font =font; -GUI.skin.window.fontStyle =FontStyle; theGUI.skin.window.fontSize =fontSize; *GUI.skin.window.margin =margin; $GUI.skin.window.padding =padding;Panax Notoginseng - if(Gameobject.tag = ="Pipe") the { +Gui. Window (0, Rect, Onwindowone,"Piping"); A } the Else if(Gameobject.tag = ="Stand") + { -Gui. Window (1, Rect, Onwindowone,"brackets"); $ } $ Else if(Gameobject.tag = ="Base") - { -Gui. Window (2, Rect, Onwindowone,"Base"); the } - Else if(Gameobject.tag = ="Valve")Wuyi { theGui. Window (3, Rect, Onwindowone,"Valve"); - } Wu } - About } $ - - voidOnwindowone (intwinId) - { A + theGUI.skin.label.font =font; -GUI.skin.label.fontStyle =FontStyle; $GUI.skin.label.fontSize =fontSize; theGUI.skin.label.margin =margin; theGUI.skin.label.padding =padding; the the if(Gameobject.tag = ="Pipe") - { inGui. Label (NewRect (Ten,Ten, $, +),"The current window is a pipe"); the } the Else if(Gameobject.tag = ="Stand") About { theGui. Label (NewRect (Ten,Ten, $, +),"The current window is a bracket"); the } the Else if(Gameobject.tag = ="Base") + { -Gui. Label (NewRect (Ten,Ten, $, +),"The current window is the Cradle"); the }Bayi Else if(Gameobject.tag = ="Valve") the { theGui. Label (NewRect (Ten,Ten, $, +),"The current window is the valve"); - } - theGUI.skin.button.font =font; the //GUI. Label (New Rect (10, 10, 140, 40), "Current Window ID is" + winId); the if(GUI. Button (NewRect (Ten, -, the, -),"Button 1")) the { -Debug.Log ("Current Window ID"+winId); the } the //define the scope of the form to be active This function does not know why it is not implemented the //GUI. Dragwindow (New Rect (0, 0, 10000, 10000));94 } the the voidOnMouseDown () the {98 if(windowshow) About { -Windowshow =false;101 }102 Else103 {104Windowshow =true; the }106 107 }108}
Unity3d GUI font settings