Inheritance: MonoBehaviour
コード例 #1
0
    void Start()
    {
        textUI = GetComponent<Text>();
        countdownTimer = GetComponent<CountdownTimer>();

        StartFading(startSeconds);
    }
コード例 #2
0
	public ZombieState_Locked(Zombie z)
	{
		zombie = z;
		
		lockedTimer = new CountdownTimer();
		lockedTimer.Start (1.0f);
	}
コード例 #3
0
	void Start()
	{
		if (Timer == null) Timer = GetComponent<CountdownTimer>();
		if (Timer == null) 
		{
			enabled = false;
			return;
		}
		
		if (Target == null) Target = animation;
		if (Target == null) 
		{
			enabled = false;
			return;
		}
		
		cl = animation.GetClip(AnimationName);
		if (cl == null) 
		{
			Debug.LogError("Animation " + AnimationName + " not found on object");
			return;
		}
		
		if (!Blend)
		{
			animation.Play(AnimationName);
		}
		else
		{
			animation.Blend(AnimationName, BlendWeight, 0f);
		}
		
		st = animation[AnimationName];
		st.speed = 0;
	}
コード例 #4
0
	// Use this for initialization
	void Start () 
	{
		launch = GetComponent<LaunchRigidBody>();
		fireTimer = GetComponent<CountdownTimer>();
		overChargeTrigger = GetComponent<PercentEventTrigger>();
		
		overChargeTrigger.Trigger += HandleOverCharge;
	}
コード例 #5
0
 public void CountDownTimerConstructorTest()
 {
     TimeSpan time = new TimeSpan();
     TimeSpan interval = new TimeSpan();
     CountdownTimer target = new CountdownTimer(time, interval);
     Assert.IsNotNull(target);
     Assert.IsInstanceOfType(target, typeof(CountdownTimer));
 }
コード例 #6
0
ファイル: VersusScreen.cs プロジェクト: lodossDev/xnamugen
 public VersusScreen(MenuSystem screensystem, TextSection textsection, String spritepath, String animationpath, String soundpath)
     : base(screensystem, textsection, spritepath, animationpath, soundpath)
 {
     m_visibletime = textsection.GetAttribute<Int32>("time");
     m_p1 = new VersusData("p1.", textsection);
     m_p2 = new VersusData("p2.", textsection);
     m_timer = new CountdownTimer(TimeSpan.FromSeconds(m_visibletime / 60.0f), this.ShowTimeComplete);
 }
コード例 #7
0
    public PlayerState_Normal(Player p)
    {
        player = p;

        rigidbody = player.GetComponent<Rigidbody2D> ();
        fireDelayTimer = new CountdownTimer();
        fireArm = player.gameObject.GetComponentInChildren<FireArm>();
        animator = player.GetComponent<Animator>();
    }
コード例 #8
0
        public void DispatcherTimerOnTickTest()
        {
            CountdownTimer timer = new CountdownTimer(new TimeSpan(0, 0, 0, 5), new TimeSpan(0, 0, 0, 1));
            PrivateObject privateObject = new PrivateObject(timer);

            Assert.AreEqual(new TimeSpan(0, 0, 0, 5), (TimeSpan)privateObject.GetField("_startTime"));
            privateObject.Invoke("DispatcherTimerOnTick", new object[] {null,null});

            Assert.AreEqual(new TimeSpan(0, 0, 0, 4), (TimeSpan)privateObject.GetField("_startTime"));
        }
コード例 #9
0
 void Start()
 {
     countdownTimer = GameObject
                      .Find("TimeLabel")
                      .GetComponent<CountdownTimer>();
     escapeCamera = GameObject
                    .Find("EscapeMenu")
                    .camera;
     isPlaying = true;
 }
コード例 #10
0
    //---------------------------------
    void Start()
    {
        // get reference to our screen text object & our scripted timer object
        textUI = GetComponent<Text>();
        countdownTimer = GetComponent<CountdownTimer>();

        // let's start fading that on screen text ...

        StartFading(startSeconds);
    }
コード例 #11
0
    void Start()
    {
        spawnTimer = new CountdownTimer();
        spawnTimer.Start (spawnTime);

        decrementTimer = new CountdownTimer();
        decrementTimer.Start (decrementTime);

        decrementTimeIncreaseTimer = new CountdownTimer();
        decrementTimeIncreaseTimer.Start (decrementTimeIncreaseTime);

        random = new System.Random();
    }
