//bool started = false; public void setStartUpUI(bool iamhost = false) { //started = true; titleScreen.SetActive(false); playerListObject.SetActive(true); StartGameButton.SetActive(false); waitingText.SetActive(true); if (iamhost) { StartGameButton.SetActive(true); PlayAgainButton.SetActive(true); waitingText.SetActive(false); RestartGameButton.SetActive(true); settingsResetButton.interactable = true; for (int i = 0; i < settingsList.Count; i++) { settingsList[i].interactable = true; } for (int i = 0; i < numberFrequencies.Count; i++) { numberFrequencies[i].interactable = true; } } //settingsChangeEvent(); //Gameplay.current.CmdSettingsChangeEvent(); }
private void StartGameButton_Click(object sender, EventArgs e) { if (SmallFigureRadioButton.Checked) { Figure.CUBE_SIZE = 10; } else if (MediumFigureRadioButton.Checked) { Figure.CUBE_SIZE = 20; } else if (BigFigureRadioButton.Checked) { Figure.CUBE_SIZE = 30; } else { Figure.CUBE_SIZE = 20; } Size = new Size(25 * Figure.CUBE_SIZE, 25 * Figure.CUBE_SIZE); tetrisGamePanel.Location = new Point(Figure.CUBE_SIZE, 10); tetrisGamePanel.Size = new Size(10 * Figure.CUBE_SIZE, 20 * Figure.CUBE_SIZE); nextFigurePanel.Size = new Size(5 * Figure.CUBE_SIZE, 5 * Figure.CUBE_SIZE); ScoreHeaderLabel.Location = new Point(tetrisGamePanel.Right + Figure.CUBE_SIZE, tetrisGamePanel.Top); ScoreHeaderLabel.Size = new Size(5 * Figure.CUBE_SIZE, 2 * Figure.CUBE_SIZE); ScoreHeaderLabel.Font = new Font("Microsoft Sans Serif", Figure.CUBE_SIZE); ScoreLabel.Location = new Point(ScoreHeaderLabel.Left, ScoreHeaderLabel.Bottom + 10); ScoreLabel.Size = new Size(5 * Figure.CUBE_SIZE, 2 * Figure.CUBE_SIZE); ScoreLabel.Font = new Font("Microsoft Sans Serif", Figure.CUBE_SIZE); ScoreLabel.Text = gameScore.ToString(); nextFigurePanel.Location = new Point(tetrisGamePanel.Right + Figure.CUBE_SIZE, ScoreLabel.Bottom + 20); tetrisGamePanelCanvas = tetrisGamePanel.CreateGraphics(); nextFigurePanelCanvas = nextFigurePanel.CreateGraphics(); tetrisGamePanel.Show(); nextFigurePanel.Show(); ScoreHeaderLabel.Show(); StartGameButton.Enabled = false; InfoButton.Enabled = false; SmallFigureRadioButton.Enabled = false; MediumFigureRadioButton.Enabled = false; BigFigureRadioButton.Enabled = false; StartGameButton.Hide(); InfoButton.Hide(); FigureSizeLabel.Hide(); SmallFigureRadioButton.Hide(); MediumFigureRadioButton.Hide(); BigFigureRadioButton.Hide(); cubes = new List <KeyValuePair <Point, Brush> >(); tetrisGamePanel.Invalidate(); StartGame(); }
private void GenerateStartButton() { var btn = new StartGameButton(); btn.Click += btnStartGame_Click; GW.PlayerButtonsPanel.Children.Add(btn); }
void Update() { if (GameController.Instance.GetPlayer()) { Transform player = GameController.Instance.GetPlayer(); if (MenuManager.Instance.menuState != MenuManager.MenuState.INGAME) { player.position = transform.position; } else { timer -= 1 * Time.deltaTime; Vector3 playerPos = player.position; playerPos.y = 0; player.position = playerPos; player.position += Vector3.left * 3f * Time.deltaTime; player.rotation = Quaternion.Euler(new Vector3(0, -90, 0)); } if (timer <= 0) { timer = 0; player.position = new Vector3(player.position.x, 0, player.position.z); player.rotation = Quaternion.Euler(0, -90, 0); StartGameButton survival = GameObject.Find("PlayButton").GetComponent <StartGameButton>(); survival.beginGame = true; Destroy(this); } } }
// Use this for initialization void Start() { passerUserName = passerUserNameObje.GetComponent <PasserUserName>(); startGameButton = playAgainButton.GetComponent <StartGameButton>(); previousTime = 0.0f; currentTime = 0.0f; ClickArea(); MusicSource.clip = MusicClip; userName = passerUserName.username; }
public TetrisGame(MainMenuForm mainMenu) { InitializeComponent(); this.mainMenu = mainMenu; tetrisGamePanel.Hide(); nextFigurePanel.Hide(); ScoreHeaderLabel.Hide(); StartGameButton.Show(); InfoButton.Show(); Size = new Size(280, 280); }
private void StartGameButtonHandler(object sender, EventArgs e) //кнопка для начала игры { //скрытие всех начальных элементов формы StartGameButton.Hide(); Ship1.Hide(); Ship2.Hide(); Ship3.Hide(); Ship4.Hide(); Ship5.Hide(); Ship6.Hide(); MartianBattleLabel.Hide(); //определение управляющего объекта m_controlGame = new Controller(this, NumbersOfLives, Platform, new TextBox[] { Ship1, Ship2, Ship3, Ship4, Ship5, Ship6 }); m_controlGame.StartGame(); //запуск игры }
public void checkAvailableLayoutUnits() { if (!allUnitsSet()) { NextPlayerButton.SetActive(false); StartGameButton.SetActive(false); return; } if (playerTurn == 0) { NextPlayerButton.SetActive(true); } else { StartGameButton.SetActive(true); } }
// Use this for initialization void Start() { passerUserName = passerUserNameObje.GetComponent <PasserUserName>(); startGameButton = playAgainButton.GetComponent <StartGameButton>(); previousTime = 0.0f; currentTime = 0.0f; MusicSource.clip = MusicClip; userName = passerUserName.username; GetDivManPoints(gameId); int rowRandom = xArray[0]; int colRandom = yArray[0]; print(colRandom + " , " + rowRandom); Vector2 areaPosition = previousPosition + new Vector2((colRandom - 1) * 120f + 60f, (rowRandom - 1) * 120f + 60f); transform.localPosition = areaPosition; }
static void PatchMenuText(StartGameButton __instance) { if (adVanceBepisMain.configEnableCustomMenuText.Value) { __instance.gameObject.GetComponent <TextMesh>().text = adVanceBepisMain.configCustomMenuText.Value; } if (adVanceBepisMain.configEnableCustomMenuTextSize.Value) { __instance.gameObject.GetComponent <TextMesh>().fontSize = adVanceBepisMain.configCustomMenuTextSize.Value; } //Because the custom text still persists when going to space if (FindObjectOfType <StartGameButton>().InfiniteMode) { __instance.gameObject.GetComponent <TextMesh>().text = "∞"; } if (FindObjectOfType <StartGameButton>().InfiniteMode) { __instance.gameObject.GetComponent <TextMesh>().fontSize = 200; } }
private void GamePanel_Load(object sender, EventArgs e) { Text = $"{Text} ({GameServer.GameAddress}:{GameServer.GamePort})"; PlayerNameLabel.Text = PlayerSetting.Username + (PlayerSetting.IsHost ? " (Host)" : ""); MessageInputText.MaxLength = GameServer.SizeLimit / 2; ProtocolProcess.RequestGameSettings(); ProtocolProcess.OnGameSettingsReceivedEvent += delegate(object o, GameSettingsReceivedEvent ev) { if (ev.GameSettings != null) { GameNameText.Invoke((MethodInvoker)(() => GameNameText.Text = ev.GameSettings.GameName)); PlayerCountLabel.Invoke((MethodInvoker)(() => PlayerCountLabel.Text = $"PLAYERS ({ev.GameSettings.CurrentPlayers}/{ev.GameSettings.GameSize})")); StartGameButton.Invoke((MethodInvoker)(() => StartGameButton.Visible = PlayerSetting.IsHost && !ev.GameSettings.GameInProgress)); PointsRedText.Invoke((MethodInvoker)(() => PointsRedText.Text = ev.GameSettings.DefaultPointValues[0].ToString())); PointsBlueText.Invoke((MethodInvoker)(() => PointsBlueText.Text = ev.GameSettings.DefaultPointValues[1].ToString())); PointsYellowText.Invoke((MethodInvoker)(() => PointsYellowText.Text = ev.GameSettings.DefaultPointValues[2].ToString())); RefreshTimeText.Invoke((MethodInvoker)(() => RefreshTimeText.Text = ev.GameSettings.Timer)); WinPointText.Invoke((MethodInvoker)(() => WinPointText.Text = ev.GameSettings.Win)); // TODO: This line would allow for dynamic panel sizing, perhaps figure out the best way to implement this someday? // Invoke((MethodInvoker)(() => this.Size = new Size(ev.GameSettings.PanelSize.X, ev.GameSettings.PanelSize.Y))); } }; }
private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { while (true) { if (backgroundWorker1.CancellationPending) { return; } if (currentFigure.isStay) { if (currentFigure.GetTopmostCoordinate() <= 0) { MessageBox.Show("You lose"); StartGameButton.Location = new Point(nextFigurePanel.Location.X, nextFigurePanel.Location.Y + nextFigurePanel.Height + 20); StartGameButton.Size = new Size(5 * Figure.CUBE_SIZE, 2 * Figure.CUBE_SIZE); StartGameButton.Font = new Font("Microsoft Sans Serif", Figure.CUBE_SIZE / 2); StartGameButton.Enabled = true; StartGameButton.Show(); return; } int rows_to_del = 0; // add current figure cubes into panel cubes list for (int i = 0; i < currentFigure.cubes.Count; i++) { KeyValuePair <Point, Brush> cube = new KeyValuePair <Point, Brush>(currentFigure.cubes[i], currentFigure.GetBrushByFigureType()); occupatedMap[cube.Key.Y / Figure.CUBE_SIZE, cube.Key.X / Figure.CUBE_SIZE] = 1; cubes.Add(cube); } // find 10 cubes in a row // and shift upper cubes down for (int i = occupatedMap.GetLength(0) - 1; i > 0; i--) { int cubes_in_row = 0; for (int j = 0; j < occupatedMap.GetLength(1); j++) { if (occupatedMap[i, j] == 1) { cubes_in_row++; } else { break; } } if (cubes_in_row == occupatedMap.GetLength(1)) { rows_to_del++; for (int k = 0; k < occupatedMap.GetLength(1); k++) { occupatedMap[i, k] = 0; occupatedMap[0, k] = 0; } cubes.RemoveAll(x => x.Key.Y == i * Figure.CUBE_SIZE); //shift upper cubes down for (int u = 0; u < cubes.Count; u++) { var item = cubes[u]; if (item.Key.Y < i * Figure.CUBE_SIZE) { cubes[u] = new KeyValuePair <Point, Brush>(new Point(cubes[u].Key.X, cubes[u].Key.Y + Figure.CUBE_SIZE), cubes[u].Value); } } //change map for (int x = i; x > 0; x--) { for (int y = 0; y < occupatedMap.GetLength(1); y++) { occupatedMap[x, y] = occupatedMap[x - 1, y]; } } i++; } } switch (rows_to_del) { case 1: gameScore += 100; break; case 2: gameScore += 300; break; case 3: gameScore += 700; break; case 4: gameScore += 1500; break; default: break; } if (gameScore > 5000) { gameSpeed = (int)GAME_SPEED.INCREDIBLE; } else if (gameScore >= 3000) { gameSpeed = (int)GAME_SPEED.HIGH; } else if (gameScore >= 1000) { gameSpeed = (int)GAME_SPEED.MEDIUM; } else { gameSpeed = (int)GAME_SPEED.LOW; } Random random = new Random(); currentFigure = nextFigure; nextFigure = new Figure(tetrisGamePanel, FIGURE_TYPE.I + random.Next() % Enum.GetNames(typeof(FIGURE_TYPE)).Length); if (rows_to_del > 0) { tetrisGamePanel.Invalidate(); ScoreLabel.Text = gameScore.ToString(); } nextFigurePanel.Invalidate(); } Thread.Sleep(gameSpeed); currentFigure.StepDown(cubes); Point startRedrawPoint = new Point(currentFigure.GetLeftmostCoordinate(), currentFigure.GetTopmostCoordinate() - Figure.CUBE_SIZE); Size sizeRedraw = new Size(currentFigure.GetRightmostCoordinate() - currentFigure.GetLeftmostCoordinate() + Figure.CUBE_SIZE, currentFigure.GetBottommostCoordinate() - currentFigure.GetTopmostCoordinate() + Figure.CUBE_SIZE); Rectangle invRect = new Rectangle(startRedrawPoint, sizeRedraw); tetrisGamePanel.Invalidate(invRect); } }
} //makes the loading look less shitty private void MainForm_Load(object sender, EventArgs e) { var watch = Pool.Get <Stopwatch>(); try { watch.Restart(); AdminLaunchButton.Visible = false; if (!Program.IsElevated) { AdminLaunchButton.Image = BitmapHelper.ResizeImage(SystemIcons.Shield.ToBitmap(), new Size(16, 16)); } DvarsCheckBox.Visible = Debugger.IsAttached; var argsSB = Pool.Get <StringBuilder>(); try { argsSB.Clear(); var cmdArgs = Environment.GetCommandLineArgs(); for (int i = 0; i < cmdArgs.Length; i++) { var arg = cmdArgs[i]; if (arg.IndexOf(Application.ProductName, StringComparison.OrdinalIgnoreCase) >= 0 || arg.IndexOf(Application.StartupPath, StringComparison.OrdinalIgnoreCase) >= 0) { continue; } if (arg.Equals("-unlock", StringComparison.OrdinalIgnoreCase)) { DvarsCheckBox.Visible = true; } if (arg.Equals("-unlock=1", StringComparison.OrdinalIgnoreCase)) { DvarsCheckBox.Visible = true; DvarsCheckBox.Checked = true; } if (arg.Equals("-fog=1", StringComparison.OrdinalIgnoreCase)) { settings.Fog = true; } else if (arg.Equals("-fog=0", StringComparison.OrdinalIgnoreCase)) { settings.Fog = false; } if (arg.Equals("-launch", StringComparison.OrdinalIgnoreCase)) { StartGameButton.PerformClick(); } if (arg.Equals("-debug", StringComparison.OrdinalIgnoreCase)) { IsDev = true; } if (Program.IsElevated) //ensure elevation before checking these args, otherwise a user could potentially make these forms appear without being elevated & cause an exception { if (arg.Equals("-hotkeys", StringComparison.OrdinalIgnoreCase)) { new Hotkeys().Show(); } if (arg.Equals("-cdkeymanager", StringComparison.OrdinalIgnoreCase)) { var form = new CDKeyManagerForm(); form.Show(); form.BeginInvoke((MethodInvoker) delegate { form.BringToFront(); form.Select(); }); form.Location = new Point((int)(Location.X / 3.25f), (int)(Location.Y / 3f)); } } if (arg.IndexOf("-fov=", StringComparison.OrdinalIgnoreCase) >= 0) { if (decimal.TryParse(arg.Split('=')[1], out decimal FoV)) { SetFoVNumeric(FoV); } } argsSB.Append(arg).Append(" "); } if (argsSB.Length > 1) { argsSB.Length -= 1; var argStr = argsSB.ToString(); Log.WriteLine(argsSB.Clear().Append("Launched program with args: ").Append(argStr).ToString()); } } finally { Pool.Free(ref argsSB); } StartUpdates(); Task.Run(() => { try { if (string.IsNullOrEmpty(settings.InstallPath) || !Directory.Exists(settings.InstallPath)) { var scannedPath = PathScanner.ScanForGamePath(); if (!string.IsNullOrEmpty(scannedPath)) { MessageBox.Show("Automatically detected game path: " + Environment.NewLine + scannedPath, ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); settings.InstallPath = scannedPath; } else { ipDialog.Description = "Locate your Call of Duty installation directory"; var ipResult = ipDialog.ShowDialog(); if (ipResult == DialogResult.Cancel) { Application.Exit(); return; } var selectedPath = ipDialog.SelectedPath; settings.InstallPath = selectedPath; MessageBox.Show("Set install path to: " + selectedPath, ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("An error has occurred: " + ex.Message + Environment.NewLine + "Please refer to the log for more information."); Log.WriteLine("An exception happened on Install Path code:" + Environment.NewLine + ex.ToString()); } }); UpdateProcessBox(); AdminLaunchButton.Visible = !Program.IsElevated && (SelectedMemory?.ProcMemory?.RequiresElevation() ?? false); SetFoVNumeric(settings.FoV); MinimizeCheckBox.Checked = settings.MinimizeToTray; FogCheckBox.Checked = settings.Fog; fogToolStripMenuItem.Checked = settings.Fog; LaunchParametersTB.Text = settings.CommandLine; if (settings.TrackGameTime) { AccessGameTimeLabel(); } else { GameTimeLabel.Visible = false; CurSessionGT.Visible = false; GameTracker.Enabled = false; } if (IsDev) { UpdateButton.Visible = true; } } finally { watch.Stop(); var sb = Pool.Get <StringBuilder>(); try { var timeTaken = watch.Elapsed; Console.WriteLine(sb.Clear().Append("Form load took: ").Append(timeTaken.TotalMilliseconds).Append("ms").ToString()); if (timeTaken.TotalMilliseconds > 100) { Log.WriteLine(sb.Clear().Append("Startup took: ").Append(timeTaken.TotalMilliseconds).Append("ms (this is too long!)").ToString()); } Log.WriteLine(sb.Clear().Append("Successfully started application, version ").Append(Application.ProductVersion).ToString()); } finally { Pool.Free(ref sb); } } }
//public Camera _uicamera; // Use this for initialization void Awake() { //shortcut CraftZoneManager craftZoneManager = CraftZoneManager.get(); GameStateController gameStateController = GameStateController.get(); //CraftFinalizer _craftfinalizer = craftFinalizer; GUITransitioner guiTransitioner = GUITransitioner.get(); DevicesDisplayer devicesDisplayer = DevicesDisplayer.get(); InfoWindowManager infoWindowManager = InfoWindowManager.get(); AvailableBioBricksManager availableBioBricksManager = AvailableBioBricksManager.get(); TooltipManager tooltipManager = TooltipManager.get(); ModalManager modalManager = ModalManager.get(); GameObject mediumInfoPanelCell = GameObject.Find("MediumInfoPanelCell"); //GUITransitioner guiTransitioner.celliaGraph = mediumInfoPanelCell.transform.Find("CellMediumInfoBackgroundSprite").gameObject .GetComponent <VectrosityPanel>(); guiTransitioner.roomGraph = GameObject.Find("MediumInfoPanelRoom").transform.Find("RoomMediumInfoBackgroundSprite").gameObject .GetComponent <VectrosityPanel>(); guiTransitioner.animator = GameObject.Find("WorldEquipButton").GetComponent <InventoryAnimator>(); guiTransitioner.worldScreen = GameObject.Find("WorldScreensPanel"); guiTransitioner.craftScreen = craftScreenPanel; ContinueButton cb = okButton1.GetComponent <ContinueButton>(); StartGameButton sgb = okButton2.GetComponent <StartGameButton>(); //GameStateController gameStateController.intro = introduction1; gameStateController.introContinueButton = cb; gameStateController.fadeSprite = fade; gameStateController.endWindow = end; EndMainMenuButton emmb = endMainMenuButton.GetComponent <EndMainMenuButton>(); gameStateController.endMainMenuButton = emmb; gameStateController.mainMenu = mainMenu; //TODO should be done in gameStateController instead tutorialPanels.SetActive(true); introduction1.SetActive(false); introduction2.SetActive(false); end.SetActive(false); pauseIndicator.SetActive(false); genericModalWindow.SetActive(false); craftScreenPanel.SetActive(false); mainMenu.open(); gameStateController.pauseIndicator = pauseIndicator; //initialization of intro panels cb.nextInfoPanel = introduction2; cb.nextInfoPanelContinue = sgb; //CraftFinalizer craftFinalizer.ToCraftZoneManager = craftZoneManager; //CraftZoneManager craftZoneManager.GetComponent <CraftZoneManager>().craftFinalizer = craftFinalizer; //CraftFinalizer _craftFinalizer2 = CraftZoneManager.get().GetComponent<CraftZoneManager>().craftFinalizer; if (null == craftFinalizer.craftFinalizationButton) { craftFinalizer.craftFinalizationButton = GameObject.Find("CraftButton").GetComponent <CraftFinalizationButton>(); } craftZoneManager.displayedBioBrick = craftZoneDisplayedBioBrickPrefab; craftZoneManager.lastHoveredInfoManager = lastHoveredInfo.GetComponent <LastHoveredInfoManager>(); craftZoneManager.assemblyZonePanel = craftScreenPanel.transform.FindChild("TopPanel").transform.FindChild("AssemblyZonePanel").gameObject; //DevicesDisplayer devicesDisplayer.equipPanel = equipedDevicesSlotsPanel; devicesDisplayer.inventoryPanel = inventoryDevicesSlotsPanel; devicesDisplayer.listedInventoryPanel = craftScreenPanel.transform.FindChild("BottomPanel").transform.FindChild("DevicesPanel").GetComponent <UIPanel>(); devicesDisplayer.graphMoleculeList = mediumInfoPanelCell.GetComponent <GraphMoleculeList>() as GraphMoleculeList; devicesDisplayer.equipedDevice = equipedDeviceButtonPrefabPos; devicesDisplayer.equipedDevice2 = equipedDeviceButtonPrefabPos2; devicesDisplayer.inventoryDevice = inventoryDevicePrefab; devicesDisplayer.listedInventoryDevice = listedDevicePrefab; //InfoWindowManager infoWindowManager.infoPanel = genericInfoWindow; infoWindowManager.titleLabel = genericInfoWindow.transform.FindChild("TitleLabel").GetComponent <UILocalize>(); infoWindowManager.subtitleLabel = genericInfoWindow.transform.FindChild("SubtitleLabel").GetComponent <UILocalize>(); infoWindowManager.explanationLabel = genericInfoWindow.transform.FindChild("ExplanationLabel").GetComponent <UILocalize>(); infoWindowManager.bottomLabel = genericInfoWindow.transform.FindChild("BottomLabel").GetComponent <UILocalize>(); infoWindowManager.infoSprite = genericInfoWindow.transform.FindChild("InfoSprite").GetComponent <UISprite>(); //ModalManager modalManager.modalBackground = modalBackground; modalManager.genericModalWindow = genericModalWindow; modalManager.titleLabel = genericModalWindow.transform.FindChild("TitleLabel").GetComponent <UILocalize>(); modalManager.explanationLabel = genericModalWindow.transform.FindChild("ExplanationLabel").GetComponent <UILocalize>(); modalManager.infoSprite = genericModalWindow.transform.FindChild("InfoSprite").GetComponent <UISprite>(); modalManager.genericValidateButton = genericModalWindow.transform.FindChild("ValidateButton").gameObject; modalManager.genericCenteredValidateButton = genericModalWindow.transform.FindChild("CenteredValidateButton").gameObject; modalManager.genericCancelButton = genericModalWindow.transform.FindChild("CancelButton").gameObject; //DeviceInventory Inventory.get().animator = GameObject.Find("WorldEquipButton").GetComponent <InventoryAnimator>(); Inventory.get().animator.tutorialArrowAnimation = tutorialArrow.GetComponent <ArrowAnimation>(); //BiobrickInventory //AvailableBioBricksManager.get().bioBricksPanel = GameObject.Find("BiobricksPanel"); availableBioBricksManager.bioBricksPanel = craftScreenPanel.transform.FindChild("BottomPanel").transform.FindChild("BiobricksPanel").gameObject; availableBioBricksManager.availableBioBrick = availableBioBricksManager.bioBricksPanel.transform.FindChild("AvailableDisplayedBioBrickPrefab").gameObject; //AvailableBioBricksManager.get ().availableBioBrick = GameObject.Find ("AvailableDisplayedBioBrickPrefab"); //TooltipManager tooltipManager.bioBrickTooltipPanel = biobrickTooltipPanel; tooltipManager.deviceTooltipPanel = deviceTooltipPanel; tooltipManager.uiCamera = GameObject.Find("Camera").GetComponent <Camera>(); Logger.get().loggerGUIComponent = loggerGUIComponent; }