示例#1
0
 public override void _Ready()
 {
     UnitPic        = GetNode("UnitIcon") as TextureRect;
     HPBar          = GetNode("HealthBar") as ProgressBar;
     APLabel        = GetNode("ActionLabel") as Label;
     SelectionLabel = GetNode("SelectionLabel") as Label;
 }
示例#2
0
    public void DeductLife()
    {
        int         index       = GetLife() - 1;
        TextureRect textureLife = (TextureRect)GetChild(index);

        textureLife.Visible = false;
    }
示例#3
0
    public void AddLife()
    {
        int         index       = GetLife();
        TextureRect textureLife = (TextureRect)GetChild(index);

        textureLife.Visible = true;
    }
        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;
        }
        protected override void Initialize()
        {
            base.Initialize();
            IoCManager.InjectDependencies(this);
            Placement = (PlacementManager)IoCManager.Resolve <IPlacementManager>();
            Placement.PlacementCanceled += OnPlacementCanceled;

            HideOnClose = true;
            Title       = "Construction";
            Visible     = false;
            var split     = Contents.GetChild("HSplitContainer");
            var rightSide = split.GetChild("Guide");
            var info      = rightSide.GetChild("Info");

            InfoIcon  = info.GetChild <TextureRect>("TextureRect");
            InfoLabel = info.GetChild <Label>("Label");
            StepList  = rightSide.GetChild <ItemList>("StepsList");
            var buttons = rightSide.GetChild("Buttons");

            BuildButton            = buttons.GetChild <Button>("BuildButton");
            BuildButton.OnPressed += OnBuildPressed;
            EraseButton            = buttons.GetChild <Button>("EraseButton");
            EraseButton.OnToggled += OnEraseToggled;

            var leftSide = split.GetChild("Recipes");

            SearchBar = leftSide.GetChild <LineEdit>("Search");
            SearchBar.OnTextChanged += OnTextEntered;
            RecipeList = leftSide.GetChild <Tree>("Tree");
            RecipeList.OnItemSelected += OnItemSelected;

            PopulatePrototypeList();
            PopulateTree();
        }
示例#6
0
文件: UI.cs 项目: AnotherGuy7/Colony
    private void UpdateInventoryDrawings()
    {
        for (int i = 0; i < GameData.MaxInventorySlots; i++)
        {
            Item        item                = GameData.playerInventory[i];
            TextureRect currentSlot         = inventorySlots[i];
            TextureRect currentSlotItemRect = (TextureRect)inventorySlots[i].GetNode(inventorySlots[i].GetPath() + "/ItemTexture");
            Label       currentSlotStack    = (Label)inventorySlots[i].GetNode(inventorySlots[i].GetPath() + "/ItemStack");
            currentSlotItemRect.RectScale = new Vector2(40f, 40f) / item.sprite.GetSize();
            currentSlotItemRect.Texture   = item.sprite;

            if (item.stack > 1)
            {
                currentSlotStack.Text = item.stack.ToString();
            }
            else
            {
                currentSlotStack.Text = "";
            }

            if (i == GameData.selectedInventorySlot)
            {
                currentSlot.Texture = activeSlot;
            }
            else
            {
                currentSlot.Texture = inactiveSlot;
            }
        }
    }
示例#7
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            var textureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            var textureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            var textureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");
            var storageTexture    = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png");

            _rightStatusPanel = new ItemStatusPanel(true);
            _leftStatusPanel  = new ItemStatusPanel(false);

            _leftButton  = new ItemSlotButton(textureHandLeft, storageTexture);
            _rightButton = new ItemSlotButton(textureHandRight, storageTexture);
            var hBox = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           = { _rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel }
            };

            AddChild(hBox);

            _leftButton.OnPressed         += args => HandKeyBindDown(args, HandNameLeft);
            _leftButton.OnStoragePressed  += args => _OnStoragePressed(args, HandNameLeft);
            _rightButton.OnPressed        += args => HandKeyBindDown(args, HandNameRight);
            _rightButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameRight);

            // Active hand
            _leftButton.AddChild(ActiveHandRect = new TextureRect
            {
                Texture      = textureHandActive,
                TextureScale = (2, 2)
            });
