void clearTeamList() { for (int i = 0; i < teamsList.GetChildCount(); i++) { teamsList.GetChild(i).QueueFree(); } }
private void PopulateHistoryHelp(List <string> StringList, bool UseHelpText) { int HelpLabelsCount = HistoryHelpBox.GetChildCount(); int HelpCmdCount = StringList.Count; int i = 0; // Update existing controls for (; i < Mathf.Min(HelpLabelsCount, HelpCmdCount); ++i) { int StringIndex = HelpCmdCount - i - 1; Label HelpLabel = HistoryHelpBox.GetChild <Label>(i); HelpLabel.Text = UseHelpText ? MDCommands.GetHelpText(StringList[StringIndex]) : StringList[StringIndex]; HelpLabel.Visible = true; } // Create new ones as needed for (; i < HelpCmdCount; ++i) { int StringIndex = HelpCmdCount - i - 1; Label HelpLabel = new Label { Text = UseHelpText ? MDCommands.GetHelpText(StringList[StringIndex]) : StringList[StringIndex] }; HistoryHelpBox.AddChild(HelpLabel); } // Hide the extras for (; i < HelpLabelsCount; ++i) { Label HelpLabel = HistoryHelpBox.GetChild <Label>(i); HelpLabel.Visible = false; } }
public void updateMapData(int sizeMap, int[] terrain, int[] playerUnits) { GD.Print("GUI: updata map data"); maxPlayerOnMap = 0; players = new Player[8]; //panel LOBBY for (int i = 0; i < 8; i++) { Label lblChild = vbcPlayerUnitsCounts.GetChild(i) as Label; Button buP = vbcPlayerTypeChange.GetChild(i) as Button; if (playerUnits[i] > 0) { //data players[i] = new Player(i); players[i].playerType = (i == 0)? Player.TYPEPLAYER.LOCAL : Player.TYPEPLAYER.IA; //primero player local el resto IA players[i].playerteam = i; //free for all players[i].unitsCount = playerUnits[i]; //view lblChild.Text = (String.Format("P{0}.{1} Units:{2}", i, players[i].playerType, players[i].unitsCount)); lblChild.Visible = (true); buP.Visible = (true); //connect onclick if (!buP.IsConnected("pressed", this, "onClickChangeTypePlayer")) { Godot.Collections.Array gdArray = new Godot.Collections.Array(); gdArray.Add(i); buP.Connect("pressed", this, "onClickChangeTypePlayer", gdArray); } //multi maxPlayerOnMap++; } else { lblChild.Visible = (false); buP.Visible = (false); } } //datas terrain show view lblTerrainDataSize.Text = ("Map: " + sizeMap + " x " + sizeMap); vbcTerrainDatas.GetChild <Label>(0).Text = ("Deep Water: " + terrain[0]); vbcTerrainDatas.GetChild <Label>(1).Text = ("Water: " + terrain[1]); vbcTerrainDatas.GetChild <Label>(2).Text = ("Ground: " + terrain[2]); vbcTerrainDatas.GetChild <Label>(3).Text = ("Glass: " + terrain[3]); vbcTerrainDatas.GetChild <Label>(4).Text = ("Forest: " + terrain[4]); vbcTerrainDatas.GetChild <Label>(5).Text = ("Hill: " + terrain[5]); vbcTerrainDatas.GetChild <Label>(6).Text = ("Mountain: " + terrain[6]); vbcTerrainDatas.GetChild <Label>(7).Text = ("Top: " + terrain[7]); vbcTerrainDatas.GetChild <Label>(8).Text = ("River: " + terrain[8]); vbcTerrainDatas.GetChild <Label>(9).Text = ("Road: " + terrain[9]); vbcTerrainDatas.GetChild <Label>(10).Text = ("Building: " + terrain[10]); }
void onRefreshButtonPressed() { requestReloadingTeams(); for (int i = 0; i < teamsList.GetChildCount(); i++) { teamsList.GetChild(i).QueueFree(); } }
void updateTeamsData() { for (int i = 0; i < teamList.GetChildCount(); i++) { teamList.GetChild(i).QueueFree(); } List <Row> rows = getTeamsData(); foreach (Row row in rows) { generateTeamButton(row.Values[0]); } }
void onConfirmButtonPressed() { for (int i = 0; i < footballersList.GetChildCount(); i++) { if (footballersList.GetChild(i).GetType().Name == "FootballerFullInfoField") { FootballerFullInfoField field = (FootballerFullInfoField)footballersList.GetChild(i); if (field.IsChecked()) { handleConfirmSelection(field); } } } }
bool controlSchemeCorrectness() { for (int i = 0; i < schemesList.GetChildCount(); i++) { CheckBoxListItem field = (CheckBoxListItem)schemesList.GetChild(i); if (field.IsChecked()) { return(true); } } errorInfo.Text = ERROR_NO_SCHEMA_TEXT; return(false); }
void onChallengeAccepted(TeamChallengeField sender) { for (int i = 0; i < challengesList.GetChildCount(); i++) { TeamChallengeField field = (TeamChallengeField)challengesList.GetChild(i); if (field == sender) { RequestCaller.RequestChallengeAnswer(field.Team.TeamAlias, true); field.QueueFree(); } } GameData.CurrentOpponentTeam = sender.Team; paired = true; }
void clearFootballersList() { for (int i = 0; i < footballersList.GetChildCount(); i++) { footballersList.GetChild(i).QueueFree(); } }
void clearTournamentsList() { for (int i = 0; i < tournamentsList.GetChildCount(); i++) { tournamentsList.GetChild(i).QueueFree(); } }
void clearRoundSection() { for (int i = 0; i < itemsList.GetChildCount(); i++) { itemsList.GetChild(i).QueueFree(); } }
private void RemoveJoint(int index) { var child = jointList.GetChild(index); jointList.RemoveChild(child); child.Dispose(); }
void controlBuffer() { if (messagesList.GetChildCount() > MESSAGE_BUFFER_LENGTH) { messagesList.GetChild(0).QueueFree(); } }
void onScored(string scoringTeamAlias) { for (int i = 0; i < matchesList.GetChildCount(); i++) { MatchInfo match = (MatchInfo)matchesList.GetChild(i); if (match.Team1Alias == scoringTeamAlias) { match.AddScore(scoringTeamAlias); return; } if (match.Team2Alias == scoringTeamAlias) { match.AddScore(scoringTeamAlias); return; } } }
private void DescriptionValidation(string text) { if (GetParent <ScrollContainer>() == null) { return; } GetParent <ScrollContainer>().GetParent <Tabs>().Name = text; lineEditDescription.FocusNext = lineEditLengthBase.GetPath(); lineEditLengthBase.FocusNext = lineEditCutSize.GetPath(); lineEditCutSize.FocusNext = vBoxContainer.GetChild <Control>(0)?.GetPath(); lineEditLengthBase.GrabFocus(); lineEditLengthBase.SelectAll(); }
public override void _Input(InputEvent @event) { if (@event.IsActionReleased("ui_console")) { if (ConsoleVisible) { Window.Hide(); ConsoleVisible = false; } else { Window.Popup_(); ConsoleLine.CallDeferred("grab_focus"); ConsoleVisible = true; } } if (ConsoleVisible) { if (@event.IsActionPressed("ui_accept")) { Sys.Ref.Shared.GetNode <InterpreterSys>().ProcessScript(ConsoleLine.Text); ConsoleLine.Clear(); } if (@event.IsActionPressed("ui_autofill")) { if (Autofill.GetChildCount() != 0) { string Text = Autofill.GetChild <Node>(0).GetNode <Label>("Alias").Text; Text = Text.GetPartsFromBeginToIndex('(', 0) + '('; ConsoleLine.Text = Text; ConsoleLine.CaretPosition = Text.Length; } } } }
private void _LoadButtons() { _CreateButtons(); VBoxContainer container = GetNode <VBoxContainer>("ColorRect/VBoxContainer"); for (int i = 0; i < container.GetChildCount(); i += 1) { container.RemoveChild(container.GetChild(i)); } foreach (TextureButton button in _Buttons) { CenterContainer center = new CenterContainer(); center.AddChild(button); container.AddChild(center); } }
private List <Button> CreateButton(int count) { List <Button> buttons = new List <Button>(); var btn = buttonContainer.GetChild <Button>(0); buttons.Add(btn); for (int i = 1; i < count; i++) { var newBtn = btn.Duplicate() as Button; buttonContainer.AddChild(newBtn); buttons.Add(newBtn); } return(buttons); }
public override void _Ready() { Input.SetMouseMode(Input.MouseMode.Visible); Button addButton = GetNode("CenterContainer/VBoxContainer/ButtonBar/Add") as Button; Button backButton = GetNode("CenterContainer/VBoxContainer/ButtonBar/Back") as Button; serverList = GetNode("CenterContainer/VBoxContainer/Servers") as VBoxContainer; addServerPopup = GetNode("AddServerPopup") as PopupDialog; Button popupAddButton = GetNode("AddServerPopup/HBoxContainer/ButtonBar/Add") as Button; Button popupBackButton = GetNode("AddServerPopup/HBoxContainer/ButtonBar/Back") as Button; serverName = GetNode("AddServerPopup/HBoxContainer/Name") as LineEdit; serverAddress = GetNode("AddServerPopup/HBoxContainer/Address") as LineEdit; addButton?.Connect("pressed", this, nameof(onAdd)); backButton?.Connect("pressed", this, nameof(onBack)); popupAddButton?.Connect("pressed", this, nameof(onPopupAdd)); popupBackButton?.Connect("pressed", this, nameof(onPopupBack)); random = new RandomNumberGenerator(); random.Randomize(); // remove visual indicators we have in editor while (serverList?.GetChildCount() > 0) { Node child = serverList.GetChild(0); serverList.RemoveChild(child); child.QueueFree(); } // load servers from server manager foreach (Server server in SingletonHandler.instance.serverManager.getServers()) { addServer(server.name, server.host, server.port); } }
private void AddEntry(string Text, ConsoleColors TextColor) { if (ConsoleHistory.GetChildCount() >= ConsoleMaxLines) { ConsoleHistory.GetChild(0).QueueFree(); } Node ConsoleEntryNode = ConsoleEntry.Instance(); Label ConsoleEntryLabel = (Label)ConsoleEntryNode; switch (TextColor) { default: case ConsoleColors.Message: ConsoleEntryLabel.AddColorOverride("font_color", new Color(1.0f, 1.0f, 1.0f)); break; case ConsoleColors.Warning: ConsoleEntryLabel.AddColorOverride("font_color", new Color(0.988f, 0.91f, 0.012f)); break; case ConsoleColors.Error: ConsoleEntryLabel.AddColorOverride("font_color", new Color(0.988f, 0.012f, 0.012f)); break; } ConsoleEntryLabel.Text = Text; if (Sys.Ref.Shared.Contains <RCONSys>()) { Sys.Ref.Shared.GetNode <RCONSys>().Send(Text, TextColor); } ConsoleHistory.AddChild(ConsoleEntryLabel); CallDeferred(nameof(SetScrollbar)); }