コード例 #12
0
ファイル: FadeAway.cs プロジェクト: LastGhost/UGUICoreUI
    void Start()
    {
        _textUI = GetComponent<Text> ();
        _countdownTimer = GetComponent<CountdownTimer> ();

        if(_textUI == null || _countdownTimer == null){

            Debug.LogError ("Error , Can'n found the Text or CountdownTimer");

            return;
        }

        StartFading (_fadeDuration);
    }
コード例 #13
0
        public void EnterState()
        {
            /*game.gameTime.Start();
             *
             *          game.timerText.gameObject.SetActive(true);
             *          game.roundText.gameObject.SetActive(true);*/

            MinigamesUI.Timer.Play();


            anturaTimer            = new CountdownTimer(10);
            anturaTimer.onTimesUp += OnTimesUp;

            anturaTimer.Reset();
            anturaTimer.Start();
        }
コード例 #14
0
ファイル: LifeBar.cs プロジェクト: dmanning23/LifeBarBuddy
        public LifeBar(float maxHP, ContentManager content, string borderImage, string meterImage, string alphaMaskImage, Rectangle position) :
            base(position)
        {
            HealthClock    = new GameClock();
            HitTimer       = new CountdownTimer();
            HealTimer      = new CountdownTimer();
            NearDeathClock = new GameClock();

            MaxHP       = maxHP;
            CurrentHP   = 1f;
            HealthColor = new List <Color> {
                new Color(100, 0, 0), new Color(180, 0, 0)
            };
            DepletedHealthColor = new Color(0.5f, 0.5f, 0.5f);
            HitHealthColor      = new List <Color> {
                Color.DarkRed, Color.HotPink
            };
            HitDepletedHealthColor = new List <Color> {
                new Color(0f, 0f, 0f, 0.5f), Color.Yellow
            };
            HitHealthColorSpeed         = 5f;
            HitHealthDepletedColorSpeed = 7f;
            HealthColorSpeed            = 0.75f;
            HitTimeDelta                  = 0.8f;
            HitShakeSpeed                 = 30f;
            HitHealthScaleAmount          = 0.06f;
            HitHealthOffsetAmount         = 3f;
            HitDepletedHealthScaleAmount  = 0.1f;
            HitDepletedHealthOffsetAmount = 5f;
            HealColor = new List <Color> {
                Color.Green, Color.LightGreen
            };
            HealingColor = new List <Color> {
                Color.DarkGreen, Color.Green
            };
            HealTimeDelta       = 1f;
            HealScaleAmount     = 0.04f;
            HealPulsateSpeed    = 20f;
            HealColorSpeed      = 5f;
            NearDeathPercentage = .2f;
            NearDeathColorSpeed = 10f;
            NearDeathColors     = new List <Color> {
                Color.Red, new Color(0.4f, 0f, 0f)
            };

            LoadContent(content, new Filename(borderImage), new Filename(meterImage), new Filename(alphaMaskImage));
        }
コード例 #15
0
        protected Vector2 LerpScale(CountdownTimer currentTime, float size, Rectangle rect)
        {
            var scale = GetLerpScale(currentTime, size);

            //which side needs to pulsate less?
            if (rect.Height < rect.Width)
            {
                var aspect    = ((float)rect.Height / (float)rect.Width);
                var halfScale = GetLerpScale(currentTime, 1 + (size * aspect));
                return(new Vector2(halfScale, scale));
            }
            else
            {
                var halfScale = GetLerpScale(currentTime, size * (rect.Width / rect.Height));
                return(new Vector2(scale, halfScale));
            }
        }
コード例 #16
0
        void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Debug.LogError("RaceManager has already been created.");
            }

            stopwatch = GetComponent <Stopwatch>();

            countdownTimer = GetComponent <CountdownTimer>();

            countdownTimer.AddTimerFinishedListener(CountdownTimerFinished);
        }
コード例 #17
0
        public async Task CountdownTimer_Abort_StopsCountdown()
        {
            // Arrange
            var    timer    = new CountdownTimer("Test timer", Logger);
            var    timeout  = TimeSpan.FromMilliseconds(10);
            int    called   = 0;
            Action callback = () => called++;

            timer.Start(timeout, callback);

            // Act
            timer.Abort();
            await Task.Delay(50);

            // Assert
            called.Should().Be(0);
        }
