void Start()
        {
            // find the clock and level if not assigned
            if (timer == null)
            {
                timer = FindObjectOfType <ClockController> ();
            }
            if (level == null)
            {
                level = FindObjectOfType <TiledMap> ();
            }

            // get all replayables in this level, filtered by
            // enabled-ness, and sorted by name (using System.Linq)

            dynamics = level.GetComponentsInChildren <DynamicReplayer> ();
            dynamics = dynamics.Where(
                gameObject => gameObject.enabled).ToArray();
            dynamics = dynamics.OrderBy(
                gameObject => gameObject.name).ToArray();

            statics = level.GetComponentsInChildren <StaticReplayer> ();
            statics = statics.Where(
                gameObject => gameObject.enabled).ToArray();
            statics = statics.OrderBy(
                gameObject => gameObject.name).ToArray();
        }
예제 #2
0
        internal ImageAnimationController(Image image, ObjectAnimationUsingKeyFrames animation, bool autoStart)
        {
            _image = image;
            try
            {
                _animation            = animation;
                _animation.Completed += AnimationCompleted;
                _clock           = _animation.CreateClock();
                _clockController = _clock.Controller;
                _sourceDescriptor.AddValueChanged(image, ImageSourceChanged);

                // ReSharper disable once PossibleNullReferenceException
                _clockController.Pause();

                _image.ApplyAnimationClock(Image.SourceProperty, _clock);

                if (autoStart)
                {
                    _clockController.Resume();
                }
            }
            catch (Exception)
            {
            }
        }
예제 #3
0
        public Controller()
        {
            this._updateTimer           = new Timer();
            this._updateTimer.Interval  = 100;
            this._updateTimer.AutoReset = false;
            this._updateTimer.Elapsed  += _updateTimer_Elapsed;


            //  Initilize the AlarmItemCollection
            this.AlarmItemCollection     = new ObservableCollection <AlarmItem>(new AlarmItemRepository().GetAlarmItems());
            this.AlarmScheduleCollection = new ObservableCollection <Models.AlarmSchedule>((new AlarmScheduleRepository()).GetAlarmSchedules());

            //  Initilize the Eorzea Clock
            this.EorzeaClock = new ClockController();


            //  Initilize the sound player
            _waveOutDevice = new WaveOut();

            //  Initilize the text-to-speech object
            _synth = new SpeechSynthesizer();

            Controller.Master = this;



            this._updateTimer.Start();
        }
        /// Apply frame n's information to these replayer objects
        /// so that they match the frame
        public void ApplyFrame(ClockController timer,
                               DynamicReplayer[] dynamics, StaticReplayer[] statics)
        {
            // spin up to the frame right before the current time

            float currentTime = timer.GetTime();

            while (frames[head].time <= currentTime)
            {
                head++;
                if (head >= frames.Count)
                {
                    // we've reached the end of the recording, and should
                    // return the last frame
                    head--;
                    break;
                }
            }

            // that makes frames[head] the first frame before (or at) the
            // current time

            // if this frame hasn't been rendered yet, we should play it

            if (head > prev)
            {
                frames[head].Apply(dynamics, statics);
                prev = head;
            }
        }
        void Start()
        {
            // find the clock and level if not assigned
            if (timer == null)
            {
                timer = FindObjectOfType <ClockController> ();
            }
            if (level == null)
            {
                level = FindObjectOfType <TiledMap> ();
            }

            // calculate fps

            fps = (int)(1 / (fixedUpdatesPerFrame * Time.fixedDeltaTime));


            // get all recordables in this level, filtered by
            // enabled-ness, and sorted by name (using System.Linq)

            dynamics = level.GetComponentsInChildren <DynamicRecorder> ();
            dynamics = dynamics.Where(
                gameObject => gameObject.enabled).ToArray();
            dynamics = dynamics.OrderBy(
                gameObject => gameObject.name).ToArray();

            statics = level.GetComponentsInChildren <StaticRecorder> ();
            statics = statics.Where(
                gameObject => gameObject.enabled).ToArray();
            statics = statics.OrderBy(
                gameObject => gameObject.name).ToArray();
        }
예제 #6
0
 private void Start()
 {
     clock   = ClockController.instance;
     journal = JournalController.instance;
     game    = GameManager.instance;
     anim    = GetComponent <Animator>();
     sprite  = GetComponent <SpriteRenderer>();
 }
예제 #7
0
 void Start()
 {
     hour     = 4f;
     minute   = 20f;
     second   = 0f;
     instance = this;
     //pointerHour.transform.
 }
