Beispiel #1
0
        private void TxtVip_GotFocus(object sender, EventArgs e)
        {
            textbox txt = sender as textbox;

            txt.BackColor = Color.Cyan;
            txt.SelectAll();
        }
Beispiel #2
0
        public static bool ValidarForm(Control objForm, ErrorProvider error)
        {
            bool valor = true;

            foreach (Control obj in objForm.Controls)
            {
                //if (obj.Controls.Count > 0)
                //{
                //    valor = ValidarForm2(obj, error);
                //    continue;
                //}

                if (obj is textbox)
                {
                    textbox obj2 = (textbox)obj;
                    if (obj2.Validar)
                    {
                        if (string.IsNullOrEmpty(obj2.Text.Trim()))
                        {
                            valor = false;

                            error.SetError(obj, (string.IsNullOrEmpty(obj2.Text.Trim())) ? "Campo obligatorio" : "");
                        }
                    }
                }
            }
            return(valor);
        }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        textManager = GameObject.Find("LeftBodyPart").GetComponent <textbox>();
        symManager  = GameObject.Find("Text1").GetComponent <symptomManager>();
        lManager    = GameObject.Find("Text1").GetComponent <lightManager>();

        selectedPart = "";
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        tManag      = GameObject.Find("GvrEventSystem").GetComponent <translationManager>();
        textManager = GameObject.Find("LeftBodyPart").GetComponent <textbox>();
        lManag      = GameObject.Find("Text1").GetComponent <lightManager>();

        selectedPart = "";

        symptomToggles = new Dictionary <bodyPart, List <symptom> >()
        {
        };
        selectedSymptoms = new List <symptom>()
        {
        };

        defaultSymptoms = new List <symptom> {
            symptom.Pain, symptom.Swelling, symptom.Weakness, symptom.Redness, symptom.Itching, symptom.Other
        };
        symptomsDictionary = new Dictionary <bodyPart, List <symptom> >()
        {
            { bodyPart.UpperRightLeg, defaultSymptoms },
            { bodyPart.Knees, defaultSymptoms },
            { bodyPart.UpperLeftLeg, defaultSymptoms },
            { bodyPart.Belly, new List <symptom> {
                  symptom.Diarrhea, symptom.Constipation, symptom.LossOfAppetite, symptom.Swelling, symptom.WeightLoss, symptom.Other
              } },
            { bodyPart.LowerRightLeg, defaultSymptoms },
            { bodyPart.LowerHead, new List <symptom> {
                  symptom.Vomiting, symptom.BleedingGums, symptom.DryMouth, symptom.StiffNeck, symptom.Thirsty, symptom.Other
              } },
            { bodyPart.LowerBack, defaultSymptoms },
            { bodyPart.LowerLeftLeg, defaultSymptoms },
            { bodyPart.Feet, defaultSymptoms },
            { bodyPart.UpperHead, new List <symptom> {
                  symptom.Headache, symptom.Dizziness, symptom.EyePain, symptom.Fever, symptom.YellowingOfEyes, symptom.Other
              } },
            { bodyPart.UpperBack, defaultSymptoms },
            { bodyPart.Chest, new List <symptom> {
                  symptom.Cough, symptom.ShortOfBreath, symptom.Chills, symptom.Sweating, symptom.Pain, symptom.Other
              } },
            { bodyPart.RightBiceps, defaultSymptoms },
            { bodyPart.RightForearms, defaultSymptoms },
            { bodyPart.RightTriceps, defaultSymptoms },
            { bodyPart.RightHandPinky, defaultSymptoms },
            { bodyPart.RightHandRing, defaultSymptoms },
            { bodyPart.RightHandMiddle, defaultSymptoms },
            { bodyPart.RightHandIndex, defaultSymptoms },
            { bodyPart.RightHandThumb, defaultSymptoms },
            { bodyPart.LeftBiceps, defaultSymptoms },
            { bodyPart.LeftForearms, defaultSymptoms },
            { bodyPart.LeftTriceps, defaultSymptoms },
            { bodyPart.LeftHandPinky, defaultSymptoms },
            { bodyPart.LeftHandRing, defaultSymptoms },
            { bodyPart.LeftHandMiddle, defaultSymptoms },
            { bodyPart.LeftHandIndex, defaultSymptoms },
            { bodyPart.LeftHandThumb, defaultSymptoms },
        };
    }