コード例 #18
0
    public void Initialize(Troop troop)
    {
        countdown = GetComponent <CountdownTimer>();

        this.troop              = troop;
        troopNameText.text      = troop.troopName;
        troopImg.sprite         = troop.troopSprite;
        troopImg.preserveAspect = true;

        timerBar.fillAmount = 0.0f;

        timerContainer.SetActive(false);

        switch (troop.troopType)
        {
        case Troop.TroopType.Infantry:
            haveTrainedAmountText.text = "Trained: " + MilitaryManager.Instance.infantryAmount;
            break;

        case Troop.TroopType.Cavalry:
            haveTrainedAmountText.text = "Trained: " + MilitaryManager.Instance.cavalryAmount;
            break;

        case Troop.TroopType.Spear:
            haveTrainedAmountText.text = "Trained: " + MilitaryManager.Instance.spearAmount;
            break;

        case Troop.TroopType.Archer:
            haveTrainedAmountText.text = "Trained: " + MilitaryManager.Instance.archerAmount;
            break;

        case Troop.TroopType.Magic:
            haveTrainedAmountText.text = "Trained: " + MilitaryManager.Instance.mageAmount;
            break;

        default:
            break;
        }

        if (troop.availabilityState == Troop.AvailabilityState.Locked)
        {
            //troopImg.color = Color.grey;
            trainButton.interactable    = false;
            GameEvents.OnTroopUnlocked += UnlockedTroop;
        }
    }
コード例 #19
0
    void Awake()
    {
        // populate moduleMapping
        nameToIndexMapping = new Dictionary <string, int>();
        for (int i = 0; i < itemManager.itemPrefabs.Length; ++i)
        {
            SwarmItemManager.PrefabItem current = itemManager.itemPrefabs[i];
            nameToIndexMapping[current.prefab.name] = i;
        }

        StartCoroutine(Preload());

        if (!(pruneDataList == null || pruneDataList.Length == 0))
        {
            pruneTimer = new CountdownTimer(pruneIntervalTime);
        }
    }
コード例 #20
0
        public override void Start()
        {
            base.Start();

            Boss.Speed       = 500f;
            _newPositionTime = TimeSpan.Zero;

            _shootBulletTimer = new CountdownTimer(1);

            _shootBulletTimer.Completed += (sender, args) =>
            {
                Boss.Game.GameManager.MoverManager.TriggerPattern("XmasSnowflake/pattern1", BulletType.Type2, false, Boss.Position());
                _shootBulletTimer.Restart();
            };

            Boss.CurrentAnimator.Play("Idle");
        }
コード例 #21
0
        public CountdownPage(CountdownTimer timer)
        {
            InitializeComponent();

            _timer = timer;
            _timer.SetUpdateAction(span => Dispatcher.Invoke(() => _updateTime(span)));
            // TODO: Reset color here....
            _timer.SetOnStoppedAction(() => Dispatcher.Invoke(() => {
                StartBtn.Content = "Start";
                _changeTimerColor(_foreColor);
            }));
            _timer.SetOnFinishedAction(() => _changeTimerColor(_warningColor));
            _timer.AutoStop = false;
            StartBtn.Click += (sender, e) => _startTimer();
            ResetBtn.Click += (sender, e) => _ResetTimer();
            SettingsChanged();
        }
コード例 #22
0
        /// <summary>
        ///     Instructs Chrome to close
        /// </summary>
        /// <param name="countdownTimer">
        ///     If a <see cref="CountdownTimer" /> is set then
        ///     the method will raise an <see cref="ConversionTimedOutException" /> in the
        ///     <see cref="CountdownTimer" /> reaches zero before Chrome response that it is going to close
        /// </param>
        /// <exception cref="ChromeException">Raised when an error is returned by Chrome</exception>
        public void Close(CountdownTimer countdownTimer = null)
        {
            var message = new Message {
                Method = "Target.closeTarget"
            };

            message.AddParameter("targetId", _pageConnection.TargetId);

            if (countdownTimer != null)
            {
                _pageConnection.SendAsync(message).Timeout(countdownTimer.MillisecondsLeft).GetAwaiter();
            }
            else
            {
                _pageConnection.SendAsync(message).GetAwaiter();
            }
        }
