public void Activate()
        {
            if (!initialized)
            {
                this.LogError("Cannot activate before being initialized");
            }

            // If already active
            if (state == State.Active)
            {
                this.LogError($"{this} is already active");
            }

            // Send the activation event
            ActivateEvent activation = new ActivateEvent(this);

            StratusScene.Dispatch <ActivateEvent>(activation);

            // If the activation was successful
            if (activation.valid)
            {
                OnActivate();
                this.Log("Activated");
                state = State.Active;
                onActivate?.Invoke();
            }
            else
            {
                this.LogError($"Failed to activate {this}");
            }
        }
        protected override void WriteData(BinaryWriter w)
        {
            Texture.Write(w);

            w.Write((uint)Properties);
            w.Write((uint)Form);
            w.Write((uint)Anchors);
            w.Write((uint)Reactions);
            w.Write(Solidity);
            w.Write(Light);

            w.Write(Layer);
            w.Write(PartSize);
            w.Write(FramesCount);
            w.Write(FrameDelay);

            w.Write(OffsetX);
            w.Write(OffsetY);

            SetupEvent.Write(w);
            ReformEvent.Write(w);
            TouchEvent.Write(w);
            ActivateEvent.Write(w);
            RecieveEvent.Write(w);
            RemoveEvent.Write(w);

            w.Write(BackColor);
            w.Write(GridEnabled);
        }
        public QuestionGridViewModel(IEventAggregator eventAggregator, RoundService roundService, StandingsService standingsService)
        {
            _eventAggregator = eventAggregator;
            _roundService = roundService;
            _standingsService = standingsService;

            AddCommand = new DelegateCommand<object>(AddPoints);
            SubstractCommand = new DelegateCommand<object>(Substract);

            StartCommand = new DelegateCommand(Start);
            StopCommand = new DelegateCommand(Stop);
            BonusCommand = new DelegateCommand(Bonus);
            WrongCommand = new DelegateCommand(Wrong);
            CorrectCommand = new DelegateCommand(Correct);
            CloseCommand = new DelegateCommand(Close);
            BonusAddCommand = new DelegateCommand<object>(AddBonusPoints);

            _showEvent = _eventAggregator.GetEvent<ShowEvent>();
            _activateEvent = _eventAggregator.GetEvent<ActivateEvent>();
            _stopEvent = _eventAggregator.GetEvent<StopEvent>();
            _bonusEvent = _eventAggregator.GetEvent<BonusEvent>();
            _closeEvent = _eventAggregator.GetEvent<CloseEvent>();

            _newSelectorEvent = _eventAggregator.GetEvent<NewSelectorEvent>();
        }
示例#4
0
        public override void OnActivate(object sender, Event e)
        {
            ActivateEvent ae = (ActivateEvent)e;

            if (ae.Active)
            {
                if (nLocalTelaAtiva == Resource.FRMCADASSUNTOS)
                {
                    fCadAssuntos.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADAUTORES)
                {
                    fCadAutores.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADEDITORAS)
                {
                    fCadEditoras.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADENDERECOS)
                {
                    fCadEnderecos.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADIDIOMAS)
                {
                    fCadIdiomas.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADPAISES)
                {
                    fCadPaises.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADPROFISSOES)
                {
                    fCadProfissoes.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADCLIENTES)
                {
                    fCadClientes.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCADLIVROS)
                {
                    fCadLivros.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMVENDERLIVROS)
                {
                    fVenderLivros.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMCONVENDAS)
                {
                    fConVendas.SetFocus();
                }
                else if (nLocalTelaAtiva == Resource.FRMALTERARSENHA)
                {
                    fAlterarSenha.SetFocus();
                }
            }
        }
 /// <summary>
 /// Activates any attached controller with the given activation event.
 /// </summary>
 /// <param name="viewModel"></param>
 /// <param name="kind"></param>
 public static void ActivateAttachedController(this IMvxViewModel viewModel, ActivateEvent kind)
 {
     var controllerAware = viewModel as IControllerAware;
     if (controllerAware != null)
     {
         var ctl = controllerAware.Controller as IMvxActivatable;
         if (ctl != null)
         {
             ctl.Activate(kind);
         }
     }
 }
        /// <summary>
        /// Activates any attached controller with the given activation event.
        /// </summary>
        /// <param name="viewModel"></param>
        /// <param name="kind"></param>
        public static void ActivateAttachedController(this IMvxViewModel viewModel, ActivateEvent kind)
        {
            var controllerAware = viewModel as IControllerAware;

            if (controllerAware != null)
            {
                var ctl = controllerAware.Controller as IMvxActivatable;
                if (ctl != null)
                {
                    ctl.Activate(kind);
                }
            }
        }
