コード例 #1
0
ファイル: Romancer.cs プロジェクト: yakoder/NRaas
            protected override bool Run(SimDescription a, SimDescription b)
            {
                Relationship relation = Relationship.Get(a, b, true);

                if (relation == null)
                {
                    return(false);
                }

                string text = StringInputDialog.Show("Change Long Term Relationship", "Enter the amount to change the existing long term relationship between\n" + a.FirstName + " " + a.LastName + "\nand\n" + b.FirstName + " " + b.LastName + "\n\nRange is -100 to 100", relation.LTR.Liking.ToString("F1"), 256, StringInputDialog.Validation.None);

                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                float value = 0f;

                if (!float.TryParse(text, out value))
                {
                    SimpleMessageDialog.Show("Change Long Term Relationship", "Value '" + text + "' could not be converted to a number.");
                    return(false);
                }

                relation.LTR.SetLiking(value);
                return(true);
            }
コード例 #2
0
            protected override bool PrivatePerform(List <int> values)
            {
                foreach (int value in values)
                {
                    string text = StringInputDialog.Show(Name, Localize("Prompt", new object[] { value }), Value[value].ToString());
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }

                    int newValue;
                    if (!int.TryParse(text, out newValue))
                    {
                        Common.Localize("Numeric:Error");
                        continue;
                    }

                    if (newValue < 0)
                    {
                        newValue = -newValue;
                    }

                    Value[value] = newValue;
                }

                return(true);
            }
コード例 #3
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            Unemployed unemployed = parameters.mTarget.Occupation as Unemployed;

            if (unemployed == null)
            {
                return(OptionResult.Failure);
            }

            string text = StringInputDialog.Show(Name, Common.Localize("ChangeStipend:Prompt", parameters.mActor.IsFemale), unemployed.mStipend.ToString());

            if (string.IsNullOrEmpty(text))
            {
                return(OptionResult.Failure);
            }

            int value;

            if (!int.TryParse(text, out value))
            {
                Common.Notify(Common.Localize("Numeric:Error"));
                return(OptionResult.Failure);
            }

            unemployed.mStipend = value;
            return(OptionResult.SuccessClose);
        }
コード例 #4
0
        protected override OptionResult Perform(IActor actor, GameObject target, GameObjectHit hit)
        {
            Lot lot = GetLot(target, hit);

            if (lot == null)
            {
                return(OptionResult.Failure);
            }

            string backupAddress = "";
            string key           = World.GetLotAddressKey(lot.LotId);

            if (!string.IsNullOrEmpty(key) && Localization.HasLocalizationString(key))
            {
                backupAddress = Common.LocalizeEAString(key);
            }
            string text = StringInputDialog.Show(GetInteractionName(), GetPrompt(lot, lot.Household, backupAddress), lot.Address, StringInputDialog.Validation.NoneAllowEmptyOK);

            if (text == null || text == lot.Address)
            {
                return(OptionResult.Failure);
            }

            if (text == "" || text == backupAddress)
            {
                Tagger.Settings.mAddresses.Remove(lot.LotId);
            }
            else
            {
                Tagger.Settings.AddAddress(lot.LotId, text);
            }
            lot.mAddressLocalizationKey = text;
            return(OptionResult.SuccessClose);
        }
コード例 #5
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                int remainingPoints = (int)(me.CelebrityManager.GetGoalPointsForCurrentLevel() - me.CelebrityManager.Points);

                string text = StringInputDialog.Show(Name, Common.Localize("CelebrityPoints:Prompt", me.IsFemale, new object[] { me, remainingPoints }), me.CelebrityManager.Points.ToString(), 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                mPoints = 0;
                if (!uint.TryParse(text, out mPoints))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            CelebrityLevel.CleanupFreeStuffAlarm(me);

            me.CelebrityManager.AddPointsInternal(mPoints);
            return(true);
        }
コード例 #6
0
ファイル: PerformanceBase.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize("Performance:Prompt"), GetValue(me).ToString(), 256, StringInputDialog.Validation.None);
                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                if (!float.TryParse(text, out mValue))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }

                if (mValue > 100f)
                {
                    mValue = 100f;
                }
                else if (mValue < -100f)
                {
                    mValue = -100f;
                }
            }

            SetValue(me, mValue);
            return(true);
        }