コード例 #23
0
    public void UpdateAerialState(CountdownTimer jumpResponseCountdownTimer, bool jumpButtonDown, bool jumpButtonUp)
    {
        jumpResponseCountdownTimer.Tick(Time.deltaTime);

        float finalJumpHeight = JumpHeight * (1 - (PlayerItemSlot != null ? PlayerItemSlot.JumpPenaltyWhenPickedUp : 0f));

        //Skaczemy
        if (AerialState == AerialState.Grounded &&
            jumpButtonDown
            //Mozna wykonac drugi skok
            && jumpResponseCountdownTimer.Expired)
        {
            alreadyJumpedTwice = false;
            jumpCommand.Execute(anim);
            JumpSound?.Play();
            rigidBody.AddForce(Vector2.up * finalJumpHeight);
            jumpResponseCountdownTimer.Start();

            //Debug.Log($"{Time.time}: Jump:{rigidBody.velocity}");
        }
        else if (
            (AerialState == AerialState.FirstJump ||
             AerialState == AerialState.Falling) &&
            jumpButtonDown &&
            !alreadyJumpedTwice)
        {
            alreadyJumpedTwice = true;
            jumpCommand.Execute(anim);
            JumpSound?.Play();
            AerialState = AerialState.SecondJump;

            //przed skokiem wyzerowanie predkości wznoszenia, żeby drugi skok nie zwielokratniał bieżącej siły skoku
            rigidBody.velocity = new Vector2(rigidBody.velocity.x, 0);

            rigidBody.AddForce(Vector2.up * finalJumpHeight);
            jumpResponseCountdownTimer.Stop();

            //Debug.Log($"{Time.time}: Jump2:{rigidBody.velocity}");
        }
        //Wyladowal
        else if (AerialState == AerialState.Grounded)
        {
            jumpResponseCountdownTimer.Stop();
        }
    }
コード例 #24
0
ファイル: Program.cs プロジェクト: nikolajlauridsen/Stopwatch
        static void Main(string[] args)
        {
            Console.WriteLine("Creating timer");

            /*
             * CountdownTimer timer = new CountdownTimer(span =>
             * {
             *  Console.Write(span.ToString(@"hh\:mm\:ss") + "\r");
             * });
             */
            CountdownTimer timer = new CountdownTimer();

            Console.WriteLine("Starting timer");
            timer.Start(0, 0, 5);
            Console.WriteLine("Waiting...");
            int wait = 20;

            while (wait > 0)
            {
                if (!timer.Finished)
                {
                    Console.Write(timer.Remaining.ToString(@"hh\:mm\:ss") + "\r");
                }
                else
                {
                    Console.Write("-" + timer.Remaining.ToString(@"hh\:mm\:ss") + "\r");
                }
                Thread.Sleep(1000);
                wait--;
            }

            /*
             * Console.WriteLine("Pausing 2 seconds");
             * timer.Pause();
             * Thread.Sleep(2000);
             * timer.Start();
             * Console.WriteLine("Waiting again...");
             * while (timer.Running)
             * {
             *  Thread.Sleep(50);
             * }
             */
            Console.WriteLine("Done, press any key to exit");
            Console.ReadKey(true);
        }
コード例 #25
0
        private void Countdown()
        {
            TextValue.Opacity = 0;
            int x = Int32.Parse(CountdownText.Text) - 1;

            CountdownText.Text = x.ToString();
            if (x > 0)
            {
                CountdownTimer.Begin();
            }
            else
            {
                StartTimestamp = DateTime.Now;
                dt.Start();
                IsGameRunning = true;
                StartGame();
            }
        }
コード例 #26
0
        public void SetUp()
        {
            _fakeTimerFacade   = A.Fake <ITimerFacade>();
            _fakeSoundProvider = A.Fake <ISoundProvider>();

            _sut = new CountdownTimer(_fakeTimerFacade, _fakeSoundProvider)
            {
                Callback = Callback
            };

            _callBackList        = new List <TimeSpan>();
            _timerFacadeCallback = null;

            A.CallTo(() => _fakeTimerFacade.NewTimer(A <TimerCallback> .Ignored)).Invokes(a =>
            {
                _timerFacadeCallback = a.GetArgument <TimerCallback>(0);
            });
        }
コード例 #27
0
        public void finish_help_formats_default()
        {
            var scheduler = new TestScheduler();

            var plugin = new CountdownTimer(scheduler);

            var pl = new ParsedLine("!countdown", "Bob");

            IObservable <string> results = plugin.Evaluate(pl);

            ITestableObserver <string> obs = scheduler.Start(() => results);

            obs.Messages.First().Value.Value.Contains("System.String[]")
            .Should().BeFalse("the formatting of the default value shouldn't be System.String[]");

            obs.Messages.First().Value.Value.Contains("(Default: Finished!)")
            .Should().BeTrue();
        }
