private void BuildWidget() { HBox box = new HBox(); disk_bar_align = new Alignment(0.5f, 0.5f, 1.0f, 1.0f); disk_bar = new SegmentedBar(); disk_bar.ValueFormatter = DapValueFormatter; disk_bar.AddSegmentRgb(Catalog.GetString("Audio"), 0, 0x3465a4); disk_bar.AddSegmentRgb(Catalog.GetString("Video"), 0, 0x73d216); disk_bar.AddSegmentRgb(Catalog.GetString("Other"), 0, 0xf57900); disk_bar.AddSegment(Catalog.GetString("Free Space"), 0, disk_bar.RemainderColor, false); UpdateUsage(); disk_bar_align.Add(disk_bar); box.PackStart(disk_bar_align, true, true, 0); disk_bar_align.TopPadding = 6; Add(box); box.ShowAll(); SizeAllocated += delegate(object o, Gtk.SizeAllocatedArgs args) { SetBackground(); disk_bar.HorizontalPadding = (int)(args.Allocation.Width * 0.25); }; }
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); reportTabButton = GetNode <Button>(ReportTabButtonPath); patchMapButton = GetNode <Button>(PatchMapButtonPath); cellEditorButton = GetNode <Button>(CellEditorButtonPath); structureTab = GetNode <PanelContainer>(StructureTabPath); structureTabButton = GetNode <Button>(StructureTabButtonPath); appearanceTab = GetNode <PanelContainer>(ApperanceTabPath); appearanceTabButton = GetNode <Button>(AppearanceTabButtonPath); statisticsPanel = GetNode <PanelContainer>(OrganismStatisticsPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); hpLabel = GetNode <Label>(HpLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <ProgressBar>(MutationPointsBarPath); mutationPointsSubtractBar = GetNode <ProgressBar>(MutationPointsSubtractBarPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); menuButton = GetNode <TextureButton>(MenuButtonPath); helpButton = GetNode <TextureButton>(HelpButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionLabel = GetNode <Label>(ATPProductionLabelPath); atpConsumptionLabel = GetNode <Label>(ATPConsumptionLabelPath); atpProductionBar = GetNode <SegmentedBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <SegmentedBar>(ATPConsumptionBarPath); timeIndicator = GetNode <Label>(TimeIndicatorPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchDepth = GetNode <Label>(PatchDepthPath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesListBox = GetNode <CollapsibleList>(SpeciesCollapsibleBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); speedIndicator = GetNode <TextureRect>(SpeedIndicatorPath); hpIndicator = GetNode <TextureRect>(HpIndicatorPath); sizeIndicator = GetNode <TextureRect>(SizeIndicatorPath); negativeAtpPopup = GetNode <ConfirmationDialog>(NegativeAtpPopupPath); islandPopup = GetNode <AcceptDialog>(IslandErrorPath); menu = GetNode <PauseMenu>(MenuPath); mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); }; atpProductionBar.SelectedType = SegmentedBar.Type.ATP; atpProductionBar.IsProduction = true; atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP; RegisterTooltips(); }
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); itemTooltipElements = GetTree().GetNodesInGroup("ItemTooltip"); menu = GetNode <Control>(MenuPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <TextureProgress>(MutationPointsBarPath); mutationPointsSubtractBar = GetNode <TextureProgress>(MutationPointsSubtractBarPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionBar = GetNode <SegmentedBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <SegmentedBar>(ATPConsumptionBarPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchDepth = GetNode <Label>(PatchDepthPath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesList = GetNode <VBoxContainer>(SpeciesListPath); physicalConditionsBox = GetNode <Control>(PhysicalConditionsBoxPath); atmosphericConditionsBox = GetNode <Control>(AtmosphericConditionsBoxPath); compoundsBox = GetNode <Control>(CompoundsBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); physicalConditionsButton = GetNode <Control>(PhysicalConditionsButtonPath); atmosphericConditionsButton = GetNode <Control>(AtmosphericConditionsButtonPath); compoundsButton = GetNode <Control>(CompoundsBoxButtonPath); speciesListButton = GetNode <Control>(SpeciesListButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); invalidBarTexture = GD.Load <Texture>("res://assets/textures/gui/bevel/MpBarInvalid.png"); subractBarTexture = GD.Load <Texture>("res://assets/textures/gui/bevel/MpBarSubtract.png"); mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); }; atpProductionBar.SelectedType = SegmentedBar.Type.ATP; atpProductionBar.IsProduction = true; atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP; // Fade out for that smooth satisfying transition TransitionManager.Instance.AddScreenFade(Fade.FadeType.FadeOut, 0.5f); TransitionManager.Instance.StartTransitions(null, string.Empty); }
void Start(){ SegmentedBar[] bars = gameObject.GetComponentsInChildren<SegmentedBar>(); hpBar = bars[0]; // change this when more bars are implemented }