public void Init() { sessionController = SessionController.Instance; sessionController.BubblesController.OnExplosion += OnExplosion; sessionController.BubblesController.OnBubbleReleased += OnBubbleReleased; bubbleSettings = ResourceManager.GetResource <BubblesSettings>(GameConstants.BUBBLE_SETTINGS); }
public Worker(VisualArea area, Size bounds, BubblesSettings settings) { this.area = area; this.bounds = bounds; // 10 - 60 fps -> update every 100 - 17 ms minimumUpdateTime = (long)FastMath.LinearInterpolate(17, 100, settings.PowerSavings); }
private void Application_Startup(object sender, StartupEventArgs e) { var settings = BubblesSettings.Load(BubblesSettings.SettingsFile); if (e.Args.Length == 0 || e.Args[0].ToLower().StartsWith("/s")) { MainWindow win = new MainWindow(settings) { WindowState = WindowState.Maximized }; win.Show(); } // Preview mode--display in little window in Screen Saver dialog else if (e.Args[0].ToLower().StartsWith("/p")) { winSaver = new MainWindow(settings); string handle = e.Args[0].Contains(":") ? e.Args[0].Split(':')[1] : e.Args[1]; IntPtr pPreviewHnd = new IntPtr(Convert.ToInt32(handle)); RECT lpRect = new RECT(); Win32API.GetClientRect(pPreviewHnd, ref lpRect); HwndSourceParameters sourceParams = new HwndSourceParameters("sourceParams") { PositionX = 0, PositionY = 0, Height = lpRect.Bottom - lpRect.Top, Width = lpRect.Right - lpRect.Left, ParentWindow = pPreviewHnd, WindowStyle = (int)(WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_CLIPCHILDREN) }; var winWpfContent = new HwndSource(sourceParams); winWpfContent.Disposed += winWPFContent_Disposed; winWpfContent.RootVisual = winSaver.MainGrid; } else if (e.Args[0].ToLower().StartsWith("/c")) { SettingsWindow win = new SettingsWindow(); win.Show(); } else { Application.Current.Shutdown(); } }
public void Init() { settings = ResourceManager.GetResource <BubblesSettings>(GameConstants.BUBBLE_SETTINGS); sessionController = SessionController.Instance; initialPosition = transform.position; var raycastController = sessionController.PlayerController.RaycastController; raycastController.OnBubbleChanged += OnBubbleChanged; raycastController.OnPathChanged += OnPathChanged; raycastController.OnStartRaycasting += OnStartRaycasting; raycastController.OnStopRaycasting += OnStopRaycasting; sessionController.BubblesController.OnCurrentPowerChanged += OnCurrentPowerChanged; prevX = PlayerRaycastController.DEFAULT_X; prevY = PlayerRaycastController.DEFAULT_Y; }
/// <summary> /// Attempt to load settings from external file. If the file doesn't /// exist, or if there is a problem, no settings are changed. /// </summary> public static BubblesSettings Load(string sSettingsFilename) { BubblesSettings settings = null; try { XmlSerializer serializer = new XmlSerializer(typeof(BubblesSettings)); using (FileStream fs = new FileStream(sSettingsFilename, FileMode.OpenOrCreate)) using (TextReader reader = new StreamReader(fs)) settings = (BubblesSettings)serializer.Deserialize(reader); } catch { // If we can't load, just create a new object, which gets default values settings = new BubblesSettings(); } return(settings); }
public void Init() { settings = ResourceManager.GetResource <BubblesSettings>(GameConstants.BUBBLE_SETTINGS); minPower = 1; maxPower = settings.Bubbles.Count; minX = 0; maxX = settings.Width; minY = 0; maxY = settings.Height; deadlineY = minY + 1; moveSpeed = settings.MoveSpeed; fallingSpeed = settings.FallingSpeed; bubblesVisibleCount = settings.BubblesVisibleCount; initialRowsCount = settings.InitialRowsCount; initialColumnsCount = settings.InitialColumnsCount; rootInitialPosition = bubblesPool.Root.transform.localPosition; generationMinPower = settings.GenerationMinPower; generationMaxPower = settings.GenerationMaxPower; CurrentPower = 1; SpawnBubbles(); }
public SettingsWindow() { Settings = BubblesSettings.Load(BubblesSettings.SettingsFile); InitializeComponent(); DataContext = this; }
public MainWindow(BubblesSettings settings) { InitializeComponent(); this.settings = settings; MainGrid.Background = new SolidColorBrush(Color.FromArgb((byte)(settings.BackgroundAlpha * byte.MaxValue), 0, 0, 0)); }