Simple crosshair widget and material

This commit is contained in:
2022-05-22 15:49:28 +03:00
parent 5a19278808
commit ec8a749ef8
3 changed files with 121 additions and 4 deletions

Binary file not shown.

View File

@@ -47,13 +47,11 @@
"Transform": { "Transform": {
"Translation": { "Translation": {
"X": 1355.0, "X": 1355.0,
"Y": 791.0, "Y": 730.0,
"Z": 0.0 "Z": 0.0
} }
}, },
"Data": { "Data": {}
"Text": "15fps"
}
}, },
{ {
"ID": "35b34b0c4476f0ed43aa8fb4d5f2eebc", "ID": "35b34b0c4476f0ed43aa8fb4d5f2eebc",
@@ -64,6 +62,100 @@
"control": "ad0c546649722a6c7a6b9aa8fdcac019" "control": "ad0c546649722a6c7a6b9aa8fdcac019"
} }
}, },
{
"ID": "ebb8c92a4ff8ec3219a072b394accc0b",
"TypeName": "FlaxEngine.UIControl",
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
"Name": "SpeedWidget"
},
{
"ID": "9dc0648c43fc1553b23af188179c704f",
"TypeName": "Game.SpeedWidget",
"ParentID": "ebb8c92a4ff8ec3219a072b394accc0b",
"V": {}
},
{
"ID": "2fe5467d4e92726e24227cbcbcbd2844",
"TypeName": "FlaxEngine.UIControl",
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
"Name": "CrosshairWidget",
"Control": "FlaxEngine.GUI.Image",
"Data": {
"Brush": {
"$type": "FlaxEngine.GUI.MaterialBrush, FlaxEngine.CSharp",
"Material": "3f912eea48c6e2438fe49881210cb7d7"
},
"Margin": {
"Left": 0.0,
"Right": 0.0,
"Top": 0.0,
"Bottom": 0.0
},
"Color": {
"R": 1.0,
"G": 1.0,
"B": 1.0,
"A": 1.0
},
"MouseOverColor": {
"R": 1.0,
"G": 1.0,
"B": 1.0,
"A": 1.0
},
"DisabledTint": {
"R": 0.5019608,
"G": 0.5019608,
"B": 0.5019608,
"A": 1.0
},
"KeepAspectRatio": false,
"ClipChildren": true,
"CullChildren": true,
"AnchorMin": {
"X": 0.0,
"Y": 0.0
},
"AnchorMax": {
"X": 1.0,
"Y": 1.0
},
"Offsets": {
"Left": 0.0,
"Right": 0.0,
"Top": 0.0,
"Bottom": 0.0
},
"Scale": {
"X": 1.0,
"Y": 1.0
},
"Pivot": {
"X": 0.5,
"Y": 0.5
},
"Shear": {
"X": 0.0,
"Y": 0.0
},
"Rotation": 0.0,
"BackgroundColor": {
"R": 0.0,
"G": 0.0,
"B": 0.0,
"A": 0.0
},
"Enabled": true,
"Visible": true,
"AutoFocus": false
}
},
{
"ID": "e12c6b914501fde5098a14a350c2809c",
"TypeName": "Game.CrosshairWidget",
"ParentID": "2fe5467d4e92726e24227cbcbcbd2844",
"V": {}
},
{ {
"ID": "9b0c532d4247061970c809a0af58c82a", "ID": "9b0c532d4247061970c809a0af58c82a",
"TypeName": "FlaxEngine.PostFxVolume", "TypeName": "FlaxEngine.PostFxVolume",

View File

@@ -0,0 +1,25 @@
using System;
using System.Diagnostics;
using FlaxEngine;
using FlaxEngine.GUI;
namespace Game
{
public class CrosshairWidget : Script
{
private Image control;
public override void OnAwake()
{
var uiControl = Actor.As<UIControl>();
//control = new Image();
//uiControl.Control = control;
control = (Image)uiControl.Control;
}
public override void OnUpdate()
{
}
}
}