private string PremadeString( RICOBuilding building )
 {
     if ( building.service == "residential" )
         return String.Format( "{0}-{1}, Level {2}, {3} homes, {4} cost, used {5} times{6}",
             building.service,
             building.subService,
             building.level,
             building.homeCount,
             building.constructionCost,
             building.usages,
             ( building.author != "" ? ", official" : "" )
         );
     else
         return String.Format(
             "{0}-{1}, Level {2}, {3} workplaces ( {4} deviation ), {5} cost, used {6} times{7}",
             building.service,
             building.subService,
             building.level,
             building.workplacesString,
             building.workplaceDeviationString,
             building.constructionCost,
             building.usages,
             ( building.author != "" ? ", official" : "" )
         );
 }
Пример #2
0
        /// <summary>
        /// Called by other mods to determine whether or not Ploppable RICO Revisited is controlling the population of this prefab.
        /// </summary>
        /// <param name="prefab">Prefab reference</param>
        /// <returns>True if Ploppable RICO is controlling the population of this prefab, false otherwise.</returns>
        public static bool IsRICOPopManaged(BuildingInfo prefab)
        {
            // First, do we have a setting at all?
            if (Loading.xmlManager.prefabHash.ContainsKey(prefab))
            {
                // Get active RICO settings.
                RICOBuilding building = RICOUtils.CurrentRICOSetting(Loading.xmlManager.prefabHash[prefab]);

                // Check that it's enabled and isn't using reality.
                if (building != null && building.ricoEnabled && !building.useReality)
                {
                    return(true);
                }
            }

            // If we got here, we don't have an active setting.
            return(false);
        }
 private void listBoxPremades_SelectionChanged( object sender, SelectionChangedEventArgs e )
 {
     selectedBuilding = buildings[ listBoxPremades.SelectedIndex ];
 }
 private void listBoxPremades_MouseDoubleClick( object sender, MouseButtonEventArgs e )
 {
     selectedBuilding = buildings[listBoxPremades.SelectedIndex];
     this.DialogResult = true;
     this.Close();
 }
        void postUse( RICOBuilding building )
        {
            var client = new WebClient();
            var url = String.Format("{0}", Settings.remote_host );
            var args = new NameValueCollection() {{ "db-key", building.dbKey.ToString() }};

            try
            {
                byte[] response = client.UploadValues( url, "PUT", args );
                string result = System.Text.Encoding.UTF8.GetString(response);
            }
            catch // ( Exception e )
            {
                // MessageBox.Show( "Upload failed.\r\n" + e.Message, "Calimero - Error", MessageBoxButton.OK, MessageBoxImage.Error );
            }
        }