Ejemplo n.º 1
0
        private void drawEditDegreeState(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
            }
            Vector2 pos  = new Vector2((float)bounds.X + 10f, (float)bounds.Y + 60f);
            bool    flag = this.editedField == AcademicDatabaseDaemon.ADDEditField.None;

            TextItem.doSmallLabel(pos, LocaleTerms.Loc("University") + ":", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, this.searchedDegrees[this.editedIndex].uni, new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.Uni ? this.themeColor : Color.White));
            Rectangle destinationRectangle;

            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.Uni)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(this.searchedDegrees[this.editedIndex].uni);
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46700, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.Uni;
                this.os.execute("getString University");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, LocaleTerms.Loc("Degree") + ":", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, this.searchedDegrees[this.editedIndex].name, new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.Degree ? this.themeColor : Color.White));
            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.Degree)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(this.searchedDegrees[this.editedIndex].name);
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46705, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.Degree;
                this.os.execute("getString Degree");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "GPA:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, string.Concat((object)this.searchedDegrees[this.editedIndex].GPA), new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.GPA ? this.themeColor : Color.White));
            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.GPA)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(string.Concat((object)this.searchedDegrees[this.editedIndex].GPA));
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46710, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.GPA;
                this.os.execute("getString GPA");
            }
            pos.Y += 30f;
            if (this.editedField != AcademicDatabaseDaemon.ADDEditField.None)
            {
                if (!this.doEditField())
                {
                    return;
                }
                this.editedField       = AcademicDatabaseDaemon.ADDEditField.None;
                this.os.getStringCache = "";
                this.saveChangesToEntry();
            }
            else if (Button.doButton(486012, bounds.X + 2, bounds.Y + bounds.Height - 40, 230, 30, LocaleTerms.Loc("Save And Return"), new Color?(this.backThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
                this.comp.log("ACADEMIC_DATABASE::RecordEdit_:_#" + (object)this.editedIndex + "_: " + this.searchedName.Replace(" ", "_"));
            }
        }
Ejemplo n.º 2
0
        private void drawEntryState(Rectangle bounds, SpriteBatch sb)
        {
            if (this.state == AcademicDatabaseDaemon.ADDState.Entry && this.os.hasConnectionPermission(true))
            {
                this.state = AcademicDatabaseDaemon.ADDState.EditPerson;
            }
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Welcome;
            }
            float x  = (float)bounds.X + 20f;
            float y1 = (float)bounds.Y + 50f;

            TextItem.doFontLabel(new Vector2(x, y1), this.searchedName, GuiData.font, new Color?(), (float)bounds.Width - (x - (float)bounds.X), 60f, false);
            float y2 = y1 + 30f;

            if (this.searchedDegrees.Count == 0)
            {
                TextItem.doFontLabel(new Vector2(x, y2), " -" + LocaleTerms.Loc("No Degrees Found"), GuiData.smallfont, new Color?(), float.MaxValue, float.MaxValue, false);
            }
            for (int index = 0; index < this.searchedDegrees.Count; ++index)
            {
                string text = LocaleTerms.Loc("Degree") + " :" + this.searchedDegrees[index].name + "\n" + LocaleTerms.Loc("Uni") + "      :" + this.searchedDegrees[index].uni + "\nGPA      :" + (object)this.searchedDegrees[index].GPA;
                TextItem.doFontLabel(new Vector2(x, y2), text, GuiData.smallfont, new Color?(), (float)bounds.Width - ((float)bounds.X - x), 50f, false);
                y2 += 60f;
                if (this.state == AcademicDatabaseDaemon.ADDState.EditPerson)
                {
                    float num = y2 - 10f;
                    if (Button.doButton(457900 + index, (int)x, (int)num, 100, 20, LocaleTerms.Loc("Edit"), new Color?()))
                    {
                        this.state       = AcademicDatabaseDaemon.ADDState.EditEntry;
                        this.editedField = AcademicDatabaseDaemon.ADDEditField.None;
                        this.editedIndex = index;
                    }
                    if (Button.doButton(456900 + index, (int)x + 105, (int)num, 100, 20, this.needsDeletionConfirmation ? LocaleTerms.Loc("Delete") : LocaleTerms.Loc("Confirm?"), new Color?(this.needsDeletionConfirmation ? Color.Gray : Color.Red)))
                    {
                        if (this.needsDeletionConfirmation)
                        {
                            this.needsDeletionConfirmation = false;
                        }
                        else
                        {
                            this.comp.log("ACADEMIC_DATABASE::RecordDeletion_:_#" + (object)index + "_: " + this.searchedName.Replace(" ", "_"));
                            this.searchedDegrees.RemoveAt(index);
                            this.saveChangesToEntry();
                            --index;
                            this.needsDeletionConfirmation = true;
                        }
                    }
                    y2 = num + 35f;
                }
            }
            float num1 = y2 + 10f;

            if (this.state != AcademicDatabaseDaemon.ADDState.EditPerson || !Button.doButton(458009, (int)x, (int)num1, 200, 30, LocaleTerms.Loc("Add Degree"), new Color?(this.themeColor)))
            {
                return;
            }
            Degree degree = new Degree("UNKNOWN", "UNKNOWN", 0.0f);

            this.searchedDegrees.Add(degree);
            this.editedIndex = this.searchedDegrees.IndexOf(degree);
            this.state       = AcademicDatabaseDaemon.ADDState.EditEntry;
            this.comp.log("ACADEMIC_DATABASE::RecordAdd_:_#" + (object)this.editedIndex + "_: " + this.searchedName.Replace(" ", "_"));
        }