/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="color"></param>
 /// <param name="alignment"></param>
 public AbstractLabel(Color color, LabelAlignment alignment)
 {
     this.RenderColor = color;
     this.DefaultColor = color;
     this.Alignment = alignment;
     this._labelState = LabelState.Visible;
 }
Exemple #2
0
 public TrailLabel(List <Vector3> unityPositions, GameObject labelObject, string name)
 {
     this.unityPositions = unityPositions;
     this.labelObject    = labelObject;
     this.name           = name;
     this.state          = LabelState.outOfSight;
 }
    private IEnumerator VoiceFromTheSkies()
    {
        activeSword.VibrateController();
        AudioSource.PlayClipAtPoint(question, transform.position);

        yield return(new WaitForSeconds(1));

        activeSword.StartLabeling();

        yield return(new WaitForSeconds(audio.clip.length - 1));

        speechRecognition.startRecording();

        yield return(new WaitForSeconds(5));

        speechRecognition.stopRecording();

        yield return(new WaitForSeconds(4));

        if (state == LabelState.Active) // If no OnSpeechRecognized event came, just deactivate labeling
        {
            Debug.Log("No SpeechRecognised after 4 seconds");
            activeSword.StopLabeling();
            state       = LabelState.Idle;
            activeSword = null;
            AudioSource.PlayClipAtPoint(error, transform.position);
        }
    }
 private void Start()
 {
     activeSword       = null;
     state             = LabelState.Idle;
     audio             = GetComponent <AudioSource>();
     speechRecognition = FindObjectOfType <SpeechRecognition>();
     speechRecognition.OnSpeechRecognized += NameSword;
 }
    private void NameSword(string name)
    {
        AudioSource.PlayClipAtPoint(success, transform.position);
        Debug.Log($"Sword named {name}");
        activeSword.swordName = name;
        activeSword.StopLabeling();
        activeSword.brieflyShowSwordName();

        state       = LabelState.Idle;
        activeSword = null;
    }
Exemple #6
0
        public void ShowLabel(LabelState state)
        {
            if (state == LabelState.WrongShotRed)
            {
                pbLabel.Image = BilliardWindowsApplication.Properties.Resources.wrong_shot_red;
            }
            else if (state == LabelState.EqualName)
            {
                pbLabel.Image = BilliardWindowsApplication.Properties.Resources.equal_name;
            }

            pbLabel.Location = new Point(660, 478);
            pbLabel.Visible  = true;
        }
Exemple #7
0
        protected virtual void UpdateState()
        {
            if (!m_IsInited)
            {
                return;
            }

            m_LabelState = GetLabelState();

            switch (m_LabelState)
            {
            case LabelState.GetFree:
                SetLabelActive(m_GetFreeLabel, true);
                SetLabelActive(m_LockLabel, false);
                SetLabelActive(m_PriceLabel, false);
                SetLabelActive(m_LevelLabel, false);
                break;

            case LabelState.Lock:
                SetLabelActive(m_GetFreeLabel, false);
                SetLabelActive(m_LockLabel, true);
                SetLabelActive(m_PriceLabel, false);
                SetLabelActive(m_LevelLabel, false);
                break;

            case LabelState.Price:
                SetLabelActive(m_GetFreeLabel, false);
                SetLabelActive(m_LockLabel, false);
                SetLabelActive(m_PriceLabel, true);
                SetLabelActive(m_LevelLabel, false);
                break;

            case LabelState.Level:
                SetLevelState();
                break;

            default:
                SetLabelActive(m_GetFreeLabel, false);
                SetLabelActive(m_LockLabel, false);
                SetLabelActive(m_PriceLabel, false);
                SetLabelActive(m_LevelLabel, false);
                break;
            }

            SetState(m_LabelState);
        }
        private void LabelVisibility(LabelState state, int index)
        {
            int oIndex = 99 - index;

            switch (state)
            {
            case LabelState.Hidden:
                gridLabels[oIndex]     = LabelState.Hidden;
                labels[oIndex].Visible = true;
                labels[oIndex].Text    = "";
                break;

            case LabelState.Showing:
                gridLabels[oIndex]     = LabelState.Showing;
                labels[oIndex].Visible = true;
                labels[oIndex].Text    = CheckBombs(index);
                break;
            }
        }
    private void OnTriggerEnter(Collider other)
    {
        if (state == LabelState.Active)
        {
            // Debug.Log("LabelState already active");
            return;
        }

        activeSword = GetSword(other);


        if (activeSword == null)
        {
            // Debug.Log("No Sword found");
            return;
        }

        state = LabelState.Active;
        StartCoroutine(VoiceFromTheSkies());
    }
