public override void _Ready() { base._Ready(); _actionsBackground = GetNode <TextureRect>("ActionsBackground"); _actionsLabelsContainer = _actionsBackground.GetNode <VBoxContainer>("ActionsLabelsContainer"); _completedActionsLabel = _actionsLabelsContainer.GetNode <RichTextLabel>("CompletedActionsLabel"); _correctActionsLabel = _actionsLabelsContainer.GetNode <RichTextLabel>("CorrectActionsLabel"); var labelsFont = (DynamicFont)GD.Load($"{_simpleHudResourcesPath}montserrat_bold.tres"); labelsFont.Size = 24; _completedActionsLabel.AddFontOverride("normal_font", labelsFont); _correctActionsLabel.AddFontOverride("normal_font", labelsFont); _actionsBackground.Texture = (Texture)GD.Load($"{_simpleHudResourcesPath}actions_background.png"); _actionsBackground.RectPosition = new Vector2(650, 0); _actionsLabelsContainer.RectPosition = new Vector2(30, 15); _completedActionsLabel.RectMinSize = new Vector2(250, 30); _completedActionsLabel.BbcodeEnabled = true; _completedActionsLabel.ScrollActive = false; _correctActionsLabel.RectMinSize = new Vector2(250, 30); _correctActionsLabel.BbcodeEnabled = true; _correctActionsLabel.ScrollActive = false; }
/// <summary> /// Initializes the control. /// </summary> /// <param name="teammate">Teammate model to initialize the control from.</param> /// <param name="addIcon">Texture of the add icon.</param> /// <param name="removeIcon">Texture of the remove icon.</param> public void Init(Teammate teammate, Texture addIcon, Texture removeIcon) { Teammate = teammate; var actionIcon = teammate.IsAddedToTeam ? removeIcon : addIcon; var usedTexture = teammate.IsAddedToTeam ? teammate.SmallTexture : teammate.BigTexture; _verticalContainer = GetNode <VBoxContainer>("VerticalContainer"); _teammateButton = _verticalContainer.GetNode <TextureButton>("TeammateButton"); _actionIcon = _teammateButton.GetNode <TextureRect>("ActionIcon"); _teammateName = _verticalContainer.GetNode <Label>("CenterContainer/TeammateName"); _teammateButton.TextureNormal = usedTexture; var teammateButtonSize = _teammateButton.TextureNormal.GetSize(); this.RectMinSize = _teammateButton.TextureNormal.GetSize(); _teammateName.Text = teammate.Name; _actionIcon.Texture = teammate.IsAddedToTeam ? actionIcon : actionIcon; var actionIconSize = _actionIcon.Texture.GetSize(); _actionIcon.SetPosition(new Vector2(teammateButtonSize.x - actionIconSize.x, teammateButtonSize.y - actionIconSize.y)); _teammateButton.Connect("pressed", this, nameof(OnClick)); _verticalContainer.Set("custom_constants/separation", VerticalContainerSeparation); _teammateName.AddFontOverride("font", Font); if (LabelColor.HasValue) { _teammateName.AddColorOverride("font_color", LabelColor.Value); } }
public override void _Ready() { base._Ready(); _actionsBackground = GetNode <TextureRect>("ActionsBackground"); _actionsLabelsContainer = _actionsBackground.GetNode <VBoxContainer>("ActionsLabelsContainer"); _completedActionsLabel = _actionsLabelsContainer.GetNode <RichTextLabel>("CompletedActionsLabel"); _correctActionsLabel = _actionsLabelsContainer.GetNode <RichTextLabel>("CorrectActionsLabel"); var labelsFont = (DynamicFont)GD.Load($"{_resourcesPath}bebas_neue_actions.tres"); labelsFont.Size = 25; _completedActionsLabel.AddFontOverride("normal_font", labelsFont); _correctActionsLabel.AddFontOverride("normal_font", labelsFont); _actionsBackground.Texture = (Texture)GD.Load($"{_resourcesPath}time_background.png"); _actionsBackground.RectPosition = new Vector2(800, -10); _actionsLabelsContainer.RectPosition = new Vector2(70, 15); _actionsLabelsContainer.Set("custom_constants/separation", -2); _completedActionsLabel.RectMinSize = new Vector2(250, 30); _completedActionsLabel.BbcodeEnabled = true; _completedActionsLabel.ScrollActive = false; _correctActionsLabel.RectMinSize = new Vector2(250, 30); _correctActionsLabel.BbcodeEnabled = true; _correctActionsLabel.ScrollActive = false; }
public override void _Ready() { _margin = GetNode <MarginContainer>("MarginContainer"); _vBox = _margin.GetNode <VBoxContainer>("VBoxContainer"); _topHBox = _vBox.GetNode <HBoxContainer>("Top"); _nameMargin = _topHBox.GetNode <MarginContainer>("NameMargin"); _nameLabelMargin = _nameMargin.GetNode <MarginContainer>("NameLabelMargin"); _nameLabel = _nameLabelMargin.GetNode <Label>("Name"); _secondRowHBox = _vBox.GetNode <HBoxContainer>("SecondRow"); _itemMargin = _secondRowHBox.GetNode <MarginContainer>("ItemMargin"); _iconMargin = _itemMargin.GetNode <MarginContainer>("IconMargin"); _itemIcon = _iconMargin.GetNode <TextureRect>("ItemIcon"); _buttonMargin = _secondRowHBox.GetNode <MarginContainer>("ButtonMargin"); _equipButton = _buttonMargin.GetNode <TextureButton>("Equip"); _useButton = _buttonMargin.GetNode <TextureButton>("Use"); _damageValues = _vBox.GetNode <HBoxContainer>("DamageValues"); _quickVBox = _damageValues.GetNode <VBoxContainer>("Quick"); _quickDamageLabel = _quickVBox.GetNode <Label>("DamageValue"); _quickIconVBox = _quickVBox.GetNode <VBoxContainer>("IconVBoxContainer"); _quickTypeIcon = _quickIconVBox.GetNode <TextureRect>("TypeIcon"); _quickStatusIcon = _quickIconVBox.GetNode <TextureRect>("StatusIcon"); _quickStatusEffectChanceLabel = _quickIconVBox.GetNode <Label>("StatusEffectChance"); _heavyVBox = _damageValues.GetNode <VBoxContainer>("Heavy"); _heavyDamageLabel = _heavyVBox.GetNode <Label>("DamageValue"); _heavyIconVBox = _heavyVBox.GetNode <VBoxContainer>("IconVBoxContainer"); _heavyTypeIcon = _heavyIconVBox.GetNode <TextureRect>("TypeIcon"); _heavyStatusIcon = _heavyIconVBox.GetNode <TextureRect>("StatusIcon"); _heavyStatusEffectChanceLabel = _heavyIconVBox.GetNode <Label>("StatusEffectChance"); _counterVBox = _damageValues.GetNode <VBoxContainer>("Counter"); _counterDamageLabel = _counterVBox.GetNode <Label>("DamageValue"); _counterIconVBox = _counterVBox.GetNode <VBoxContainer>("IconVBoxContainer"); _counterTypeIcon = _counterIconVBox.GetNode <TextureRect>("TypeIcon"); _counterStatusIcon = _counterIconVBox.GetNode <TextureRect>("StatusIcon"); _counterStatusEffectChanceLabel = _counterIconVBox.GetNode <Label>("StatusEffectChance"); _healthGainedHBox = _vBox.GetNode <HBoxContainer>("HealthGainedHBox"); _healthGainedValueLabel = _healthGainedHBox.GetNode <Label>("HealthGainedValueLabel"); _confirmUsePopup = _margin.GetNode <MarginContainer>("ConfirmUsePopup"); _backButton = GetNode <TextureButton>("MarginContainer/VBoxContainer/Top/Back"); _yesButton = GetNode <TextureButton>( "MarginContainer/ConfirmUsePopup/TextMargin/VBoxContainer/HBoxContainer/Yes"); _noButton = GetNode <TextureButton>( "MarginContainer/ConfirmUsePopup/TextMargin/VBoxContainer/HBoxContainer/No"); _confirmUsePopup.Visible = false; }
public override void _EnterTree() { dock = (VBoxContainer)GD.Load <PackedScene>("res://addons/road_editor/CustomGridDock.tscn").Instance(); editDock = (VBoxContainer)GD.Load <PackedScene>("res://addons/road_editor/CustomEditRoadDock.tscn").Instance(); AddControlToContainer(CustomControlContainer.SpatialEditorSideLeft, dock); AddControlToContainer(CustomControlContainer.SpatialEditorSideLeft, editDock); var connectorPortScript = GD.Load <Script>("res://addons/road_editor/RoadConnectorPort.cs"); var connectorSideScript = GD.Load <Script>("res://addons/road_editor/RoadConnectorSide.cs"); var roadConnectorScript = GD.Load <Script>("res://addons/road_editor/RoadConnector.cs"); var script = GD.Load <Script>("res://addons/road_editor/RoadGridMap.cs"); var texture = GD.Load <Texture>("res://addons/road_editor/icons/road.png"); var texture_connector = GD.Load <Texture>("res://addons/road_editor/icons/grid.png"); var texture_point = GD.Load <Texture>("res://addons/road_editor/icons/point.png"); var texture_side = GD.Load <Texture>("res://addons/road_editor/icons/side.png"); dock.Visible = false; editDock.Visible = false; (editDock.GetNode("route_connector") as Button).Connect("pressed", this, "initConnector"); AddCustomType("RoadGrid", "Spatial", script, texture); AddCustomType("RoadConnectorPort", "ImmediateGeometry", connectorPortScript, texture_point); AddCustomType("RoadConnectorSide", "Spatial", connectorSideScript, texture_side); AddCustomType("RoadConnector", "Spatial", roadConnectorScript, texture_connector); }
public override void _Ready() { root_holder = GetNode <VBoxContainer>("root_holder"); GetViewport().Connect("size_changed", this, nameof(OnViewportResize)); root_holder.GetNode <Button>("start_button").Connect("pressed", this, nameof(OnPressed_start)); root_holder.GetNode <Button>("options_button").Connect("pressed", this, nameof(OnPressed_options)); root_holder.GetNode <Button>("about_button").Connect("pressed", this, nameof(OnPressed_about)); GetNode("about_popup").GetNode("about_holder").GetNode <Button>("close_button").Connect("pressed", this, nameof(OnPressed_about_close)); GetNode("about_popup").GetNode("about_holder").GetNode <RichTextLabel>("c_label").Connect("meta_clicked", this, nameof(OnLabel_url_clicked)); GetNode("options_popup").GetNode("options_holder").GetNode <Button>("close_button").Connect("pressed", this, nameof(OnPressed_options_close)); root_holder.RectMinSize = GetViewportRect().Size; ThemeDefaultHolder(root_holder); root_holder.GetNode <Label>("title").AddColorOverride("font_color", new Color(1, 1, 1)); ThemeButtons(GetNode <VBoxContainer>("root_holder")); }
public override void _Ready() { _teammateScene = (PackedScene)GD.Load("res://Controls/Teammate/TeammateControl.tscn"); GetCommonNodes(); _windowWrapper = GetNode <VBoxContainer>("WindowWrapper"); _verticalContainer = _windowWrapper.GetNode <VBoxContainer>("VerticalContainer"); _newTeammatesWrapper = _verticalContainer.GetNode <VBoxContainer>("NewTeammatesWrapper"); _sideScrollMarginContainer = _newTeammatesWrapper.GetNode <MarginContainer>("SideScrollMarginContainer"); _teammatesSideScrollControl = _sideScrollMarginContainer.GetNode <TeammatesSideScrollControl>("TeammatesSideScrollControl"); _marginContainer = _verticalContainer.GetNode <MarginContainer>("MarginContainer"); _addedTeammatesWrapper = _marginContainer.GetNode <VBoxContainer>("AddedTeammatesWrapper"); _teammatesHorizontalContainer = _addedTeammatesWrapper.GetNode <HBoxContainer>("TeammatesHorizontalContainer"); _newTeammatesLabel = _newTeammatesWrapper.GetNode <Label>("CenterContainer/NewTeammatesLabel"); _addedTeammatesLabel = _addedTeammatesWrapper.GetNode <Label>("AddedTeammatesLabel"); }
public override void _Ready() { _tween = GetNode <Tween>("Tween"); _popupDisappearDelayTimer = GetNode <Timer>("PopupDisappearDelay"); _background = GetNode <TextureRect>("Background"); _textMargin = GetNode <MarginContainer>("TextMargin"); _textVBox = _textMargin.GetNode <VBoxContainer>("VBoxContainer"); _itemNameLabel = _textVBox.GetNode <Label>("Name"); _damageMargin = _textVBox.GetNode <MarginContainer>("DamageMargin"); _damageValuesHBox = _damageMargin.GetNode <HBoxContainer>("DamageValues"); _quickDamageLabel = _damageValuesHBox.GetNode <Label>("QuickDamage"); _heavyDamageLabel = _damageValuesHBox.GetNode <Label>("HeavyDamage"); _counterDamageLabel = _damageValuesHBox.GetNode <Label>("CounterDamage"); _healthGainedMargin = _textVBox.GetNode <MarginContainer>("HealthGainedMargin"); _healthGainedLabel = _healthGainedMargin.GetNode <Label>("HealthGained"); }
private void removeServer(String name) { Node node = serverList.GetNode(name); if (node != null) { serverList.RemoveChild(node); } }
public override void _Ready() { _topButtons = GetNode <VBoxContainer>("TopButtons"); _botButtons = GetNode <VBoxContainer>("BottomButtons"); buttons.Add(_topButtons.GetNode("Play") as Button); buttons.Add(_topButtons.GetNode("Settings") as Button); buttons.Add(_botButtons.GetNode("About") as Button); buttons.Add(_botButtons.GetNode("Exit") as Button); for (int i = 0; i < buttons.Count; i++) { Button button = buttons[i]; button.Connect("button_down", this, "_onButtonPress", new Array(new[] { i })); Interface.ButtonGroup.Add(button); } }
public override void _EnterTree() { editDock = (VBoxContainer)GD.Load <PackedScene>("res://addons/mesh_lod/CustomEditMeshDock.tscn").Instance(); AddControlToContainer(CustomControlContainer.SpatialEditorSideLeft, editDock); var script = GD.Load <Script>("res://addons/mesh_lod/MeshLod.cs"); var texture = GD.Load <Texture>("res://addons/mesh_lod/icons/mesh.png"); editDock.Visible = false; (editDock.GetNode("create_lod") as Button).Connect("pressed", this, "createLod"); (editDock.GetNode("create_food_collision") as Button).Connect("pressed", this, "createCollisionFootsteps"); (editDock.GetNode("create_collision") as Button).Connect("pressed", this, "createCollision"); (editDock.GetNode("destroy_mesh") as Button).Connect("pressed", this, "destroyMesh"); (editDock.GetNode("redraw_mesh") as Button).Connect("pressed", this, "redrawMesh"); AddCustomType("MeshLod", "Spatial", script, texture); }
public override void _Ready() { if (instance == null) { instance = this; } else { instance.Dispose(); instance = this; } if (Vars.PersistentData.isMobile) { RectPosition = new Vector2(9, 0); } content = GetNode("MarginContainer").GetNode <VBoxContainer>("Content"); messageScrollerBox = content.GetNode <ScrollContainer>("Messages"); messageBox = messageScrollerBox.GetNode <VBoxContainer>("MessageContainer"); senderBox = content.GetNode <HBoxContainer>("Sender"); chatMessage = messageBox.GetNode <RichTextLabel>("ChatMessage"); button = senderBox.GetNode <Button>("Button"); _lineEdit = senderBox.GetNode <LineEdit>("LineEdit"); _lineEdit.Connect("focus_entered", this, "_onSenderBoxFocusEnter"); _lineEdit.Connect("focus_exited", this, "_onFocusLost"); _lineEdit.Connect("text_changed", this, "_onTextChanged"); _lineEdit.custom_behaviour = true; rnd = new RandomNumberGenerator(); chatMessage.Visible = false; senderBox.Modulate = new Color(0, 0, 0, 0); button.Connect("pressed", this, "SendPressed"); messageScrollerBox.GetVScrollbar().Modulate = new Color(0, 0, 0, 0); }
public override void _Ready() { globals = GetTree().Root.GetNode("Globals") as Globals; titleScreen = GetNode <VBoxContainer>("Title Screen"); mainMenu = titleScreen.GetNode <VBoxContainer>("Main Menu"); play = mainMenu.GetNode <TextureButton>("Play"); menu = mainMenu.GetNode <TextureButton>("Menu"); exit = mainMenu.GetNode <TextureButton>("Exit"); optionsMenu = titleScreen.GetNode <VBoxContainer>("Options Menu"); bgm = optionsMenu.GetNode <HBoxContainer>("Music").GetNode <HSlider>("Slider"); playerSfx = optionsMenu.GetNode <HBoxContainer>("Player SFX").GetNode <HSlider>("Slider"); enemySfx = optionsMenu.GetNode <HBoxContainer>("Enemy SFX").GetNode <HSlider>("Slider"); optionsMenu.Hide(); play.Connect("pressed", this, "_OnPlayPressed"); menu.Connect("pressed", this, "_OnMenuPressed"); exit.Connect("pressed", this, "_OnExitPressed"); bgm.Connect("value_changed", this, "_OnBgmDbChanged"); playerSfx.Connect("value_changed", this, "_OnPlayerSfxDbChanged"); enemySfx.Connect("value_changed", this, "_OnEnemySfxDbChanged"); bgm.Value = globals.MusicDb; playerSfx.Value = globals.PlayerSfxDb; enemySfx.Value = globals.EnemySfxDb; bgm.MaxValue = 15f; bgm.Value = globals.MusicDb; bgm.MinValue = globals.minDb; playerSfx.MaxValue = 15; playerSfx.Value = globals.PlayerSfxDb; playerSfx.MinValue = globals.minDb; enemySfx.MaxValue = 15f; enemySfx.Value = globals.EnemySfxDb; enemySfx.MinValue = globals.minDb; }
public override void _Ready() { manager = (GameManager)GetNode("GameManager"); canvas = (CanvasLayer)GetNode("CanvasLayer"); menuBox = (VBoxContainer)canvas.GetNode("VBoxContainer"); levelsGrid = (GridContainer)canvas.GetNode("GridContainer"); playButton = (Button)menuBox.GetNode("ButtonPlayer"); if (manager.currentlevel != 0) { playButton.Text = "Continue"; } manager.updateData(); levelSelector = (LevelSelector)levelsGrid; levelSelector.EnableUpTo(manager.maxLevel); }
/// <summary> /// Initializes nodes common for all components. /// </summary> protected void GetCommonNodes() { _background = GetNode <Sprite>("Background"); _windowWrapper = GetNode <VBoxContainer>("WindowWrapper"); _title = _windowWrapper.GetNode <Label>("Title"); }
public override void Edit(Godot.Object @object) { selectionLodList.Clear(); selectionList.Clear(); if (@object != null && @object is MeshInstance) { meshLod = null; (editDock.GetNode("create_lod") as Button).Visible = true; (editDock.GetNode("create_food_collision") as Button).Visible = false; (editDock.GetNode("create_collision") as Button).Visible = false; (editDock.GetNode("destroy_mesh") as Button).Visible = false; (editDock.GetNode("redraw_mesh") as Button).Visible = false; (editDock.GetNode("destroy_mesh") as Button).Visible = false; (editDock.GetNode("redraw_mesh") as Button).Visible = false; (editDock.GetNode("lod2_quality") as Slider).Value = 0.7f; (editDock.GetNode("lod3_quality") as Slider).Value = 0.5f; if ((@object as MeshInstance).GetParent() is MeshLod) { mesh = null; editDock.Visible = false; } else { mesh = (MeshInstance)@object; editDock.Visible = true; } } else if (@object != null && @object is MeshLod) { mesh = null; editDock.Visible = true; meshLod = @object as MeshLod; (editDock.GetNode("create_lod") as Button).Visible = false; (editDock.GetNode("create_food_collision") as Button).Visible = true; (editDock.GetNode("create_collision") as Button).Visible = true; (editDock.GetNode("destroy_mesh") as Button).Visible = true; (editDock.GetNode("redraw_mesh") as Button).Visible = true; (editDock.GetNode("lod2_quality") as Slider).Value = meshLod.lod2Quality; (editDock.GetNode("lod3_quality") as Slider).Value = meshLod.lod3Quality; } else { mesh = null; meshLod = null; editDock.Visible = false; } }