/// <summary> /// Initializes the category. /// </summary> /// <param name="prefab">The prefab.</param> private bool InitializeCategory(PrefabInfo prefab) { string category = null; try { ItemClass.SubService subService = prefab.GetSubService(); if (subService != ItemClass.SubService.None && subService != ItemClass.SubService.Unused2) { category = subService.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "SubService:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { ItemClass.Service service = prefab.GetService(); if (service != ItemClass.Service.None && service != ItemClass.Service.Unused2) { category = service.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "Service:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { category = prefab.category; if (!String.IsNullOrEmpty(category)) { this.RawCategory = "Category:" + prefab.category; this.Category = InfoHelper.CleanCategory(prefab.category); return(true); } } catch { } this.RawCategory = null; this.Category = "Unknown"; return(true); }
private void AddSlider(UIHelperBase group, ItemClass.Service service) { var Slider = group.AddSlider("Budget buffer(" + service.ToString() + ")", 0, 50, 1, AutoBudgetSettings.instance.buffers[(int)service], EmptyCallback) as UISlider; var serviceNumber = (int)service; Slider.tooltip = Slider.value.ToString(); Slider.eventValueChanged += delegate(UIComponent slider, float val) { slider.tooltip = val.ToString(); AutoBudgetSettings.instance.buffers[serviceNumber] = (int)val; AutoBudgetSettings.instance.SaveSettings(); }; }
public static string GenerateName(ItemClass.Service service, Randomizer randomizer) { return(_generateNameHelper(bnd.BuildingNameDataForSubService(service.ToString()), randomizer)); }
public static void CustomAddGovermentIncome(ref int amount, ItemClass.Service service) { switch (service) { case ItemClass.Service.Garbage: ProcessUnitTax100(ref amount, ref garbageIncome); RealCityEconomyManager.garbageIncomeForUI[MainDataStore.updateMoneyCount] += amount; break; case ItemClass.Service.Education: ProcessUnitTax100(ref amount, ref schoolIncome); RealCityEconomyManager.schoolIncomeForUI[MainDataStore.updateMoneyCount] += amount; break; case ItemClass.Service.HealthCare: ProcessUnitTax100(ref amount, ref healthCareIncome); RealCityEconomyManager.healthCareIncomeForUI[MainDataStore.updateMoneyCount] += amount; break; case ItemClass.Service.FireDepartment: ProcessUnitTax100(ref amount, ref fireStationIncome); RealCityEconomyManager.fireStationIncomeForUI[MainDataStore.updateMoneyCount] += amount; break; case ItemClass.Service.PoliceDepartment: ProcessUnitTax100(ref amount, ref policeStationIncome); RealCityEconomyManager.policeStationIncomeForUI[MainDataStore.updateMoneyCount] += amount; break; default: amount = 0; DebugLog.LogToFileOnly("Error: Find unknown EXAddGovermentIncome building" + " service is" + service.ToString()); break; } }
/// <summary> /// 刷新相关的里程碑(服务、子服务、功能等) /// </summary> /// <param name="name"></param> /// <param name="category"></param> /// <param name="service"></param> /// <param name="subService"></param> /// <param name="milestoneInfo"></param> private void RefreshRelatedMilestone(string name, string category, ItemClass.Service service, ItemClass.SubService subService, MilestoneInfo milestoneInfo) { switch (category) { case "LandscapingPaths": case "LandscapingWaterStructures": RefreshFeatureMilestones(UnlockManager.Feature.Landscaping.ToString(), milestoneInfo); break; case "IndustryFishing": RefreshServiceMilestones(ItemClass.Service.Garbage.ToString(), milestoneInfo); RefreshFeatureMilestones(UnlockManager.Feature.Fishing.ToString(), milestoneInfo); break; case "IndustryWarehouses": RefreshServiceMilestones(ItemClass.Service.Garbage.ToString(), milestoneInfo); RefreshFeatureMilestones(UnlockManager.Feature.IndustryAreas.ToString(), milestoneInfo); break; case "MonumentFootball": RefreshFeatureMilestones(UnlockManager.Feature.Football.ToString(), milestoneInfo); break; case "MonumentConcerts": RefreshFeatureMilestones(UnlockManager.Feature.Concerts.ToString(), milestoneInfo); break; case "RoadsIntersection": BuildingInfo building = PrefabCollection <BuildingInfo> .FindLoaded(name); IntersectionAI intersectionAI = building.m_buildingAI as IntersectionAI; if (milestoneInfo.GetLevel() < intersectionAI.GetUnlockMilestone().GetLevel()) { SetPrivateVariable(intersectionAI, "m_cachedUnlockMilestone", milestoneInfo); } break; case "FireDepartmentDisaster": RefreshServiceMilestones(ItemClass.Service.FireDepartment.ToString(), milestoneInfo); RefreshFeatureMilestones(UnlockManager.Feature.DisasterResponse.ToString(), milestoneInfo); break; case "PublicTransportShip": RefreshFeatureMilestones(UnlockManager.Feature.Ferry.ToString(), milestoneInfo); break; case "PublicTransportPlane": if (name.Contains("Blimp")) { RefreshFeatureMilestones(UnlockManager.Feature.Blimp.ToString(), milestoneInfo); } else if (name.Contains("Helicopter")) { RefreshFeatureMilestones(UnlockManager.Feature.Helicopter.ToString(), milestoneInfo); } break; case "PublicTransportTrolleybus": RefreshFeatureMilestones(UnlockManager.Feature.Trolleybus.ToString(), milestoneInfo); break; case "BeautificationExpansion1": RefreshFeatureMilestones(UnlockManager.Feature.ParkAreas.ToString(), milestoneInfo); break; } RefreshServiceMilestones(service.ToString(), milestoneInfo); RefreshSubServiceMilestones(subService, milestoneInfo); }