コード例 #7
0
ファイル: ChangeName.cs プロジェクト: yakoder/NRaas
        public override bool Run()
        {
            try
            {
                if (Target is Lot)
                {
                    Lot target = Target as Lot;

                    string text = StringInputDialog.Show(Common.Localize("ChangeName:Lot"), Common.Localize("ChangeName:Prompt"), target.Name);
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }

                    target.Name = text;
                }
                else if (Target is RabbitHole)
                {
                    RabbitHole hole = Target as RabbitHole;

                    string str = StringInputDialog.Show(Common.Localize("ChangeName:Rabbithole"), Common.Localize("ChangeName:Prompt"), Target.CatalogName);
                    if (string.IsNullOrEmpty(str))
                    {
                        return(false);
                    }

                    hole.SetOverrideNameString(str);
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
            }
            return(true);
        }
コード例 #8
0
        public override SimSelection.UpdateResult Update(IMiniSimDescription actor, IEnumerable <SimSelection.ICriteria> criteria, List <IMiniSimDescription> allSims, bool secondStage)
        {
            if (!secondStage)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", actor.IsFemale), "");
                if (string.IsNullOrEmpty(text))
                {
                    return(SimSelection.UpdateResult.Failure);
                }

                if (!int.TryParse(text, out mValue))
                {
                    Common.Notify(Common.Localize("Numeric:Error"));
                    return(SimSelection.UpdateResult.Failure);
                }

                return(SimSelection.UpdateResult.Delay);
            }
            else
            {
                RandomUtil.RandomizeListOfObjects(allSims);

                allSims.RemoveRange(mValue, allSims.Count - mValue);

                return(SimSelection.UpdateResult.Success);
            }
        }
コード例 #9
0
ファイル: NormalMapValue.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(me, CASParts.sPrimary))
            {
                if (!builder.OutfitValid)
                {
                    return(true);
                }

                if (!ApplyAll)
                {
                    float oldValue = GetValue(builder.Builder);

                    string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me }), oldValue.ToString(), 256, StringInputDialog.Validation.None);
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }

                    mValue = 0;
                    if (!float.TryParse(text, out mValue))
                    {
                        SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                        return(false);
                    }
                }

                ApplyValue(builder.Builder, mValue);
            }

            new SavedOutfit.Cache(me).PropagateGenetics(me, CASParts.sPrimary);

            return(true);
        }
コード例 #10
0
ファイル: BreakupScenario.cs プロジェクト: yakoder/NRaas
        protected bool RenameDivorcee(SimDescription sim)
        {
            string parentNames = null;

            List <SimDescription> parents = Relationships.GetParents(sim);

            if (parents.Count > 0)
            {
                object[] objParents = null;
                if (parents.Count == 2)
                {
                    objParents = new object[] { parents[0], parents[1] };
                }
                else
                {
                    objParents = new object[] { parents[0] };
                }

                parentNames = Common.Localize("RenameDivorcee:PromptParents", sim.IsFemale, objParents);
            }

            List <object> parameters = Stories.AddGenderNouns(sim);

            string text = StringInputDialog.Show(Common.Localize("RenameDivorcee:MenuName"), Common.Localize("RenameDivorcee:Prompt", sim.IsFemale, parameters.ToArray()) + parentNames, sim.LastName);

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            sim.LastName = text;

            return(true);
        }
コード例 #11
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Occupation occupation = GetOccupation(me);

            if (occupation == null)
            {
                return(false);
            }

            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me, occupation.PaidDaysOff }), "0", 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                if (!int.TryParse(text, out mValue))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            occupation.mDaysOff += mValue;

            if (occupation.mDaysOff < 0)
            {
                occupation.mDaysOff = 0;
            }

            return(true);
        }
