public List <IdCard> SelectAll(int kid)
        {
            List <IdCard> di  = new List <IdCard>();
            SqlParameter  pid = new SqlParameter("@kid", SqlDbType.Int);

            pid.Value = kid;
            bool f = DBHelper.ExecuteBatchProc("IdCard_S_select", pid);

            if (f == true)
            {
                while (DBHelper.reader.Read())
                {
                    IdCard idc = new IdCard();
                    idc.Name    = DBHelper.reader["name"] + "";
                    idc.Sex     = DBHelper.reader["sex"] + "";
                    idc.Age     = Convert.ToInt32(DBHelper.reader["age"]);
                    idc.Address = DBHelper.reader["address"] + "";
                    di.Add(idc);
                }
            }
            DBHelper.con.Close();
            DBHelper.reader.Dispose();
            DBHelper.cmd.Dispose();
            DBHelper.con.Dispose();

            return(di);
        }
        public SIdCard SIdcard(int stucode)
        {
            SIdCard Detail = new SIdCard();
            IdCard  idcard = new IdCard();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_api_IDcard", con))
                {
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@studentcode", SqlDbType.Int).Value = stucode;
                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();
                    sda.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dtrow in dt.Rows)
                        {
                            idcard.IdLink = Convert.ToString(dtrow["IdLink"]);
                        }
                        Detail.StudentIdCard = idcard;
                    }
                    else
                    {
                        throw new HttpResponseException(HttpStatusCode.NoContent);
                    }
                }
                return(Detail);
            }
        }
Exemple #3
0
        public Dictionary <int, IdCard> IdCardSelect(IdCard i)
        {
            SqlDataReader            reader = DBHelper.SectionRoomSelect("p_IdCard_select");
            Dictionary <int, IdCard> cards  = new Dictionary <int, IdCard>();

            while (reader.Read())
            {
                IdCard cd = new IdCard();
                cd.Kid      = int.Parse(reader[0] + "");
                cd.Name     = reader[1] + "";
                cd.Sex      = reader[2] + "";
                cd.Age      = int.Parse(reader[3] + "");
                cd.Birthday = reader[4] + "";
                cd.Address  = reader[5] + "";
                cd.Phone    = reader[6] + "";
                cd.Nation   = reader[7] + "";
                cd.Cultrue  = reader[8] + "";
                cd.Marriage = reader[9] + "";
                cd.Work     = reader[10] + "";
                cd.Postcode = reader[11] + "";
                cd.IdcardNo = reader[12] + "";
                cards.Add(cd.Kid, cd);
            }
            DBHelper.con.Close();
            DBHelper.con.Dispose();
            DBHelper.cmd.Dispose();
            return(cards);
        }
Exemple #4
0
        /// <summary>
        /// 获取采购or出票 信息
        /// </summary>
        private EnterpriseAccountDTO GetEnterprisAccount()
        {
            CompanyInfo companyInfo = Session["Info"] as CompanyInfo;

            return(new EnterpriseAccountDTO
            {
                AccountNo = this.txtAccountNo.Text.Trim(),
                LoginPassword = companyInfo.UserPassword,
                PayPassword = IdCard.GetPayPassword(this.txtIDCard.Text.Trim()),
                AdministorName = companyInfo.Contact,
                Email = companyInfo.ManagerEmail,
                ContactPhone = companyInfo.ContactPhone,
                AdministorCertId = this.txtIDCard.Text.Trim(),
                OwnerState = AddressShow.GetProvince(companyInfo.Province),
                OwnerCity = AddressShow.GetCity(companyInfo.City),
                OwnerZone = AddressShow.GetCounty(companyInfo.District),
                OwnerStreet = companyInfo.Address,
                PostalCode = companyInfo.ZipCode,
                OrganizationCode = this.txtOrganizationCode.Text.Trim(),
                CompanyName = companyInfo.CompanyName,
                LegalContactPhone = this.txtLegalPersonPhone.Text.Trim(),
                LegalPersonName = this.txtLegalPersonName.Text.Trim(),
                LegalPersonCertId = this.txtIDCard.Text.Trim()
            });
        }
Exemple #5
0
 // Token: 0x0600014C RID: 332 RVA: 0x00002EBD File Offset: 0x000010BD
 public GClass11(IdCard idCard_1)
 {
     this.method_1(idCard_1);
     base.SelectedImageIndex = 5;
     base.StateImageIndex    = 5;
     base.ImageIndex         = 5;
 }
Exemple #6
0
    private void OnTriggerExit2D(Collider2D Collections)
    {
        if (Collections.CompareTag("Steal"))
        {
            Passwordlock.gameObject.SetActive(false);
        }

        if (Collections.CompareTag("Chest0") && IdCard.GetComponent <Image>().enabled == true)
        {
            IdCard.GetComponent <Image>().enabled = false;
            TextScript._instance.ChangeText("这是一张身份证,上面有所有者的生日1976-09-08");
            Iffchest = false;
        }

        if (Collections.CompareTag("Fridge1") && FridgeTips.GetComponent <Image>().enabled == true)
        {
            FridgeTips.GetComponent <Image>().enabled = false;
            if (IfFridge == false)
            {
                zz++;
                IfFridge = true;
            }
        }

        if (Collections.CompareTag("BookObject") && ChestTips.GetComponent <Image>().enabled == true)
        {
            ChestTips.GetComponent <Image>().enabled = false;
        }
    }
Exemple #7
0
        public void Should_create_a_valid_DNI()
        {
            var dni = new IdCard(new OnlyOneProvider());

            var numberLength = dni.Number.ToString().Length;

            Assert.Equal(8, numberLength);
            Assert.Equal("11111111H", dni.ToString());
        }