예제 #8
0
 private void InitializeControllerInstances()
 {
     this.ScoreController      = ScoreboardBLL.ScoreController.GetScoreController();
     this.FoulController       = ScoreboardBLL.FoulController.GetFoulController();
     this.ClockController      = ScoreboardBLL.ClockController.GetClockController();
     this.PeriodController     = ScoreboardBLL.PeriodController.GetPeriodController();
     this.PossessionController = ScoreboardBLL.PossessionController.GetPossessionController();
     this.TimeoutController    = ScoreboardBLL.TimeoutController.GetTimeoutController();
 }
예제 #9
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this);
         return;
     }
     instance = this;
     canvas   = GetComponent <CanvasGroup>();
 }
예제 #10
0
 // Start is called before the first frame update
 void Start()
 {
     game  = GameManager.instance;
     clock = ClockController.instance;
     anim  = GetComponent <Animator>();
     if (allowInfiniteJump)
     {
         isGrounded = true;
     }
 }
예제 #11
0
 public void newClock(float seconds)
 {
     if (!clock)
     {
         clock = GameObject.Instantiate(clockPrefab);
         ClockController clockConfig = clock.GetComponent <ClockController>();
         clockConfig.delay = seconds;
         clockConfig.fire();
         clock.transform.SetParent(gameObject.transform, false);
     }
 }
예제 #12
0
 private void Awake()
 {
     allFood = FindObjectsOfType <Food>().ToList();
     for (int i = 0; i < allFood.Count; i++)
     {
         allItems.Add(allFood[i].gameObject);
     }
     tableScript = FindObjectOfType <TableController>();
     clockScript = FindObjectOfType <ClockController>();
     aiScript    = FindObjectOfType <AIController>();
 }
        /// Add the information from these recordable objects to
        /// a new frame
        public void AddFrame(ClockController timer,
                             DynamicRecorder[] dynamics, StaticRecorder[] statics)
        {
            // create and store a new frame

            Frame frame = new Frame(timer.GetTime(), dynamics, statics);

            frames.Add(frame);

            // optional: print the frame's json to the console

            // Debug.Log(JsonUtility.ToJson(frame));
        }
예제 #14
0
    void DropClock()
    {
        ScoreItem  scoreItem = scoreItemList.scores[this.count++ % scoreItemList.scores.Count];
        GameObject clock     = Instantiate(clockPrefab, transform.position, Quaternion.identity) as GameObject;
        float      time      = float.Parse(scoreItem.finishedAt);
        string     name      = scoreItem.playerName;

        ClockController clockController = clock.GetComponent <ClockController> ();

        clockController.stopTicking();
        clockController.SetName(name);
        clockController.SetClock(time);
    }
예제 #15
0
    /****************************************** PRIVATE METHODS ******************************************/

    void Grab()
    {
        if (!isHoldingItem)
        {
            Vector2      grabBox      = new Vector2(grabRadius, GetHeight());
            Collider2D[] gnomesToGrab = Physics2D.OverlapBoxAll(grabCenter.position, grabBox, 0f, whatCanBeGrabbed);

            foreach (Collider2D coll in gnomesToGrab)
            {
                coll.gameObject.transform.parent = gameObject.transform;

                GnomeController gnome = coll.gameObject.GetComponent <GnomeController> ();
                ClockController clock = coll.gameObject.GetComponent <ClockController> ();

                if (gnome != null)
                {
                    Vector3 newGnomePosition = gnomeHolster.position;
                    newGnomePosition.y += gnome.GetWidth();
                    coll.gameObject.transform.position = newGnomePosition;
                    gnome.Flip(90);
                    gnome.Freeze();

                    // Fix the scale
                    Vector3 gnomeScale = new Vector3(1.1f, 1.1f, 0.3f);
                    coll.gameObject.transform.localScale = gnomeScale;

                    currentGnome = coll.gameObject;
                    animator.SetBool("isCarrying", true);
                    this.isHoldingItem = true;
                }
                else if (clock != null)
                {
                    Vector3 newClockPosition = gnomeHolster.position;
                    newClockPosition.y += clock.GetHeight() / 4;
                    coll.gameObject.transform.position = newClockPosition;
                    clock.FixRotation();
                    clock.Freeze();

                    // Fix the scale
                    Vector3 clockScale = new Vector3(0.26f, 0.26f, 0.26f);
                    coll.gameObject.transform.localScale = clockScale;

                    animator.SetBool("isCarrying", true);
                    this.isHoldingItem = true;
                    currentClock       = coll.gameObject;
                    string name = currentClock.GetComponent <ClockController> ().GetName();
                    EventManagerController.FireClockSelectedEvent(name);
                }
            }
        }
    }