コード例 #28
0
        public async Task CancelTest()
        {
            int timerDurationInMs = 100;
            var timer             = CountdownTimer.StartNew(timerDurationInMs);
            await Task.Delay(10);

            timer.CancelTimer();
            await Assert.ThrowsAsync <TaskCanceledException>(async() => {
                await timer.timerTask;
            });

            var duration = timer.ElapsedMilliseconds;

            Assert.True(timerDurationInMs > timer.ElapsedMilliseconds);
            await Task.Delay(10); // Ensure the timer stopped

            Assert.Equal(duration, timer.ElapsedMilliseconds);
        }
コード例 #29
0
 public void StopAllButtons()
 {
     for (int i = 0; i < 3; i++)
     {
         moveButtons[i].enabled = false;
         try
         {
             moveButtons[i].GetComponent <AxisTouchButton>().enabled = false;
         }
         catch (Exception)
         {
             moveButtons[i].GetComponent <ButtonHandler>().Name = (isOpen) ? "Jump" : "Jum";
         }
     }
     storeButton.enabled = false;
     InventoryController.GetInventoryController().SetInteractible(false);
     CountdownTimer.getInstance().StopTimer();
 }
コード例 #30
0
        public void ZoomTo(float targetZoom, double time, Vector2?origin = null)
        {
            if (_targetingZoom)
            {
                return;
            }

            _initialZoom     = Zoom;
            _targetZoom      = targetZoom;
            _targetingZoom   = true;
            _targetZoomTimer = new CountdownTimer(time);
            _targetZoomTimer.Start();

            if (origin.HasValue)
            {
                Origin = origin.Value;
            }
        }
コード例 #31
0
ファイル: CoreUI.cs プロジェクト: yprovost/outwar-dca
        internal void ToggleAttack(bool on)
        {
            if (InvokeRequired)
            {
                Invoke(new ToggleHandler(ToggleAttack), on);
                return;
            }

            Toggle(!on);

            AttackingOn        = on;
            Globals.AttackMode = on;

            if (CountdownTimer != null && on)
            {
                CountdownTimer.Stop();
            }
        }
コード例 #32
0
        static void Main(string[] args)
        {
            Console.WriteLine("Pomodoro has been started at " + DateTime.Now.ToShortTimeString());

            var timer = new CountdownTimer(new TimeSpan(0, 25, 0));

            timer.Start();

            while (timer.IsRunning)
            {
                Console.WriteLine(timer.RemainingTime.ToString("mm\\:ss"));
                Thread.Sleep(1000);
            }
            Console.WriteLine("GONG!!!");

            Console.WriteLine("Pomodoro has been finished at " + DateTime.Now.ToShortTimeString());
            Console.WriteLine("Please write down what you have been working on and start another one.");
        }
コード例 #33
0
ファイル: HuntNodeUI.cs プロジェクト: LoekvandenBerg/-mmg
    public void Initialize(Hunt hunt)
    {
        countdown = GetComponent <CountdownTimer>();

        this.hunt  = hunt;
        huntReward = GetComponent <HuntReward>();
        rarity     = hunt.rarity;

        requiredTroopAmountText.text = string.Format("Needed: {0} {1}", hunt.neededArmyAmount, hunt.requiredTroopType.ToString());
        huntNameText.text            = hunt.huntName;

        if (hunt.availabilityState == Hunt.AvailabilityState.Locked)
        {
            huntImg.color              = Color.red;
            huntButton.interactable    = false;
            GameEvents.OnHuntUnlocked += UnlockedHunt;
        }
    }
コード例 #34
0
ファイル: Game.cs プロジェクト: Wizardo367/CityScape
    /// <summary>
    /// Initialises variables, called before Start().
    /// </summary>
    private void Awake()
    {
        // Initialise tax timer
        _gameTimer = new CountdownTimer {
            Seconds = 10f
        };
        _gameTimer.Begin();

        // Initialise map
        _map = gameObject.GetComponent <Map2D>();

        // Get audio sources
        _musicSource = transform.FindChild("Music").GetComponent <AudioSource>();
        _sfxSource   = transform.FindChild("SFX").GetComponent <AudioSource>();

        // Initialise the game
        InitGame();
    }
コード例 #35
0
ファイル: Map2D.cs プロジェクト: Wizardo367/CityScape
    /// <summary>
    /// Initialises this instance, called before Start().
    /// </summary>
    private void Awake()
    {
        // Set TimeScale | Bug Fix
        Time.timeScale = 1f;

        // Variable initialisation
        GroundTiles = new Tile[XSize, YSize];
        Buildings   = new List <Building>();
        Roads       = new List <Tile>();
        Decorations = new List <Tile>();

        _roadPathFinder = gameObject.GetComponent <RoadPathFinder>();
        _timer          = new CountdownTimer {
            Seconds = 5f
        };
        _timer.Begin();

        _game = GameObject.Find("Game").GetComponent <Game>();
    }
