public override void _Ready() { // load in some nodes asteroidManager = GetNode <AsteroidManager>("AsteroidManager"); endGameDelayTimer = GetNode <Timer>("EndGameDelayTimer"); canvasLayer = GetNode <CanvasLayer>("CanvasLayer"); map = GetNode <Map>("Map"); gui = canvasLayer.GetNode <GUI>("GUI"); techTree = canvasLayer.GetNode <Control>("TechTree"); leaderBoard = canvasLayer.GetNode <Control>("Leaderboard"); quitPopup = canvasLayer.GetNode <ConfirmationDialog>("QuitPopup"); Signals.FinalWaveCompleteEvent += OnFinalWaveComplete; Signals.TerritoryDestroyedEvent += OnTerritoryDestroyed; gui.TechTreeButtonPressedEvent += OnTechTreeButtonPressed; gui.LeaderBoardButtonPressedEvent += OnLeaderBoardButtonPressed; quitPopup.Connect("confirmed", this, nameof(OnQuitPopupConfirmed)); // setup our list of territories per owner map.Territories.ForEach(t => numTerritoriesPerPlayer[t.TerritoryOwner - 1]++); asteroidManager.Territories = map.Territories; AddPlayersToWorld(); // after the world is setup, tell the server to start the timer and begin the game Server.Instance.PostBeginGame(); }
public void ConnectSignals() { PlayBtn.Connect("pressed", this, nameof(PlayStream)); StopBtn.Connect("pressed", this, nameof(StopStream)); NextBtn.Connect("pressed", this, nameof(NextStation)); Radio.Connect("index_pressed", this, nameof(RadioPressed)); VolumeBar.Connect("value_changed", this, nameof(ChangeVolume)); AddStation.Connect("pressed", this, nameof(PopupAddStation)); NewStation.Connect("confirmed", this, nameof(AddNewStation)); StationHandler.Connect(nameof(StationHandler.AddNewStation), this, nameof(AddRadioItem)); }
public override void _EnterTree() { _settingsButton = new ToolButton { Text = "Polygonizer Settings" }; _settingsButton.Connect("pressed", this, nameof(Settings_ButtonClicked)); _button = new ToolButton { Text = "Polygonize" }; _button.Connect("pressed", this, nameof(Polygonize_ButtonClicked)); _button.Hide(); _settingsDialog = (ConfirmationDialog)ResourceLoader.Load <PackedScene>("addons/Polygonizer/SettingsDialog.tscn").Instance(); GetEditorInterface().GetBaseControl().AddChild(_settingsDialog); GetEditorInterface().GetInspector().Connect("property_edited", this, nameof(OnPropertyEdited)); AddControlToContainer(CustomControlContainer.CanvasEditorMenu, _settingsButton); AddControlToContainer(CustomControlContainer.CanvasEditorMenu, _button); GetEditorInterface().GetSelection().Connect("selection_changed", this, nameof(OnSelectionChanged)); _settingsDialog.Connect("confirmed", this, nameof(Settings_DialogConfirmed)); }
public override void _Ready() { var button1 = GetNode <TextureButton>("Buttons/Control/Level1Button"); button1.Connect("pressed", this, nameof(OnLevel1ButtonPressed)); //button1.TextureHover = GetHighlightedTexture(button1.TextureNormal); button1.TexturePressed = new ImageTexture(); var button2 = GetNode <TextureButton>("Buttons/Control/Level2Button"); button2.Connect("pressed", this, nameof(OnLevel2ButtonPressed)); //button2.TextureHover = GetHighlightedTexture(button2.TextureNormal); button2.TexturePressed = new ImageTexture(); var button3 = GetNode <TextureButton>("Buttons/Control/Level3Button"); button3.Connect("pressed", this, nameof(OnLevel3ButtonPressed)); //button3.TextureHover = GetHighlightedTexture(button3.TextureNormal); button3.TexturePressed = new ImageTexture(); _settingsWindow = GetNode <ConfirmationDialog>("SettingsWindow"); _settingsWindow.Connect("confirmed", this, nameof(_on_SettingsWindow_confirmed)); _settingsWindow.GetCancel().Connect("pressed", this, nameof(_on_SettingsWindow_canceled)); _settingsWindow.GetCloseButton().Connect("pressed", this, nameof(_on_SettingsWindow_canceled)); _settingsWindow.GetOk().Text = "Apply"; _settingsWindow.GetLabel().AddFontOverride("font", Font); _settingsWindow.GetOk().AddFontOverride("font", Font); _settingsWindow.GetCancel().AddFontOverride("font", Font); _settingsWindow.GetCloseButton().AddFontOverride("font", Font); _resolutionsOption = GetNode <OptionButton>("SettingsWindow/MarginContainer/GridContainer/ResolutionOptionButton"); _displayModeOption = GetNode <OptionButton>("SettingsWindow/MarginContainer/GridContainer/DisplayModeOptionButton"); _masterVolumeSlider = GetNode <ValueSlider>("SettingsWindow/MarginContainer/GridContainer/MasterVolumeValueSlider"); foreach (var res in ResolutionsNames) { _resolutionsOption.AddItem(res); } foreach (var mode in DisplayModesNames) { _displayModeOption.AddItem(mode); } _resolutionsOption.Selected = 1; _displayModeOption.Selected = 0; _masterVolumeSlider.Value = 50; _settings = new Settings { Resolution = ResolutionsNames[1], DisplayMode = DisplayModesNames[0], MasterVolume = 50 }; var saveFile = new File(); if (saveFile.FileExists(SettingsFileName)) { saveFile.Open(SettingsFileName, File.ModeFlags.Read); _settings = JsonConvert.DeserializeObject <Settings>(saveFile.GetLine()); saveFile.Close(); _resolutionsOption.Selected = Array.IndexOf(ResolutionsNames, _settings.Resolution); _displayModeOption.Selected = Array.IndexOf(DisplayModesNames, _settings.DisplayMode); _masterVolumeSlider.Value = _settings.MasterVolume; } ApplySettings(); }