예제 #1
0
        public void OnCompletedEntry()
        {
            if (CanAnswer)
            {
                if (WordText.Equals(Lyrics[CurrentVerseIndex - 1].CorrectWord))
                {
                    TimeSpan span = DateTime.Now - StartTime;
                    TotalPoints += (int)span.TotalMilliseconds / 10;
                }

                ResetMusic();
            }
        }
예제 #2
0
    public void CheckPassWord(WordText text)
    {
        if (int.Parse(TargetPassword[text.Bit].ToString()) == (int)text.Password)
        {
            FinishBit++;
            text.IsFinish = true;
            OnPasswordTruth?.Invoke();
            // Debug.Log("检测成功密码");
        }

        if (FinishBit >= bit)
        {
            OnPasswordFinish?.Invoke();
        }
    }
예제 #3
0
 public void OnTextButton(WordText clickedText)
 {
     Definition.GetComponent <Canvas> ().enabled = true;
     foreach (WordText text in texts)
     {
         if (text.wordGroup == clickedText.wordGroup)
         {
             text.text.color = HighlightedColor;
             Debug.Log(text.text);
         }
         else
         {
             text.text.color = NormalColor;
         }
     }
 }
예제 #4
0
    public void AddText(WordGroupObject wordGroup)
    {
        //Debug.Log ("78THOUSAND");

        string[] words = wordGroup.text.Split(' ');
        narrator = words [0];
        for (int i = 0; i < words.Length; i++)
        {
            string word = words [i];

            SentenceRow currentRow = rows [rowIndex];
            WordText    newText    = currentRow.AddText(word);
            newText.text.color = NormalColor;
            //wordClone.GetComponent<Button> ().color.normalColor = Color.cyan;

            //To enforce the layout to rebuild, which makes the horizontal layoutgroup resize
            LayoutRebuilder.ForceRebuildLayoutImmediate(rt);

            float myWidth = rt.rect.width - layoutGroup.padding.horizontal;
            //We add a text, check if the width is fitting.

            if (currentRow.rt.rect.width + newText.rt.rect.width >= myWidth)
            {
                CreateRow();
                currentRow.PopText();
                rowIndex++;
                //Safety check in case of really long words
                if (newText.rt.rect.width < myWidth)
                {
                    //go a word back
                    i -= 1;
                }
                else
                {
                    Debug.LogWarningFormat("The word {0} does not fit in the SentenceRowContainer! It will be skipped.", word);
                }
            }
            else
            {
                //We set the wordGroup of each textfield so we can highlight them alltogether

                newText.wordGroup = wordGroup;
                texts.Add(newText);
            }
        }
    }
예제 #5
0
        protected void Confirm_Click(object sender, EventArgs e)
        {
            if (NameText.Text == "")
            {
                Response.Write("<script>alert('用户名不能为空!')</script>");
                NameText.Focus();
                return;
            }
            else if (WordText.Text == "")
            {
                Response.Write("<script>alert('密码不能为空!')</script>");
                WordText.Focus();
                return;
            }
            else if (CheckText.Text != checkNum.ToString())
            {
                Response.Write("<script>alert('验证码错误!')</script>");
                CheckText.Focus();
                return;
            }
            string        strConn = ConfigurationManager.ConnectionStrings["TSGConnectionString1"].ConnectionString;
            SqlConnection conn    = new SqlConnection(strConn);
            DataSet       ds      = new DataSet();

            conn.Open();
            if (DropDownList1.SelectedValue == "普通读者")
            {
                string     lendSql = "SELECT * FROM PATRON WHERE PATRONID = \'" + NameText.Text + "\' AND PASSWORD = \'" + WordText.Text + "\'";
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    SqlDataReader dr = lendCmd.ExecuteReader();
                    if (dr.Read())
                    {
                        Response.Redirect("library.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户名或密码错误!')</script>");
                    }
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                }
                finally {
                    library.figure = "普通读者";
                }
            }
            else
            {
                string lendSql = "SELECT * FROM USERS WHERE USERID = \'" + NameText.Text +
                                 "\' AND PASSWORD = \'" + WordText.Text +
                                 "\' AND ROLE = \'" + DropDownList1.SelectedValue + "\'";
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    SqlDataReader dr = lendCmd.ExecuteReader();
                    if (dr.Read())
                    {
                        library.figure = DropDownList1.SelectedValue;
                        Response.Redirect("library.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户名或密码错误!')</script>");
                    }
                }
                catch (Exception err) {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                }
                finally {
                    library.figure = DropDownList1.SelectedValue;
                }
            }
        }