예제 #16
0
    void OnCollisionEnter2D(Collision2D other)
    {
        //we also add a debug log to know what the projectile touch
        Debug.Log("Projectile Collision with " + other.gameObject);

        ClockController c = other.collider.GetComponent <ClockController>();

        if (c != null)
        {
            c.Fix();
        }

        Destroy(gameObject);
    }
예제 #17
0
        void Start()
        {
            // find the clock
            clock = FindObjectOfType <ClockController> ();

            // reset static state between games
            ended = false;

            // link components together
            if (recorder == null)
            {
                recorder = FindObjectOfType <RecordingController> ();
            }
        }
예제 #18
0
        private static void LinkUpdateManager(UpdateManager updateManager)
        {
            // link clock with updateManager
            ClockController clock = FindObjectOfType <ClockController> ();

            updateManager.clock = clock;


            // link chat with updateManager

            ChatController chat = FindObjectOfType <ChatController>();

            updateManager.chatController = chat;
            chat.updateManager           = updateManager;
        }
예제 #19
0
 internal ImageAnimationController(Image image, ObjectAnimationUsingKeyFrames animation, bool autoStart)
 {
     this._image                = image;
     this._animation            = animation;
     this._animation.Completed += new EventHandler(this.AnimationCompleted);
     this._clock                = this._animation.CreateClock();
     this._clockController      = this._clock.Controller;
     _sourceDescriptor.AddValueChanged(image, new EventHandler(this.ImageSourceChanged));
     this._clockController.Pause();
     this._image.ApplyAnimationClock(Image.SourceProperty, this._clock);
     if (autoStart)
     {
         this._clockController.Resume();
     }
 }
예제 #20
0
    void Start()
    {
        DialogBoxHolder dialogBoxHolder = transform.parent.gameObject.GetComponent <DialogBoxHolder>();

        dialogBox      = dialogBoxHolder.dialogBox;
        questText      = dialogBoxHolder.questText;
        questText.text = "";
        _questionPanel.SetActive(false);
        _isMouseOver         = false;
        _lable               = null;
        _transform           = this.gameObject.GetComponent <Transform>();
        Questions            = game.GetQuestions(Name);
        _clock               = GameObject.FindGameObjectWithTag("Clock").GetComponent <ClockController>();
        _skyController       = GameObject.FindGameObjectWithTag("Sky").GetComponent <SkyController>();
        _newspaperController = GameObject.FindGameObjectWithTag("Newspaper").GetComponent <NewspaperController>();
        _lastClick           = DateTime.Now;
    }
예제 #21
0
        private void LinkUpdateManager(UpdateManager updateManager)
        {
            // link clock with updateManager
            ClockController clock = gameObject.GetComponentInChildren <ClockController> ();

            updateManager.clock = clock;


            // link chat with updateManager

            ChatController chat = gameObject.GetComponentInChildren <ChatController>();

            updateManager.chatController = chat;
            if (chat != null)
            {
                chat.updateManager = updateManager;
            }
        }