コード例 #12
0
        public TLSTEntryNode NewEntry()
        {
            if (Resource.Children.Count >= 255)
            {
                return(null);
            }
            StringInputDialog d = new StringInputDialog("New TLST Entry", "");

            if (d.ShowDialog() == DialogResult.OK)
            {
                // Get an unused expanded song id
                uint songID = 0x0000F000;
                while (Resource.Children.Count(n => ((TLSTEntryNode)n)._songID == songID) > 0)
                {
                    songID++;
                }
                TLSTEntryNode node = new TLSTEntryNode
                {
                    _name     = d.resultString,
                    _songID   = songID,
                    Volume    = 80,
                    Frequency = 40
                };

                _resource.AddChild(node);
                BaseWrapper w = FindResource(node, false);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
                return(node);
            }

            return(null);
        }
コード例 #13
0
ファイル: GenderPreference.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize("GenderPreference:MalePrompt", me.IsFemale, new object[] { me }), me.mGenderPreferenceMale.ToString(), 256, StringInputDialog.Validation.None);
                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                mPreferenceMale = 0;
                if (!int.TryParse(text, out mPreferenceMale))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }

                text = StringInputDialog.Show(Name, Common.Localize("GenderPreference:FemalePrompt", me.IsFemale, new object[] { me }), me.mGenderPreferenceFemale.ToString(), 256, StringInputDialog.Validation.None);
                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                mPreferenceFemale = 0;
                if (!int.TryParse(text, out mPreferenceFemale))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            me.mGenderPreferenceMale   = mPreferenceMale;
            me.mGenderPreferenceFemale = mPreferenceFemale;
            return(true);
        }
コード例 #14
0
ファイル: RelationshipValue.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription a, SimDescription b)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(true);
            }

            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize("RelationshipByValue:Prompt", a.IsFemale, new object[] { a, b }), relation.LTR.Liking.ToString());
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                mValue = 0;
                if (!float.TryParse(text, out mValue))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            relation.LTR.SetLiking(mValue);
            return(true);
        }
コード例 #15
0
ファイル: ColorSettingOption.cs プロジェクト: yakoder/NRaas
        protected override OptionResult Run(GameHitParameters <TTarget> parameters)
        {
            string text = StringInputDialog.Show(Name, GetPrompt(), this.DisplayValue);

            if (string.IsNullOrEmpty(text))
            {
                return(OptionResult.Failure);
            }

            uint value = 0;

            try
            {
                value = uint.Parse("FF" + text, System.Globalization.NumberStyles.HexNumber);
            }
            catch
            { }

            if (value == 0)
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Hex:Error"));
                return(OptionResult.Failure);
            }

            Value = Validate(value);

            Tagger.InitTags(false);

            Common.Notify(ToString());
            return(OptionResult.SuccessRetain);
        }
コード例 #16
0
ファイル: AddTitleOption.cs プロジェクト: yakoder/NRaas
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Sim target = parameters.mActor as Sim;

            if (target != null)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", false), "");
                if (string.IsNullOrEmpty(text))
                {
                    return(OptionResult.Failure);
                }

                if (!Tagger.Settings.mCustomSimTitles.ContainsKey(target.SimDescription.SimDescriptionId))
                {
                    Tagger.Settings.mCustomSimTitles.Add(target.SimDescription.SimDescriptionId, new List <string>());
                }

                if (!Tagger.Settings.mCustomSimTitles[target.SimDescription.SimDescriptionId].Contains(text))
                {
                    Tagger.Settings.mCustomSimTitles[target.SimDescription.SimDescriptionId].Add(text);
                }

                Tagger.Settings.SetCustomTitles(target);

                Common.Notify(Common.Localize("General:Success"));
            }

            return(OptionResult.SuccessClose);
        }
コード例 #17
0
            protected override void OnPerform()
            {
                LoopingAnimationBase interaction = mInteractionInstance as LoopingAnimationBase;

                string value = StringInputDialog.Show(Common.Localize("Timing:MenuName"), Common.Localize("Timing:Prompt", interaction.TargetSim.IsFemale, new object[] { interaction.TargetSim }), interaction.Timing.ToString());

                if (string.IsNullOrEmpty(value))
                {
                    return;
                }

                float timing = 0;

                if (!float.TryParse(value, out timing))
                {
                    AcceptCancelDialog.Show(Common.Localize("Numeric:Error"));
                    return;
                }

                if (timing < 0)
                {
                    timing = 0;
                }

                interaction.Timing = timing;

                mTone.mTiming = timing;

                Sims3.UI.Hud.InteractionQueue.Instance.UpdateQueueFull();
            }