Exemple #10
0
        public void Update(GameTime gameTime)
        {
            switch (currentLabelState)
            {
            case LabelState.Menu:
                break;

            case LabelState.WaitForConnect:
                break;

            case LabelState.InGame:
                isEnd = world.IsGameEnd;
                if (isEnd)
                {
                    currentLabelState = LabelState.GameOver;
                }
                break;

            case LabelState.GameOver:
                break;
            }
        }
Exemple #11
0
        private void changeLabel(LabelState lblState)
        {
            lblStatus.ForeColor = Color.Green;
            switch (lblState)
            {
            case LabelState.None:
                lblStatus.ForeColor = Color.Red;
                lblStatus.Text      = "Waiting for connection...";
                btnOpenFile.Enabled = false;
                btnSendFile.Enabled = false;
                break;

            case LabelState.Connected:
                lblStatus.Text      = "Connected!";
                btnOpenFile.Enabled = true;
                btnSendFile.Enabled = false;
                break;

            case LabelState.FileLoaded:
                lblStatus.Text      = "File Loaded";
                btnOpenFile.Enabled = true;
                btnSendFile.Enabled = true;
                break;

            case LabelState.FileSent:
                lblStatus.Text      = "File Sent";
                btnConnect.Enabled  = false;
                btnOpenFile.Enabled = false;
                btnSendFile.Enabled = false;
                break;

            case LabelState.Finished:
                lblStatus.Text      = "Finished";
                btnConnect.Enabled  = true;
                btnOpenFile.Enabled = false;
                btnSendFile.Enabled = false;
                break;
            }
        }
        public void Update()
        {
            switch (State)
            {
            case LabelState.FadeIn:
                if (Label.opacity < 255)
                {
                    Label.opacity += 6;
                    Window.opacity = Label.opacity;
                }

                this.draw_offset.X *= 0.92f;
                if (Math.Abs(this.draw_offset.X) < 1f)
                {
                    this.draw_offset.X = 0;
                }
                break;

            case LabelState.FadeOut:
                Label.opacity -= 8;
                Window.opacity = Label.opacity;

                if (Label.opacity <= 0)
                {
                    State = LabelState.None;
                }
                break;

            case LabelState.None:
            default:
                break;
            }

            Label.update();
            Window.opacity = Label.opacity;
        }
 public void FadeIn()
 {
     State = LabelState.FadeIn;
 }
 public ExtendedLetterLabel(char symbol, LabelState labelState)
 {
     Symbol = symbol;
     LabelState = labelState;
 }
Exemple #15
0
 public static Label <THelper> SetState <THelper>(this Label <THelper> label, LabelState state)
     where THelper : BootstrapHelper <THelper>
 {
     label.ToggleCss(state);
     return(label);
 }