Exemple #8
0
        public void Should_create_a_concrete_DNI()
        {
            var dni = new IdCard(new IncrementalProvider());

            var numberLength = dni.Number.ToString().Length;

            Assert.Equal(87654321, dni.Number);
            Assert.Equal(8, numberLength);
            Assert.Equal("87654321X", dni.ToString());
        }
        public void CheckDisguiseStatus(bool handleBuff, IdCard idCard = null)
        {
            if (Character == null)
            {
                return;
            }

            string currentlyDisplayedName = DisplayName;

            IsDisguised          = currentlyDisplayedName == disguiseName;
            IsDisguisedAsAnother = !IsDisguised && currentlyDisplayedName != Name;

            if (IsDisguisedAsAnother)
            {
                if (handleBuff)
                {
                    Character.CharacterHealth.ApplyAffliction(Character.AnimController.GetLimb(LimbType.Head), AfflictionPrefab.List.FirstOrDefault(a => a.Identifier.Equals("disguised", StringComparison.OrdinalIgnoreCase)).Instantiate(100f));
                }

                if (idCard != null)
                {
#if CLIENT
                    GetDisguisedSprites(idCard);
#endif
                    return;
                }

                if (Character.Inventory != null)
                {
                    int cardSlotIndex = Character.Inventory.FindLimbSlot(InvSlotType.Card);
                    if (cardSlotIndex >= 0)
                    {
                        idCard = Character.Inventory.Items[cardSlotIndex].GetComponent <IdCard>();

                        if (idCard != null)
                        {
#if CLIENT
                            GetDisguisedSprites(idCard);
#endif
                            return;
                        }
                    }
                }
            }

#if CLIENT
            disguisedJobIcon  = null;
            disguisedPortrait = null;
#endif

            if (handleBuff)
            {
                Character.CharacterHealth.ReduceAffliction(Character.AnimController.GetLimb(LimbType.Head), "disguised", 100f);
            }
        }
Exemple #10
0
        private void btnReg_Click(object sender, EventArgs e)
        {
            foreach (Control item in this.Controls)
            {
                if (item is TextBox || item is ComboBox)
                {
                    if (item.Text == "")
                    {
                        PromptingForm p = new PromptingForm("请把信息填写完整!");
                        p.ShowDialog();
                        return;
                    }
                }
            }


            IdCard IC = new IdCard();

            IC.Name = txtName.Text;
            if (rdoBoy.Checked)
            {
                IC.Sex = rdoBoy.Text;
            }
            else
            {
                IC.Sex = rdoGirl.Text;
            }
            IC.Age      = int.Parse(txtAge.Text);
            IC.Birthday = dtpBrithday.Text;
            IC.Address  = txtAddress.Text;
            IC.Phone    = (txtPhone.Text);
            IC.Nation   = cboNation.Text;
            IC.Cultrue  = cboCultrue.Text;
            if (rdoMarriageYes.Checked)
            {
                IC.Marriage = rdoMarriageYes.Text;
            }
            else
            {
                IC.Marriage = rdoMarriageNo.Text;
            }
            IC.Work     = cboWork.Text;
            IC.Postcode = (txtPostcode.Text);
            IC.IdcardNo = txtIdcardNo.Text;

            string mes = new IdCard_BLL().Reg(IC);


            string s = new IdCard_BLL().p_IdCard_select();

            PromptingForm pp = new PromptingForm("注册成功!卡号为:" + s);

            pp.ShowDialog();
        }
Exemple #11
0
        public async Task <ActionResult <IdCard> > PostIdCard(IdCard idCard)
        {
            if (IdCardVerificator(idCard))
            {
                _context.IdCards.Add(idCard);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetIdCard", new { id = idCard.NationalId }, idCard));
            }
            else
            {
                return(StatusCode(406, "Data not valid."));
            }
        }