示例#8
0
    /// <summary>
    ///   Setup the main menu.
    /// </summary>
    private void RunMenuSetup()
    {
        Background = GetNode <TextureRect>("Background");
        thriveLogo = GetNode <TextureRect>(ThriveLogoPath);

        if (MenuArray != null)
        {
            MenuArray.Clear();
        }

        // Get all of menu items
        MenuArray = GetTree().GetNodesInGroup("MenuItem");

        if (MenuArray == null)
        {
            GD.PrintErr("Failed to find all the menu items!");
            return;
        }

        RandomizeBackground();

        options = GetNode <OptionsMenu>("OptionsMenu");

        // Load settings
        options.SetSettingsFrom(Settings.Instance);

        // Set initial menu to the current menu index
        SetCurrentMenu(CurrentMenuIndex, false);
    }
示例#9
0
    //<document>
    //	<Description>	Calculate mesh data: vertices, triangles, uv
    //	<Note>			This chunk was filled
    //</document>
    void AddMeshProperites(int chunkIndex, int blockType, int index)
    {
        lock (this.vertices) {
            lock (this.triangles) {
                lock (this.uv0) {
                    int count = this.vertices.Count;

                    //Add vertices
                    for (int i = 0; i < 4; i++)
                    {
                        this.vertices.Add(VoxelEngine.Instance.chunkLocalPosition[chunkIndex + VoxelEngine.Instance.trianglesIndex1[index][i]]);
                    }

                    //Add triangles
                    this.triangles.Add(count + 1);
                    this.triangles.Add(count);
                    this.triangles.Add(count + 2);
                    this.triangles.Add(count + 1);
                    this.triangles.Add(count + 2);
                    this.triangles.Add(count + 3);

                    //Add uv
                    TextureRect _temp = ChunkMetaData.Instance.textureLoader.GetBlockTexture(blockType - 1, index);
                    this.uv0.Add(_temp.bottomLeft);
                    this.uv0.Add(_temp.bottomRight);
                    this.uv0.Add(_temp.topLeft);
                    this.uv0.Add(_temp.topRight);
                }
            }
        }
    }
示例#10
0
        protected override void DrawStyle(Style style, float opacity)
        {
            base.DrawStyle(style, opacity);

            var texture = Gui.Renderer.GetTexture(Texture);

            if (texture < 0)
            {
                return;
            }

            if (ColorByTint)
            {
                Color = style.Tint;
            }

            var color = Color;

            if (Tint != -1)
            {
                color = ColorInt.Blend(Tint, color);
            }

            color = ColorInt.FromArgb(opacity, color);

            if (TextureRect.IsEmpty())
            {
                var texsize = Gui.Renderer.GetTextureSize(texture);
                TextureRect = new Rectangle(Point.Zero, texsize);
            }

            //bool atlas = SpriteBatch.AutoAtlas;

            //if (ExcludeFromAtlas)
            //    SpriteBatch.AutoAtlas = false;

            if (Tiling == TextureMode.Grid || Tiling == TextureMode.GridRepeat)
            {
                SliceTexture(texture, Tiling, TextureRect, Grid, opacity, color);
            }
            else if (Tiling == TextureMode.Stretch)
            {
                Gui.Renderer.DrawTexture(texture, Location.X + Inset.Left, Location.Y + Inset.Top, Size.X - (Inset.Left + Inset.Right), Size.Y - (Inset.Top + Inset.Bottom), TextureRect, color);
            }
            else if (Tiling == TextureMode.Center)
            {
                var center   = Location + Size / 2;
                var rectsize = new Point(TextureRect.Width, TextureRect.Height);
                var pos      = center - rectsize / 2;

                Gui.Renderer.DrawTexture(texture, pos.X, pos.Y, rectsize.X, rectsize.Y, TextureRect, color);
            }
            else
            {
                RepeatTexture(texture, Location, TextureRect, Tiling, opacity, color);
            }

            //if (ExcludeFromAtlas)
            //    SpriteBatch.AutoAtlas = atlas;
        }