Beispiel #5
0
        private void Other_KeyDown(object sender, KeyEventArgs e)
        {
            textbox text = sender as textbox;

            if (e.KeyCode == Keys.Enter)
            {
                //如果是数量文本框
                if (text.Tag.ToString() == "quantity")
                {
                    if (text.CheckData(@"^[1-9]\d*$", "数量为整数") != 0)
                    {
                        BindProduct();
                    }
                    else
                    {
                        MessageBox.Show("数量为整数", "提示");
                    }
                    text.Text = "1";
                }
                //如果是单价文本框
                else if (text.Tag.ToString() == "unitPrice")
                {
                    if (text.CheckData(@"^(([1-9]\d*)|([1-9]\d*.\d{0,2}))$", "价钱输入有误") != 0)
                    {
                        if (text.Text.Contains(".") && text.Text.IndexOf('.') == text.Text.Length - 1)
                        {
                            //输入的是整数
                            text.Text += "0";
                        }
                        decimal money = Convert.ToDecimal(text.Text.Trim());
                        text.Text = money.ToString("F2");
                        BindProduct();
                    }
                    else
                    {
                        MessageBox.Show("单价为数字", "提示");
                    }
                    text.Text = "0.00";
                }
                //如果文本框是折扣
                else
                {
                    if (text.CheckData(@"^((\d)|(\d.\d))$", "折扣输入有误") != 0)
                    {
                        BindProduct();
                    }
                    else
                    {
                        MessageBox.Show("折扣输入有误", "提示");
                    }
                    text.Text = "0";
                }
                txtProductId.Focus();
            }
        }
