private void ShowIntersitital(string tag, Action callback, bool useBetweenLevelCounter, bool usePromoCounter, GameObject adBlockObject)
        {
            IAdsWrapperInterface wrapper = Wrapper;
            bool adStarted = false;

            if (Enabled && wrapper != null)
            {
                if (useBetweenLevelCounter)
                {
                    Manager.State.IncreaseInterstitialCounter();
                }

                bool allowed = true;

                if (useBetweenLevelCounter)
                {
                    allowed = CanDisplayBetweenLevelAd;

                    if (allowed)
                    {
                        Manager.State.ResetInterstitialCounter();
                    }
                }

                if (usePromoCounter)
                {
                    allowed = CanDisplayPromo;

                    if (allowed)
                    {
                        Manager.State.RegisterPromoDisplay();
                    }
                }

                if (allowed)
                {
                    if (adBlockObject != null)
                    {
                        _adBlockObject = adBlockObject;
                        _adBlockObject.SetActive(true);
                    }

                    adStarted = true;
                    _interstitialClosedCallback = callback;
                    EventManager.SendEvent(IDs.Events.DisableMusicDuringAd);
                                        #if UNITY_EDITOR
                    DelayedCall.Create(OnInterstitialClosed, 2f);
                                        #else
                    wrapper.ShowIntersitital(tag);
                                        #endif
                }
            }

            if (!adStarted && callback != null)
            {
                callback();
            }

            callback = null;
        }
        public void ShowRewardedVideo(string tag, Action callback, Action <int> rewardCallback, int productID)
        {
            IAdsWrapperInterface wrapper = Wrapper;
            bool adStarted = false;

            if (wrapper != null)
            {
                adStarted = true;
                _interstitialClosedCallback = callback;
                _rewardCallback             = rewardCallback;
                _rewardProductID            = productID;

                LogRewardAnalytics("start", tag);

                EventManager.SendEvent(IDs.Events.DisableMusicDuringAd);
                                #if UNITY_EDITOR
                DelayedCall.Create(OnGrantReward, 2f);
                                #else
                wrapper.ShowRewardedVideo(tag);
                                #endif
            }

            if (!adStarted && callback != null)
            {
                callback();
            }

            callback       = null;
            rewardCallback = null;
        }
Exemple #3
0
 private void InitializeComponent()
 {
     hideCursorTimer = DelayedCall.Create(HideCursor, 2000);
     if (!DesignMode)
     {
         Application.AddMessageFilter(this);
     }
 }
Exemple #4
0
 public ProjectFile(Project project)
 {
     Project = project;
     if (project.HasBaseline)
     {
         CompressedResultSizeBaseline = CompressedResultSize;
     }
     compileDc = DelayedCall.Create(async() => await Compile(true), 500);
 }
Exemple #5
0
 public void RequestNotificationsPermission(float delay = 0f)
 {
     if (delay <= 0)
     {
         RequestNotifications();
     }
     else
     {
         DelayedCall.Create(RequestNotifications, delay, true, true, "Request Push Notifications");
     }
 }
        private static void TextBox_GotFocus(object sender, EventArgs args)
        {
            TextBox textBox = sender as TextBox;

            if (textBox != null)
            {
                DelayedCall dc = DelayedCall <TextBox> .Create(TextBoxUpdateBinding, textBox, GetUpdateDelay(textBox));

                textBox.SetValue(UpdateDelayCallProperty, dc);
            }
        }
        public DateTimeWindow()
        {
            InitializeComponent();
            this.HideIcon();

            foreach (string cultureName in MainViewModel.Instance.LoadedCultureNames)
            {
                CultureInfo ci = new CultureInfo(cultureName);
                CulturesList.Items.Add(new ValueViewModel <string>(ci.DisplayName, cultureName));
            }

            timerDc = DelayedCall.Create(UpdateView, 1000);
        }
        public MainWindow()
        {
            Instance = this;

            InitializeComponent();

            Width  = 1000;
            Height = 500;
            SettingsHelper.BindWindowState(this, App.Settings.MainWindowState);

            logItemsScrollPixelDc = DelayedCall.Create(() => { logItemsHostPanel.ScrollToPixel = true; }, 600);
            updateScrollmapDc     = DelayedCall.Create(UpdateScrollmap, 100);

            App.Settings.OnPropertyChanged(s => s.ShowWarningsErrorsInScrollBar, () => InvalidateScrollmap(false));
            App.Settings.OnPropertyChanged(s => s.ShowSelectionInScrollBar, () => InvalidateScrollmap(false));
        }
Exemple #9
0
        public EasyForm()
        {
            renderPageDc = DelayedCall.Create(RenderPdfPage, 200);

            InitializeComponent();

            FillCertificatesList();
            ValidateUIState();

            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                InputFileText.Text = args[1];
                ValidateInputFile();
            }
        }
        public void TriggerExpandCollapse()
        {
            if (_buttonItems.Count == 0)
            {
                return;
            }

            _expandSize = 2;             // corresponds to the padding

            foreach (PreferencesButtonItem val in _buttonItems)
            {
                _expandSize += val.Height;
            }

            if (_isExpandable)
            {
                if (_isExpanded)
                {
                    if (_dcExpand != null)
                    {
                        _dcExpand.Cancel();
                        _dcExpand.Dispose();
                        _dcExpand = null;
                    }

                    OnCollapsing();
                    _dcCollapse = DelayedCall.Create(CollapseButton, 1);
                    _dcCollapse.Start();
                }
                else
                {
                    if (_dcCollapse != null)
                    {
                        _dcCollapse.Cancel();
                        _dcCollapse.Dispose();
                        _dcCollapse = null;
                    }

                    OnExpanding();
                    UpdateItems(true);
                    _isExpanded = true;
                    _dcExpand   = DelayedCall.Create(ExpandButton, 1);
                    _dcExpand.Start();
                }
            }
        }
        /// <summary>
        /// Call this at the beginning of the scene to fade in.
        /// </summary>
        /// <param name="fadeScreen">Fade screen.</param>
        public void UseFadeScreen(Animator fadeScreen, float delay = 0f, string fadeInTrigger = null, string fadeOutTrigger = null)
        {
            if (fadeScreen)
            {
                if (fadeInTrigger != null)
                {
                    FadeInTrigger = Animator.StringToHash(fadeInTrigger);
                }
                else
                {
                    FadeInTrigger = Animator.StringToHash("FadeIn");
                }

                if (fadeOutTrigger != null)
                {
                    FadeOutTrigger = Animator.StringToHash(fadeOutTrigger);
                }
                else
                {
                    FadeOutTrigger = Animator.StringToHash("FadeOut");
                }

                _fadeScreen = fadeScreen;

                if (delay > 0)
                {
                    DelayedCall.Create(UseFadeScreen, delay, false);
                }
                else
                {
                    UseFadeScreen();
                }
            }
            else
            {
                _fadeScreen = null;
            }
        }