Fixed Button texture swapping. Fixed Button scripts on scene change. Added buttons to scenes. Added SHEDITOR define for Managed #341
|
@ -1,16 +1,16 @@
|
|||
[Window][MainStatusBar]
|
||||
Pos=0,981
|
||||
Size=1920,20
|
||||
Pos=0,989
|
||||
Size=2560,20
|
||||
Collapsed=0
|
||||
|
||||
[Window][SHEditorMenuBar]
|
||||
Pos=0,48
|
||||
Size=1920,933
|
||||
Size=2560,941
|
||||
Collapsed=0
|
||||
|
||||
[Window][Hierarchy Panel]
|
||||
Pos=0,186
|
||||
Size=300,795
|
||||
Pos=0,187
|
||||
Size=300,802
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
|
@ -20,14 +20,14 @@ Size=400,400
|
|||
Collapsed=0
|
||||
|
||||
[Window][Inspector]
|
||||
Pos=1434,48
|
||||
Size=486,933
|
||||
Pos=2074,48
|
||||
Size=486,941
|
||||
Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][Profiler]
|
||||
Pos=0,48
|
||||
Size=300,136
|
||||
Size=300,137
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
|
@ -76,7 +76,7 @@ DockId=0x0000000B,0
|
|||
|
||||
[Window][ Viewport]
|
||||
Pos=302,48
|
||||
Size=1130,697
|
||||
Size=1770,705
|
||||
Collapsed=0
|
||||
DockId=0x0000000B,0
|
||||
|
||||
|
@ -93,14 +93,14 @@ Collapsed=0
|
|||
DockId=0x0000000A,0
|
||||
|
||||
[Window][ Asset Browser]
|
||||
Pos=302,747
|
||||
Size=1130,234
|
||||
Pos=302,755
|
||||
Size=1770,234
|
||||
Collapsed=0
|
||||
DockId=0x0000000C,0
|
||||
|
||||
[Window][Material Inspector]
|
||||
Pos=1434,48
|
||||
Size=486,933
|
||||
Pos=2074,48
|
||||
Size=486,941
|
||||
Collapsed=0
|
||||
DockId=0x00000006,1
|
||||
|
||||
|
@ -116,13 +116,13 @@ Collapsed=0
|
|||
|
||||
[Window][Collider Tag Panel]
|
||||
Pos=302,48
|
||||
Size=1130,697
|
||||
Size=1770,705
|
||||
Collapsed=0
|
||||
DockId=0x0000000B,1
|
||||
|
||||
[Window][Input Bindings Panel]
|
||||
Pos=1434,48
|
||||
Size=486,933
|
||||
Pos=2074,48
|
||||
Size=486,941
|
||||
Collapsed=0
|
||||
DockId=0x00000006,2
|
||||
|
||||
|
@ -151,7 +151,7 @@ Column 15 Weight=1.2009
|
|||
Column 16 Weight=1.0132
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,77 Size=1920,933 Split=X
|
||||
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=2560,941 Split=X
|
||||
DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 Selected=0x1E6EB881
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- EID: 0
|
||||
Name: Canvas
|
||||
IsActive: true
|
||||
NumberOfChildren: 1
|
||||
NumberOfChildren: 2
|
||||
Components:
|
||||
Canvas Component:
|
||||
Canvas Width: 1920
|
||||
|
@ -9,7 +9,7 @@
|
|||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 1
|
||||
Name: Default
|
||||
Name: Background
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
|
@ -23,6 +23,29 @@
|
|||
Material: 121834459
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 5
|
||||
Name: Start Game Button
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 75, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 400, y: 200, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 52901020
|
||||
Hovered Texture: 62235279
|
||||
Clicked Texture: 64722619
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
sceneID: 86098106
|
||||
- EID: 2
|
||||
Name: Light
|
||||
IsActive: true
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using SHADE;
|
||||
|
||||
public class ChangeSceneButton : Script
|
||||
{
|
||||
public uint sceneID = 0;
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
UIElement ui = GetComponent<UIElement>();
|
||||
ui.OnClick.RegisterAction(() =>
|
||||
{
|
||||
if(sceneID != 0)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
SceneManager.ChangeScene(86098106);
|
||||
Audio.StopAllSounds();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
protected override void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_ChangeSceneButton
|
||||
ID: 155329160
|
||||
Type: 9
|
|
@ -39,5 +39,10 @@ layout(location = 1) out uint outEntityID;
|
|||
void main()
|
||||
{
|
||||
fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
|
||||
if (fragColor.a < 0.01f)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
outEntityID = In2.eid;
|
||||
}
|
Binary file not shown.
|
@ -7,7 +7,7 @@ namespace SHADE
|
|||
{
|
||||
SHButtonComponent::SHButtonComponent()
|
||||
:size(1.0f), isHovered(false), isClicked(false),
|
||||
defaultTexture(0), hoveredTexture(0), clickedTexture(0)
|
||||
defaultTexture(0), hoveredTexture(0), clickedTexture(0), currentTexture(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ namespace SHADE
|
|||
AssetID hoveredTexture;
|
||||
AssetID clickedTexture;
|
||||
|
||||
AssetID currentTexture;
|
||||
|
||||
|
||||
RTTR_ENABLE()
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace SHADE
|
|||
{
|
||||
SHToggleButtonComponent::SHToggleButtonComponent()
|
||||
:size(1.0f), isHovered(false), isClicked(false), value(false),
|
||||
defaultTexture(0), toggledTexture(0)
|
||||
defaultTexture(0), toggledTexture(0), currentTexture(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace SHADE
|
|||
AssetID defaultTexture;
|
||||
AssetID toggledTexture;
|
||||
|
||||
AssetID currentTexture;
|
||||
|
||||
|
||||
|
||||
RTTR_ENABLE()
|
||||
|
|
|
@ -236,12 +236,14 @@ namespace SHADE
|
|||
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
||||
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
||||
|
||||
auto material = renderable->GetModifiableMaterial();
|
||||
|
||||
AssetID textureID = 0;
|
||||
if (!comp.isHovered && !comp.isClicked)
|
||||
{
|
||||
if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
|
||||
{
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
|
||||
textureID = comp.GetDefaultTexture();
|
||||
//material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
|
||||
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +251,8 @@ namespace SHADE
|
|||
{
|
||||
if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
|
||||
{
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetClickedTexture()));
|
||||
textureID = comp.GetClickedTexture();
|
||||
//material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetClickedTexture()));
|
||||
//SHLOG_INFO("SETTING CLICKED TEXTURE")
|
||||
}
|
||||
}
|
||||
|
@ -257,10 +260,17 @@ namespace SHADE
|
|||
{
|
||||
if (comp.GetHoveredTexture() != 0 && SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
|
||||
{
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>( comp.GetHoveredTexture()));
|
||||
textureID = comp.GetHoveredTexture();
|
||||
//material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>( comp.GetHoveredTexture()));
|
||||
//SHLOG_INFO("SETTING HOVERED TEXTURE")
|
||||
}
|
||||
}
|
||||
if (textureID != 0 && textureID != comp.currentTexture)
|
||||
{
|
||||
auto material = renderable->GetModifiableMaterial();
|
||||
comp.currentTexture = textureID;
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -358,12 +368,14 @@ namespace SHADE
|
|||
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
||||
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
||||
|
||||
auto material = renderable->GetModifiableMaterial();
|
||||
//auto material = renderable->GetModifiableMaterial();
|
||||
AssetID textureID = 0;
|
||||
if (comp.GetValue() == false)
|
||||
{
|
||||
if (comp.GetDefaultTexture()!= 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
|
||||
{
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
|
||||
textureID = comp.GetDefaultTexture();
|
||||
//material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
|
||||
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
||||
}
|
||||
}
|
||||
|
@ -371,11 +383,20 @@ namespace SHADE
|
|||
{
|
||||
if (comp.GetToggledTexture() != 0 && SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE)
|
||||
{
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetToggledTexture()));
|
||||
textureID = comp.GetToggledTexture();
|
||||
//material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetToggledTexture()));
|
||||
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
||||
}
|
||||
}
|
||||
|
||||
if (textureID != 0 && textureID != comp.currentTexture)
|
||||
{
|
||||
auto material = renderable->GetModifiableMaterial();
|
||||
comp.currentTexture = textureID;
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue