• 靠边伸缩菜单的做法(类似QQ,碰到就会伸出来)


    var LeftGroupToTop:int=60;
    var LeftGroupWidth:int=300;
    var LeftGroupHeight:int=700;
    var LeftGroupLabelWidth:int=30;
    private var MoveDistance =LeftGroupLabelWidth-LeftGroupWidth; 
    private var XPosition;
    private var StartPoint:float=MoveDistance;
     
     
    function Update(){
         //获取鼠标的x坐标位置
         XPosition=Input.mousePosition.x;
         if(XPosition<LeftGroupLabelWidth){
               OpenLeftGroup ();
         }
     
         if(XPosition>LeftGroupWidth){
               CloseLeftGroup();
         }
    }
     
    function OnGUI () { 
     
          GUI.Box(Rect(100,0,100,400),XPosition.ToString());//可以去掉,调试看效果用的
          GUI.Box(Rect(100,500,100,400),StartPoint.ToString());//可以去掉,调试看效果用的
      
      
          //下面是组里面的内容
          GUI.BeginGroup(Rect(StartPoint,LeftGroupToTop,LeftGroupWidth,LeftGroupHeight));
          GUI.Box(Rect(0,0,LeftGroupWidth,LeftGroupHeight),"");
          GUI.Box(Rect(LeftGroupWidth-   LeftGroupLabelWidth,0,LeftGroupLabelWidth,LeftGroupHeight),"qiyechaxun");
          GUI.EndGroup ();//组结束
    } 
     
     
    //控制菜单的伸出
    function OpenLeftGroup () { 
          if(StartPoint < 0.0) { 
                StartPoint +=1.0; 
                yield WaitForSeconds (2);
          } 
    }
    //控制菜单的收回
    function CloseLeftGroup () { 
          if(StartPoint >MoveDistance) { 
                StartPoint -=0.1; 
                yield WaitForSeconds (5);
          } 
    }
  • 相关阅读:
    SPOJ LCS2
    SPOJ NSUBSTR
    1977: [BeiJing2010组队]次小生成树 Tree
    2002: [Hnoi2010]Bounce 弹飞绵羊
    P3690 【模板】Link Cut Tree (动态树)
    P2093 [国家集训队]JZPFAR
    2648: SJY摆棋子
    HDU 2966 In case of failure
    bzoj 一些题目汇总
    BZOJ3653谈笑风生——可持久化线段树+dfs序
  • 原文地址:https://www.cnblogs.com/fm168/p/3038545.html
Copyright © 2020-2023  润新知