The method of scaling the menu by the side (like QQ, it will be stretched out when it comes to it)

Source: Internet
Author: User

This section script mainly implements the scaling of A group function . The content in the group, that is, the menu content, can be freely added.

VaR leftgrouptotop: Int = 60; var leftgroupwidth: Int = 300; var weight: Int = 700; var leftgrouplabelwidth: Int = 30; private var movedistance = leftgrouplabelwidth-leftgroupwidth; private var xposition; private var startpoint: Float = movedistance; function Update () {// obtain the X coordinate position of the mouse, xposition = input. mouseposition. x; If (xposition <leftgrouplabelwidth) {openleftgroup ();} If (xposition> leftgroupwidth) {closeleftgroup () ;}} function ongui () {GUI. box (rect (100,400, 0,), xposition. tostring (); // you can remove it and debug the GUI for the effect. box (rect (100,500,100,400), startpoint. tostring (); // can be removed. for debugging, see the effect. // The following figure shows the content GUI in the group. begingroup (rect (startpoint, leftgrouptotop, leftgroupwidth, leftgroupheight); GUI. box (rect (0, 0, leftgroupwidth, leftgroupheight), ""); GUI. box (rect (leftgroupwidth-leftgrouplabelwidth, 0, leftgrouplabelwidth, leftgroupheight), "qiyechaxun"); GUI. endgroup (); // group end} // extended function openleftgroup () {If (startpoint <0.0) {startpoint + = 1.0; yield waitforseconds (2);} of the control menu );}} // function closeleftgroup () {If (startpoint> movedistance) {startpoint-= 0.1; yield waitforseconds (5 );}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.