Exemplo n.º 1
0
        protected override void Handle(EconomySetTaxRateCommand command)
        {
            IgnoreHelper.StartIgnore();

            EconomyManager.instance.SetTaxRate(command.Service, command.SubService, command.Level, command.Rate);

            EconomyPanel panel = typeof(ToolsModifierControl).GetField("m_EconomyPanel", ReflectionHelper.AllAccessFlags)?.GetValue(null) as EconomyPanel;

            if (panel != null)
            {
                SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() => ReflectionHelper.Call(panel, "PopulateTaxesTab"));
            }

            IgnoreHelper.EndIgnore();
        }
        protected override void Handle(EconomyTakeLoanCommand command)
        {
            IgnoreHelper.StartIgnore();

            AddResource.DontAddResource = true;

            EconomyManager.instance.TakeNewLoan(command.Index, command.Amount, command.Interest, command.Length).MoveNext();

            AddResource.DontAddResource = false;

            EconomyPanel panel = typeof(ToolsModifierControl).GetField("m_EconomyPanel", ReflectionHelper.AllAccessFlags)?.GetValue(null) as EconomyPanel;

            if (panel != null)
            {
                SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() => ReflectionHelper.Call(panel, "PopulateLoansTab"));
            }

            IgnoreHelper.EndIgnore();
        }
        protected override void Handle(EconomyPayLoanCommand command)
        {
            IgnoreHelper.StartIgnore();

            FetchResource.DontFetchResource   = true;
            FetchResource.ReturnFetchedAmount = command.Paid;

            EconomyManager.instance.PayLoanNow(command.Index).MoveNext();

            FetchResource.DontFetchResource = false;

            EconomyPanel panel = typeof(ToolsModifierControl).GetField("m_EconomyPanel", ReflectionHelper.AllAccessFlags)?.GetValue(null) as EconomyPanel;

            if (panel != null)
            {
                SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() => ReflectionHelper.Call(panel, "PopulateLoansTab"));
            }

            IgnoreHelper.EndIgnore();
        }