Ejemplo n.º 1
0
 public AppDelegate(DataLoader dataLoader, ICanSuspendApp appSuspender, BuildingDescriptionDatabase buildingDescriptionDatabase, ColorCollectionFile colorCollectionFile, LanguageSettings languageSettings)
 {
     if (DataLoader != null)
     {
         throw new InvalidOperationException("Only one AppDelegate can be instantiated");
     }
     DataLoader   = dataLoader;
     AppSuspender = appSuspender;
     BuildingDescriptionDatabase = buildingDescriptionDatabase;
     ColorCollectionFile         = colorCollectionFile;
     LanguageSettings            = languageSettings;
 }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            CCLog.Logger = (e, a) => { };
            System.Diagnostics.Debug.WriteLine("");

#if DEBUG
            Tests.RunTests();
#endif

            string buildingXml;
            string colorXml;
            string languageXml;

            using (var colorsStream = Assets.Open("colors.xml"))
            {
                using (var sr = new StreamReader(colorsStream))
                {
                    colorXml = sr.ReadToEnd();
                }
            }

            using (var buildingStream = Assets.Open("buildings.xml"))
            {
                using (var sr = new StreamReader(buildingStream))
                {
                    buildingXml = sr.ReadToEnd();
                }
            }

            using (var languageStream = Assets.Open("languages.xml"))
            {
                using (var sr = new StreamReader(languageStream))
                {
                    languageXml = sr.ReadToEnd();
                }
            }

            var           buildingDescriptionDatabase = BuildingDescriptionDatabase.CreateFromXml(buildingXml);
            var           colorCollectionFile         = ColorCollectionFile.CreateFromXml(colorXml);
            var           languageSettings            = LoadLanguagesFromXml(languageXml);
            CCApplication application = new CCApplication {
                ApplicationDelegate = new AppDelegate(new AndroidDataLoader(), this, buildingDescriptionDatabase, colorCollectionFile, languageSettings)
            };

            SetContentView(application.AndroidContentView);
            application.StartGame();
        }
Ejemplo n.º 3
0
        public MainMenuLayer(BuildingDescriptionDatabase buildingDescriptionDatabase, ColorCollectionFile colorCollectionFile, LanguageSettings languageSettings)
        {
            var colorCollection = new ColorCollection(colorCollectionFile);

            HelpButton = new HexButton("Help", 150, colorCollection);
            //OptionsButton = new HexButton("Options", 150, colorCollection);
            StartGameButton = new HexButton("Start", 150, colorCollection);

            BuildingDescriptionDatabase = buildingDescriptionDatabase;
            ColorCollectionFile         = colorCollectionFile;
            LanguageSettings            = languageSettings;
            VisualSettings           = new VisualSettings(colorCollectionFile);
            StartGameButton.Touched += StartGameButton_Clicked;
            HelpButton.Touched      += HelpButton_Clicked;
            //OptionsButton.Touched += OptionsButton_Clicked;

            AddEventListener(new CCEventListenerTouchOneByOne {
                OnTouchBegan = TouchDown, OnTouchCancelled = OnTouchCancelled, OnTouchEnded = OnTouchUp, OnTouchMoved = OnTouchMoved
            });
        }
Ejemplo n.º 4
0
 public VisualSettings(ColorCollectionFile colorCollectionFile)
 {
     ColorCollection = new ColorCollection(colorCollectionFile);
 }
Ejemplo n.º 5
0
        public MainMenuScene(CCWindow window, BuildingDescriptionDatabase buildingDescriptionDatabase, ColorCollectionFile colorCollectionFile, LanguageSettings languageSettings) : base(window)
        {
            var mainMenuLayer = new MainMenuLayer(buildingDescriptionDatabase, colorCollectionFile, languageSettings);

            AddChild(mainMenuLayer);
        }
Ejemplo n.º 6
0
 public GameSettings(BuildingDescriptionDatabase buildingDescriptionDatabase, ColorCollectionFile colorCollectionFile, LanguageSettings languageSettings) : this(new LayoutSettings(), new VisualSettings(colorCollectionFile), new GameplaySettings(), buildingDescriptionDatabase, languageSettings)
 {
 }