void ConstructEvent(Action function) { BuildingConfigData buildingConfigData = ConfigInterface.Instance.BuildingConfigHelper.GetBuildingData(this.BuildingBehavior.BuildingType, 0); Dictionary <CostType, int> costBalance = this.BuildingBehavior.Created ? SystemFunction.UpgradeCostBalance(this.BuildingLogicData) : SystemFunction.UpgradeCosBalance(buildingConfigData); Dictionary <CostType, int> costTotal = this.BuildingBehavior.Created ? SystemFunction.UpgradeTotalCost(this.BuildingLogicData) : SystemFunction.UpgradeTotalCost(buildingConfigData); int costGem = this.BuildingBehavior.Created ? this.BuildingLogicData.UpgradeGem : buildingConfigData.UpgradeGem; if (costBalance.Count > 0) { int costBalanceGem = SystemFunction.ResourceConvertToGem(costBalance); //int costResourceToGem = SystemFunction.ResourceConvertToGem(costTotal) - costGem; string resourceContext = SystemFunction.BuyReusoureContext(costBalance); UIManager.Instance.UIWindowCostPrompt.ShowWindow(costBalanceGem, resourceContext, SystemFunction.BuyReusoureTitle(costBalance)); UIManager.Instance.UIWindowCostPrompt.UnRegistDelegate(); UIManager.Instance.UIWindowCostPrompt.Click += () => { if (SystemFunction.CostUplimitCheck(costTotal[CostType.Gold], costTotal[CostType.Food], costTotal[CostType.Oil])) { if (LogicController.Instance.PlayerData.CurrentStoreGem - costBalanceGem /*costResourceToGem*/ < costGem) { print("宝石不足,去商店"); UIManager.Instance.UIWindowFocus = null; //UIManager.Instance.UIButtonShopping.GoShopping(); UIManager.Instance.UISelectShopMenu.GoShopping(); } else { print("宝石换资源!"); SystemFunction.BuyResources(costBalance); function.Invoke(); } } else { UIErrorMessage.Instance.ErrorMessage(16); } }; } else { function.Invoke(); } }