示例#11
0
        public override void _Ready()
        {
            base._Ready();

            _totalActionsBackground   = GetNode <TextureRect>("TotalActionsBackground");
            _totalActionsLabel        = _totalActionsBackground.GetNode <RichTextLabel>("TotalActionsLabel");
            _correctActionsBackground = GetNode <TextureRect>("CorrectActionsBackground");
            _correctActionsMarker     = _correctActionsBackground.GetNode <TextureRect>("CorrectActionsMarker");

            _totalActionsBackground.Texture      = (Texture)GD.Load($"{_resourcesPath}time_background.png");
            _totalActionsBackground.RectPosition = new Vector2(600, -10);

            _correctActionsBackground.Texture      = (Texture)GD.Load($"{_qualityHudResourcesPath}correct_actions_background.png");
            _correctActionsBackground.RectPosition = new Vector2(835, -10);

            _correctActionsMarker.Texture         = (Texture)GD.Load($"{_qualityHudResourcesPath}correct_actions_marker.png");
            _correctActionsMarker.RectPivotOffset = new Vector2(10, 49);
            _correctActionsMarker.RectPosition    = new Vector2(133, 17);
            _correctActionsMarker.RectRotation    = -75;

            var labelFont = (DynamicFont)GD.Load($"{_resourcesPath}bebas_neue_actions.tres");

            labelFont.Size = 24;

            _totalActionsLabel.RectPosition = new Vector2(70, 28);
            _totalActionsLabel.RectMinSize  = new Vector2(350, 30);
            _totalActionsLabel.AddFontOverride("normal_font", labelFont);
            _totalActionsLabel.BbcodeEnabled = true;
            _totalActionsLabel.ScrollActive  = false;

            _popupPackedScene = (PackedScene)GD.Load($"res://Scenes/HUD/Gamified/GamifiedTaskCompletedPopup.tscn");
        }
示例#12
0
    private void Set(TextureRect tr, TextureRect btr, float p)
    {
        float   max     = btr.GetRect().Size.x;
        Vector2 newSize = new  Vector2(max * p, tr.GetRect().Size.y);

        tr.SetSize(newSize);
    }
示例#13
0
 public State(Menu menu, StateMachine stateMachine)
 {
     _menu         = menu;
     _stateMachine = stateMachine;
     _menuPanel    = _menu.GetNode <TextureRect>("MenuPanel");
     _store        = _menu.GetNode <Strore>("Strore");
 }
示例#14
0
    public override void _Ready()
    {
        image      = GetNode(nameof(image)) as TextureRect;
        albumList  = GetNode(nameof(albumList)) as ScrollList;
        spriteList = GetNode(nameof(spriteList)) as ItemList;
        spriteList.Connect("item_selected", this, nameof(setImage));

        albumList.Init(() =>
        {
            var btn = new Button()
            {
                Align = Button.TextAlign.Left
            };
            var btnbase            = new ButtonBase <Button>(btn);
            btnbase.onButtonClick += _selectAlbum;
            buttons.Add(btnbase);
            return(btn);
        }, (_c, _i, _t) =>
        {
            (_c as Button).Text     = npkKeys[_i];
            buttons[_t].Id          = _i;
            buttons[_t].VId         = _t;
            _c.Name                 = _i.ToString();
            buttons[_t].target.Flat = _i == selectAlbum;
        }, new Vector2(0, 24));

        ResourceManager.Instance.Connect(nameof(ResourceManager.load_npk_header_), this, nameof(_show_npk_list));
    }
示例#15
0
文件: UI.cs 项目: AnotherGuy7/Colony
    private void UpdateQuestListings()
    {
        Label       questName        = questPanel.GetNode("QuestName") as Label;
        Label       questDescription = questPanel.GetNode("QuestDescription") as Label;
        Label       questProvider    = questPanel.GetNode("QuestProvider") as Label;
        Label       questProgress    = questPanel.GetNode("QuestProgress") as Label;
        TextureRect questIcon        = questPanel.GetNode("Icon") as TextureRect;

        if (GameData.activeQuests[questIndex].questName != "None")
        {
            questName.Text        = GameData.activeQuests[questIndex].questName;
            questDescription.Text = GameData.activeQuests[questIndex].questDescription;
            questIcon.Texture     = GameData.activeQuests[questIndex].iconSprite;
            questProvider.Text    = "Provider: " + GameData.activeQuests[questIndex].askerName;
            questProgress.Text    = "Progress: " + GameData.activeQuests[questIndex].progress + " / " + GameData.activeQuests[questIndex].maxProgress;
            if (GameData.activeQuests[questIndex].progress >= GameData.activeQuests[questIndex].maxProgress)
            {
                questProgress.Text = "Progress: Completed";
            }
        }
        else
        {
            questName.Text        = "None";
            questDescription.Text = "No quest occupies this slot. Go talk to someone and start a quest!";
            questIcon.Texture     = GameData.activeQuests[questIndex].iconSprite;
            questProvider.Text    = "Provider: None";
            questProgress.Text    = "Progress: None";
        }
    }
