| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
-
- import gfx.controls.Button;
- import mx.transitions.easing.None;
- import mx.transitions.Tween;
- class NavigationMenu extends MovieClip
- {
- private var mcLogIn:Button;
- private var mcLogOut:Button;
- private var mcProfile:Button;
- private var mcFriends:Button;
- private var mcEmail:Button;
- private var mcClan:Button;
- private var mcExit:Button;
-
- private var mButtonAnimCt:Number;
- private var mButtons:Array; //store buttons in array for sequencial animation
-
- public function NavigationMenu()
- {
- mButtons = new Array;
- }
-
- public function onLoad()
- {
- mcLogIn.addEventListener("click", this, "OnClickedLogInButton");
- mcLogOut.addEventListener("click", this, "OnClickedLogoutButton");
- mcProfile.addEventListener("click", this, "OnClickedProfileButton");
- mcFriends.addEventListener("click", this, "OnClickedFriendsButton");
- mcEmail.addEventListener("click", this, "OnClickedEmailButton");
- mcClan.addEventListener("click", this, "OnClickedClanButton");
- mcExit.addEventListener("click", this, "OnClickedExitButton");
-
- mButtons.push( mcLogOut );
- mButtons.push( mcProfile );
- mButtons.push( mcFriends );
- mButtons.push( mcEmail );
- mButtons.push( mcClan );
- mButtons.push( mcExit );
- OnPlayerLoggedOut();
- }
-
- public function OnClickedLogInButton():Void
- {
- }
-
- public function OnClickedLogoutButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.GetScreen(ScreenID.LOGGED_IN)["f2c_Logoff"]();
- }
- }
-
- public function OnClickedProfileButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.ShowScreen( ScreenID.PROFILE );
- }
- }
-
- public function OnClickedFriendsButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.ShowScreen( ScreenID.FRIENDS );
- }
- }
-
- public function OnClickedEmailButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.ShowScreen( ScreenID.EMAIL );
- }
- }
-
- public function OnClickedClanButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.ShowScreen( ScreenID.CLAN_ROOT );
- }
- }
-
- public function OnClickedExitButton():Void
- {
- if ( LobbyInterface.Instance.IsLoggedIn() )
- {
- LobbyInterface.Instance.GetScreen(ScreenID.LOGGED_IN)["f2c_Logoff"]();
- }
- }
-
- private var mLastTime:Number;
- public function OnPlayerLoggedIn():Void
- {
- mButtonAnimCt = 0;
- onEnterFrame = PlayIntroAnimation;
- mLastTime = getTimer();
- /*
- mcLogIn.visible = false;
- mcLogOut.visible = true;
- mcProfile.visible = true;
- mcFriends.visible = true;
- mcClan.visible = true;
- mcEmail.visible = true;
- mcFriends.visible = true;
- mcExit.visible = true; */
- PlayIntroAnimation();
- }
-
- public function PlayIntroAnimation():Void
- {
- var now:Number = getTimer();
- var delta:Number = now - mLastTime;
- if ( delta > 100 )
- {
- mLastTime = now;
- //mButtons[mButtonAnimCt]._visible = true;
- new Tween( mButtons[mButtonAnimCt], "_alpha", None.easeNone, 0, 100, .5, true );
- // new Tween( this, "_alpha", None.easeNone, 0, 100, .5, true );
- mButtonAnimCt++;
- if ( mButtonAnimCt >= mButtons.length )
- {
- onEnterFrame = null;
- }
- }
- }
-
- public function OnPlayerLoggedOut():Void
- {
- /*mcLogOut._alpha = 0;
- mcProfile._alpha = 0;
- mcFriends._alpha = 0;
- mcClan._alpha = 0;
- mcEmail._alpha = 0;
- mcFriends._alpha = 0;
- mcExit._alpha = 0;*/
- for ( var i:Number = 0; i < mButtons.length; i++ )
- {
- new Tween( mButtons[i], "_alpha", None.easeNone, 100, 0, .4, true );
- }
- /* mcLogIn._alpha = true;
- mcLogOut.visible = false;
- mcProfile.visible = false;
- mcFriends.visible = false;
- mcClan.visible = false;
- mcEmail.visible = false;
- mcFriends.visible = false;
- mcExit.visible = false;*/
- }
- }
|