Example #1
0
    private IEnumerator loadXPHudPrefab(PrefabContentKey contentKey, string mascotName)
    {
        AssetRequest <GameObject> assetRequest = Content.LoadAsync(contentKey, mascotName);

        yield return(assetRequest);

        GameObject xpGO = UnityEngine.Object.Instantiate(assetRequest.Asset);

        xpGO.transform.SetParent(XpHudParentTransform, worldPositionStays: false);
        currentXpDisplay = xpGO.GetComponent <XPHudItem>();
        currentXpDisplay.LevelProgressImage.fillAmount = ProgressionService.GetMascotLevelPercentFromXP(currentMascotLevel);
        XPHudItem xPHudItem = currentXpDisplay;

        xPHudItem.IntroAnimationCompleteAction = (System.Action)Delegate.Combine(xPHudItem.IntroAnimationCompleteAction, new System.Action(OnXPIntroAnimationComplete));
        XPHudItem xPHudItem2 = currentXpDisplay;

        xPHudItem2.OutroAnimationCompleteAction = (System.Action)Delegate.Combine(xPHudItem2.OutroAnimationCompleteAction, new System.Action(OnXPOutroAnimationComplete));
        XPLayoutElement.preferredHeight         = 130f;
        showXPHud();
    }
Example #2
0
    public void OnXPOutroAnimationComplete()
    {
        state = XPHudState.closed;
        XPHudItem xPHudItem = currentXpDisplay;

        xPHudItem.IntroAnimationCompleteAction = (System.Action)Delegate.Remove(xPHudItem.IntroAnimationCompleteAction, new System.Action(OnXPIntroAnimationComplete));
        XPHudItem xPHudItem2 = currentXpDisplay;

        xPHudItem2.OutroAnimationCompleteAction = (System.Action)Delegate.Remove(xPHudItem2.OutroAnimationCompleteAction, new System.Action(OnXPOutroAnimationComplete));
        currentMascotName = null;
        UnityEngine.Object.Destroy(currentXpDisplay.gameObject);
        XPLayoutElement.preferredHeight = 0f;
        if (pendingXP.Count > 0)
        {
            onAddXP((RewardEvents.AddXP)pendingXP.Dequeue());
        }
        if (this.HudClosed != null)
        {
            this.HudClosed(base.gameObject);
        }
    }