本帖最后由 U侠 于 2012-12-23 20:49 编辑
提示:安装quicktime
[code=javascript]var bg:Texture2D;
var movieBg:Texture2D;
var playBg:Texture2D;
var stopBg:Texture2D;
var arrowBg:Texture2D;
var stopStyle:GUIStyle;
var playStyle:GUIStyle;
var arrowStyle:GUIStyle;
var play=true;
var stop=false;
var pau=false;
var panel=false;
var panelRect:Rect;
//
var screen:GameObject;
var Yint;
var Yheight;
function Start(){
Yint=Screen.height;
Yheight=Screen.height;
panelRect=Rect(Screen.width/2-140,Yint,280,136);
};
function OnGUI () {
//================================================
panelRect=Rect(Screen.width/2-140,Yint,280,136);
GUI.BeginGroup(panelRect);
GUI.DrawTexture(Rect(0,0,280,136),bg);
//movie
GUI.DrawTexture(Rect(16,16,249,58),movieBg);
if(GUI.Toggle(Rect(23,26,30,30),stop,stopBg,stopStyle)){
stop=true;
screen.renderer.material.mainTexture.Stop();
screen.renderer.enabled=false;
play=false;
}else{
stop=false;
}
if(GUI.Toggle(Rect(118,28,30,30),play,playBg,playStyle)){
play=true;
screen.renderer.material.mainTexture.Play();
screen.renderer.enabled=true;
stop=false;
}else{
play=false;
}
//
if(play==false&&stop==false){
screen.renderer.material.mainTexture.Pause();
//pau=true;
};
GUI.EndGroup();
//========================================================
if(GUI.Button(Rect(Screen.width/2-13,Screen.height-18,35,18),arrowBg,arrowStyle)){
if(panel==false){
panel=true;
}else{
panel=false;
}
}
//panel motion
if(panel==true&&Yint>Yheight-136){
Yint-=(Yint-(Yheight-136))*0.1;
}
if(panel==false&&Yint<Yheight){
Yint+=(Yheight-Yint)*0.1;
}
}
[/code]
|