private void CreateWorldsContainer() { Sunfish.Views.Sprite world0Title = new Sunfish.Views.Sprite (LoadTexture ("World0Title")); Sunfish.Views.Sprite world1Title = new Sunfish.Views.Sprite (LoadTexture ("World1Title")); Sunfish.Views.Sprite world2Title = new Sunfish.Views.Sprite (LoadTexture ("World2Title")); Sunfish.Views.Container world0LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_1"), Sunfish.Constants.ViewContainerLayout.FloatLeft); Sunfish.Views.Container world1LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_2"), Sunfish.Constants.ViewContainerLayout.FloatLeft); Sunfish.Views.Container world2LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_3"), Sunfish.Constants.ViewContainerLayout.FloatLeft); Sunfish.Views.Container world0Container = new Sunfish.Views.Container (Math.Max(world0Title.Width, world0LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered); world0Container.ShouldExpandHeight = true; Sunfish.Views.Container world1Container = new Sunfish.Views.Container (Math.Max(world1Title.Width, world1LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered); world1Container.ShouldExpandHeight = true; Sunfish.Views.Container world2Container = new Sunfish.Views.Container (Math.Max(world2Title.Width, world2LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered); world2Container.ShouldExpandHeight = true; PopulateWorldContainer (world0LevelsContainer, 0); PopulateWorldContainer (world1LevelsContainer, 1); PopulateWorldContainer (world2LevelsContainer, 2); world0Container.AddChild (world0Title); world0Container.AddChild (world0LevelsContainer, 0, PixelsWithDensity(20)); world1Container.AddChild (world1Title); world1Container.AddChild (world1LevelsContainer, 0, PixelsWithDensity(20)); world2Container.AddChild (world2Title); world2Container.AddChild (world2LevelsContainer, 0, PixelsWithDensity(20)); Sunfish.Views.Container worldsContainer = new Sunfish.Views.Container (LocksGame.ScreenHeight, LocksGame.ScreenWidth, new Vector2 (0, PixelsWithDensity(140)), Sunfish.Constants.ViewContainerLayout.FloatLeft); worldsContainer.AddChild (world0Container, PixelsWithDensity(31), 0); worldsContainer.AddChild (world1Container, PixelsWithDensity(31), 0); worldsContainer.AddChild (world2Container, PixelsWithDensity(31), 0); AddChildView (worldsContainer); }
public SettingsPopup() : base(LocksGame.ActiveScreen.LoadTexture ("PopupBackground"), Sunfish.Constants.ViewContainerLayout.StackCentered) { TransitionAudioFilename = "PopupTransition"; TransitionAudioVolume = 0.8f; Sunfish.Views.Sprite soundEffectsLabel = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("SoundEffectsLabel"), Sunfish.Constants.ViewLayer.Modal); if (LocksGame.SoundEffectsOn) { SoundEffectsCheckBox = Sunfish.Views.Switch.CreateOn (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleSoundEffectsCheckboxTapped); } else { SoundEffectsCheckBox = Sunfish.Views.Switch.CreateOff (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleSoundEffectsCheckboxTapped); } Sunfish.Views.Container soundEffectsContainer = new Sunfish.Views.Container (soundEffectsLabel.Width + SoundEffectsCheckBox.Width, soundEffectsLabel.Height, Sunfish.Constants.ViewLayer.Modal, Sunfish.Constants.ViewContainerLayout.FloatLeft); soundEffectsContainer.AddChild (SoundEffectsCheckBox); soundEffectsContainer.AddChild (soundEffectsLabel); Sunfish.Views.Sprite musicLabel = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("MusicLabel"), Sunfish.Constants.ViewLayer.Modal); if (LocksGame.MusicOn) { MusicCheckBox = Sunfish.Views.Switch.CreateOn (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleMusicCheckboxTapped); } else { MusicCheckBox = Sunfish.Views.Switch.CreateOff (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleMusicCheckboxTapped); } Sunfish.Views.Container musicContainer = new Sunfish.Views.Container (musicLabel.Width + MusicCheckBox.Width, musicLabel.Height, Sunfish.Constants.ViewLayer.Modal, Sunfish.Constants.ViewContainerLayout.FloatLeft); musicContainer.AddChild (MusicCheckBox); musicContainer.AddChild (musicLabel); Sunfish.Views.Sprite closeButton = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("CloseButton"), Sunfish.Constants.ViewLayer.Modal); closeButton.EnableTapGesture (HandleCloseButtonTap); AddChild (soundEffectsContainer, 0, PixelsWithDensity(80)); AddChild (musicContainer, 0, PixelsWithDensity(15)); AddChild (closeButton, 0, PixelsWithDensity(50)); }