示例#16
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     buildButton = GetNode <Button>("BuildButton");
     label       = GetNode <Label>("Label");
     buildSound  = GetNode <AudioStreamPlayer2D>("BuildSound");
     range       = GetNode <TextureRect>("Range");
 }
示例#17
0
    /// <summary>
    ///   Setup the main menu.
    /// </summary>
    private void RunMenuSetup()
    {
        Background      = GetNode <TextureRect>("Background");
        guiAnimations   = GetNode <AnimationPlayer>("GUIAnimations");
        thriveLogo      = GetNode <TextureRect>(ThriveLogoPath);
        newGameButton   = GetNode <Button>(NewGameButtonPath);
        freebuildButton = GetNode <Button>(FreebuildButtonPath);

        MenuArray?.Clear();

        // Get all of menu items
        MenuArray = GetTree().GetNodesInGroup("MenuItem");

        if (MenuArray == null)
        {
            GD.PrintErr("Failed to find all the menu items!");
            return;
        }

        RandomizeBackground();

        options = GetNode <OptionsMenu>("OptionsMenu");
        saves   = GetNode <SaveManagerGUI>("SaveManagerGUI");

        // Load settings
        if (Settings.Instance == null)
        {
            GD.PrintErr("Failed to initialize settings.");
        }

        // Set initial menu
        SwitchMenu();
    }
示例#18
0
        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()
        {
            _animationTree = GetNode <AnimationTree>("AnimationTree");
            _playerModel   = GetNode <Spatial>("PlayerModel");
            _shootFrom     = _playerModel.GetNode <Position3D>(@"Robot_Skeleton/Skeleton/GunBone/ShootFrom");
            _colorRect     = GetNode <ColorRect>("ColorRect");
            _crosshair     = GetNode <TextureRect>("Crosshair");
            _fireCooldown  = GetNode <Timer>("FireCooldown");

            _cameraBase      = GetNode <Spatial>("CameraBase");
            _cameraAnimation = _cameraBase.GetNode <AnimationPlayer>(@"Animation");
            _cameraRot       = _cameraBase.GetNode <Spatial>(@"CameraRot");
            _cameraSpringArm = _cameraRot.GetNode <SpringArm>(@"SpringArm");
            _cameraCamera    = _cameraSpringArm.GetNode <CameraNoiseShakeEffect>(@"Camera");

            _soundEffects     = GetNode <Node>("SoundEffects");
            _soundEffectJump  = _soundEffects.GetNode <AudioStreamPlayer>(@"Jump");
            _soundEffectLand  = _soundEffects.GetNode <AudioStreamPlayer>(@"Land");
            _soundEffectShoot = _soundEffects.GetNode <AudioStreamPlayer>(@"Shoot");

            _initialPosition = Transform.origin;
            _gravity         =
                Convert.ToSingle(ProjectSettings.GetSetting("physics/3d/default_gravity")) *
                (Vector3)ProjectSettings.GetSetting("physics/3d/default_gravity_vector");

            // Pre-initialize orientation transform.
            _orientation        = _playerModel.GlobalTransform;
            _orientation.origin = new Vector3();
        }
示例#20
0
 public override void _Ready()
 {
     // public Message() {
     theirAvatar = ((TextureRect)GetNode("TheirAvatar"));
     myAvatar    = ((TextureRect)GetNode("MyAvatar"));
     text        = ((Label)GetNode("Label"));
 }
