// Update is called once per frame void Update() { if (!active) { return; } currentProductionOption = options[GameObject.Find("Canvas").transform.Find("City").transform.Find("Dropdown").GetComponent <TMP_Dropdown>().value]; UpdateCityStats(); }
void CheckProtected(ProductionOptions options) { foreach (ProductionOptions possible_option in Enum.GetValues(typeof(ProductionOptions))) { if ((possible_option & options) != 0) { if (GetTagValue("production") != null && GetTagValue("production").ToLower().Contains(possible_option.ToString().ToLower())) { throw new Exception("This instance is protected from the operation you are trying to perform. Use web console to remove the following Production option: " + possible_option.ToString()); } } } }
// Start is called before the first frame update void Start() { grid = GameObject.Find("Grid").GetComponent <TileGrid>(); FoodBank = FoodBankGrowthNeeded; options = GenProductionOptions(); currentProductionOption = options.First(p => p.name == "None"); CityUI = GameObject.Find("Canvas").transform.Find("City").gameObject; List <TMP_Dropdown.OptionData> optionData = new List <TMP_Dropdown.OptionData>(); foreach (var option in options) { optionData.Add(new TMP_Dropdown.OptionData() { text = option.name }); } GameObject.Find("Canvas").transform.Find("City").transform.Find("Dropdown").GetComponent <TMP_Dropdown>().options = optionData; }
static void Main() { _projectPath = CommandLineUtilities.GetArgument("path", (string)null) ?? CommandLineUtilities.GetArgument(0, (string)null); _schema = ConvertUtilities.Nullify(CommandLineUtilities.GetArgument("schema", (string)null) ?? CommandLineUtilities.GetArgument(1, (string)null), true); _changeTargetDirectory = CommandLineUtilities.GetArgument("changeTargetDirectory", true); _disableNonPersistenceProducers = CommandLineUtilities.GetArgument("disableNonPersistenceProducers", true); // Load the model Project project = new Project(); project.Entities.ListChanged += Entities_ListChanged; // Change schema as soon as the entity is loaded project.Load(_projectPath, ProjectLoadOptions.Default); // Update producer target directory if (!string.IsNullOrEmpty(_schema) && _changeTargetDirectory) { foreach (var producer in project.Producers) { var sqlServerProducer = producer.Instance as SqlServerProducer; if (sqlServerProducer != null) { sqlServerProducer.Production += SqlServerProducer_Production; } var databaseProducer = producer.Instance as DatabaseProducer; if (databaseProducer != null) { databaseProducer.Production += DatabaseProducer_Production; } } } // Generate code project.Producing += OnProjectProduction; ProductionOptions productionOptions = BuildProductionOptions(project); project.Produce(productionOptions); Console.WriteLine(); }
private static ProductionOptions BuildProductionOptions(Project project) { ProductionOptions options = _disableNonPersistenceProducers ? new DatabaseProducerOnlyProductionOptions() : new ProductionOptions(); options.Flags = CommandLineUtilities.GetArgument("opf", ProductionOptionsFlags.None); foreach (KeyValuePair <string, bool> kvp in new NameValueCollectionCollection(CommandLineUtilities.GetArgument <string>("ena", null), '!', '"', '=', true, true, false, false ).ToDictionary <bool>()) { Producer producer = project.GetProducer(kvp.Key); if (producer != null) { options.Enable(producer, kvp.Value); } else { CodeFluent.Model.SubProducer sp = project.GetSubProducer(kvp.Key); if (sp != null) { options.Enable(sp, kvp.Value); } else { Guid guid = ConvertUtilities.ChangeType(kvp.Key, Guid.Empty); if (guid != Guid.Empty) { Node node = project.GetNode(guid); if (node != null) { options.Enable(node, kvp.Value); } } } } } return(options); }
public void FinishProduction() { if (currentProductionOption.name == "Houses") { } else if (currentProductionOption.name == "Apartment") { } else if (currentProductionOption.name == "Mansion") { } else if (currentProductionOption.name == "Granary") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Granary); } else if (currentProductionOption.name == "Library") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Library); } else if (currentProductionOption.name == "Lighthouse") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Lighthouse); } else if (currentProductionOption.name == "Shipyard") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Shipyard); } else if (currentProductionOption.name == "Monument") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Monument); } else if (currentProductionOption.name == "Shrine") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Shrine); } else if (currentProductionOption.name == "Temple") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Temple); } else if (currentProductionOption.name == "Arena") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Arena); } else if (currentProductionOption.name == "Ampitheater") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Ampitheater); } else if (currentProductionOption.name == "Market") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Market); } else if (currentProductionOption.name == "Workshop") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Workshop); } else if (currentProductionOption.name == "Armory") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Armory); } else if (currentProductionOption.name == "Potter") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.Potter); } else if (currentProductionOption.name == "StoneMason") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.StoneMason); } else if (currentProductionOption.name == "LumberMill") { options.Remove(options.First(p => p.name == currentProductionOption.name)); RefreshDDLBuildOptions(); buildings.Add(Buildings.LumberMill); } else if (currentProductionOption.name == "Worker") { } else if (currentProductionOption.name == "Explorer") { } currentProductionBank -= currentProductionOption.production_cost; currentProductionOption = options.First(p => p.name == "None"); GameObject.Find("Canvas").transform.Find("City").transform.Find("Dropdown").GetComponent <TMP_Dropdown>().SetValueWithoutNotify(0); }
void CheckProtected(ProductionOptions options) { foreach(ProductionOptions possible_option in Enum.GetValues(typeof(ProductionOptions))) { if((possible_option & options) != 0) { if(GetTagValue("production") != null && GetTagValue("production").ToLower().Contains(possible_option.ToString().ToLower())) { throw new Exception("This instance is protected from the operation you are trying to perform. Use web console to remove the following Production option: " + possible_option.ToString()); } } } }