コード例 #18
0
ファイル: CareerBonus.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Career career = me.Occupation as Career;

            if (career == null)
            {
                return(true);
            }

            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize("CareerBonus:Prompt", me.IsFemale, new object[] { me, career.mPayPerHourExtra }), "0", 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                if (!float.TryParse(text, out mValue))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            career.mPayPerHourExtra += mValue;

            if (career.mPayPerHourExtra < 0)
            {
                career.mPayPerHourExtra = 0;
            }

            return(true);
        }
コード例 #19
0
 private void BtnAddSub_Click(object sender, EventArgs e)
 {
     using (StringInputDialog d = new StringInputDialog("Github link to a repository:", ""))
     {
         if (d.ShowDialog(this) == DialogResult.OK)
         {
             Regex rgx = new Regex(".*[Gg][Ii][Tt][Hh][Uu][Bb][.][Cc][Oo][Mm]/([^/\n]+)/([^/\n]+)[^\n]*");
             Match m   = rgx.Match(d.resultString);
             if (m.Success && m.Groups.Count == 3)
             {
                 string repoOwner = m.Groups[1].Value;
                 string repoName  = m.Groups[2].Value;
                 if (repoOwner.Equals("soopercool101", StringComparison.OrdinalIgnoreCase) ||
                     MessageBox.Show(
                         $"Warning: The {repoOwner}/{repoName} repository is not affiliated with the BrawlCrate Developement Team.\n" +
                         "You should only install scripts from sources you trust. Would you like to proceed?",
                         "API Subscription Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) ==
                     DialogResult.Yes)
                 {
                     UpdaterHelper.BrawlAPIInstallUpdate(true, repoOwner, repoName, true);
                     GetNewFiles();
                     RefreshList();
                 }
             }
             else
             {
                 MessageBox.Show($"{d.resultString} is not a valid GitHub repository.", "Error",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
コード例 #20
0
        protected override OptionResult Run(Lot lot, Household me)
        {
            if (me != null)
            {
                if (!ApplyAll)
                {
                    string text = StringInputDialog.Show(Name, Common.Localize("FamilyFunds:Prompt", false, new object[] { me.Name, me.FamilyFunds }), "0");
                    if (string.IsNullOrEmpty(text))
                    {
                        return(OptionResult.Failure);
                    }

                    mDelta = 0;
                    if (!int.TryParse(text, out mDelta))
                    {
                        SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                        return(OptionResult.Failure);
                    }
                }

                me.ModifyFamilyFunds(mDelta);
            }

            return(OptionResult.SuccessClose);
        }
コード例 #21
0
        public UserRole CreateNewUserRole()
        {
            StringInputDialog addPersonDialog = new StringInputDialog
            {
                Title   = "Creazione nuovo Ruolo Utente",
                Message = "Nome:"
            };

            if (addPersonDialog.ShowDialog() != true)
            {
                return(null);
            }

            UserRole newRole = new UserRole
            {
                Name        = addPersonDialog.InputString,
                Description = ""
            };

            _lInstData.Execute(new InsertEntityCommand <LInstContext>(newRole));

            foreach (User usr in _lInstData.RunQuery(new UsersQuery()))
            {
                UserRoleMapping newMap = new UserRoleMapping
                {
                    IsSelected = false,
                    UserRoleID = newRole.ID,
                    UserID     = usr.ID
                };

                _lInstData.Execute(new InsertEntityCommand <LInstContext>(newMap));
            }

            return(newRole);
        }
コード例 #22
0
        public Person CreateNewPerson()
        {
            StringInputDialog addPersonDialog = new StringInputDialog
            {
                Title   = "Creazione nuova Persona",
                Message = "Nome:"
            };

            if (addPersonDialog.ShowDialog() != true)
            {
                return(null);
            }

            Person newPerson = new Person
            {
                Name = addPersonDialog.InputString
            };

            foreach (PersonRole prr in _lInstData.RunQuery(new PersonRolesQuery()))
            {
                PersonRoleMapping tempPRM = new PersonRoleMapping();
                tempPRM.RoleID     = prr.ID;
                tempPRM.IsSelected = false;
                newPerson.RoleMappings.Add(tempPRM);
            }

            _lInstData.Execute(new InsertEntityCommand <LInstContext>(newPerson));

            return(newPerson);
        }
コード例 #23
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me, 100 }), me.AlienDNAPercentage.ToString(), 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                mPercent = 0;
                if (!float.TryParse(text, out mPercent))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            me.mAlienDNAPercentage = mPercent;

            if (me.CreatedSim != null)
            {
                me.CreatedSim.Motives.RecreateMotives(me.CreatedSim);
            }
            return(true);
        }
コード例 #24
0
        // this could be further broken down into another class (IntegerSettingOption) but not right now
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            OptionResult result = base.Run(parameters);

            if (result != OptionResult.Failure)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", false), ""); // def

                if (string.IsNullOrEmpty(text))
                {
                    return(OptionResult.Failure);
                }

                int value;
                if (!int.TryParse(text, out value))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(OptionResult.Failure);
                }

                foreach (OccupationNames name in base.mPicks)
                {
                    NRaas.CareerSpace.PersistedSettings.CareerSettings settings = NRaas.Careers.Settings.GetCareerSettings(name, true);
                    settings.minCoworkers = value;
                    NRaas.Careers.Settings.UpdateCareerSettings(settings);
                }

                Common.Notify("Generic:Success");
                return(OptionResult.SuccessLevelDown);
            }

            return(result);
        }