示例#21
0
    public override void _EnterTree()
    {
        printer3D = (Printer3D)building;

        buildingSelector = GetNode <ItemList>("back/BuildingList");

        imageDesc       = GetNode <TextureRect>("back/BuildingDescription/ImageBuilding/TextureRect");
        titleDesc       = GetNode <Label>("back/BuildingDescription/Description/HBox/Title");
        timeDesc        = GetNode <Label>("back/BuildingDescription/Description/HBox/VBox/Time");
        energyDesc      = GetNode <Label>("back/BuildingDescription/Description/HBox/VBox/Energy");
        descriptionDesc = GetNode <Label>("back/BuildingDescription/Description/Description");
        itemListDesc    = GetNode <Control>("back/BuildingDescription/Description/Items");

        btnPrint = GetNode <Button>("back/BuildingDescription/BtnPrint");

        btnPause    = GetNode <Button>("back/VBox/HBox/BtnPause");
        btnCancel   = GetNode <Button>("back/VBox/HBox/BtnCancel");
        btnClaim    = GetNode <Button>("back/VBox/HBox/BtnClaim");
        progressBar = GetNode <ProgressBar>("back/VBox/Progress");
        stateLabel  = GetNode <Label>("back/VBox/HBox/State");

        InitBuildingSelector();
        _on_BuildingList_item_selected(0);
        RefreshBtns();
    }
示例#22
0
    public override void _Ready()
    {
        uploadDialog = GetNode <CustomConfirmationDialog>(UploadDialogPath);

        modSelect = GetNode <OptionButton>(ModSelectPath);

        unknownItemActions   = GetNode <Control>(UnknownItemActionsPath);
        createNewButton      = GetNode <Button>(CreateNewButtonPath);
        showManualEnterId    = GetNode <Button>(ShowManualEnterIdPath);
        manualIdEntry        = GetNode <LineEdit>(ManualIdEntryPath);
        acceptManualId       = GetNode <Button>(AcceptManualIdPath);
        manualEnterIdSection = GetNode <Control>(ManualEnterIdSectionPath);

        detailsEditor               = GetNode <Control>(DetailsEditorPath);
        editedTitle                 = GetNode <LineEdit>(EditedTitlePath);
        editedDescription           = GetNode <TextEdit>(EditedDescriptionPath);
        editedVisibility            = GetNode <CheckBox>(EditedVisibilityPath);
        editedTags                  = GetNode <LineEdit>(EditedTagsPath);
        previewImageRect            = GetNode <TextureRect>(PreviewImageRectPath);
        toBeUploadedContentLocation = GetNode <Label>(ToBeUploadedContentLocationPath);
        changeNotes                 = GetNode <TextEdit>(ChangeNotesPath);

        workshopNotice = GetNode <CustomRichTextLabel>(WorkshopNoticePath);
        errorDisplay   = GetNode <Label>(ErrorDisplayPath);

        uploadSucceededDialog = GetNode <CustomDialog>(UploadSucceededDialogPath);
        uploadSucceededText   = GetNode <CustomRichTextLabel>(UploadSucceededTextPath);

        fileSelectDialog = GetNode <FileDialog>(FileSelectDialogPath);

        fileSelectDialog.Filters = SteamHandler.RecommendedFileEndings.Select(e => "*" + e).ToArray();

        UpdateWorkshopNoticeTexts();
    }
示例#23
0
        public override void _Ready()
        {
            var size = GetViewportRect().Size;

            viewport = new Viewport()
            {
                Size  = size,
                Usage = Viewport.UsageEnum.Usage2d,
                RenderTargetUpdateMode = Viewport.UpdateMode.Always,
                RenderTargetClearMode  = Viewport.ClearMode.OnlyNextFrame,
                RenderTargetVFlip      = true
            };
            AddChild(viewport);

            pen = new Node2D();
            pen.Connect("draw", this, nameof(OnPenDraw));
            viewport.AddChild(pen);

            var texture = viewport.GetTexture();

            board = new TextureRect()
            {
                AnchorBottom = 1.0f,
                AnchorRight  = 1.0f,
                Texture      = texture
            };
            AddChild(board);

            // First clear on ready
            QueueClearDrawing(clearColor);
        }
示例#24
0
    public override void _Ready()
    {
        base._Ready();

        functionalBar = (TextureRect)GetNode("Bar/FunctionalBar");
        text          = (Label)GetNode("Text");
    }
示例#25
0
        public void ChangeMode(string Mode)
        {
            string[] Modes = { "Draft", "Attack", "Fortify" };

            Texture Active = ResourceLoader.Load("res://Images/GameUI/Layer.png") as Texture;
            Texture None   = ResourceLoader.Load("res://Images/GameUI/Layer2.png") as Texture;

            RichTextLabel modeTextLabel = GetNode("OnReady/Mode") as RichTextLabel;

            modeTextLabel.Text = Mode;



            foreach (string mode in Modes)
            {
                TextureRect ModeMarker = GetNode($"OnReady/{mode}Marker") as TextureRect;
                if (mode == Mode)
                {
                    ModeMarker.SetTexture(Active);
                }

                else
                {
                    ModeMarker.SetTexture(None);
                }
            }
        }