Exemple #12
0
        //卡号输入框变化
        private void TxtKid_TextChanged(object sender, TextChangedEventArgs e)
        {
            IdCard IC = new IdCard();

            if (txtKid.Text == "")
            {
                return;
            }
            IC.Kid = int.Parse(txtKid.Text);
            Dictionary <int, IdCard> Cd = new IdCard_BLL().IdCard(IC);

            foreach (int item in Cd.Keys)
            {
                if (int.Parse(txtKid.Text) == item)
                {
                    if (txtKid.Text.Length == 5)
                    {
                        txtName.Text     = Cd[int.Parse(txtKid.Text)].Name;
                        txtAge.Text      = Cd[int.Parse(txtKid.Text)].Age.ToString();
                        txtPostcode.Text = Cd[int.Parse(txtKid.Text)].Postcode;
                        txtIdcardNo.Text = Cd[int.Parse(txtKid.Text)].IdcardNo;
                        cboCultrue.Text  = Cd[int.Parse(txtKid.Text)].Cultrue;
                        cboNation.Text   = Cd[int.Parse(txtKid.Text)].Nation;
                        txtPhone.Text    = Cd[int.Parse(txtKid.Text)].Phone;
                        cboWork.Text     = Cd[int.Parse(txtKid.Text)].Work;
                        txtAddress.Text  = Cd[int.Parse(txtKid.Text)].Address;
                        if (Cd[int.Parse(txtKid.Text)].Sex == "女")
                        {
                            rdoGirl.IsChecked = true;
                        }
                        else
                        {
                            rdoBoy.IsChecked = true;
                        }
                        if (Cd[int.Parse(txtKid.Text)].Marriage == "未婚")
                        {
                            rdoMarriageNo.IsChecked = true;
                        }
                        else
                        {
                            rdoMarriageYes.IsChecked = true;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
Exemple #13
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         IdCard.CheckIdentityCard(this.txtIDCard.Text);
         var user = this.IsAccountType() ?AccountBaseService.EnterpriseAccountOpening(this.GetEnterprisAccount()):
                    AccountBaseService.PersonAccountOpening(this.GetAccount() == null ? this.GetEnterprisAccount() : this.GetAccount());
         this.SucceedInfo();
     }
     catch (Exception ex)
     {
         ShowExceptionMessage(ex, "开户");
     }
 }
Exemple #14
0
 private bool IdCardVerificator(IdCard idCard)
 {
     // National ID is unique and cannot be the same as another one within the DB.
     if (!_context.IdCards.Any(i => i.NationalId == idCard.NationalId && i.MemberId != idCard.MemberId))
     {
         if (!DateHelper.IsDateExpired(idCard.ExpiryDate) && DateHelper.IsDateExpired(idCard.CreatedOn))
         {
             if (!IdCardExists(idCard.NationalId) && idCard.CardIsValid())
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 public void ValidateIdCard(IdCard idCard)
 {
     if (idCard == null)
     {
         throw new ModelException("IdCard cannot be null");
     }
     ValidateIdCardData(idCard);
     ValidateSystemInfo(((SystemIdCard)idCard).SystemInfo);
     if (idCard is UserIdCard)
     {
         bool allowEmptyCPR =
             idCard.AuthenticationLevel.Level < AuthenticationLevel.VocesTrustedSystem.Level &&
             !ModelUtilities.IsEmpty(idCard.AlternativeIdentifier);
         ValidateUserInfo(((UserIdCard)idCard).UserInfo, allowEmptyCPR);
     }
 }
Exemple #16
0
        //მეთოდი რომელიც ამატებს ახალ ობიექტს ან არედაქტირებს ძველს
        public void AddOrUpdate(object sender, EventArgs e)
        {
            errorDiv.Visible = false;
            errorDiv.Text    = "";

            var fName         = fNameInput.Text;
            var lName         = lNameInput.Text;
            var nationalityID = nationalityInput.SelectedValue;
            var genderID      = genderInput.SelectedValue;
            var pN            = pnInput.Text;
            var bDate         = bDateInput.Text;
            var issuDate      = issueDateInput.Text;
            var validityDate  = validDateInput.Text;
            var birthPlaceID  = birthPlaceInput.SelectedValue;
            var cardNr        = cardNrInput.Text;
            var issuer        = issuerInput.Text;

            IdCard newCard = CreateModel(fName, lName, pN, cardNr, issuer, nationalityID, genderID, birthPlaceID, bDate, issuDate, validityDate);

            if (newCard != null)
            {
                if (cardId.HasValue)
                {
                    var oldCard = unitOfWork.IdCardRepository.GetByID(cardId.Value);

                    oldCard.FirstName     = newCard.FirstName;
                    oldCard.LastName      = newCard.LastName;
                    oldCard.IssueDate     = newCard.IssueDate;
                    oldCard.Issuer        = newCard.Issuer;
                    oldCard.NationalityID = newCard.NationalityID;
                    oldCard.PersonalNr    = newCard.PersonalNr;
                    oldCard.ValidityDate  = newCard.ValidityDate;
                    oldCard.BirthDate     = newCard.BirthDate;
                    oldCard.GenderID      = newCard.GenderID;
                    oldCard.BirthPlaceID  = newCard.BirthPlaceID;
                    oldCard.CardNr        = newCard.CardNr;

                    unitOfWork.IdCardRepository.Update(oldCard);
                }
                else
                {
                    unitOfWork.IdCardRepository.Insert(newCard);
                }
                unitOfWork.Save();
                Response.Redirect("/");
            }
        }
        public string Reg(IdCard ic)
        {
            int re = new IdCard_DAL().Reg(ic);

            if (re == 0)
            {
                return("该身份证已注册过绿卡");
            }
            else if (re == 1)
            {
                return("注册成功");
            }
            else
            {
                return("注册失败");
            }
        }
Exemple #18
0
        /// <summary>
        /// Builds an ID-card objects from a DOM document.
        /// </summary>
        /// <param name="doc">The DOM document used for the ID-card.</param>
        /// <returns>A new <see cref="IdCard"/></returns>
        public IdCard BuildModel(XDocument doc)
        {
            IdCard result = null;

            var assertions = doc.Elements(NameSpaces.saml + SamlTags.Assertion);

            foreach (var assertion in assertions)
            {
                foreach (var xAttribute in assertion.Attributes())
                {
                    if (xAttribute.Name.LocalName.ToLower().EndsWith("id") && xAttribute.Value.Equals(IdValues.IdCard))
                    {
                        result = InternalBuild(assertion);
                        break;
                    }
                }
            }
            return(result);
        }
Exemple #19
0
//----------*跳跃部分--------------
    void Start()
    {
        Darak      = GameObject.Find("Dark");
        BoradText  = GameObject.Find("BoradText");
        Open       = GameObject.Find("Fridge_Open");
        Chest_Open = GameObject.Find("Chest_Open");

        //init
        Darak.GetComponent <SpriteRenderer>().enabled      = true;
        Open.GetComponent <SpriteRenderer>().enabled       = false;
        Chest_Open.GetComponent <SpriteRenderer>().enabled = false;

        IdCard.GetComponent <Image>().enabled             = false;
        BoradText.GetComponent <SpriteRenderer>().enabled = false;

        FridgeTips.GetComponent <Image>().enabled = false;
        // WinImage.GetComponent<RawImage>().enabled=false;

        StartCoroutine("StarPlay");
    }
Exemple #20
0
        /// <summary>
        /// 卡号添加
        /// </summary>
        /// <param name="ic"></param>
        /// <returns></returns>
        public int Reg(IdCard ic)
        {
            SqlParameter name     = new SqlParameter("@name", SqlDbType.VarChar);
            SqlParameter sex      = new SqlParameter("@sex", SqlDbType.Char);
            SqlParameter age      = new SqlParameter("@age", SqlDbType.Int);
            SqlParameter Birthday = new SqlParameter("@Birthday", SqlDbType.SmallDateTime);
            SqlParameter address  = new SqlParameter("@address", SqlDbType.VarChar);
            SqlParameter phone    = new SqlParameter("@phone", SqlDbType.Char);
            SqlParameter nation   = new SqlParameter("@nation", SqlDbType.VarChar);
            SqlParameter Cultrue  = new SqlParameter("@Cultrue", SqlDbType.VarChar);
            SqlParameter Marriage = new SqlParameter("@Marriage", SqlDbType.Char);
            SqlParameter Work     = new SqlParameter("@Work", SqlDbType.VarChar);
            SqlParameter Postcode = new SqlParameter("@Postcode", SqlDbType.Int);
            SqlParameter IdcardNo = new SqlParameter("@IdcardNo", SqlDbType.VarChar);
            SqlParameter result   = new SqlParameter("@result", SqlDbType.Int);

            result.Direction = ParameterDirection.Output;
            name.Value       = ic.Name;
            sex.Value        = ic.Sex;
            age.Value        = ic.Age;
            Birthday.Value   = ic.Birthday;
            address.Value    = ic.Address;
            phone.Value      = ic.Phone;
            nation.Value     = ic.Nation;
            Cultrue.Value    = ic.Cultrue;
            Marriage.Value   = ic.Marriage;
            Work.Value       = ic.Work;
            Postcode.Value   = ic.Postcode;
            IdcardNo.Value   = ic.IdcardNo;
            SqlParameter[] sp = { name, sex, age, Birthday, address, phone, nation, Cultrue, Marriage, Work, Postcode, IdcardNo, result };
            bool           f  = DBHelper.ExecuteNonQueryProc("Reg_IdCard", sp);

            if (f)
            {
                return((int)result.Value);
            }
            else
            {
                return(-1);
            }
        }
        private void GetDisguisedSprites(IdCard idCard)
        {
            if (idCard.Item.Tags == string.Empty)
            {
                return;
            }

            if (idCard.StoredOwnerAppearance.JobPrefab == null || idCard.StoredOwnerAppearance.Portrait == null)
            {
                string[] readTags = idCard.Item.Tags.Split(',');

                if (readTags.Length == 0)
                {
                    return;
                }

                if (idCard.StoredOwnerAppearance.JobPrefab == null)
                {
                    idCard.StoredOwnerAppearance.ExtractJobPrefab(readTags);
                }

                if (idCard.StoredOwnerAppearance.Portrait == null)
                {
                    idCard.StoredOwnerAppearance.ExtractAppearance(this, readTags);
                }
            }

            if (idCard.StoredOwnerAppearance.JobPrefab != null)
            {
                disguisedJobIcon  = idCard.StoredOwnerAppearance.JobPrefab.Icon;
                disguisedJobColor = idCard.StoredOwnerAppearance.JobPrefab.UIColor;
            }

            disguisedPortrait          = idCard.StoredOwnerAppearance.Portrait;
            disguisedSheetIndex        = idCard.StoredOwnerAppearance.SheetIndex;
            disguisedAttachmentSprites = idCard.StoredOwnerAppearance.Attachments;

            disguisedHairColor       = idCard.StoredOwnerAppearance.HairColor;
            disguisedFacialHairColor = idCard.StoredOwnerAppearance.FacialHairColor;
            disguisedSkinColor       = idCard.StoredOwnerAppearance.SkinColor;
        }
        public async Task <ActionResult <Member> > PostMember(Member member)
        {
            try
            {
                if (!_context.Members.Any(m => (m.EmailAddress == member.EmailAddress || member.PhoneNumber == m.PhoneNumber) && m.MemberId != member.MemberId))
                {
                    IdCard idCard = member.IdCard;
                    // Ensure data are correct
                    if (member.IsValidUser() && idCard.CardIsValid())
                    {
                        IdCardsController idCardsController = new IdCardsController(_context);
                        if (!idCardsController.IdCardExists(member.IdCard.NationalId))
                        {
                            _context.Members.Add(member);
                            await _context.SaveChangesAsync();

                            return(CreatedAtAction("GetMember", new { id = member.MemberId }, member));
                        }
                        else
                        {
                            return(StatusCode(406, "National ID already exist within the database. Operation aborted. "));
                        }
                    }
                    else
                    {
                        return(StatusCode(406, "Data not valid. Please check it."));
                    }
                }
                else
                {
                    return(StatusCode(406, "Email address and/or phone number incorrect."));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #23
0
        /// <summary>
        /// 获取产品方信息
        /// </summary>
        private AccountDTO GetAccount()
        {
            SupplierCreatureInfo providerInfo = Session["Info"] as SupplierCreatureInfo;

            if (providerInfo == null)
            {
                return(null);
            }
            return(new AccountDTO
            {
                AccountNo = this.txtAccountNo.Text.Trim(),
                LoginPassword = providerInfo.UserPassword,
                PayPassword = IdCard.GetPayPassword(this.txtIDCard.Text.Trim()),
                AdministorName = providerInfo.Name,
                Email = providerInfo.Email,
                ContactPhone = providerInfo.ContactPhone,
                AdministorCertId = this.txtIDCard.Text.Trim(),
                OwnerState = AddressShow.GetProvince(providerInfo.Province),
                OwnerCity = AddressShow.GetCity(providerInfo.City),
                OwnerZone = AddressShow.GetCounty(providerInfo.District),
                OwnerStreet = providerInfo.Address,
                PostalCode = providerInfo.ZipCode
            });
        }
Exemple #24
0
        public async Task <IActionResult> PutIdCard(int id, IdCard idCard)
        {
            if (IdCardVerificator(idCard))
            {
                // Need to define if it's the ID or nationalID
                // Card ID
                if (id != idCard.IdCardId)
                {
                    return(BadRequest());
                }

                _context.Entry(idCard).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IdCardExists(idCard.IdCardId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(CreatedAtAction("GetIdCard", new { id = idCard.IdCardId }, idCard));
            }
            else
            {
                return(StatusCode(406, "Data not valid."));
            }
        }
Exemple #25
0
    void OnTriggerStay2D(Collider2D Collections)
    {
        //------------*判断玩家与坐便器物体进行碰撞----------
        if (Collections.gameObject.tag == "ToiletObject1")
        {
            if (Input.GetKeyDown(KeyCode.Z))
            {
                vv++;
                if (Input.GetKeyDown(KeyCode.Z) && vv == 2)
                {
                    // Debug.Log("坐便器2");
                    Get_Structural.WriteStu_key(1);
                    Debug.Log(Get_Structural.ReedStruct().study_key);
                    TextScript._instance.ChangeText("获得一把钥匙!");
                    PlayGetAudio();
                    vv++;
                }
                else
                {
                    TextScript._instance.ChangeText("肮脏的坐便器");
                    Debug.Log("肮脏的坐便器");
                }
            }
        }
        //------------判断玩家与坐便器物体进行碰撞*----------

        //------------*判断玩家与医疗箱物体进行碰撞----------

        if (Collections.gameObject.tag == "ToiletObject31" && Input.GetKeyDown(KeyCode.Z))
        {
            if (IfMasterKey != true)
            {
                PlayGetAudio();
                Get_Structural.WriteMaster_key(1);
                TextScript._instance.ChangeText("发现一个铁钩!");
                IfMasterKey = true;
            }
            else
            {
                TextScript._instance.ChangeText("没有其他东西了");
            }
        }
        //------------判断玩家与医疗箱物体进行碰撞*----------

        //------------*判断玩家与冰箱物体进行碰撞-----------
        if (Collections.gameObject.tag == "Fridge1" && Input.GetKeyDown(KeyCode.Z))
        {
            if (FridgeTips.GetComponent <Image>().enabled != true)
            {
                if (zz == 1 && IfFridge == true)//按第二次Z时出现鸡蛋
                // Debug.Log("");
                {
                    Open.GetComponent <SpriteRenderer>().enabled = true;
                    Get_Structural.WriteEgg(1);                                             //写入 物品系统 Egg=1
                    TextScript._instance.ChangeText("获得一个鸡蛋!");
                    PlayGetAudio();
                    zz++;
                    StartCoroutine("CloseFridge");                                          //执行关闭冰箱效果动画
                }
                else
                {
                    FridgeTips.GetComponent <Image>().enabled = true;
                    FridgeTips.GetComponent <AudioSource>().Play();
                    Debug.Log("冰箱小贴士");

                    //按的次数超过两次出现的一直都是提示语
                }
            }
        }
        //------------判断玩家与冰箱物体进行碰撞*----------

        //------------*判断玩家与电箱物体进行碰撞----------

        if (Collections.gameObject.tag == "Switch1" && Input.GetKeyDown(KeyCode.Z))
        {
            GameObject SwitchObj = GameObject.Find("Switch");                               //找到相对应的组件
            SwitchObj.GetComponent <AudioSource>().Play();
            if (IfBorad == false)                                                           //IfBorad 用于判断是否打开电闸,默认值为false
            {
                Darak.GetComponent <SpriteRenderer>().enabled     = false;
                BoradText.GetComponent <SpriteRenderer>().enabled = true;
                TextScript._instance.ChangeText("打开了电闸!");
                IfBorad = true;
            }
            else
            {
                Darak.GetComponent <SpriteRenderer>().enabled     = true;
                BoradText.GetComponent <SpriteRenderer>().enabled = false;
                TextScript._instance.ChangeText("关闭了电闸!");
                IfBorad = false;
            }
        }
        //------------判断玩家与电箱物体进行碰撞*----------

        //------------*判断玩家与微波炉物体进行碰撞----------
        if (Collections.gameObject.tag == "Micrwave" && Input.GetKeyDown(KeyCode.Z))
        {
            if (Get_Structural.ReedStruct().egg != 0 && InventoryScript._instance.GetInventory() == 5)
            {
                Debug.Log("触发短路事件");
                Get_Structural.WriteEgg(0);                                                  //鸡蛋归零
                InventoryScript._instance.WriteInventory(6);
                InventoryScript._instance.ChangeInventory();
                GameObject Microwave1 = GameObject.Find("Microwave");
                Microwave1.GetComponent <SpriteRenderer>().enabled = false;
                Microwave1.GetComponent <BoxCollider2D>().enabled  = false;
                MicrWaveScript._instance.StarAnimate();
            }
            else
            {
                TextScript._instance.ChangeText("这是一个微波炉,好像还可以用");
                Debug.Log("这是一个微波炉,好像还可以用");
            }
        }
        //------------判断玩家与微波炉物体进行碰撞*----------

        //------------*判断玩家与保险箱物体进行碰撞----------
        //If_StealKey 用于判断是否是第一次开启保险箱,默认值为True
        if (Collections.gameObject.tag == "Steal" && Input.GetKeyDown(KeyCode.Z))
        {
            if (If_StealKey == true)
            {
                if (Get_Structural.ReedStruct().steel_key != 0 && InventoryScript._instance.GetInventory() == 4)
                {
                    //执行输入密码操作
                    Passwordlock.gameObject.SetActive(true);
                    If_StealKey = false;
                }
                else
                {
                    TextScript._instance.ChangeText("保险箱好像需要一把钥匙");
                }
            }
            else
            {
                Passwordlock.gameObject.SetActive(true);
            }
        }
        //------------判断玩家与保险箱物体进行碰撞*----------

        //------------*判断玩家与书房门物体进行碰撞----------
        //If_LivingDoor 用于判断是否为第一次使用钥匙 true为是,默认值为true
        if (Collections.gameObject.tag == "Living_Door1" && Input.GetKeyDown(KeyCode.Z))
        {
            if (If_LivingDoor == true)
            {
                Debug.Log("true");

                if (Get_Structural.ReedStruct().study_key != 0 && InventoryScript._instance.GetInventory() == 2)
                {
                    DoorScript._instance.MoveToDoor(0);
                    If_LivingDoor = false;
                }
                else
                {
                    TextScript._instance.ChangeText("没有书房的钥匙");
                }
            }
            else
            {
                DoorScript._instance.MoveToDoor(0);
                Debug.Log("else");
            }
        }
        //------------判断玩家与书房门物体进行碰撞*----------

        //------------*判断玩家与厕所门物体进行碰撞----------
        if (Collections.CompareTag("ToiletDoor") && Input.GetKeyDown(KeyCode.Z))
        {
            if (Get_Structural.ReedStruct().toilte_key != 0 && InventoryScript._instance.GetInventory() == 1)
            {
                LivindToilet._instance.OpenToiletDoor();
                TextScript._instance.ChangeText("使用除锈剂打开了厕所门!");
            }
            else
            {
                TextScript._instance.ChangeText("厕所门生锈卡住了");
            }
        }
        //------------判断玩家与厕所门物体进行碰撞*----------

        //------------*判断玩家与除锈剂物体进行碰撞----------
        if (Collections.CompareTag("l") && Input.GetKeyDown(KeyCode.Z))
        {
            if (IffToiletKey != true)
            {
                Get_Structural.WriteToilet_key(1);
                PlayGetAudio();
                TextScript._instance.ChangeText("获得除锈剂!");
                IffToiletKey = true;
            }
        }
        //------------判断玩家与除锈剂物体进行碰撞*----------

        //------------*判断玩家与书架物体进行碰撞----------
        if (Collections.CompareTag("BookObject") && Input.GetKeyDown(KeyCode.Z))
        {
            if (IfStudyObj == false)
            {
                Get_Structural.WriteChest_key(1);
                TextScript._instance.ChangeText("发现了一把钥匙!");
                PlayGetAudio();
                IfStudyObj = true;
                FridgeTips.GetComponent <AudioSource>().Play();

                ChestTips.GetComponent <Image>().enabled = true;
            }
            else
            {
                TextScript._instance.ChangeText("书架上没什么东西了");
            }
        }
        //------------判断玩家与书架物体进行碰撞*----------

        //------------*判断玩家与衣柜物体进行碰撞----------
        if (Collections.CompareTag("Chest0") && Input.GetKeyDown(KeyCode.Z))
        {
            if (Get_Structural.ReedStruct().chest_key != 0 && InventoryScript._instance.GetInventory() == 3)
            {
                if (Iffchest != true)
                {
                    GameObject chset = GameObject.Find("chest");
                    chset.GetComponent <AudioSource>().Play();
                    IdCard.GetComponent <Image>().enabled = true;
                    Chest_Open.GetComponent <SpriteRenderer>().enabled = true;
                    if (IfChest == false)
                    {
                        Get_Structural.WriteStell_key(1);
                        TextScript._instance.ChangeText("发现一把铁制的钥匙!");
                        PlayGetAudio();
                        IfChest = true;
                    }
                    StartCoroutine("CloseChest");
                }
            }
            else
            {
                TextScript._instance.ChangeText("衣柜锁住了");
            }
        }
        //------------判断玩家与衣柜物体进行碰撞*----------

        //------------*判断玩家与沙发、凳子物体进行碰撞----------
        if (Collections.CompareTag("Desk") && Input.GetKeyDown(KeyCode.Z))
        {
            TextScript._instance.ChangeText("这是一个凳子");
        }
        if (Collections.CompareTag("Sofa") && Input.GetKeyDown(KeyCode.Z))
        {
            TextScript._instance.ChangeText("这是一个沙发");
        }
        //------------判断玩家与沙发、凳子物体进行碰撞*----------

        //------------*判断玩家与梯子物体进行碰撞----------
        if (Collections.CompareTag("Ladder") && Input.GetKeyDown(KeyCode.Z))
        {
            if (IfLadder != true)
            {
                TextScript._instance.ChangeText("发现一个梯子似乎可以使用");
                GameObject Ladder = GameObject.Find("Ladder");
                Ladder.GetComponent <SpriteRenderer>().enabled = false;
                InventoryScript._instance.WriteInventory(7);
                IfLadder = true;
            }
        }
        //------------判断玩家与梯子物体进行碰撞*----------

        //------------*判断玩家与外门物体进行碰撞----------
        if (Collections.CompareTag("Door") && Input.GetKeyDown(KeyCode.Z))
        {
            if (Get_Structural.ReedStruct().winKnief != 0)
            {
                if (doorPosition == 0 && doorPosition < 1)
                {
                    doorPosition++;
                }
                TextScript._instance.ChangeText("收容成功!");
                SaveByjson();
                StartCoroutine("WinPlay");
                // Time0._instance.Settlement();
            }
            else
            {
                TextScript._instance.ChangeText("还未达成任务目标");
            }
        }
        //------------判断玩家与外门物体进行碰撞*----------
    }
Exemple #26
0
        private void GetDisguisedSprites(IdCard idCard)
        {
            if (idCard.Item.Tags == string.Empty)
            {
                return;
            }

            if (idCard.StoredJobPrefab == null || idCard.StoredPortrait == null)
            {
                string[] readTags = idCard.Item.Tags.Split(',');

                if (readTags.Length == 0)
                {
                    return;
                }

                if (idCard.StoredJobPrefab == null)
                {
                    string jobIdTag = readTags.FirstOrDefault(s => s.StartsWith("jobid:"));

                    if (jobIdTag != null && jobIdTag.Length > 6)
                    {
                        string jobId = jobIdTag.Substring(6);
                        if (jobId != string.Empty)
                        {
                            idCard.StoredJobPrefab = JobPrefab.Get(jobId);
                        }
                    }
                }

                if (idCard.StoredPortrait == null)
                {
                    string disguisedGender              = string.Empty;
                    string disguisedRace                = string.Empty;
                    string disguisedHeadSpriteId        = string.Empty;
                    int    disguisedHairIndex           = -1;
                    int    disguisedBeardIndex          = -1;
                    int    disguisedMoustacheIndex      = -1;
                    int    disguisedFaceAttachmentIndex = -1;

                    foreach (string tag in readTags)
                    {
                        string[] s = tag.Split(':');

                        switch (s[0])
                        {
                        case "gender":
                            disguisedGender = s[1];
                            break;

                        case "race":
                            disguisedRace = s[1];
                            break;

                        case "headspriteid":
                            disguisedHeadSpriteId = s[1];
                            break;

                        case "hairindex":
                            disguisedHairIndex = int.Parse(s[1]);
                            break;

                        case "beardindex":
                            disguisedBeardIndex = int.Parse(s[1]);
                            break;

                        case "moustacheindex":
                            disguisedMoustacheIndex = int.Parse(s[1]);
                            break;

                        case "faceattachmentindex":
                            disguisedFaceAttachmentIndex = int.Parse(s[1]);
                            break;

                        case "sheetindex":
                            string[] vectorValues = s[1].Split(";");
                            idCard.StoredSheetIndex = new Vector2(float.Parse(vectorValues[0]), float.Parse(vectorValues[1]));
                            break;
                        }
                    }

                    if (disguisedGender == string.Empty || disguisedRace == string.Empty || disguisedHeadSpriteId == string.Empty)
                    {
                        idCard.StoredPortrait    = null;
                        idCard.StoredAttachments = null;
                        return;
                    }

                    foreach (XElement limbElement in Ragdoll.MainElement.Elements())
                    {
                        if (!limbElement.GetAttributeString("type", "").Equals("head", StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }

                        XElement spriteElement = limbElement.Element("sprite");
                        if (spriteElement == null)
                        {
                            continue;
                        }

                        string spritePath = spriteElement.Attribute("texture").Value;

                        spritePath = spritePath.Replace("[GENDER]", disguisedGender);
                        spritePath = spritePath.Replace("[RACE]", disguisedRace.ToLowerInvariant());
                        spritePath = spritePath.Replace("[HEADID]", disguisedHeadSpriteId);

                        string fileName = Path.GetFileNameWithoutExtension(spritePath);

                        //go through the files in the directory to find a matching sprite
                        foreach (string file in Directory.GetFiles(Path.GetDirectoryName(spritePath)))
                        {
                            if (!file.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                            {
                                continue;
                            }
                            string fileWithoutTags = Path.GetFileNameWithoutExtension(file);
                            fileWithoutTags = fileWithoutTags.Split('[', ']').First();
                            if (fileWithoutTags != fileName)
                            {
                                continue;
                            }
                            idCard.StoredPortrait = new Sprite(spriteElement, "", file)
                            {
                                RelativeOrigin = Vector2.Zero
                            };
                            break;
                        }

                        break;
                    }

                    if (Wearables != null)
                    {
                        XElement        disguisedHairElement, disguisedBeardElement, disguisedMoustacheElement, disguisedFaceAttachmentElement;
                        List <XElement> disguisedHairs, disguisedBeards, disguisedMoustaches, disguisedFaceAttachments;

                        Gender disguisedGenderEnum = disguisedGender == "female" ? Gender.Female : Gender.Male;
                        Race   disguisedRaceEnum   = (Race)Enum.Parse(typeof(Race), disguisedRace);
                        int    headSpriteId        = int.Parse(disguisedHeadSpriteId);

                        float commonness = disguisedGenderEnum == Gender.Female ? 0.05f : 0.2f;
                        disguisedHairs           = AddEmpty(FilterByTypeAndHeadID(FilterElementsByGenderAndRace(wearables, disguisedGenderEnum, disguisedRaceEnum), WearableType.Hair, headSpriteId), WearableType.Hair, commonness);
                        disguisedBeards          = AddEmpty(FilterByTypeAndHeadID(FilterElementsByGenderAndRace(wearables, disguisedGenderEnum, disguisedRaceEnum), WearableType.Beard, headSpriteId), WearableType.Beard);
                        disguisedMoustaches      = AddEmpty(FilterByTypeAndHeadID(FilterElementsByGenderAndRace(wearables, disguisedGenderEnum, disguisedRaceEnum), WearableType.Moustache, headSpriteId), WearableType.Moustache);
                        disguisedFaceAttachments = AddEmpty(FilterByTypeAndHeadID(FilterElementsByGenderAndRace(wearables, disguisedGenderEnum, disguisedRaceEnum), WearableType.FaceAttachment, headSpriteId), WearableType.FaceAttachment);

                        if (IsValidIndex(disguisedHairIndex, disguisedHairs))
                        {
                            disguisedHairElement = disguisedHairs[disguisedHairIndex];
                        }
                        else
                        {
                            disguisedHairElement = GetRandomElement(disguisedHairs);
                        }
                        if (IsValidIndex(disguisedBeardIndex, disguisedBeards))
                        {
                            disguisedBeardElement = disguisedBeards[disguisedBeardIndex];
                        }
                        else
                        {
                            disguisedBeardElement = GetRandomElement(disguisedBeards);
                        }

                        if (IsValidIndex(disguisedMoustacheIndex, disguisedMoustaches))
                        {
                            disguisedMoustacheElement = disguisedMoustaches[disguisedMoustacheIndex];
                        }
                        else
                        {
                            disguisedMoustacheElement = GetRandomElement(disguisedMoustaches);
                        }
                        if (IsValidIndex(disguisedFaceAttachmentIndex, disguisedFaceAttachments))
                        {
                            disguisedFaceAttachmentElement = disguisedFaceAttachments[disguisedFaceAttachmentIndex];
                        }
                        else
                        {
                            disguisedFaceAttachmentElement = GetRandomElement(disguisedFaceAttachments);
                        }

                        idCard.StoredAttachments = new List <WearableSprite>();

                        disguisedFaceAttachmentElement?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.FaceAttachment)));
                        disguisedBeardElement?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.Beard)));
                        disguisedMoustacheElement?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.Moustache)));
                        disguisedHairElement?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.Hair)));

                        if (OmitJobInPortraitClothing)
                        {
                            JobPrefab.NoJobElement?.Element("PortraitClothing")?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.JobIndicator)));
                        }
                        else
                        {
                            idCard.StoredJobPrefab?.ClothingElement?.Elements("sprite").ForEach(s => idCard.StoredAttachments.Add(new WearableSprite(s, WearableType.JobIndicator)));
                        }
                    }
                }
            }

            if (idCard.StoredJobPrefab != null)
            {
                disguisedJobIcon  = idCard.StoredJobPrefab.Icon;
                disguisedJobColor = idCard.StoredJobPrefab.UIColor;
            }

            disguisedPortrait          = idCard.StoredPortrait;
            disguisedSheetIndex        = idCard.StoredSheetIndex;
            disguisedAttachmentSprites = idCard.StoredAttachments;
        }
 public IdCardMessageHeader(IdCard sc) : this()
 {
     this.sc = sc;
 }