コード例 #25
0
ファイル: SetCustom.cs プロジェクト: yakoder/NRaas
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            foreach (SimDescription sim in new SimSelection(Name, PortraitPanel.Settings.SelectedSims, new SortColumn()).SelectMultiple())
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", sim.IsFemale, new object[] { sim }), PortraitPanel.Settings.GetSimSort(sim).ToString());
                if (string.IsNullOrEmpty(text))
                {
                    return(OptionResult.Failure);
                }

                int value;
                if (!int.TryParse(text, out value))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    continue;
                }

                PortraitPanel.Settings.SetSimSort(sim, value);
            }

            PortraitPanel.Settings.AddSelectedSimsFilter();

            SkewerEx.Instance.PopulateSkewers();

            return(OptionResult.SuccessRetain);
        }
コード例 #26
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (parameters.mTarget != null)
            {
                DoorPortalComponentEx.DoorSettings settings = GoHere.Settings.GetDoorSettings(parameters.mTarget.ObjectId);

                string sCost = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":PromptCost"), settings.mDoorCost.ToString());
                if (string.IsNullOrEmpty(sCost))
                {
                    return(OptionResult.Failure);
                }

                int cost = 0;
                if (!int.TryParse(sCost, out cost))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(OptionResult.Failure);
                }

                if (cost < 0 || cost > int.MaxValue)
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:InvalidInput"));
                    return(OptionResult.Failure);
                }

                settings.mDoorCost = cost;
                GoHere.Settings.AddOrUpdateDoorSettings(parameters.mTarget.ObjectId, settings, false);

                Common.Notify(Common.Localize("Generic:Success"));

                return(OptionResult.SuccessClose);
            }

            return(OptionResult.Failure);
        }
コード例 #27
0
ファイル: BabyMultiple.cs プロジェクト: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize("BabyMultiple:Prompt", me.IsFemale, new object[] { me, Pregnancy.kMaxBabyMultiplier }), me.Pregnancy.mMultipleBabiesMultiplier.ToString());
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                mMultiple = 0;
                if (!float.TryParse(text, out mMultiple))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }

                if (mMultiple < 0)
                {
                    mMultiple = 0;
                }
                else if (mMultiple > Pregnancy.kMaxBabyMultiplier)
                {
                    mMultiple = Pregnancy.kMaxBabyMultiplier;
                }
            }

            me.Pregnancy.mMultipleBabiesMultiplier = mMultiple;
            return(true);
        }