コード例 #36
0
        public void DispatcherTimerTest()
        {
            CountdownTimer timer = new CountdownTimer(new TimeSpan(0, 0, 0, 5), new TimeSpan(0, 0, 0, 1));
            PrivateObject privateObject = new PrivateObject(timer);

            Timer testTimer = new Timer(5001);

            testTimer.Elapsed += (sender, args) =>
                                {
                                    Assert.IsFalse((bool)privateObject.GetProperty("IsEnabled"));
                                    Assert.AreEqual(new TimeSpan(), (TimeSpan)privateObject.GetField("_startTime"));
                                };

            Assert.AreEqual(new TimeSpan(0, 0, 0, 5), (TimeSpan)privateObject.GetField("_startTime"));
            Assert.IsFalse((bool)privateObject.GetProperty("IsEnabled"));
            privateObject.Invoke("Start");
            Assert.IsTrue((bool)privateObject.GetProperty("IsEnabled"));
            testTimer.Start();
        }
コード例 #37
0
    private IEnumerator CTimer(float duration)
    {
        Blackboard.Instance.LevelManager.triggeredTimerTime.gameObject.SetActive(true);
        Blackboard.Instance.LevelManager.triggeredTimerTime.text = CountdownTimer.ToString("0");
        float value = 0;

        while (CountdownTimer > 0.0f)
        {
            CountdownTimer -= Time.deltaTime;
            Blackboard.Instance.LevelManager.triggeredTimerTime.text = CountdownTimer.ToString("0");
            value = CountdownTimer / countdownTime;
            fillImage.fillAmount = value;
            yield return(null);
        }

        Blackboard.Instance.LevelManager.EndLevelTimer();
        HasRun = true;
        Blackboard.Instance.LevelManager.Lose();
    }
コード例 #38
0
        public void DispatcherTimerTest()
        {
            CountdownTimer timer         = new CountdownTimer(new TimeSpan(0, 0, 0, 5), new TimeSpan(0, 0, 0, 1));
            PrivateObject  privateObject = new PrivateObject(timer);

            Timer testTimer = new Timer(5001);

            testTimer.Elapsed += (sender, args) =>
            {
                Assert.IsFalse((bool)privateObject.GetProperty("IsEnabled"));
                Assert.AreEqual(new TimeSpan(), (TimeSpan)privateObject.GetField("_startTime"));
            };

            Assert.AreEqual(new TimeSpan(0, 0, 0, 5), (TimeSpan)privateObject.GetField("_startTime"));
            Assert.IsFalse((bool)privateObject.GetProperty("IsEnabled"));
            privateObject.Invoke("Start");
            Assert.IsTrue((bool)privateObject.GetProperty("IsEnabled"));
            testTimer.Start();
        }
コード例 #39
0
        /// <summary>
        ///     Instructs Chrome to print the page
        /// </summary>
        /// <param name="pageSettings"><see cref="PageSettings" /></param>
        /// <param name="countdownTimer">If a <see cref="CountdownTimer"/> is set then
        /// the method will raise an <see cref="ConversionTimedOutException"/> in the
        /// <see cref="CountdownTimer"/> reaches zero before finishing the printing to pdf</param>
        /// <remarks>
        ///     See https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
        /// </remarks>
        /// <exception cref="ConversionException">Raised when Chrome returns an empty string</exception>
        /// <exception cref="ConversionTimedOutException">Raised when <paramref name="countdownTimer"/> reaches zero</exception>
        internal async Task <PrintToPdfResponse> PrintToPdf(
            PageSettings pageSettings,
            CountdownTimer countdownTimer = null)
        {
            var message = new Message {
                Method = "Page.printToPDF"
            };

            message.AddParameter("landscape", pageSettings.Landscape);
            message.AddParameter("displayHeaderFooter", pageSettings.DisplayHeaderFooter);
            message.AddParameter("printBackground", pageSettings.PrintBackground);
            message.AddParameter("scale", pageSettings.Scale);
            message.AddParameter("paperWidth", pageSettings.PaperWidth);
            message.AddParameter("paperHeight", pageSettings.PaperHeight);
            message.AddParameter("marginTop", pageSettings.MarginTop);
            message.AddParameter("marginBottom", pageSettings.MarginBottom);
            message.AddParameter("marginLeft", pageSettings.MarginLeft);
            message.AddParameter("marginRight", pageSettings.MarginRight);
            message.AddParameter("pageRanges", pageSettings.PageRanges ?? string.Empty);
            message.AddParameter("ignoreInvalidPageRanges", pageSettings.IgnoreInvalidPageRanges);
            if (!string.IsNullOrEmpty(pageSettings.HeaderTemplate))
            {
                message.AddParameter("headerTemplate", pageSettings.HeaderTemplate);
            }
            if (!string.IsNullOrEmpty(pageSettings.FooterTemplate))
            {
                message.AddParameter("footerTemplate", pageSettings.FooterTemplate);
            }
            message.AddParameter("preferCSSPageSize", pageSettings.PreferCSSPageSize);

            var result = countdownTimer == null
                ? await _pageConnection.SendAsync(message)
                : await _pageConnection.SendAsync(message).Timeout(countdownTimer.MillisecondsLeft);

            var printToPdfResponse = PrintToPdfResponse.FromJson(result);

            if (string.IsNullOrEmpty(printToPdfResponse.Result?.Data))
            {
                throw new ConversionException("Conversion failed");
            }

            return(printToPdfResponse);
        }
