コード例 #1
0
    //Pushes new activity on top of current one.
    public void PushActivity(ManagerActivities newAcitivty, bool HidePanel = false)
    {
        //Hack to hide the panel if requested.
        if (HidePanel)
        {
            Panel.SetActive(false);
        }

        //New activity is indexed and grabbed.
        FUIActivity activty = Activities[(int)newAcitivty];

        //Grab the current activity;
        FUIActivity curActivity = currentAcitivty;

        //Deactivitate current activity.
        if (curActivity != null)
        {
            curActivity.ActivityOff();
            //_activityQue.Pop();
        }


        //Activate the new activity.
        activty.ActivityOn();

        //push the new activity.
        _activityQue.Push(activty);

        //Push the audio of the activitiy
        PushAudio();

        //Play audio sound
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Open);
    }
コード例 #2
0
    //Pops the current activity and returns it.
    public FUIActivity PopActivity(bool forceShow = false)
    {
        //Little hack to hide panel.
        if (!Panel.activeSelf && forceShow)
        {
            Panel.SetActive(true);
        }

        if (_activityQue.Count == 0)
        {
            return(null);
        }

        //Grab the acivity at the top.
        FUIActivity curActivity = _activityQue.Pop() as FUIActivity;

        //We didnt have any activities to pop so we return null.
        if (curActivity == null)
        {
            return(null);
        }


        //deactivate the current activity and activate the new one.
        curActivity.ActivityOff();

        //Grab the now current activity now that this one has been popped..
        FUIActivity returnedActivity = currentAcitivty;

        //If we have one, then we activate.
        if (returnedActivity != null)
        {
            returnedActivity.ActivityOn();
        }

        //Play audio sound
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Close);

        return(curActivity);
    }