public static void ShowScreen(ScreenType type) { Time.timeScale = 0.0f; _currentActiveScreen = _instance.GetScreen(type); _currentActiveScreen.Show(); BlackScreen.Show(); }
// Use this for initialization void Start() { // Set the screen size GetComponent <CanvasScaler>().referenceResolution = ScreenData.GetScreenSize(); // Initialize Components graphicRaycaster = GetComponent <GraphicRaycaster>(); int creation = SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Creation); if (creation == 1) { RefTileMap.CreateNew(SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Row), SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Col)); } else if (creation == 0) { RefTileMap.Load(SaveClass.GetPlayerPrefString(SaveClass.Save_Keys.Key_Level)); // Assign current values to editor UI MapName.text = RefTileMap.Name; var parameters = RefTileMap.ObjectiveParams.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); RefObjectiveParam.text = parameters[0]; } else { Application.LoadLevel("MainMenuScene"); } }
public static DeviceInfo GetDeviceWithSupportedOrientations(ScreenOrientation[] orientations, int screenWidth = 500, int screenHeight = 1000, float screenDpi = 200) { if (orientations.Length > 4) { throw new ArgumentException("There are 4 possible screen orientations"); } var screen = new ScreenData() { dpi = screenDpi, width = screenWidth, height = screenHeight, orientations = new Dictionary <ScreenOrientation, OrientationDependentData>() }; for (int i = 0; i < orientations.Length; i++) { screen.orientations.Add(orientations[i], Orientations[i]); } var device = new DeviceInfo() { Screens = new[] { screen } }; return(device); }
public static DeviceInfo GetDeviceWithSupportedOrientations(ScreenOrientation[] orientations, int screenWidth = 500, int screenHeight = 1000, float screenDpi = 200) { if (orientations.Length > 4) { throw new ArgumentException("There are 4 possible screen orientations"); } var screen = new ScreenData() { dpi = screenDpi, width = screenWidth, height = screenHeight, orientations = new OrientationData[orientations.Length] }; for (int i = 0; i < orientations.Length; i++) { screen.orientations[i] = new OrientationData() { safeArea = Orientations[i].safeArea, cutouts = Orientations[i].cutouts, orientation = orientations[i] }; } var device = new DeviceInfo() { Screens = new[] { screen } }; return(device); }
private void Awake() { instance = this; InternalSocketMananger.InternalMessageEvent += Get_app; high = Screen.height; width = Screen.width; }
private void DrawScreenShot(string group, int currenttime, bool forcerefresh, COLDataSource ds) { ScreenData screen = ds.GetScreenshotData(DataType.ScreenShot, currenttime); if (screen == null) { return; } if (screen.Images != null && screen.Images.Count > 0) { JavaScriptSerializer jss = new JavaScriptSerializer(); List <ScreenImage> list = new List <ScreenImage>(); foreach (KeyValuePair <int, byte[]> item in screen.Images) { if (item.Value == null) { continue; } //row 0~7, col 0~7 int row = item.Key / Constants.MAX_ROW_NO; int col = item.Key % Constants.MAX_COL_NO; list.Add(new ScreenImage { Row = row, Col = col, ImageStream = Convert.ToBase64String(item.Value) }); } Clients.Group(group).broadcastDrawImage(jss.Serialize(list)); } }
public FrameInformation GetCleanFrame() { HandleDesktop(); var setCurrent = Desktop.SetCurrent(_lastDesktopInput); return(!setCurrent ? null : ScreenData.DesktopCapture()); }
public override object Process(FastBitmapHSV bitmap) { scannerState = 1; var hasTextBox = HasChatBoxArea(bitmap); if (hasTextBox) { scannerState = 2; var hasPurifyPlate = HasPurifyPlate(bitmap); if (hasPurifyPlate) { scannerState = 3; var outputOb = new ScreenData(); ScanSP(bitmap, outputOb); ScanBurst(bitmap, outputOb); for (int idx = 0; idx < posActionSlots.Length; idx++) { ScanActionSlot(bitmap, posActionSlots[idx], outputOb, idx); } return(outputOb); } } return(null); }
//Load content on screen public override void LoadContent(ScreenData data) { int bgHeight = GraphicsDeviceManager.DefaultBackBufferHeight; int bgWidth = GraphicsDeviceManager.DefaultBackBufferWidth; Image background = new Image(Loader.getTexture("backgroundCharacterWorldMenu"), new Vector2(0, 0), new Vector2(bgWidth, bgHeight)); drawables.Add(background); //int minX = 150; //int maxX = 600; //int minY = 100; //int maxY = 400; //int x = minX; //int y = minY; //Draw buttons on screen Button stageItem = new Button("cloud", Loader.getTexture("CloudStageButton"), new Vector2(150, 100), new Vector2(200, 100)); stageItem.click += Stage_click; drawables.Add(stageItem); Button stageItem2 = new Button("grassland", Loader.getTexture("GrasslandButton"), new Vector2(465, 100), new Vector2(200, 100)); stageItem2.click += Stage_click; drawables.Add(stageItem2); Button back = new Button("back", Loader.getTexture("backbutton"), new Vector2(25, 10), new Vector2(100, 75)); back.click += Back_click; drawables.Add(back); base.LoadContent(data); }
private void updateBounds() { // Top Vector3 pos = Bounds[(int)BOUNDS_TYPE.BOUNDS_TOP].transform.position; Vector3 scale = Bounds[(int)BOUNDS_TYPE.BOUNDS_TOP].transform.localScale; pos.y = TopBound; scale.x = ScreenData.GetScreenSize().x; Bounds[(int)BOUNDS_TYPE.BOUNDS_TOP].transform.position = pos; Bounds[(int)BOUNDS_TYPE.BOUNDS_TOP].transform.localScale = scale; // Bottom pos = Bounds[(int)BOUNDS_TYPE.BOUNDS_BOTTOM].transform.position; scale = Bounds[(int)BOUNDS_TYPE.BOUNDS_BOTTOM].transform.localScale; pos.y = BottomBound; scale.x = ScreenData.GetScreenSize().x; Bounds[(int)BOUNDS_TYPE.BOUNDS_BOTTOM].transform.position = pos; Bounds[(int)BOUNDS_TYPE.BOUNDS_BOTTOM].transform.localScale = scale; // Left pos = Bounds[(int)BOUNDS_TYPE.BOUNDS_LEFT].transform.position; scale = Bounds[(int)BOUNDS_TYPE.BOUNDS_LEFT].transform.localScale; pos.x = LeftBound; scale.y = ScreenData.GetScreenSize().y; Bounds[(int)BOUNDS_TYPE.BOUNDS_LEFT].transform.position = pos; Bounds[(int)BOUNDS_TYPE.BOUNDS_LEFT].transform.localScale = scale; // Right pos = Bounds[(int)BOUNDS_TYPE.BOUNDS_RIGHT].transform.position; scale = Bounds[(int)BOUNDS_TYPE.BOUNDS_RIGHT].transform.localScale; pos.x = RightBound; scale.y = ScreenData.GetScreenSize().y; Bounds[(int)BOUNDS_TYPE.BOUNDS_RIGHT].transform.position = pos; Bounds[(int)BOUNDS_TYPE.BOUNDS_RIGHT].transform.localScale = scale; }
public IEnumerator ChangeScreen(ScreenData screenData) { var loadScreenEvent = (GameEvent)Resources.Load($"Global/Event/Screens/Load{screenData.name}"); loadScreenEvent.Raise(); yield return(null); }
private void ScanSpecialAction(FastBitmapHSV bitmap, ScreenData screenData) { FastPixelHSV[] samples = FindSpecialActionButton(bitmap); if (samples != null) { for (int idx = 0; idx < samples.Length; idx++) { bool hasMatch = matchSpecialReload.IsMatching(samples[idx]); if (hasMatch) { screenData.specialAction = ESpecialAction.Reload; break; } } } if (DebugLevel >= EDebugLevel.Simple) { Console.WriteLine("{0} ScanSpecialAction: {1}", ScannerName, screenData.specialAction); } if (DebugLevel >= EDebugLevel.Verbose) { if (samples != null) { for (int idx = 0; idx < samples.Length; idx++) { Console.WriteLine(">> bigButton[{0}]: {1}", idx, samples[idx]); } } } }
public void OneTimeSetUp() { m_SimulatorWindow = new TestSimulatorWindow(); var screen = new ScreenData() { dpi = 200, width = 500, height = 1000, orientations = new Dictionary <ScreenOrientation, OrientationDependentData>() { { ScreenOrientation.Portrait, new OrientationDependentData() { safeArea = new Rect(0, 0, 500, 1000) } }, { ScreenOrientation.LandscapeLeft, new OrientationDependentData() { safeArea = new Rect(0, 0, 1000, 500) } }, { ScreenOrientation.LandscapeRight, new OrientationDependentData() { safeArea = new Rect(0, 0, 1000, 500) } }, { ScreenOrientation.PortraitUpsideDown, new OrientationDependentData() { safeArea = new Rect(0, 0, 500, 1000) } } } }; m_Device = new DeviceInfo() { Screens = new[] { screen } }; }
private void GetScreenFrame() { while (_client != null && _client.IsConnected && _authClient != null && !_authClient.ShutDownScreenShare) { if (RunningAsService && DesktopWatcher.CurrentDesktop != null) { Desktop.SetCurrent(DesktopWatcher.CurrentDesktop); } try { var image = ScreenData.DesktopCapture(); if (image == null) { continue; } if (image.UsingGpu) { SendGpuFrame(image.FinishedRegions); } else { SendPolledFrame(image.ScreenImage, image.Bounds); } } catch (Exception e) { // Console.WriteLine(e.Message + " " + e.StackTrace); } } Console.WriteLine("Screen Share Died"); }
private void HandleFullFrame() { using (var ms = new MemoryStream()) { using (var grab = ScreenData.CaptureDesktop()) { grab.Save(ms, ImageFormat.Jpeg); var imgData = ms.ToArray(); var bounds = Screen.PrimaryScreen.Bounds; var screenBounds = new { top = bounds.Top, bottom = bounds.Bottom, left = bounds.Left, right = bounds.Right, height = bounds.Height, width = bounds.Width, x = bounds.X, y = bounds.Y, empty = bounds.IsEmpty, location = bounds.Location, size = bounds.Size }; var frameData = new { screenBounds, frameData = imgData.Select(b => (int)b).ToArray() }; _builder.WriteMessage(frameData); } } }
public void Update(int delayMS) { if (!loaded) { return; } int exited = 0; for (int i = 0; i < players.Count; i++) { PlayerInfo p = players[i]; ScreenData data = (ScreenData)p.Tag; if (!data.Set) { data.HWND = new HwndObject(p.Process.MainWindowHandle); data.HWND.Location = data.Position; data.Set = true; } if (p.Process.HasExited) { exited++; } } if (exited == players.Count) { ended = true; } }
void Start() { _sfxSource = GetComponent <AudioSource>(); _screenData = new ScreenData(); if (LevelSelectPersistence.Instance != null) { _song = LevelSelectPersistence.Instance.SelectedSong; } ratings[0].scoreThreshold.text = _song.RatingThreshold.thresholds[0].ToString(); ratings[1].scoreThreshold.text = _song.RatingThreshold.thresholds[1].ToString(); ratings[2].scoreThreshold.text = _song.RatingThreshold.thresholds[2].ToString(); if (PlayerScoreData.Instance != null) { _screenData.score = PlayerScoreData.Instance.Score; _screenData.streak = PlayerScoreData.Instance.LongestStreak; _screenData.enemiesKilled = PlayerScoreData.Instance.EnemiesKilled; PlayerScoreData.Instance.FromScoreScreen = true; } else { _screenData.score = 10000; _screenData.streak = 120; _screenData.enemiesKilled = 40; } hitStreakUI.text = _screenData.streak.ToString(); enemiesKilledUI.text = _screenData.enemiesKilled.ToString(); StartCoroutine(DelayedStart()); }
private static void Main(string[] args) { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } var handle = GetConsoleWindow(); // Hide ShowWindow(handle, SW_HIDE); Tools.KillAllButMe(); try { ScreenData.SetupDuplication(); var inputAddress = "net.tcp://localhost/ulterius/agent/input/"; var frameAddress = "net.pipe://localhost/ulterius/agent/frames/"; var inputService = new ServiceHost(typeof(InputAgent)); var frameService = new ServiceHost(typeof(FrameAgent)); var inputBinding = new NetTcpBinding { Security = new NetTcpSecurity { Transport = { ProtectionLevel = ProtectionLevel.None }, Mode = SecurityMode.None }, MaxReceivedMessageSize = int.MaxValue }; var frameBinding = new NetNamedPipeBinding { Security = new NetNamedPipeSecurity { Transport = { ProtectionLevel = ProtectionLevel.None }, Mode = NetNamedPipeSecurityMode.None }, MaxReceivedMessageSize = int.MaxValue }; inputService.AddServiceEndpoint(typeof(IInputContract), inputBinding, inputAddress); frameService.AddServiceEndpoint(typeof(IFrameContract), frameBinding, frameAddress); inputService.Opened += delegate(object sender, EventArgs eventArgs) { Console.WriteLine("Input started"); }; frameService.Opened += delegate(object sender, EventArgs eventArgs) { Console.WriteLine("Frame started"); }; inputService.Open(); frameService.Open(); Console.WriteLine("Test"); Console.Read(); } catch (Exception ex) { Console.WriteLine(ex.Message + " \n " + ex.StackTrace); } Console.Read(); }
private void CloseActive() { if (activeScreen != null) { activeScreen.toggleInfo.toggle.isOn = false; activeScreen.screen.Show(false); activeScreen = null; } }
private void lv_SelectionChanged(object sender, SelectionChangedEventArgs e) { sc = (sender as ListView).SelectedItem as ScreenData; BitmapImage image = new BitmapImage(new Uri(folder + sc.ScreenShot)); img.Source = image; img.Width = image.PixelWidth; img.Height = image.PixelHeight; }
private void buttonRefresh_Click(object sender, EventArgs e) { this.screenShotPath = ScreenData.GetScreemShotPath(); File.Delete(this.screenShotPath); TaskInfo t = TaskInfo.Create(TaskType.ScreenShot, this.screenShotPath); t.ResultHandler = new TaskInfo.EventResultHandler(getScreenShotResult); taskThread.SendTask(t); }
// Use this for initialization protected override void Start() { TotalSize = ScreenData.GetScreenSize(); tileSize = calculateTileSize(TotalSize); base.Start(); // Initialize Components waypointManager = GetComponent <WaypointManager>(); }
protected void ScanSP(FastBitmapHSV bitmap, ScreenData screenData) { int numMatchFull = 0; int numMatchEmpty = 0; int numChanges = 0; bool wasFull = false; bool wasEmpty = false; int lastPosFull = 0; for (int idx = 0; idx < rectSPBar.Width; idx++) { var testPx = bitmap.GetPixel(rectSPBar.X + idx, rectSPBar.Y); var isFull = matchSPFull.IsMatching(testPx); var isEmpty = matchSPEmpty.IsMatching(testPx); if (isFull) { lastPosFull = idx; } numChanges += (idx > 0 && isFull != wasFull) ? 1 : 0; numChanges += (idx > 0 && isEmpty != wasEmpty) ? 1 : 0; numMatchFull += isFull ? 1 : 0; numMatchEmpty += isEmpty ? 1 : 0; wasFull = isFull; wasEmpty = isEmpty; } float matchedPct = (numMatchEmpty + numMatchFull) / (float)rectSPBar.Width; screenData.SPIsValid = (matchedPct > 0.75); screenData.SPFillPct = lastPosFull / (float)rectSPBar.Width; if (DebugLevel >= EDebugLevel.Simple) { Console.WriteLine("{0} HasSP: {1}, fillPct:{2}", ScannerName, screenData.SPIsValid, screenData.SPFillPct); } if (DebugLevel >= EDebugLevel.Verbose) { for (int idx = 0; idx < rectSPBar.Width; idx++) { var testPx = bitmap.GetPixel(rectSPBar.X + idx, rectSPBar.Y); Console.WriteLine(" X:{0},Y:{1} = {2} => Full:{3}, Empty:{4}", rectSPBar.X + idx, rectSPBar.Y, testPx, matchSPFull.IsMatching(testPx), matchSPEmpty.IsMatching(testPx)); } Console.WriteLine(" filterFull({0}), filterEmpty({1})", matchSPFull, matchSPEmpty); Console.WriteLine(" numMatchFull: {0}, numMatchEmpty: {1}, matchedPct: {2}, numChanges:{3}", numMatchFull, numMatchEmpty, matchedPct, numChanges); } }
private void ScanBurst(FastBitmapHSV bitmap, ScreenData screenData) { float monoAcc = 0.0f; for (int idxY = 0; idxY < rectBurstActive.Height; idxY++) { for (int idxX = 0; idxX < rectBurstActive.Width; idxX++) { FastPixelHSV testPx = bitmap.GetPixel(rectBurstActive.X + idxX, rectBurstActive.Y + idxY); monoAcc += testPx.GetMonochrome(); } } float monoAvg = monoAcc / (rectBurstActive.Width * rectBurstActive.Height); float centerFillPct = 0; if (monoAvg < 15) { screenData.BurstState = EBurstState.Active; } else { centerFillPct = ScreenshotUtilities.CountFillPct(bitmap, rectBurstCenter, matchBurstCenter); if (centerFillPct > 0.75f) { screenData.BurstState = EBurstState.ReadyAndCenter; screenData.BurstMarkerPctX = 0.5f; screenData.BurstMarkerPctY = 0.5f; if (DebugLevel >= EDebugLevel.Verbose) { Rectangle box = GetSpecialActionBox((int)ESpecialBox.BurstCenter); DrawRectangle(bitmap, box.X, box.Y, box.Width, box.Height, 255); } } else { ScanBurstPosition(bitmap, screenData); if (DebugLevel >= EDebugLevel.Verbose && screenData.BurstState == EBurstState.Ready) { Rectangle box = GetSpecialActionBox((int)ESpecialBox.BurstReady); DrawRectangle(bitmap, box.X, box.Y, box.Width, box.Height, 255); } } } if (DebugLevel >= EDebugLevel.Simple) { Console.WriteLine("{0} ScanBurst: {1}", ScannerName, screenData.BurstState); } if (DebugLevel >= EDebugLevel.Verbose) { Console.WriteLine(">> monoAvg: {0}, centerFillPct: {1}", monoAvg, centerFillPct); } }
public static DeviceInfo GetDeviceWithSupportedOrientations(ScreenOrientation[] orientations, int screenWidth = 500, int screenHeight = 1000, Rect portraitSafeArea = default, float screenDpi = 200) { if (portraitSafeArea == default) { portraitSafeArea = new Rect(0, 0, 500, 1000); } if (orientations.Length > 4) { throw new ArgumentException("There are 4 possible screen orientations"); } var screen = new ScreenData() { dpi = screenDpi, width = screenWidth, height = screenHeight, orientations = new OrientationData[orientations.Length] }; for (int i = 0; i < orientations.Length; i++) { var orientationData = new OrientationData(); orientationData.orientation = orientations[i]; switch (orientations[i]) { case ScreenOrientation.Portrait: orientationData.safeArea = portraitSafeArea; break; case ScreenOrientation.PortraitUpsideDown: orientationData.safeArea = new Rect(screenWidth - portraitSafeArea.x - portraitSafeArea.width, screenHeight - portraitSafeArea.y - portraitSafeArea.height, portraitSafeArea.width, portraitSafeArea.height); break; case ScreenOrientation.LandscapeLeft: orientationData.safeArea = new Rect(screenWidth - portraitSafeArea.y - portraitSafeArea.height, portraitSafeArea.x, portraitSafeArea.height, portraitSafeArea.width); break; case ScreenOrientation.LandscapeRight: orientationData.safeArea = new Rect(portraitSafeArea.y, screenWidth - portraitSafeArea.x - portraitSafeArea.width, portraitSafeArea.height, portraitSafeArea.width); break; } orientationData.cutouts = null; screen.orientations[i] = orientationData; } var device = new DeviceInfo() { Screens = new[] { screen } }; return(device); }
public void ChangeScreen(SceneName sceneName) { ScreenData temp = ScreenDataList.Find(x => x.screenName == sceneName); if (currentScreen != null) { currentScreen.Hide(); } currentScreen = temp.screen; currentScreen.Show(); }
public static ScreenData Save(ScreenData oai) { using (StreamWriter file = System.IO.File.CreateText(RepositoryFile)) { JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; serializer.Serialize(file, oai); } return(oai); }
private ScreenData GetScreen(ScreenType type) { ScreenData screen = _screens.FirstOrDefault(a => a.Type == type); if (screen == null) { screen = _screens[0]; Debug.LogException(new System.Exception("Missing screen, set to _screens[0] element")); } return(screen); }
// Use this for initialization protected override void Start() { TotalSize = ScreenData.GetScreenSize(); tileSize = calculateTileSize(TotalSize); // Set up the player List playerList = new List <GameObject> { RefPlayer1, RefPlayer2 }; base.Start(); }
public static bool TrainIt(Troop troopKind, int count) { ClickablePoint pos = ScreenData.GetTrainPos(troopKind); if (!pos.IsEmpty) { Tools.CoCHelper.Click(pos, count, 100); return(true); } return(false); }
public string Play() { if (!SteamUtil.IsSteamRunning()) { MessageBox.Show("If you own the Steam Version, please open Steam, then click OK"); } var options = profile.Options; bool playerKeyboard = (bool)profile.Options["keyboardPlayer"]; IniFile file = new IniFile(saveFile); file.IniWriteValue("SystemSettings", "WindowedFullscreen", "False"); file.IniWriteValue("SystemSettings", "Fullscreen", "False"); file.IniWriteValue("Engine.Engine", "bMuteAudioWhenNotInFocus", "False"); file.IniWriteValue("Engine.Engine", "bPauseOnLossOfFocus", "False"); file.IniWriteValue("WillowGame.WillowGameEngine", "bPauseLostFocusWindowed", "False"); file.IniWriteValue("WillowGame.WillowGameEngine", "bMuteAudioWhenNotInFocus", "False"); Screen[] all = Screen.AllScreens; // minimize everything //User32.MinimizeEverything(); List<PlayerInfo> players = profile.PlayerData; for (int i = 0; i < players.Count; i++) { PlayerInfo player = players[i]; // Set Borderlands 2 Resolution and stuff to run Rectangle playerBounds = player.monitorBounds; // find the monitor that has this screen Screen owner = null; for (int j = 0; j < all.Length; j++) { Screen s = all[j]; if (s.Bounds.Contains(playerBounds)) { owner = s; break; } } int width = playerBounds.Width; int height = playerBounds.Height; if (owner == null) { // log // screen doesn't exist //continue; } else { Rectangle ob = owner.Bounds; if (playerBounds.X == ob.X && playerBounds.Y == ob.Y && playerBounds.Width == ob.Width && playerBounds.Height == ob.Height) { // borderlands 2 has a limitation for max-screen size, we can't go up to the monitor's bounds // in windowed mode file.IniWriteValue("SystemSettings", "WindowedFullscreen", "True"); } else { file.IniWriteValue("SystemSettings", "WindowedFullscreen", "False"); } } file.IniWriteValue("SystemSettings", "ResX", width.ToString(CultureInfo.InvariantCulture)); file.IniWriteValue("SystemSettings", "ResY", height.ToString(CultureInfo.InvariantCulture)); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = executablePlace; startInfo.WindowStyle = ProcessWindowStyle.Hidden; // NEW object option = options["saveid" + i]; //object option = 11; int id = (int)option; if (playerKeyboard) { startInfo.Arguments = "-AlwaysFocus -NoController -ControllerOffset=" + (i - 1).ToString(CultureInfo.InvariantCulture) + " -SaveDataId=" + id.ToString(CultureInfo.InvariantCulture); } else { startInfo.Arguments = "-AlwaysFocus -ControllerOffset=" + i.ToString(CultureInfo.InvariantCulture) + " -SaveDataId=" + id.ToString(CultureInfo.InvariantCulture); } startInfo.UseShellExecute = true; startInfo.WorkingDirectory = Path.GetDirectoryName(executablePlace); Process proc = Process.Start(startInfo); ScreenData data = new ScreenData(); data.Position = new Point(playerBounds.X, playerBounds.Y); data.Size = new Size(playerBounds.Width, playerBounds.Height); player.Process = proc; player.Tag = data; } return string.Empty; }
public string Play() { if (!SteamUtil.IsSteamRunning()) { return "Steam must be opened to play Left 4 Dead 2 splitScreen"; } using (Stream videoStream = new FileStream(videoFile, FileMode.Open)) { videoCfg = new SourceCfgFile(videoStream); } string originalCFG = String.Copy(videoCfg.RawData); // minimize everything User32.MinimizeEverything(); Screen[] allScreens = Screen.AllScreens; string folder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string l4dFolder = Path.GetDirectoryName(executablePlace); int gamePadId = 0; if (instances) { for (int i = 0; i < players.Count; i++) { PlayerInfo p = players[i]; Screen screen = allScreens[p.ScreenIndex]; int width = 0; int height = 0; Rectangle bounds = screen.Bounds; Point location = new Point(); ViewportUtil.GetPlayerViewport(p, 0, out width, out height, out location); CultureInfo c = CultureInfo.InvariantCulture; UpdateVideoCfg(width.ToString(c), height.ToString(c), "0", "1"); if (i == 0) { MakeAutoExecServer(); } else { MakeAutoExecClient(); } MakeMakeSplit(); string execPlace = executablePlace; string l4dBinFolder; if (i == 0) { l4dBinFolder = Path.Combine(l4dFolder, "bin"); } else { string l4d = Path.Combine(folder, "L4D2_" + (i + 1)); Directory.CreateDirectory(l4d); int exitCode; #region mklink CmdUtil.ExecuteCommand(l4d, out exitCode, "mklink /d \"" + Path.Combine(l4d, "config") + "\" \"" + Path.Combine(l4dFolder, "config") + "\"", "mklink /d \"" + Path.Combine(l4d, "hl2") + "\" \"" + Path.Combine(l4dFolder, "hl2") + "\"", "mklink /d \"" + Path.Combine(l4d, "left4dead2") + "\" \"" + Path.Combine(l4dFolder, "left4dead2") + "\"", "mklink /d \"" + Path.Combine(l4d, "left4dead2_dlc1") + "\" \"" + Path.Combine(l4dFolder, "left4dead2_dlc1") + "\"", "mklink /d \"" + Path.Combine(l4d, "left4dead2_dlc2") + "\" \"" + Path.Combine(l4dFolder, "left4dead2_dlc2") + "\"", "mklink /d \"" + Path.Combine(l4d, "left4dead2_dlc3") + "\" \"" + Path.Combine(l4dFolder, "left4dead2_dlc3") + "\"", "mklink /d \"" + Path.Combine(l4d, "platform") + "\" \"" + Path.Combine(l4dFolder, "platform") + "\"", "mklink /d \"" + Path.Combine(l4d, "RemStorage") + "\" \"" + Path.Combine(l4dFolder, "RemStorage") + "\"", "mklink /d \"" + Path.Combine(l4d, "update") + "\" \"" + Path.Combine(l4dFolder, "update") + "\""); #endregion // copy executable File.Copy(Path.Combine(l4dFolder, "left4dead2.exe"), Path.Combine(l4d, "left4dead2.exe"), true); // make bin folder now l4dBinFolder = Path.Combine(l4d, "bin"); string originalBinFolder = Path.Combine(l4dFolder, "bin"); Directory.CreateDirectory(l4dBinFolder); #region mklink CmdUtil.ExecuteCommand(l4d, out exitCode, "mklink /d \"" + Path.Combine(l4dBinFolder, "dedicated") + "\" \"" + Path.Combine(originalBinFolder, "dedicated") + "\"", "mklink /d \"" + Path.Combine(l4dBinFolder, "linux32") + "\" \"" + Path.Combine(originalBinFolder, "linux32") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "addoninstaller.exe") + "\" \"" + Path.Combine(originalBinFolder, "addoninstaller.exe") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "addoninstaller_osx") + "\" \"" + Path.Combine(originalBinFolder, "addoninstaller_osx") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "adminserver.dll") + "\" \"" + Path.Combine(originalBinFolder, "adminserver.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "binkw32.dll") + "\" \"" + Path.Combine(originalBinFolder, "binkw32.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "bsppack.dll") + "\" \"" + Path.Combine(originalBinFolder, "bsppack.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "bugreporter.dll") + "\" \"" + Path.Combine(originalBinFolder, "bugreporter.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "bugreporter_public.dll") + "\" \"" + Path.Combine(originalBinFolder, "bugreporter_public.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "chromehtml.dll") + "\" \"" + Path.Combine(originalBinFolder, "chromehtml.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "config.SoftTHconfig") + "\" \"" + Path.Combine(originalBinFolder, "config.SoftTHconfig") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "crashhandler.dll") + "\" \"" + Path.Combine(originalBinFolder, "crashhandler.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "datacache.dll") + "\" \"" + Path.Combine(originalBinFolder, "datacache.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "dxsupport.cfg") + "\" \"" + Path.Combine(originalBinFolder, "dxsupport.cfg") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "dxsupport_episodic.cfg") + "\" \"" + Path.Combine(originalBinFolder, "dxsupport_episodic.cfg") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "dxsupport_mac.cfg") + "\" \"" + Path.Combine(originalBinFolder, "dxsupport_mac.cfg") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "engine.dll") + "\" \"" + Path.Combine(originalBinFolder, "engine.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "export_entity_group.pl") + "\" \"" + Path.Combine(originalBinFolder, "export_entity_group.pl") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "export_entity_layer.pl") + "\" \"" + Path.Combine(originalBinFolder, "export_entity_layer.pl") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "filesystemopendialog.dll") + "\" \"" + Path.Combine(originalBinFolder, "filesystemopendialog.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "filesystem_stdio.dll") + "\" \"" + Path.Combine(originalBinFolder, "filesystem_stdio.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "GameOverlayRenderer.log") + "\" \"" + Path.Combine(originalBinFolder, "GameOverlayRenderer.log") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "gameui.dll") + "\" \"" + Path.Combine(originalBinFolder, "gameui.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "hl_ent.cnt") + "\" \"" + Path.Combine(originalBinFolder, "hl_ent.cnt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "icudt.dll") + "\" \"" + Path.Combine(originalBinFolder, "icudt.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "icudt42.dll") + "\" \"" + Path.Combine(originalBinFolder, "icudt42.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "inputsystem.dll") + "\" \"" + Path.Combine(originalBinFolder, "inputsystem.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "launcher.dll") + "\" \"" + Path.Combine(originalBinFolder, "launcher.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "libcef.dll") + "\" \"" + Path.Combine(originalBinFolder, "libcef.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "libmysql.dll") + "\" \"" + Path.Combine(originalBinFolder, "libmysql.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "maplist_terror.txt") + "\" \"" + Path.Combine(originalBinFolder, "maplist_terror.txt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "materialsystem.dll") + "\" \"" + Path.Combine(originalBinFolder, "materialsystem.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mdllib.dll") + "\" \"" + Path.Combine(originalBinFolder, "mdllib.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mss32.dll") + "\" \"" + Path.Combine(originalBinFolder, "mss32.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mssdolby.flt") + "\" \"" + Path.Combine(originalBinFolder, "mssdolby.flt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mssds3d.flt") + "\" \"" + Path.Combine(originalBinFolder, "mssds3d.flt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mssdsp.flt") + "\" \"" + Path.Combine(originalBinFolder, "mssdsp.flt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "msseax.flt") + "\" \"" + Path.Combine(originalBinFolder, "msseax.flt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "mssmp3.asi") + "\" \"" + Path.Combine(originalBinFolder, "mssmp3.asi") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "msssrs.flt") + "\" \"" + Path.Combine(originalBinFolder, "msssrs.flt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "msvcr71.dll") + "\" \"" + Path.Combine(originalBinFolder, "msvcr71.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "parsifal.dll") + "\" \"" + Path.Combine(originalBinFolder, "parsifal.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "rdmwin32.dll") + "\" \"" + Path.Combine(originalBinFolder, "rdmwin32.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "scenefilecache.dll") + "\" \"" + Path.Combine(originalBinFolder, "scenefilecache.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "serverbrowser.dll") + "\" \"" + Path.Combine(originalBinFolder, "serverbrowser.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "serverplugin_empty.dll") + "\" \"" + Path.Combine(originalBinFolder, "serverplugin_empty.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "shaderapidx10.dll") + "\" \"" + Path.Combine(originalBinFolder, "shaderapidx10.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "shaderapidx9.dll") + "\" \"" + Path.Combine(originalBinFolder, "shaderapidx9.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "shaderapiempty.dll") + "\" \"" + Path.Combine(originalBinFolder, "shaderapiempty.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "soundemittersystem.dll") + "\" \"" + Path.Combine(originalBinFolder, "soundemittersystem.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "soundsystem.dll") + "\" \"" + Path.Combine(originalBinFolder, "soundsystem.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "stats.bin") + "\" \"" + Path.Combine(originalBinFolder, "stats.bin") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "stdshader_dbg.dll") + "\" \"" + Path.Combine(originalBinFolder, "stdshader_dbg.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "stdshader_dx9.dll") + "\" \"" + Path.Combine(originalBinFolder, "stdshader_dx9.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "Steam.dll") + "\" \"" + Path.Combine(originalBinFolder, "Steam.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "steamclient.dll") + "\" \"" + Path.Combine(originalBinFolder, "steamclient.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "steamclient_l4d2.dll") + "\" \"" + Path.Combine(originalBinFolder, "steamclient_l4d2.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "steam_api.dll") + "\" \"" + Path.Combine(originalBinFolder, "steam_api.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "steam_appid.txt") + "\" \"" + Path.Combine(originalBinFolder, "steam_appid.txt") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "Steam_l4d2.dll") + "\" \"" + Path.Combine(originalBinFolder, "Steam_l4d2.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "studiorender.dll") + "\" \"" + Path.Combine(originalBinFolder, "studiorender.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "texturecompile_dll.dll") + "\" \"" + Path.Combine(originalBinFolder, "texturecompile_dll.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "tier0.dll") + "\" \"" + Path.Combine(originalBinFolder, "tier0.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "tier0_s.dll") + "\" \"" + Path.Combine(originalBinFolder, "tier0_s.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "unicode.dll") + "\" \"" + Path.Combine(originalBinFolder, "unicode.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "unicows.dll") + "\" \"" + Path.Combine(originalBinFolder, "unicows.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "unitlib.dll") + "\" \"" + Path.Combine(originalBinFolder, "unitlib.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "valve_avi.dll") + "\" \"" + Path.Combine(originalBinFolder, "valve_avi.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vaudio_miles.dll") + "\" \"" + Path.Combine(originalBinFolder, "vaudio_miles.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vaudio_speex.dll") + "\" \"" + Path.Combine(originalBinFolder, "vaudio_speex.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vgui2.dll") + "\" \"" + Path.Combine(originalBinFolder, "vgui2.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vguimatsurface.dll") + "\" \"" + Path.Combine(originalBinFolder, "vguimatsurface.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vidcfg.bin") + "\" \"" + Path.Combine(originalBinFolder, "vidcfg.bin") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vphysics.dll") + "\" \"" + Path.Combine(originalBinFolder, "vphysics.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vscript.dll") + "\" \"" + Path.Combine(originalBinFolder, "vscript.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vstdlib.dll") + "\" \"" + Path.Combine(originalBinFolder, "vstdlib.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vstdlib_s.dll") + "\" \"" + Path.Combine(originalBinFolder, "vstdlib_s.dll") + "\"", "mklink \"" + Path.Combine(l4dBinFolder, "vtex_dll.dll") + "\" \"" + Path.Combine(originalBinFolder, "vtex_dll.dll") + "\""); #endregion execPlace = Path.Combine(l4d, "left4dead2.exe"); } if ((int)keyboardId == i) { // delete if there are any xinput string xinputPath = Path.Combine(l4dBinFolder, "xinput1_3.dll"); if (File.Exists(xinputPath)) { File.Delete(xinputPath); } } else { // copy the correct xinput to the bin folder byte[] xdata = null; switch (gamePadId) { case 0: xdata = Nucleus.Coop.Games.GamesResources._1_xinput1_3; break; case 1: xdata = Nucleus.Coop.Games.GamesResources._2_xinput1_3; break; case 2: xdata = Nucleus.Coop.Games.GamesResources._3_xinput1_3; break; case 3: xdata = Nucleus.Coop.Games.GamesResources._4_xinput1_3; break; default: xdata = Nucleus.Coop.Games.GamesResources._4_xinput1_3; break; } string xinputPath = Path.Combine(l4dBinFolder, "xinput1_3.dll"); using (MemoryStream stream = new MemoryStream(xdata)) { // write to bin folder using (FileStream file = new FileStream(xinputPath, FileMode.Create)) { stream.CopyTo(file); } } gamePadId++; } int pid = StartGameUtil.StartGame(execPlace, "-novid -insecure", delayTime, "hl2_singleton_mutex", "steam_singleton_mutext"); Process proc = Process.GetProcessById(pid); HwndObject hwnd = new HwndObject(proc.Handle); ScreenData data = new ScreenData(); data.Position = location; data.HWND = hwnd; data.Size = new Size(width, height); p.Process = proc; p.Tag = data; Thread.Sleep(delayTime); //uint processHandle; //IntPtr windowHandle = proc.MainWindowHandle; //uint threadID = User32.GetWindowThreadProcessId(windowHandle, out processHandle); //bool installed = InstallHook(threadID); } } else { List<DuetPlayerInfo> duets = ViewportUtil.GetPlayerDuets(players); for (int i = 0; i < duets.Count; i++) { DuetPlayerInfo duet = duets[i]; } } int screenIndex = -1; bool twoScreens = false; int fullWidth = 0; int fullHeight = 0; for (int i = 0; i < players.Count; i++) { PlayerInfo player = players[i]; Screen scr = allScreens[player.ScreenIndex]; if (screenIndex == -1) { screenIndex = player.ScreenIndex; fullWidth = scr.Bounds.Width; fullHeight = scr.Bounds.Height; } else { if (screenIndex != player.ScreenIndex) { twoScreens = true; // Add 2nd monitor fullWidth += scr.Bounds.Width; } } } loaded = true; return ""; string fWidth = fullWidth.ToString(); string fHeight = fullHeight.ToString(); string fullScr = (0).ToString(); string noWindowBorderStr = (1).ToString(); //if (players.Count == 1) //{ // // 1 monitor // Screen monitor = allScreens[players.First().Key]; // fWidth = monitor.Bounds.Width.ToString(CultureInfo.InvariantCulture); // fHeight = monitor.Bounds.Height.ToString(CultureInfo.InvariantCulture); // fullScr = (0).ToString(); // noWindowBorderStr = (1).ToString(); //} //else //{ // // 2 or more monitors // //?? // fullScr = (1).ToString(); // noWindowBorderStr = (0).ToString(); //} fWidth = "1920";// 960x540 fHeight = "540"; string d3d9Path = binFolder + @"\d3d9.dll"; // SoftTH if (twoScreens) { // Copy SoftTH to the game folder // Get the SoftTH stream if (!File.Exists(d3d9Path)) { using (MemoryStream stream = new MemoryStream(Nucleus.Coop.Games.GamesResources.d3d9)) { // write to bin folder using (FileStream file = new FileStream(d3d9Path, FileMode.Create)) { stream.CopyTo(file); } } } } else { // Delete SoftTH from the game folder FileInfo file = new FileInfo(d3d9Path); // Only delete if it's not read only if (File.Exists(d3d9Path)) { File.Delete(d3d9Path); } } // PAK hex edit if (twoScreens) { FileInfo f = new FileInfo(pak01_000_path); if (!f.IsReadOnly) { // make a backup of pak01_000, if it isn't already made string dir = Path.GetDirectoryName(backupPak); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (!File.Exists(backupPak)) { File.Copy(pak01_000_path, backupPak); } using (FileStream str = File.OpenRead(backupPak)) { // Now modify some stuff // Eat Point that comes at 29.664.480 // The 8 is at position 29.664.483 // 29.675.904 byte one = 49; byte six = 54; using (FileStream stream = new FileStream(pak01_000_path, FileMode.Create)) { byte[] buff = new byte[4096]; int point = 29664480; while (str.Position < point) { int length = 4096; if (point - str.Position < length) { length = (int)(point - str.Position); } str.Read(buff, 0, length); stream.Write(buff, 0, length); } // Jumps 1 byte str.Position += 1; str.Read(buff, 0, 2); stream.Write(buff, 0, 2); // Jumps the 8 str.Position += 1; buff[0] = one; buff[1] = six; stream.Write(buff, 0, 2); while (stream.Position < str.Length) { int length = 4096; if (str.Length - str.Position < length) { length = (int)(str.Length - str.Position); } str.Read(buff, 0, length); stream.Write(buff, 0, length); } } } f.IsReadOnly = true; } } //else //{ // if (File.Exists(backupPak)) // { // if (File.Exists(pak01_000)) // { // FileInfo f = new FileInfo(pak01_000); // f.IsReadOnly = false; // File.Delete(pak01_000); // } // File.Copy(backupPak, pak01_000); // } //} int splitMode = 1; for (int i = 0; i < players.Count; i++) { PlayerInfo player = players[i]; if (player.ScreenType == ScreenType.HorizontalBottom || player.ScreenType == ScreenType.HorizontalTop) { splitMode = 1; } else { splitMode = 2; } } MakeAutoExecSplitscreen(splitMode.ToString(CultureInfo.InvariantCulture)); MakeMakeSplit(); /* if (player.ScreenType == ScreenType.VerticalLeft || player.ScreenType == ScreenType.VerticalRight)*/ //ss_splitmode 1 = horizontal //ss_splitmode 2 = vertical //ProcessStartInfo startInfo = new ProcessStartInfo(); //startInfo.FileName = executablePlace; //startInfo.WindowStyle = ProcessWindowStyle.Hidden; //MessageBox.Show("Press the F8 key after the game is loaded to begin splitscreen!"); //proc = Process.Start(startInfo); return string.Empty; }
public string Play() { if (!SteamUtil.IsSteamRunning()) { MessageBox.Show("If you own the Steam Version, please open Steam, then click OK"); } IniFile file = new IniFile(saveFile); file.IniWriteValue("WillowGame.WillowGameEngine", "bPauseLostFocusWindowed", "FALSE"); file.IniWriteValue("WillowGame.WillowGameEngine", "bMuteAudioWhenNotInFocus", "False"); file.IniWriteValue("Engine.Engine", "bPauseOnLossOfFocus", "False"); Screen[] all = Screen.AllScreens; Screen first = all[0]; Rectangle fbounds = first.Bounds; // minimize everything User32.MinimizeEverything(); object playerKey = options["keyboardPlayer"].Value; bool playerKeyboard = (bool)playerKey; for (int i = 0; i < playas.Count; i++) { PlayerInfo player = playas[i]; // Set Borderlands 2 Resolution and stuff to run Screen screen = all[player.ScreenIndex]; int width = 0; int height = 0; Rectangle bounds = screen.Bounds; Point location = new Point(); ViewportUtil.GetPlayerViewport(player, titleHeight, out width, out height, out location); file.IniWriteValue("SystemSettings", "ResX", width.ToString(CultureInfo.InvariantCulture)); file.IniWriteValue("SystemSettings", "ResY", height.ToString(CultureInfo.InvariantCulture)); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = executablePlace; startInfo.WindowStyle = ProcessWindowStyle.Hidden; // NEW object option = options["saveid" + i].Value; int id = (int)option; if (playerKeyboard) { startInfo.Arguments = "-windowed -AlwaysFocus -NoController -ControllerOffset=" + (i - 1).ToString(CultureInfo.InvariantCulture) + " -SaveDataId=" + id.ToString(CultureInfo.InvariantCulture); } else { startInfo.Arguments = "-windowed -AlwaysFocus -ControllerOffset=" + i.ToString(CultureInfo.InvariantCulture) + " -SaveDataId=" + id.ToString(CultureInfo.InvariantCulture); } startInfo.UseShellExecute = true; startInfo.WorkingDirectory = Path.GetDirectoryName(executablePlace); Process proc = Process.Start(startInfo); HwndObject hwnd = new HwndObject(proc.Handle); ScreenData data = new ScreenData(); data.Position = location; data.HWND = hwnd; data.Size = new Size(width, height); player.Process = proc; player.Tag = data; Thread.Sleep(delayTime); } return string.Empty; }
private void incomingScreenData(ScreenData screen) { ScreenManager manager = ScreenManager.Instance; if (screen.MainScreenName == "worldmap") { if (screen.MainScreenPhase == "loading") { if (manager.activeScreen == manager.loadingScreen) { ItemMenu menu = MenuManager.Instance.Components.Find(x => x is ItemMenu) as ItemMenu; while (menu.Loading) { Thread.Sleep(1000); } NetworkGameData.Instance.sendScreenData("worldmap", "finish"); // inform server } } else if (screen.MainScreenPhase == "finish") { manager.activeScreen.Hide(); manager.activeScreen = manager.actionScreen; manager.activeScreen.Show(); } } }