コード例 #28
0
 private void SaveImageIfNeeded(System.Drawing.Bitmap bitmap)
 {
     try
     {
         if (MainWindow.UserPrefs.IsSaveOcrImage)
         {
             var saveFolder = MainWindow.UserPrefs.SaveOcrImageFolder;
             if (!String.IsNullOrWhiteSpace(saveFolder) && Directory.Exists(saveFolder))
             {
                 StringInputDialog dialog = new StringInputDialog(this, "Entry Name", searchPage.searchTextBox.Text);
                 if (dialog.ShowDialog() == true)
                 {
                     string fileName  = DateTime.UtcNow.Ticks.ToString() + ".bmp";
                     char   seperator = System.IO.Path.DirectorySeparatorChar;
                     bitmap.Save(saveFolder + seperator + fileName, System.Drawing.Imaging.ImageFormat.Bmp);
                     using (var writer = new StreamWriter(saveFolder + seperator + OCR_IMAGE_SAVE_ENTRY_LIST, true))
                     {
                         writer.WriteLine(OCR_ENTRY_SEPERATOR + fileName + OCR_ENTRY_SEPERATOR + dialog.InputText);
                     }
                 }
             }
             else
             {
                 UIUtilities.ShowErrorDialog("Please choose a valid folder path first!");
             }
         }
     }
     catch (Exception e)
     {
         UIUtilities.ShowErrorDialog(e.Message + "\n" + e.StackTrace);
     }
 }
コード例 #29
0
        // this could be further broken down into another class (IntegerSettingOption) but not right now
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            OptionResult result = base.Run(parameters);

            if (result != OptionResult.Failure)
            {
                foreach (OccupationNames name in base.mPicks)
                {
                    string defaultText = string.Empty;
                    if (name != OccupationNames.Any)
                    {
                        NRaas.CareerSpace.PersistedSettings.CareerSettings settings = NRaas.Careers.Settings.GetCareerSettings(name, true);

                        defaultText = settings.mMaxCoworkers.ToString();
                    }

                    string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", false), defaultText);

                    if (string.IsNullOrEmpty(text))
                    {
                        return(OptionResult.Failure);
                    }

                    int value;
                    if (!int.TryParse(text, out value))
                    {
                        SimpleMessageDialog.Show(Name, Common.Localize("InputError:Numeric"));
                        return(OptionResult.Failure);
                    }

                    if (name == OccupationNames.Any)
                    {
                        foreach (Career career in CareerManager.CareerList)
                        {
                            PersistedSettings.CareerSettings settings = NRaas.Careers.Settings.GetCareerSettings(career.Guid, true);

                            settings.mMaxCoworkers = value;

                            NRaas.Careers.Settings.SetCareerData(settings);
                        }

                        Common.Notify(GetTitlePrefix() + " " + Common.Localize("Selection:All") + " " + value);
                    }
                    else
                    {
                        PersistedSettings.CareerSettings settings = NRaas.Careers.Settings.GetCareerSettings(name, true);
                        settings.mMaxCoworkers = value;

                        NRaas.Careers.Settings.SetCareerData(settings);

                        Common.Notify(GetTitlePrefix() + " " + CareerManager.GetStaticCareer(name).Name + " " + value);
                    }
                }

                Common.Notify(Common.Localize("Generic:Success"));
                return(OptionResult.SuccessLevelDown);
            }

            return(result);
        }
コード例 #30
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Sim sim = me.CreatedSim;

            if (sim == null)
            {
                return(false);
            }

            int value = me.TraitChipManager.NumTraitSlots;

            if (!ApplyAll)
            {
                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me }), value.ToString(), 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                mCount = 0;
                if (!int.TryParse(text, out mCount) || (mCount < 0 || mCount > 7))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(false);
                }
            }

            me.TraitChipManager.UpgradeNumTraitChips(mCount);

            return(true);
        }
コード例 #31
0
ファイル: BoneOps.cs プロジェクト: Ktarianen/s3pi-wrappers
 private static void ExecuteSuffix(BoneViewModel target)
 {
     var dialog = new StringInputDialog("Suffix Names in Hierarchy...");
     bool result = dialog.ShowDialog() ?? false;
     if (result)
     {
         SuffixRecursive(target, dialog.Value);
     }
 }