Exemple #28
0
        public void Should_create_a_random_valid_DNI()
        {
            var dni = new IdCard(new RandomProvider(new System.Random()));

            Assert.NotNull(dni.ToString());
        }
        //注册
        private void BtnSure_Click(object sender, RoutedEventArgs e)
        {
            List <Control> con_list = new List <Control>()
            {
                txtName,
                txtAddress,
                cboCulture,
                txtIdcardNo,
                txtPhone,
                cboWork,
                txtAge,
                cboNation,
                txtPostcode,
                rdoBoy,
                rdoGirl,
                rdoMarriageYes,
                rdoMarriageNo,
                dtpBirthday
            };

            foreach (Control item in con_list)
            {
                if (item is TextBox)
                {
                    if (((TextBox)item).Text == "")
                    {
                        var p = new Tip("请把信息填写完整!");
                        p.ShowDialog();
                        return;
                    }
                }
                if (item is ComboBox)
                {
                    if (((ComboBox)item).Text == "")
                    {
                        var p = new Tip("请把信息填写完整!");
                        p.ShowDialog();
                        return;
                    }
                }
                if (item is DatePicker)
                {
                    if (((DatePicker)item).Text == "")
                    {
                        var p = new Tip("请把信息填写完整!");
                        p.ShowDialog();
                        return;
                    }
                }
            }
            IdCard IC = new IdCard
            {
                Name = txtName.Text
            };

            if (rdoBoy.IsChecked == true)
            {
                IC.Sex = rdoBoy.Content.ToString();
            }
            else
            {
                IC.Sex = rdoGirl.Content.ToString();
            }
            IC.Age      = int.Parse(txtAge.Text);
            IC.Birthday = dtpBirthday.Text;
            IC.Address  = txtAddress.Text;
            IC.Phone    = (txtPhone.Text);
            IC.Nation   = cboNation.Text;
            IC.Cultrue  = cboCulture.Text;
            if (rdoMarriageYes.IsChecked == true)
            {
                IC.Marriage = rdoMarriageYes.Content.ToString();
            }
            else
            {
                IC.Marriage = rdoMarriageNo.Content.ToString();
            }
            IC.Work     = cboWork.Text;
            IC.Postcode = (txtPostcode.Text);
            IC.IdcardNo = txtIdcardNo.Text;

            string mes = new IdCard_BLL().Reg(IC);
            string s   = new IdCard_BLL().p_IdCard_select();

            var t = new Tip("注册成功!卡号为:" + s);

            t.ShowDialog();
        }
        private void InitializeJobItem(Character character, XElement itemElement, WayPoint spawnPoint = null, Item parentItem = null)
        {
            ItemPrefab itemPrefab;

            if (itemElement.Attribute("name") != null)
            {
                string itemName = itemElement.Attribute("name").Value;
                DebugConsole.ThrowError("Error in Job config (" + Name + ") - use item identifiers instead of names to configure the items.");
                itemPrefab = MapEntityPrefab.Find(itemName) as ItemPrefab;
                if (itemPrefab == null)
                {
                    DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemName + "\". Matching item prefab not found.");
                    return;
                }
            }
            else
            {
                string itemIdentifier = itemElement.GetAttributeString("identifier", "");
                itemPrefab = MapEntityPrefab.Find(null, itemIdentifier) as ItemPrefab;
                if (itemPrefab == null)
                {
                    DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemIdentifier + "\". Matching item prefab not found.");
                    return;
                }
            }

            Item item = new Item(itemPrefab, character.Position, null);

