コード例 #1
0
        private void Wellbeing(ref float widestWidth)
        {
            var label = AddUIComponent <UILabel>();

            label.name          = "WellbeingLabel";
            label.text          = "Wellbeing Level".TranslateCitizen();
            label.textScale     = 0.9f;
            label.isInteractive = false;

            var inputField = UiUtils.CreateCitizenInputField(this, "Wellbeing", (component, value) => { });

            inputField.text =
                CitizenHelper.GetWellbeingText(Citizen.GetWellbeingLevel(SelectedCitizen.EducationLevel,
                                                                         SelectedCitizen.m_wellbeing));
            inputField.isInteractive = false;

            inputField.tooltip = inputField.text;

            Inputs.Add(inputField);
            _labels.Add(label);

            if (label.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6 > widestWidth)
            {
                widestWidth = label.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6;
            }
        }
コード例 #2
0
        public List <Citizen> GetCitizenList(CitizenViewModel model)
        {
            List <Citizen> citizenList = new List <Citizen>();

            using (conn = new DB2Connection(connectionString))
            {
                conn.Open();
                using (DB2Command cmd = conn.CreateCommand())
                {
                    cmd.CommandText = CitizenHelper.CitizenSearchQueryBuilder(model);
                    rd = cmd.ExecuteReader();
                    rd.Read();
                    do
                    {
                        if (rd.HasRows)
                        {
                            Citizen citizen = new Citizen
                            {
                                Id          = int.Parse(rd[0].ToString()),
                                Surname     = rd[1].ToString().Trim(' '),
                                CitizenName = rd[2].ToString().Trim(' '),
                                Middlename  = rd[3].ToString().Trim(' '),
                                BirthDate   = DateTime.Parse(rd[4].ToString())
                            };
                            citizenList.Add(citizen);
                        }
                    } while (rd.Read());
                }
            }

            return(citizenList);
        }
コード例 #3
0
        public static UITextField CreateCitizenJobField(UIComponent parent, string fieldName,
                                                        PropertyChangedEventHandler <string> handler)
        {
            var textField = parent.AddUIComponent <UITextField>();

            textField.name = fieldName;
            textField.builtinKeyNavigation = true;
            textField.isInteractive        = true;
            textField.readOnly             = false;

            textField.selectionSprite          = "EmptySprite";
            textField.selectionBackgroundColor = new Color32(0, 172, 234, 255);

            textField.width               = FieldWidth;
            textField.height              = FieldHeight;
            textField.padding             = new RectOffset(6, 6, 6, 6);
            textField.normalBgSprite      = "LevelBarBackground";
            textField.hoveredBgSprite     = "LevelBarBackground";
            textField.disabledBgSprite    = "LevelBarBackground";
            textField.focusedBgSprite     = "LevelBarBackground";
            textField.horizontalAlignment = UIHorizontalAlignment.Center;
            textField.textColor           = Color.white;
            textField.textScale           = 0.85f;
            textField.selectOnFocus       = true;
            textField.eventTextSubmitted += handler;


            if (CustomizeItExtendedCitizenTool.instance.CustomJobTitles.TryGetValue(
                    CustomizeItExtendedCitizenTool.instance.SelectedCitizen, out string title))
            {
                textField.text = title;
            }
            else
            {
                if (CustomizeItExtendedCitizenTool.instance.OriginalJobTitles.TryGetValue(
                        CustomizeItExtendedCitizenTool.instance.SelectedCitizen, out string originalTitle))
                {
                    textField.text = originalTitle;
                }
                else
                {
                    var defaultTitle =
                        CitizenHelper.GetDefaultJobTitle(CustomizeItExtendedCitizenTool.instance.SelectedCitizen);
                    textField.text = defaultTitle;

                    CustomizeItExtendedCitizenTool.instance.OriginalJobTitles.Add(
                        CustomizeItExtendedCitizenTool.instance.SelectedCitizen, defaultTitle);
                }
            }

            textField.tooltip = textField.text;
            return(textField);
        }
コード例 #4
0
        private void InitializeCitizenJobData()
        {
            for (uint citizenID = 1; citizenID < CitizenManager.instance.m_citizens.m_buffer.Length; citizenID++)
            {
                var citizen = CitizenManager.instance.m_citizens.m_buffer[citizenID];

                if (!citizen.m_flags.IsFlagSet(Citizen.Flags.Created))
                {
                    continue;
                }

                if (CustomizeItExtendedCitizenTool.instance.OriginalJobTitles.TryGetValue(citizenID, out string _))
                {
                    continue;
                }

                CustomizeItExtendedCitizenTool.instance.OriginalJobTitles.Add(citizenID,
                                                                              CitizenHelper.GetDefaultJobTitle(citizenID));
            }
        }
コード例 #5
0
ファイル: Citizen.cs プロジェクト: Kampotyk/CitizenRegistry
        public Citizen(string firstName, string lastName, DateTime birthDate, Gender gender)
        {
            this.firstName = CitizenHelper.ToTitleCase(firstName);
            this.lastName  = CitizenHelper.ToTitleCase(lastName);

            if (CitizenHelper.IsGenderValid(gender))
            {
                this.gender = gender;
            }
            else
            {
                throw new ArgumentOutOfRangeException("gender");
            }

            if (CitizenHelper.IsPastDate(birthDate))
            {
                this.birthDate = CitizenHelper.GetDateOnly(birthDate);
            }
            else
            {
                throw new ArgumentException("birthDate");
            }
        }