示例#26
0
    public override void _Ready()
    {
        var statusUpdate = GetTree().GetNodesInGroup("PlayerStatusUpdate");

        currentPortrait   = (TextureRect)statusUpdate[0];
        currentSprite     = (TextureRect)statusUpdate[1];
        currentStatOutput = (RichTextLabel)statusUpdate[2];

        var buttons = GetTree().GetNodesInGroup("CharGenButtons");

        steps    = new CharGenStep[4];
        steps[0] = new CharGenStep(0, (Button)buttons[0]);          //Name
        steps[1] = new CharGenStep(1, (Button)buttons[1]);          //Attributes
        steps[2] = new CharGenStep(2, (Button)buttons[2]);          //Special Abilities
        steps[3] = new CharGenStep(3, (Button)buttons[3]);          //Customization

        saveCharacterButton = (Button)buttons[4];
        previousStepButton  = (Button)buttons[5];
        nextStepButton      = (Button)buttons[6];

        var nd = Owner.GetNode("CenterContainer").GetNode("NameDialog");

        nameDialog = (AcceptDialog)nd;
        SetNameDialogVisible(true);
    }
示例#27
0
        /// <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);
            }
        }
示例#28
0
    public override void _Ready()
    {
        Health               = GetNode <Range>(HealthPath);
        Ammo                 = GetNode <Range>(AmmoPath);
        ArmTextureRect       = GetNode <TextureRect>("Arms");
        HighlightTextureRect = GetNode <TextureRect>("Highlights");
        ArmViewport          = GetNode <Viewport>(ArmViewportPath);
        HighlightViewport    = GetNode <Viewport>(HighlightViewportPath);

        //Setup viewport textures
        ViewportTexture armTexture       = (ViewportTexture)ArmTextureRect.Texture;
        ViewportTexture highlightTexture = (ViewportTexture)HighlightTextureRect.Texture;

        armTexture.ViewportPath       = ArmViewportPath;
        highlightTexture.ViewportPath = HighlightViewportPath;
        armTexture.Flags = (int)Texture.FlagsEnum.Filter;
        HealthBarTween   = new Tween();
        ArmFlashTween    = new Tween();
        ArmFlashTween.Connect("tween_completed", this, "_OnArmFlashTweenCompleted");
        AddChild(HealthBarTween);
        AddChild(ArmFlashTween);
        if (ArmViewport != null)
        {
            Connect("resized", this, "_OnResized");
        }
    }
示例#29
0
 public override void _Ready()
 {
     loginWindow = (TextureRect)GetNode("LoginWindow");
     username    = (LineEdit)loginWindow.GetNode("Username");
     password    = (LineEdit)loginWindow.GetNode("Password");
     loginWindow.Hide();
 }
示例#30
0
    public void AddItem(Item item)
    {
        var      itemContainer = GetNode("Side/Items/ItemScroller/ItemPanel/ItemContainer");
        ItemNode itemNode      = (ItemNode)itemScene.Instance();

        itemNode.item = item;
        TextureRect itemSprite = (TextureRect)itemNode.GetNode("ItemBox/ItemLabel/Sprite");
        var         spriteName = item.GetSprite();

        if (sprites.ContainsKey(spriteName))
        {
            itemSprite.SetTexture(sprites[spriteName]);
        }
        else
        {
            itemSprite.SetTexture(sprites["unknown"]);
        }
        Label itemName = (Label)itemNode.GetNode("ItemBox/ItemLabel/Name");

        itemName.SetText(item.GetName());
        Label itemQuantity = (Label)itemNode.GetNode("ItemBox/ItemLabel/Amount");

        itemQuantity.SetText("x" + item.GetQuantity());
        itemContainer.AddChild(itemNode);
    }
示例#31
0
 /// <summary>
 ///  Draw the texture inside cuttingRectangle in the panelTextureCollector.
 /// </summary>
 private void DrawTexture()
 {
     textureRect = new TextureRect(selectedImage, cuttingRectangle, new Point(recPositionX, recPositionY));
     textureClips.Add(textureRect);
     panelTextureCollector.Refresh();
 }