/// <summary>
            /// Principles:
            ///   1) max concurrent orders per building per type is capped per MAX_TTL day period
            ///   2)
            /// </summary>
            /// <param name="material"></param>
            /// <param name="requestBuilding"></param>
            /// <param name="responseBuilding"></param>
            /// <returns></returns>
            public bool IsRestricted(TransferManager.TransferReason material, ushort requestBuilding, ushort responseBuilding)
            {
                if (!Events.TryGetValue(requestBuilding, out var list))
                {
                    return(false);
                }

                var isRequestBuildingOutside  = TransferManagerInfo.IsOutsideBuilding(requestBuilding);
                var isResponseBuildingOutside = TransferManagerInfo.IsOutsideBuilding(responseBuilding);

                if (!Settings.enableDummyCargoTraffic.value && isRequestBuildingOutside && isResponseBuildingOutside)
                {
                    return(true);
                }

                var concurrentOrderCount = list.Count;

                var concurrentOrderCountToOutsideConnection = 0;
                var concurrentOrderCountToResponseBuilding  = 0;

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].ResponseBuilding == responseBuilding)
                    {
                        concurrentOrderCountToResponseBuilding++;
                    }

                    if (TransferManagerInfo.IsOutsideBuilding(list[i].ResponseBuilding))
                    {
                        concurrentOrderCountToOutsideConnection++;
                    }
                }

                var vehicleCount = TransferManagerInfo.GetCargoVehicleCount(requestBuilding, material);

                var maxConcurrentOrderCount = Math.Ceiling(Constraints.GlobalOutsideConnectionIntensity() / 10.0);

                if (isRequestBuildingOutside && TransferManagerInfo.IsOutsideRoadConnection(requestBuilding))
                {
                    maxConcurrentOrderCount *= 4;
                }

                var maxConcurrentOrderCountToResponseBuilding  = Math.Ceiling(maxConcurrentOrderCount / 2.0);
                var maxConcurrentOrderCountToOutsideConnection = Math.Ceiling(maxConcurrentOrderCount * Constraints.GlobalOutsideToOutsidePerc() / 100.0);

                var maxVehicleCount = Math.Ceiling(maxConcurrentOrderCount / 2.0);

                bool isRestrictedConcurrent                    = concurrentOrderCount >= maxConcurrentOrderCount;
                bool isRestrictedConcurrentToBuilding          = concurrentOrderCountToResponseBuilding >= maxConcurrentOrderCountToResponseBuilding;
                bool isRestrictedConcurrentToOutsideConnection = isRequestBuildingOutside && isResponseBuildingOutside && concurrentOrderCountToOutsideConnection >= maxConcurrentOrderCountToOutsideConnection;
                bool isVehicleConstrained = vehicleCount >= maxVehicleCount;

                return(isRestrictedConcurrent || isRestrictedConcurrentToBuilding || isRestrictedConcurrentToOutsideConnection || isVehicleConstrained);
            }
        protected override void OnClick(UIMouseEventParameter p)
        {
            UIView.playSoundDelegate(this.clickSound, 1f);

            var tool = ToolsModifierControl.toolController.gameObject.GetComponent <EnhancedDistrictServicesTool>();

            if (p.buttons.IsFlagSet(UIMouseButton.Left) && tool != null)
            {
                if (Settings.modVersion.value != EnhancedDistrictServicesMod.version)
                {
                    Settings.modVersion.value         = EnhancedDistrictServicesMod.version;
                    Settings.showWelcomeMessage.value = true;
                }

                if (Settings.showWelcomeMessage)
                {
                    Settings.showWelcomeMessage.value = false;

                    Utils.DisplayMessage(
                        str1: "Enhanced District Services",
                        str2: $"Please check the EDS mod page for latest updates.  Please note that the Global Outside Connection Intensity value is now recommended to be at least 500!  Please change this setting in your games to allow more outside traffic.",
                        str3: "IconMessage");
                }
                else if (Settings.showWarnLowOutsideCapMessage && Constraints.GlobalOutsideConnectionIntensity() <= 100)
                {
                    Utils.DisplayMessage(
                        str1: "Enhanced District Services",
                        str2: $"Please note your city has a global outside connection intensity that is too low ({Constraints.GlobalOutsideConnectionIntensity()}).  Please readjust value to around 500 or above.  To permanently disable this warning, goto settings page to disable this warning message.",
                        str3: "IconMessage");
                }

                if (ToolsModifierControl.toolController.CurrentTool == tool)
                {
                    ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
                }
                else
                {
                    ToolsModifierControl.infoViewsPanel.CloseAllPanels();
                    ToolsModifierControl.mainToolbar.CloseEverything();

                    ToolsModifierControl.toolController.CurrentTool = tool;
                }
            }
        }