예제 #22
0
        /// <summary>
        /// Returns a MediaElement's root Clock controller
        /// (Only root clocks can be controlled,
        /// so this function solves a problem when MediaElement.Clock is not a root clock)
        /// </summary>
        /// <param name="player">A MediaPlayer element</param>
        /// <returns>A MediaElement's root Clock controller.</returns>
        public static ClockController GetController(MediaElement player)
        {
            ClockController controller = null;
            Clock           clock      = player.Clock;

            if (clock.HasControllableRoot)
            {
                while (clock != null)
                {
                    if (clock.Controller != null)
                    {
                        controller = clock.Controller;
                        break;
                    }
                    clock = clock.Parent;
                }
            }
            return(controller);
        }
        public async void ClockOutTests()
        {
            var c = new ClockController();


            var loginViewModel = new ClockInViewModel
            {
                token = "TdqvLaLw76Sky/m0KAC7Fjj4B9HVVBqDA1RoAhgoWyg=",
            };

            var res = await c.ClockIn(loginViewModel);

            Xunit.Assert.True(res.success);


            var res2 = await c.ClockIn(loginViewModel);

            Xunit.Assert.False(res2.success);
        }
        public async void ClockInTest()
        {
            var c = new ClockController();

            // InitWorkplaceAndPersonnel();


            var token = "XIBQX1/v9G0tn6bh4zK14KJn1rsVXbaxeLgKMoKfssw=";
            var json  = @"
{""bitmapdata"":[-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,0,0,1,0,1,0,0,-1,-37,0,67,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-37,0,67,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-64,0,17,8,0,-103,0,-52,3,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0,2,17,3,17,0,63,0,-114,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,2,-118,40,-96,15,-1,-39],""datetime"":""Jan 24, 2019 4:07:52 PM"",""location"":[{""time"":1548333267266,""latitude"":37.9491594,""longitude"":46.0582785,""speed"":0.0,""accuracy"":29.0}],""qRCodeContent"":""051000012517"",""scanResults"":[{""BSSID"":""64:d9:54:a8:21:8c"",""SSID"":""Zoltrix_ZW919"",""capabilities"":""[WPA-PSK-CCMP][WPS][ESS]"",""wifiSsid"":{""octets"":{""buf"":[90,111,108,116,114,105,120,95,90,87,57,49,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],""count"":13}},""level"":-72,""timestamp"":78161891040,""frequency"":2462}],""token"":""rLQq0z3MeiQBIhC/mUhB3oVnqRUgHHXiRp2EBR/FXpI\u003d"",""success"":false}
";

            var clockIn = JsonConvert.DeserializeObject <ClockInViewModel>(json);

            clockIn.token = token;

            var res = await c.ClockIn(clockIn);

            Xunit.Assert.True(res.success);
        }
        public async void ClockInTests()
        {
            var c = new ClockController();

            InitWorkplaceAndPersonnel();


            var loginViewModel = new ClockInViewModel
            {
                scanResults = new List <ScanResult>
                {
                    new ScanResult
                    {
                        hessid   = 61,
                        wifiSsid = "anjir_1875",
                        SSID     = "ssvd",
                        BSSID    = "sscm5"
                    },
                },
                qRCodeContent = "vlkwlkrnf;sjdsfd",
                location      = new List <MyLocation>
                {
                    new MyLocation
                    {
                        latitude  = 51.1651,
                        longitude = 35.651651,
                        speed     = 515156,
                    }
                },
                bitmapdata = new long[5],
                token      = "TdqvLaLw76Sky/m0KAC7Fjj4B9HVVBqDA1RoAhgoWyg=",
            };

            var res = await c.ClockIn(loginViewModel);

            Xunit.Assert.True(res.success);
        }
예제 #26
0
    void Throw()
    {
        if (isHoldingItem)
        {
            if (huhSound != null)
            {
                huhSound.Play();
            }

            if (currentGnome != null)
            {
                GnomeController gnome = currentGnome.GetComponent <GnomeController> ();
                currentGnome.transform.parent = null;
                gnome.UnFreeze();
                gnome.isMidAir = true;
                Rigidbody2D gnomeRb   = currentGnome.GetComponent <Rigidbody2D> ();
                float       direction = facingRight ? 1f : -1f;
                gnomeRb.velocity = new Vector2(7.5f * direction, 15f);
                isHoldingItem    = false;
                currentGnome     = null;
                animator.SetBool("isCarrying", false);
            }
            else if (currentClock)
            {
                ClockController clock = currentClock.GetComponent <ClockController> ();
                currentClock.transform.parent = null;
                clock.UnFreeze();
                Rigidbody2D clockRb   = currentClock.GetComponent <Rigidbody2D> ();
                float       direction = facingRight ? 1f : -1f;
                clockRb.velocity = new Vector2(7.5f * direction, 15f);
                isHoldingItem    = false;
                currentClock     = null;
                animator.SetBool("isCarrying", false);
                EventManagerController.FireClockSelectedEvent("");
            }
        }
    }
예제 #27
0
 // Use this for initialization
 void Start()
 {
     clockController = this.GetComponent<ClockController>();
 }
예제 #28
0
        /// <summary>
        /// Seeks the animation to the specified frame index.
        /// </summary>
        /// <param name="index">The index of the frame to seek to</param>
        public void GotoFrame(int index)
        {
            var frame = Animation.KeyFrames[index];

            ClockController.Seek(frame.KeyTime.TimeSpan, TimeSeekOrigin.BeginTime);
        }
예제 #29
0
 /// <summary>
 /// In Awake erstellen wir den Controller und stellen
 /// die Verbindung zur Model-Klasse her.
 /// </summary>
 protected virtual void Awake()
 {
     Model = new Clock();
     Cont  = new ClockController(Model);
 }
예제 #30
0
 public ClockControllerAdapter(IClock clock, ClockController clockController)
 {
     Clock            = clock ?? throw new ArgumentNullException(nameof(clock));
     _clockController = clockController ?? throw new ArgumentNullException(nameof(clockController));
 }
예제 #31
0
 public void TestInitialize()
 {
     clockController = ClockController.GetClockController();
     methodWasCalled = false;
 }