#if SERVER
            if (GameMain.Server != null && Entity.Spawner != null)
            {
                if (GameMain.Server.EntityEventManager.UniqueEvents.Any(ev => ev.Entity == item))
                {
                    string errorMsg = $"Error while spawning job items. Item {item.Name} created network events before the spawn event had been created.";
                    DebugConsole.ThrowError(errorMsg);
                    GameAnalyticsManager.AddErrorEventOnce("Job.InitializeJobItem:EventsBeforeSpawning", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
                    GameMain.Server.EntityEventManager.UniqueEvents.RemoveAll(ev => ev.Entity == item);
                    GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item);
                }

                Entity.Spawner.CreateNetworkEvent(item, false);
            }
#endif

            if (itemElement.GetAttributeBool("equip", false))
            {
                List <InvSlotType> allowedSlots = new List <InvSlotType>(item.AllowedSlots);
                allowedSlots.Remove(InvSlotType.Any);

                character.Inventory.TryPutItem(item, null, allowedSlots);
            }
            else
            {
                character.Inventory.TryPutItem(item, null, item.AllowedSlots);
            }

            Wearable wearable = ((List <ItemComponent>)item.Components)?.Find(c => c is Wearable) as Wearable;
            if (wearable != null)
            {
                if (Variant > 0 && Variant <= wearable.Variants)
                {
                    wearable.Variant = Variant;
                }
                else
                {
                    wearable.Variant = wearable.Variant; //force server event
                    if (wearable.Variants > 0 && Variant == 0)
                    {
                        //set variant to the same as the wearable to get the rest of the character's gear
                        //to use the same variant (if possible)
                        Variant = wearable.Variant;
                    }
                }
            }

            if (item.Prefab.Identifier == "idcard" && spawnPoint != null)
            {
                foreach (string s in spawnPoint.IdCardTags)
                {
                    item.AddTag(s);
                }
                item.AddTag("name:" + character.Name);
                item.AddTag("job:" + Name);
                if (!string.IsNullOrWhiteSpace(spawnPoint.IdCardDesc))
                {
                    item.Description = spawnPoint.IdCardDesc;
                }

                IdCard idCardComponent = item.GetComponent <IdCard>();
                if (idCardComponent != null)
                {
                    idCardComponent.Initialize(character.Info);
                }
            }

            foreach (WifiComponent wifiComponent in item.GetComponents <WifiComponent>())
            {
                wifiComponent.TeamID = character.TeamID;
            }

            if (parentItem != null)
            {
                parentItem.Combine(item, user: null);
            }

            foreach (XElement childItemElement in itemElement.Elements())
            {
                InitializeJobItem(character, childItemElement, spawnPoint, item);
            }
        }