Exemple #1
0
        public override void RefreshValues()
        {
            base.RefreshValues();

            // WORKAROUND IN 1.5.9
            if (_brothel == null)
            {
                _brothel = new CEBrothel(Workshop.Settlement);
            }

            Name = _brothel.Name.ToString();
            WorkshopType workshopType = WorkshopType.Find("pottery_shop");

            WorkshopTypeId = workshopType.StringId;
            Location       = _brothel.Settlement.Name.ToString();
            Income         = (int)(Math.Max(0, _brothel.ProfitMade) / Campaign.Current.Models.ClanFinanceModel.RevenueSmoothenFraction()) * (_brothel.Level + 1);

            IncomeValueText = DetermineIncomeText(Income);
            InputsText      = new TextObject("{=CEBROTHEL0985}Description").ToString();
            OutputsText     = new TextObject("{=CEBROTHEL0994}Notable Prostitutes").ToString();
            ActionList.Clear();
            ItemProperties.Clear();
            PopulateActionList();
            PopulateStatsList();
        }
Exemple #2
0
        public Actions()
        {
            Settings.GetInstance().Actions?.ForEach(a =>
            {
                ActionList.Add(new Controls.Action(a));
            });

            Settings.GetInstance().ActionsChanged += la =>
            {
                ActionList.Clear();
                la.ForEach(a =>
                {
                    ActionList.Add(new Controls.Action(a));
                });
            };
        }
Exemple #3
0
        public void ListTests(int countMax)
        {
            object sync  = new object();
            var    count = 0;
            var    list  = new ActionList();

            for (int i = 0; i < countMax; i++)
            {
                list.Add(() =>
                {
                    lock (sync)
                        count++;
                });
            }
            for (int i = 0; i < countMax; i++)
            {
                Assert.True(list.Contains(list[i]));
            }
            Assert.Equal(countMax, list.Count);

            count = 0;
            {
                var(Calls, Errors) = list.Invoke();
                Assert.Equal(countMax, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax, count);
            }
            count = 0;
            {
                var(Calls, Errors) = list.InvokeParallel();
                Assert.Equal(countMax, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax, count);
            }

            var action = list.Add(() =>
            {
                lock (sync)
                    count += 2;
            });

            Assert.Equal(countMax + 1, list.Count);

            count = 0;
            {
                var(Calls, Errors) = list.Invoke();
                Assert.Equal(countMax + 1, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax + 1 + 1, count);
            }
            count = 0;
            {
                var(Calls, Errors) = list.InvokeParallel();
                Assert.Equal(countMax + 1, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax + 1 + 1, count);
            }

            list.Remove(action);
            Assert.Equal(countMax, list.Count);

            count = 0;

            {
                var(Calls, Errors) = list.Invoke();
                Assert.Equal(countMax, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax, count);
            }
            count = 0;
            {
                var(Calls, Errors) = list.InvokeParallel();
                Assert.Equal(countMax, Calls);
                Assert.Equal(0, Errors);
                Assert.Equal(countMax, count);
            }

            list.Clear();
            Assert.Equal(0, list.Count);
        }
 private void button5_Click(object sender, EventArgs e)
 {
     CommandString = "";
     ActionList.Clear();
     this.Close();
 }
 public void ClearActions()
 {
     ActionList.Clear();
     _stringIds.Clear();
     _stringIds.Add(string.Empty);//add back in first one cause we have to.
 }