CapsApplication.DoUpdate C# (CSharp) Method

DoUpdate() protected method

protected DoUpdate ( ) : void
return void
    protected override void DoUpdate()
    {
        base.DoUpdate();

        if (GlobalVars.PurchaseSuc)
        {
            //UIWindowManager.Singleton.GetUIWindow<UIWait>().HideWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(GlobalVars.OnPurchaseFunc);        //设置完成后执行的函数
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseSucceed"));
            GlobalVars.PurchaseSuc = false;

            if (CapsConfig.EnableGA)
            {
                string StageString = "BuyCoinsStage" + GlobalVars.AvailabeStageCount;
                GA.API.Business.NewEvent("Buy" + GlobalVars.PurchasingItemName, "USD", GlobalVars.PurchasingItemPrice);             //记录购买金钱包
                GA.API.Design.NewEvent(StageString + ":Buy" + GlobalVars.PurchasingItemName);
            }

            int purchaseInTotal = PlayerPrefs.GetInt("PurchaseInTotal", 0);

            if (CapsConfig.EnableGA)
            {
                if (purchaseInTotal == 0)       //若第一次消费
                {
                    GA.API.Design.NewEvent("FirstBuyPlayTime" + ":" + GlobalVars.PurchasingItemName, GetPlayTime());                    //第一次购买时的游戏时间
                    GA.API.Design.NewEvent("FirstBuyStageCount" + ":" + GlobalVars.PurchasingItemName, GlobalVars.AvailabeStageCount);  //第一次购买时的关数
                }
            }

            PlayerPrefs.SetInt("PurchaseInTotal", purchaseInTotal + GlobalVars.PurchasingItemPrice);

            if (CapsApplication.Singleton.CurStateEnum == StateEnum.Game)
            {
                GameLogic.Singleton.ResumeGame();
            }
        }
        if (GlobalVars.PurchaseCancel)
        {
            GlobalVars.UsingItem = PurchasedItem.None;
            Debug.Log("Purchase Cancelled");

            //UIWindowManager.Singleton.GetUIWindow<UIWait>().HideWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseCancelled"));
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(GlobalVars.OnCancelFunc);        //设置完成后执行的函数
            GlobalVars.PurchaseCancel = false;

            if (CapsApplication.Singleton.CurStateEnum == StateEnum.Game)
            {
                GameLogic.Singleton.ResumeGame();
            }
        }
        if (GlobalVars.PurchaseFailed)
        {
            GlobalVars.UsingItem = PurchasedItem.None;
            //Debug.Log("Purchase Failed");
            //UIWindowManager.Singleton.GetUIWindow<UIWait>().HideWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().ShowWindow();
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetString(Localization.instance.Get("PurchaseFailed"));
            UIWindowManager.Singleton.GetUIWindow<UIMessageBox>().SetFunc(GlobalVars.OnCancelFunc);        //设置完成后执行的函数
            GlobalVars.PurchaseFailed = false;

            if (CapsApplication.Singleton.CurStateEnum == StateEnum.Game)
            {
                GameLogic.Singleton.ResumeGame();
            }
        }
    }