示例#7
0
    void MovingCharacter()
    {
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            Debug.Log("SpeedUp");
            moveWeight = runSpeed;
        }
        else
        {
            moveWeight = walkSpeed;
        }

        if (Input.GetKey(KeyCode.Space) && isGround)
        {
            Debug.Log("CanJump!");
            jumpAudio.Play();
            CharacterBody.AddForce(Vector3.up * jumpPower, ForceMode2D.Force);
        }
        else if (isGround)
        {
            if (Input.GetAxis("Horizontal") < 0)
            {
                chracter.flipX = true;
            }
            else if (Input.GetAxis("Horizontal") > 0)
            {
                chracter.flipX = false;
            }

            moveSide = Input.GetAxis("Horizontal") * moveWeight;
            CharacterBody.velocity = moveSide * transform.right;

            animator.SetFloat("speed", Mathf.Abs(Input.GetAxis("Horizontal")));
        }
        if (Input.GetKey(KeyCode.E))
        {
            if (!magicAudio.isPlaying)
            {
                magicAudio.Play();
            }
            ActivateEvent?.Invoke();
        }
        else
        {
            magicAudio.Stop();
        }
    }
        protected override void ReadData(BinaryReader r)
        {
            if (Type != CurrentType)
            {
                throw new Exception(
                          "Resource have wrong type [" + TypeToString(Type) + "]. [" +
                          TypeToString(CurrentType) + "] required.");
            }
            if (Version != CurrentVersion)
            {
                throw new Exception(
                          "Resource have wrong version \"" + Version +
                          "]. [" + CurrentVersion + "] required.");
            }

            Texture.Read(r);

            Properties = (Property)r.ReadUInt32();
            Form       = (Shape)r.ReadUInt32();
            Anchors    = (Anchor)r.ReadUInt32();
            Reactions  = (Reaction)r.ReadUInt32();
            Solidity   = r.ReadInt32();
            Light      = r.ReadUInt32();

            Layer       = r.ReadInt32();
            PartSize    = r.ReadInt32();
            FramesCount = r.ReadInt32();
            FrameDelay  = r.ReadInt32();

            OffsetX = r.ReadInt32();
            OffsetY = r.ReadInt32();

            SetupEvent.Read(r);
            ReformEvent.Read(r);
            TouchEvent.Read(r);
            ActivateEvent.Read(r);
            RecieveEvent.Read(r);
            RemoveEvent.Read(r);

            BackColor   = r.ReadInt32();
            GridEnabled = r.ReadBoolean();
        }
示例#9
0
 public Event(EventType type, ActivateEvent activation)
 {
     MyType     = type;
     Activation = activation;
     State      = EventState.Inactive;
 }
        protected override async Task OnActivate(ActivateEvent kind)
        {
            await base.OnActivate(kind);

            Mvx.Trace("Activate {0} kind {1}", GetType().Name, kind);
        }
示例#11
0
 public async Task Activate(ActivateEvent kind)
 {
     await OnActivate(kind);
 }
示例#12
0
 protected virtual async Task OnActivate(ActivateEvent kind)
 {
     await Task.Yield();
 }
示例#13
0
 remove => RemoveHandler(ActivateEvent, value);
示例#14
0
 add => AddHandler(ActivateEvent, value);
示例#15
0
 protected void OnActivateEvent(WindowInfoWithHandle windowInfo)
 {
     ActivateEvent?.Invoke(this, new OriginalWinEventArg(windowInfo));
 }