コード例 #40
0
 private void Game_Init()
 {
     Countdown--;
     if (Countdown == 0) // Если отсчет закончился
     {
         CountdownLabel.Text     = "GO";
         CountdownTimer.Interval = 500; // Ставим интервал 500 мсек на скрытие надписи "GO"
     }
     else if (Countdown == -1)          // Если прошли 500 мсек после окончания отсчета, то удаляем таймер и лейбл
     {
         CountdownLabel.Dispose();
         CountdownTimer.Dispose();
         Game_Start();
     }
     else
     {
         CountdownLabel.Text = Countdown.ToString();
     }
 }
コード例 #41
0
    public bool Initialization()
    {
        bool bNoError = true;

        if (mainScene == null)
        {
            mainScene = GameObject.Find("Main Game").GetComponent <MainScene>();
        }
        if (mainScene == null)
        {
            bNoError &= false;
        }

        enSubState = SubState.STATE_READY;

        mainScene.HideAllUI();
        mainScene.ShowUI(2);

        bFinisherState       = false;
        fStartDelayTime      = GameDatas.FLOAT_GAMESTART_DELAY_TIMER;
        fEndDelayTime        = 5.00f;
        startDelayImageShown = new bool[mainScene.sprite_startDelayGrp.Length];
        startDelayImageGrp   = new Sprite[mainScene.sprite_startDelayGrp.Length];
        for (int i = 0; i < mainScene.sprite_startDelayGrp.Length; ++i)
        {
            startDelayImageShown[i] = false;
            startDelayImageGrp[i]   = mainScene.sprite_startDelayGrp[i];
        }

        Transform uiTrans = mainScene.uiGrp[2].transform;

        mainTimer = uiTrans.FindChild("Game Timer Image").GetComponent <CountdownTimer>();
        mainTimer.timerText.ChangeAlpha(0.00f, 0.00f);
        mainTimer.timerText.ChangeAlpha(0.50f, 1.00f);
        mainTimer.fTimeLeft = GameDatas.FLOAT_NORMALPUNCH_TIMER;
        finisherImg         = uiTrans.FindChild("Finisher Image").GetComponent <TransImage>();
        finisherImg.ChangeAlpha(0.00f, 1.00f);
        finisherImg.ChangeScale(0.00f, 0.00f);

        startTimerImageTrans = uiTrans.FindChild("Start Timer Image");

        return(bNoError);
    }
コード例 #42
0
ファイル: FileWatcher.cs プロジェクト: xtuyaowu/xparser
        private void scareCrow_Changed(object sender, FileSystemEventArgs e)
        {
            string fileName = e.Name.ToLower();

            if (File.GetAttributes(e.FullPath) == FileAttributes.Directory)
            {
                return;
            }

            using (filesLock.Upgrade())
            {
                if (pendingFileReloads.Contains(fileName) || !ContainsFile(fileName))
                    return;

                pendingFileReloads.Add(fileName);
            }
            CountdownTimer timer = new CountdownTimer();
            timer.BeginCountdown(changeFileDelay, DelayedProcessFileChanged, fileName);
        }
