public void Test_EconomyOutput_ReportChaoting() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var report = Economy.inst.outputs.Single(x => x.name == "STATIC_REPORT_CHAOTING_TAX"); Assert.AreEqual(Root.def.economy.report_chaoting_percent, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); report.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value - report.currValue.Value, Chaoting.inst.oweTax); }
private void _on_LoadSaveFile_Signed(string fileName) { var content = System.IO.File.ReadAllText(GlobalPath.save + fileName + ".save"); Root.Deserialize(content); ModDataVisit.InitVisitData(Root.inst); GetTree().ChangeScene("res://Scenes/Main/MainScene.tscn"); }
public void Test_Init() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(init.common.name, Visitor.Get("taishou.name")); Assert.AreEqual(init.common.age, Visitor.Get("taishou.age")); Assert.AreEqual(init.common.party, Visitor.Get("taishou.party.type")); }
public void Test_EconomyMonthSurplus() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(Economy.inst.incomes.Sum(x => x.currValue.Value), Economy.inst.incomes.total.Value); Assert.AreEqual(Economy.inst.outputs.Sum(x => x.currValue.Value), Economy.inst.outputs.total.Value); Assert.AreEqual(Economy.inst.incomes.total.Value - Economy.inst.outputs.total.Value, Economy.inst.monthSurplus.Value); }
public void TestTaishou() { Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Visitor.InitVisitMap(typeof(Root)); Visitor.SetVisitData(Root.inst); Assert.AreEqual(false, Visitor.Get("taishou.is_revoke")); Assert.AreEqual(false, Root.inst.isEnd); Visitor.Set("taishou.is_revoke", true); Assert.AreEqual(true, Visitor.Get("taishou.is_revoke")); Assert.AreEqual(true, Root.inst.isEnd); }
public void Test_EconomyCurrValue() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Assert.AreEqual(Root.def.economy.curr, Visitor.Get("economy.value")); Economy.inst.curr.Value = 100; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(100, Visitor.Get("economy.value")); }
public void Test_EconomyDayInc() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Date.inst.day.Value = 29; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr, Visitor.Get("economy.value")); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr + Economy.inst.monthSurplus.Value, Visitor.Get("economy.value")); }
private void _on_Button_Start_button_up() { var initData = new InitData() { common = new InitData.Common() { name = "TEST1", age = 34, party = "shizu" } }; Root.Init(initData); ModDataVisit.InitVisitData(Root.inst); GetTree().ChangeScene("res://Scenes/Main/MainScene.tscn"); }
public void TestDepartDaysInc() { Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Visitor.InitVisitMap(typeof(Root)); Visitor.SetVisitData(Root.inst); double cropGrown = 0; for (int y = 1; y <= 10; y++) { for (int m = 1; m <= 12; m++) { for (int d = 1; d <= 30; d++) { if (Date.inst >= Root.def.crop.growStartDay && Date.inst <= Root.def.crop.harvestDay) { cropGrown += Root.def.crop.growSpeed; } else { cropGrown = 0; } Depart.DaysInc(); foreach (var depart in Depart.all) { Assert.AreEqual(cropGrown, depart.cropGrown.Value); } Visitor.Pos pos = null; while (Visitor.EnumerateVisit("pop", ref pos)) { Assert.AreEqual(cropGrown, Visitor.Get("pop.depart.crop_grown")); } Date.Inc(); } } } }
public void TestDateInc() { Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Visitor.InitVisitMap(typeof(Root)); Visitor.SetVisitData(Root.inst); for (int y = 1; y <= 10; y++) { for (int m = 1; m <= 12; m++) { for (int d = 1; d <= 30; d++) { Assert.AreEqual(d, Visitor.Get("date.day")); Assert.AreEqual(m, Visitor.Get("date.month")); Assert.AreEqual(y, Visitor.Get("date.year")); Date.Inc(); } } } Assert.True(Date.inst == (11, null, null)); Assert.True(Date.inst == (11, null, 1)); Assert.True(Date.inst == (11, 1, 1)); Assert.True(Date.inst == (null, 1, 1)); Assert.True(Date.inst < (12, null, null)); Assert.True(Date.inst < (12, null, 1)); Assert.True(Date.inst < (12, 1, 1)); Assert.True(Date.inst < (null, 12, 30)); Assert.True(Date.inst < (null, 1, 30)); Assert.True(Date.inst > (10, null, null)); Assert.True(Date.inst > (10, 12, null)); Assert.True(Date.inst > (10, 12, 30)); }
public void Test_EconomyOutput_AdminExpend() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var adminExpend = Economy.inst.outputs.Single(x => x.name == "STATIC_ADMIN_EXPEND"); Assert.AreEqual(Root.def.economy.expend_depart_admin, adminExpend.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.adminExpendBase.Value), adminExpend.maxValue.Value); Assert.AreEqual(adminExpend.maxValue.Value * adminExpend.percent.Value / 100, adminExpend.currValue.Value); adminExpend.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, adminExpend.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.adminExpendBase.Value), adminExpend.maxValue.Value); Assert.AreEqual(adminExpend.maxValue.Value * adminExpend.percent.Value / 100, adminExpend.currValue.Value); }
public void Test_EconomyInCome_PopTax() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var popTax = Economy.inst.incomes.Single(x => x.name == "STATIC_POP_TAX"); Assert.AreEqual(Root.def.economy.pop_tax_percent, popTax.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.tax.Value), popTax.maxValue.Value); Assert.AreEqual(popTax.maxValue.Value * popTax.percent.Value / 100, popTax.currValue.Value); popTax.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, popTax.percent.Value); Assert.AreEqual(Depart.all.Sum(x => x.tax.Value), popTax.maxValue.Value); Assert.AreEqual(popTax.maxValue.Value * popTax.percent.Value / 100, popTax.currValue.Value); }
public void Setup() { ModDataVisit.InitVisitData(Demon.Init()); }