Beispiel #6
0
    void Awake()
    {
        fade_box           = GameObject.Find("black_box").GetComponent <blackboxfade>();
        text_box           = GameObject.Find("TextBox").GetComponent <textbox>();
        right_actor_sprite = actor_right.GetComponent <SpriteRenderer>();
        string player_name = "Baka";

        dialogue.Add(new List <line>());
        dialogue.Add(new List <line>());
        dialogue.Add(new List <line>());

        //Blank canvas to add line of dialogue
        //Add_Line(true, 0, Line("", false, "???", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "",0));

        Add_Line(true, 0, Line(player_name + "....", false, "???", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line(player_name + "!!!\nWAKE UP!!!", false, "???", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 1));
        Add_Line(true, 0, Line("I awaken, and a small plastic trash can sits at the edge of my bed.", false, player_name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("Gosh, I thought you were in a coma or something!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("1.) What the F**k?\n2.) What are you doing in here?\n3.) Being woken by someone so beautiful, it’s like a fairytale", true, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(false, 0, Line("I’ll tell you what the f**k! Class starts in half an hour!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 1, Line("I live here dummy, you would know that if you ever left your room", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 2, Line(player_name + "! I… I… don’t mess with me like that! You’re leaving this room\nwhether you want to or not!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(true, 0, Line("It’s the first day of class, and I’ll be damned if you’re going to sleep\nall the time like you did over summer break. Or my name isn’t Trashley!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("1.) Seriously, what the F**k?\n2.) But I like staying at home...\n3.) Looks like you'll have to make me...", true, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(false, 0, Line("Right?? I can’t believe you survived off of hot pockets for 3 months. But enough distractions!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 1, Line("Don’t we all? But being an asocial potato isn’t very healthy for a senior in high school.", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 2, Line("Grrr... I may be a tiny trash can, but I know how to kick your lazy ass in gear if I have to!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(true, 0, Line("Trashley throws me out of bed (somehow) with enough force to land on my ass.", false, player_name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("Ok! Now that you’re out of bed, let’s set something straight. This is your last year of high school, and I’d try to make something out of it. Like dating somebody!I’m sure you can be attractive if you put your mind to it. Try saying something to woo me.", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("1.) *Kiss Trashley*\n2.) Umm, you have a nice… lid\n3.) You look stunning, like a plastic Beyonce", true, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(false, 0, Line("!!!!!That’s not what I meant!Dummy…I guess it wasn’t so bad though…Maybe we could…Kiss again ?", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, "", "", "", 0));
        Add_Line(false, 1, Line("Thank you! I polished it this morning You might have hope yet! That bar above me gauges my feelings for you, and if you max it out something good will happen!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 2, Line("Ah! I… Umm…" + player_name + "... Jeez that was sweet of you. The… uh bar above me gauges… how I – OR ANYONE ELSE Feels about you.If you max it out something good will.” happen!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, "", "", "", 0));

        Add_Line(true, 0, Line("*HONK HONK*", false, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(true, 0, Line("OH GOSH!That must be Baley outside to pick me up. Don’t forget what I said about trying to make some more friends.  Bye!", false, "Trashley", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 2));
        Add_Line(true, 0, Line("1.) Are… are all the dateable people in this game trash cans?\n2.) I should probably get dressed\n3.) Time for another nap", true, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(false, 0, Line("Yes, yes they are. That’s the point of this game, man I can ask some dumb questions sometimes.", false, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 1, Line("I find a handy pile of dirty jeans and hoodies and put them on. Good enough!", false, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));
        Add_Line(false, 2, Line("I jump back into bed but OWCH there appears to be a nest of scorpions that moved in. I guess the developers want me to go to school.", false, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Add_Line(true, 0, Line("Time to get going! But man class starts in 15 minutes. How should I get there?", false, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 0));

        Change_Dialogue(0);
    }
Beispiel #7
0
        private void TxtVip_LostFocus(object sender, EventArgs e)
        {
            textbox txt = sender as textbox;

            txt.BackColor = Color.White;
            if (txtAmount.Text.Contains(".") && txtAmount.Text.IndexOf(".") == txtAmount.Text.Length)
            {
                txtAmount.Text += "00";
            }
            else if (!txtAmount.Text.Contains("."))
            {
                txtAmount.Text += ".00";
            }
            txtAmount.Text = Convert.ToDecimal(txtAmount.Text).ToString("F2");
        }
    public void addSymptom()
    {
        string path       = Application.persistentDataPath + "/Assets/Resources/Symptom.txt";
        Toggle tempToggle = this.GetComponent <Toggle> ();

        if (tempToggle.isOn)
        {
            StreamWriter writer = new StreamWriter(path, true);
            textManager       = GameObject.Find("LeftBodyPart").GetComponent <textbox> ();
            symptomToggleText = this.GetComponentInChildren <Text> ();
            string part    = textManager.GetComponentInChildren <Text> ().text;
            string symptom = symptomToggleText.text;
            writer.WriteLine(part + ": " + symptom + "\n");
            writer.Close();
        }
    }
Beispiel #9
0
    public void addTextbox(string text, GameObject targetObj, bool type, float textSpeed)
    {
        if (!textboxPrefab)
        {
        }
        else
        {
            Vector2    newPos     = findPosition(targetObj.transform.position);
            GameObject newTextbox = Instantiate(textboxPrefab, newPos, Quaternion.identity);
            textbox    tb         = newTextbox.GetComponent <textbox> ();
            if (!type)
            {
                newTextbox.GetComponent <disappearing> ().duration = textSpeed * text.Length + timeAfter;
            }

            tb.setTypeMode(type);
            tb.setText(text);
            tb.setTargetObj(targetObj);
            tb.pauseAfterType  = timeAfter;
            tb.timeBetweenChar = textSpeed;
            tb.mManager        = this;
            RectTransform[] transforms = newTextbox.GetComponentsInChildren <RectTransform> ();
            if (text.Length > 50)
            {
                Vector2 v = new Vector2();
                foreach (RectTransform r in transforms)
                {
                    v.y = r.sizeDelta.y * 2f;
                    v.x = r.sizeDelta.x;
                    if (text.Length > 100)
                    {
                        v.x = r.sizeDelta.x * 1.5f;
                    }
                    r.sizeDelta = v;
                }
            }
            LineRenderer line = newTextbox.GetComponent <LineRenderer> ();
            line.SetPosition(0, new Vector3(newPos.x, newPos.y, 0f));
            textboxes.Add(newTextbox);
        }
    }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     sprite  = gameObject.GetComponent <SpriteRenderer>();
     the_box = GameObject.Find("TextBox").GetComponent <textbox>();
 }
Beispiel #11
0
        /// <summary>
        /// 获取焦点时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TxtProductId_GotFocus(object sender, EventArgs e)
        {
            textbox text = sender as textbox;

            text.SelectAll();
        }
Beispiel #12
0
 private void txtVip_KeyDown(object sender, KeyEventArgs e)
 {
     txtAmount.Text = txtAmount.Text.Replace("\r\n", "");
     txtVip.Text    = txtVip.Text.Replace("\r\n", "");
     if (e.KeyCode == Keys.F1)
     {
         radMoney.Checked = true;
     }
     else if (e.KeyCode == Keys.F2)
     {
         radCard.Checked = true;
     }
     else if (e.KeyCode == Keys.F3)
     {
         radQRCode.Checked = true;
     }
     else if (e.KeyCode == Keys.Enter)//回车键:表示正常结算
     {
         if (txtAmount.CheckData(@"^(([1-9]\d*)|(\d*.\d{0,2}))$", "输入金额有误") != 0)
         {
             if (txtAmount.Text.Contains(".") && txtAmount.Text.IndexOf(".") == txtAmount.Text.Length)
             {
                 txtAmount.Text += "00";
             }
             else if (!txtAmount.Text.Contains("."))
             {
                 txtAmount.Text += ".00";
             }
             txtAmount.Text = Convert.ToDecimal(txtAmount.Text).ToString("F2");
             if (txtVip.Text.Length == 0)//判断不是会员
             {
                 this.Tag = txtAmount.Text.Trim();
             }
             else//有会员卡号
             {
                 if (txtVip.CheckData(@"^[1-9]\d*$", "会员卡号有误") != 0)
                 {
                     //进一步判断会员是否正常、、自己完成
                     SMMembers members = memberManager.GetMembersById(int.Parse(txtVip.Text.Trim()));
                     if (members != null)
                     {
                         this.Tag = $"{txtAmount.Text.Trim()}&{txtVip.Text.Trim()}";
                     }
                     else
                     {
                         this.Tag = txtAmount.Text.Trim();
                     }
                 }
                 else
                 {
                     this.Tag = txtAmount.Text.Trim();
                 }
             }
             //证明客户付钱够了
             if (Convert.ToDecimal(txtPay.Text) <= Convert.ToDecimal(txtAmount.Text))
             {
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 MessageBox.Show("客户实际付款金额不足!", "注意");
             }
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         this.Tag = "Esc";
         this.Close();
     }
     else if (e.KeyCode == Keys.Tab)
     {
         textbox txt = sender as textbox;
         if (txt.Tag.ToString() == "vip")
         {
             txtAmount.Focus();
         }
         else if (txt.Tag.ToString() == "pay")
         {
             txtVip.Focus();
         }
     }
 }
Beispiel #13
0
        private void TxtProductId_LostFocus(object sender, EventArgs e)
        {
            textbox text = sender as textbox;

            text.BackColor = Color.White;
        }