コード例 #43
0
ファイル: PoolProvider.cs プロジェクト: cankarakuzulu/PTBTemp
        public void SetupNewPool <T>(PoolSettings settings) where T : MonoBehaviour, IPoolable
        {
            if (nextPoolIndex >= poolBuffer.Length)
            {
                throw new PoolException("[Pooler] Setup Pool: Max capacity Reached. Increase pooler size.");
            }
            var pool = new GenericPool <T>(settings);

            poolBuffer[nextPoolIndex]   = pool;
            prefabBuffer[nextPoolIndex] = settings.Prefab.GetHashCode();

            if (!isBackOffTimerRunning)
            {
                backoffTimer = new CountdownTimer("BackofftimerID", providerPoolRefreshTime, Domain.Enum.CountdownScope.Game, true, (id) => OnBackoffTimer(id), null);
                StartBackoffUpdateTimer();
                isBackOffTimerRunning = true;
            }
            nextPoolIndex++;
        }
コード例 #44
0
	public PlayerState_Locked(Player p)
	{
		player = p;
		lockedForCountdown = new CountdownTimer ();
		lockedForCountdown.Start (0.5f);
	}
コード例 #45
0
ファイル: FireArm.cs プロジェクト: David-Hanna/IvGGameJam
	void Awake () 
	{
		disappearTimer = new CountdownTimer();
		renderer = GetComponent<SpriteRenderer>();
		renderer.enabled = false;
	}
コード例 #46
0
ファイル: LevelTimer.cs プロジェクト: B00062217/GitTest
 private void Start()
 {
     myTimer = GetComponent<CountdownTimer>();
     myTimer.ResetTimer(levelTime);
 }
コード例 #47
0
	public override void Start()
	{
		base.Start();
		
		heldTimer = GetComponent<CountdownTimer>();
	}
コード例 #48
0
	void Start()
	{
		if (timer == null) timer = GetComponent<CountdownTimer>();
	}
コード例 #49
0
ファイル: PSMoveTimer.cs プロジェクト: ankit01217/Float-Me-Up
 public void AddTimer(float time, System.Action<object> callback, object param)
 {
     CountdownTimer timer = new CountdownTimer();
     timer.Start(time, TimesUp, null, null);
     timers[timer] = new CallbackStruct(callback, param);;
 }
コード例 #50
0
ファイル: PSMoveTimer.cs プロジェクト: ankit01217/Float-Me-Up
 private void TimesUp(CountdownTimer timer)
 {
     timers[timer].callback(timers[timer].param);
 }
コード例 #51
0
	void Start()
	{
		t = GetComponent<CountdownTimer>();
	}
コード例 #52
0
	void Start()
	{
		countdown = new CountdownTimer();
		countdown.SetTime(3.0f);
		countdown.BeginTimer();
	}
コード例 #53
0
    // Use this for initialization
    void Start()
    {
        win = false;
        gameover = false;

        // Fetch all lives UI object
        if (RefLifePanel)
        {
            var lives = RefLifePanel.GetComponentsInChildren<Transform>(true).ToList();
            lives.Remove(RefLifePanel.transform); // Removes panel object from the lives
            foreach (var life in lives)
            {
                refLives.Add(life.gameObject);
            }
        }

        // Fetch all bombs UI object
        if (RefBombPanel)
        {
            var bombs = RefBombPanel.GetComponentsInChildren<Transform>(true).ToList();
            bombs.Remove(RefBombPanel.transform); // Removes panel object from the lives
            foreach (var bomb in bombs)
            {
                refBombs.Add(bomb.gameObject);
            }
        }

        if (!overtimeTimer)
        {
            overtimeTimer = ScriptableObject.CreateInstance<CountdownTimer>();
        }
        overtimeTimer.Init(TimeTillOvertime, false);

        refreshUI();

        // Load map
        RefMap.Load("1");
    }
コード例 #54
0
 //----------------------------
 // get a reference to the CountdownTimer object that is a componet of our parent GameObject
 // and start that timer to countdown from the value in variable 'startSeconds'
 private void SetupTimer()
 {
     countdownTimer = GetComponent<CountdownTimer>();
     countdownTimer.ResetTimer(startSeconds);
 }
コード例 #55
0
        void Start()
        {
            CreatePlayers(disabledMaterial);
            timer = new CountdownTimer(countdownInSeconds);

            GameObjectFunctions.Find("player1", "ready").GetComponent<TextMesh>().text = "Start game";
            fader = ColorFader.Create(GameObject.Find("camera").GetComponent<Camera>());
        }
コード例 #56
0
 private void Start()
 {
     CountdownTimer = new CountdownTimer(SelectedTimerDuration);
       CountdownTimer.Start();
 }