Esempio n. 1
0
        private UrbanGameContextWrapper LoadUgWrappers(GridCanvas gridCanvas,out  UrbanGameTemplateWrapper template,out  UrbanGameContextWrapper context)
        {
            template = null;
            context = null;

            UG_CityElement city = elements.OfType<UG_CityElement>().FirstOrDefault();
            #region controllo prerequisiti
            if (city == null)
            {
                MessageBox.Show("City element not found.");
                return null;
            }

            #endregion

            context = city.ConvertToWrapper();
            template = city.ConvertToTemplate();
            //adding monuments ..
            foreach (var item in gridCanvas.GetElementsConnectedTo(city).OfType<UG_ContentItem>())
            {
                context.Luoghi.Add(item.ConvertToWrapper(gridCanvas, context));
                template.Tappe.Add(item.ConvertToTemplate(gridCanvas, template));
            }
            //todo: stile ????
            context.stile = new stile { id = "1" };
            return context;
        }
Esempio n. 2
0
        public bool ExportUrbanGameXML(string appName)
        {
            UrbanGameTemplateWrapper ug_template = new UrbanGameTemplateWrapper();
            UrbanGameContextWrapper ug_context = new UrbanGameContextWrapper();

            LoadUgWrappers(gridCanvas, out ug_template, out ug_context);

            if (ug_context == null || ug_template == null)
            { return false; }

            DataManager.Serialize<UrbanGameContextWrapper>(ug_context, appName+"\\context.xml" );
            DataManager.Serialize<UrbanGameTemplateWrapper>(ug_template, appName+"\\template.xml");

            ExportUGResources(gridCanvas, appName);

            return true;
        }