Exemple #16
0
 private void StateLabel_Load(object sender, EventArgs e)
 {
     state = LabelState.Off;
 }
 public LabelStyleData GetStyle(LabelState state)
 {
     return(stylesData.Find(style => style.labelState == state));
 }
        /// <summary>
        /// Update
        /// </summary>
        protected void Update()
        {
            if (this._labelState == LabelState.FadingIn)
            {
                double currentGameTime = TimeHelper.GetCurrentGameTime();
                int alpha = (int)(((currentGameTime - this._timeFadeInStarted) / this._fadeInDuration) * 255);
                this.RenderColor = new Color(this.RenderColor.R, this.RenderColor.G, this.RenderColor.B, alpha);

                if (alpha >= 255)
                {
                    this._labelState = LabelState.Visible;
                }
            }
            else if (this._labelState == LabelState.FadingOut)
            {
                double currentGameTime = TimeHelper.GetCurrentGameTime();
                int alpha = (255 - (int)(((currentGameTime - this._timeFadeOutStarted) / this._fadeOutDuration) * 255));
                this.RenderColor = new Color(this.RenderColor.R, this.RenderColor.G, this.RenderColor.B, alpha);

                if (alpha <= 0)
                {
                    this._labelState = LabelState.Hidden;
                }
            }
            else if (this._labelState == LabelState.Toast)
            {
                double currentGameTime = TimeHelper.GetCurrentGameTime();
                int alpha;

                if (currentGameTime - this._timeToastStarted < this._toastTransitionDuration)
                {
                    alpha = (int)(((currentGameTime - this._timeToastStarted) / this._toastTransitionDuration) * 255);
                }
                else if (currentGameTime - this._timeToastStarted < this._toastTransitionDuration + this._toastVisibleDuration)
                {
                    alpha = 255;
                }
                else
                {
                    alpha = (255 - (int)(((currentGameTime - this._timeToastStarted - this._toastTransitionDuration - this._toastVisibleDuration) / this._toastTransitionDuration) * 255));

                    if (alpha <= 0)
                    {
                        this._labelState = LabelState.Hidden;
                    }
                }

                this.RenderColor = new Color(this.RenderColor.R, this.RenderColor.G, this.RenderColor.B, alpha);
            }
        }
 /// <summary>
 /// Toast
 /// </summary>
 /// <param name="transitionDuration"></param>
 /// <param name="visibleDuration"></param>
 public void Toast(double transitionDuration, double visibleDuration)
 {
     if (this._labelState != LabelState.FadingIn && this._labelState != LabelState.FadingOut)
     {
         this._labelState = LabelState.Toast;
         this._toastTransitionDuration = transitionDuration;
         this._toastVisibleDuration = visibleDuration;
         this._timeToastStarted = TimeHelper.GetCurrentGameTime();
     }
 }
 /// <summary>
 /// Fade out
 /// </summary>
 /// <param name="milliseconds"></param>
 public void FadeOut(double milliseconds)
 {
     if (this._labelState != LabelState.FadingIn)
     {
         this._labelState = LabelState.FadingOut;
         this._fadeOutDuration = milliseconds;
         this._timeFadeOutStarted = TimeHelper.GetCurrentGameTime();
     }
 }
Exemple #21
0
        public async Task <IActionResult> LabelOrder(
            OrderViewModel viewModel,
            LabelSource labelSource,
            LabelObjectType labelObjectType,
            LabelState labelStatus,
            LabelReasonCodes labelReasonCode)
        {
            var order = await GetOrder(viewModel.OrderNumber);

            if (order == null)
            {
                return(BadRequest("No such order found for this user."));
            }

            #region Fraud Protection Service
            string labelObjectId;
            switch (labelObjectType)
            {
            case LabelObjectType.Purchase:
                labelObjectId = order.RiskPurchase.PurchaseId;
                break;

            case LabelObjectType.Account:
                labelObjectId = order.RiskPurchase.User.UserId;
                break;

            case LabelObjectType.Email:
                labelObjectId = order.RiskPurchase.User.Email;
                break;

            case LabelObjectType.PI:
                labelObjectId = order.RiskPurchase.PaymentInstrumentList[0].MerchantPaymentInstrumentId;
                break;

            default:
                throw new InvalidOperationException("Label object type not supported: " + labelObjectType);
            }

            var label = new Label
            {
                LabelObjectType  = labelObjectType.ToString(),
                LabelObjectId    = labelObjectId,
                LabelSource      = labelSource.ToString(),
                LabelReasonCodes = labelReasonCode.ToString(),
                LabelState       = labelStatus.ToString(),
                EventTimeStamp   = DateTimeOffset.Now,
                Processor        = "Fraud Protection sample site",
            };

            if (labelObjectType == LabelObjectType.Purchase)
            {
                label.Amount   = order.Total;
                label.Currency = order.RiskPurchase?.Currency;
            }

            var correlationId = _fraudProtectionService.NewCorrelationId;
            var response      = await _fraudProtectionService.PostLabel(label, correlationId);

            var fraudProtectionIO = new FraudProtectionIOModel(correlationId, label, response, "Label");
            TempData.Put(FraudProtectionIOModel.TempDataKey, fraudProtectionIO);
            #endregion

            return(View("LabelDone"));
        }
Exemple #22
0
 public static ComponentBuilder <TConfig, Label> SetState <TConfig>(this ComponentBuilder <TConfig, Label> builder, LabelState state)
     where TConfig : BootstrapConfig
 {
     builder.Component.ToggleCss(state);
     return(builder);
 }
 public void FadeOut()
 {
     State = LabelState.FadeOut;
 }
Exemple #24
0
 public void SetState(LabelState newState)
 {
     state = newState;
     Setup();
 }
Exemple #25
0
 protected virtual void SetState(LabelState state)
 {
 }
 public DataRowViewState()
 {
     DescriptionLabelState = new LabelState();
     DistractorLabelState = new LabelState();
     ValueLableState = new LabelState();
 }