Merge remote-tracking branch 'origin/master' into LevelSystemAndSuch
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "GUI/Slider.h"
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Game/GUI/ELoadingFrameComplete.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -29,9 +28,9 @@ public:
|
||||
m_Slider->X = Width / 2.f - m_Slider->Width / 2.f;
|
||||
}
|
||||
|
||||
void AddTexturePreload(std::string resourceName)
|
||||
void AddResource(std::string resourceType, std::string resourceName)
|
||||
{
|
||||
m_Items.push_back(resourceName);
|
||||
m_Preload.push_back(std::make_pair(resourceType, resourceName));
|
||||
}
|
||||
|
||||
void Preload()
|
||||
@@ -48,18 +47,15 @@ public:
|
||||
void Update(double dt) override
|
||||
{
|
||||
if (m_Preloading) {
|
||||
ResourceManager::Preload<dd::Texture>(m_Items[m_CurrentItem]);
|
||||
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Items.size());
|
||||
ResourceManager::Preload(m_Preload[m_CurrentItem].first, m_Preload[m_CurrentItem].second);
|
||||
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Preload.size());
|
||||
m_CurrentItem++;
|
||||
if (m_CurrentItem >= m_Items.size()) {
|
||||
if (m_CurrentItem >= m_Preload.size()) {
|
||||
m_Preloading = false;
|
||||
dd::Events::LoadingFrameComplete e;
|
||||
e.FrameName = Name();
|
||||
e.Frame = this;
|
||||
EventBroker->Publish(e);
|
||||
Events::PlaySound se;
|
||||
se.FilePath = "Sounds/jap-story.wav";
|
||||
EventBroker->Publish(se);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +63,7 @@ public:
|
||||
private:
|
||||
bool m_Preloading = false;
|
||||
int m_CurrentItem = 0;
|
||||
std::vector<std::string> m_Items;
|
||||
std::vector<std::pair<std::string, std::string>> m_Preload;
|
||||
GUI::Slider* m_Slider = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#define GUI_MAINMENU_H__
|
||||
|
||||
#include "GUI/TextureFrame.h"
|
||||
#include "Game/GUI/LoadingFrame.h"
|
||||
#include "Game/GUI/MainMenuMain.h"
|
||||
#include "Game/GUI/MainMenuOptions.h"
|
||||
#include "Core/EKeyUp.h"
|
||||
#include "Game/EGameStart.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -37,6 +39,18 @@ public:
|
||||
//EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &MainMenu::OnKeyUp);
|
||||
}
|
||||
|
||||
void Show() override
|
||||
{
|
||||
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Debug.SkipMenu", false)) {
|
||||
Events::GameStart e;
|
||||
EventBroker->Publish(e);
|
||||
Hide();
|
||||
auto hud = new GUI::HUD(BaseFrame, "HUD");
|
||||
} else {
|
||||
TextureFrame::Show();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TextureFrame* m_LeftBanner;
|
||||
MainMenuMain* m_MainMenuMain;
|
||||
|
||||
@@ -58,6 +58,7 @@ private:
|
||||
if (event.Button == m_SquidoutButton) {
|
||||
m_Parent->Hide();
|
||||
auto story = new GUI::Story1(BaseFrame, "Story1");
|
||||
story->Play();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+13
-43
@@ -3,11 +3,11 @@
|
||||
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Game/GUI/StoryboardFrame.h"
|
||||
#include "Game/GUI/ELoadingFrameComplete.h"
|
||||
#include "Game/GUI/LoadingFrame.h"
|
||||
#include "Game/EGameStart.h"
|
||||
#include "Core/EKeyDown.h"
|
||||
#include "Game/GUI/HUD.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
#include "Sound/EStopSound.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -20,37 +20,8 @@ public:
|
||||
Story1(Frame* parent, std::string name)
|
||||
: StoryboardFrame(parent, name)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ELoadingFrameComplete, &Story1::OnLoadingFrameComplete);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Story1::OnKeyDown);
|
||||
|
||||
m_LoadingFrame = new GUI::LoadingFrame(this, "Story1LoadingFrame");
|
||||
m_LoadingFrame->SetTexture("Textures/GUI/Loading.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn1.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn2.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn3.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn4.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn5.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene1.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene2.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene3.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene4.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene5.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene6.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene7.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene8.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene9.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene10.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene11.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene12.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene13.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene14.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene15.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene16.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene17.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene18.png");
|
||||
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene19.png");
|
||||
m_LoadingFrame->Preload();
|
||||
|
||||
m_Spacebar = new TextureFrame(this, "ZZZSpacebar");
|
||||
m_Spacebar->SetTexture("Textures/GUI/SpacebarSkip.png");
|
||||
m_Spacebar->SetRight(Right() - 10);
|
||||
@@ -196,6 +167,14 @@ public:
|
||||
AddTransition(t);
|
||||
}
|
||||
|
||||
virtual void Play() override
|
||||
{
|
||||
StoryboardFrame::Play();
|
||||
Events::PlaySound se;
|
||||
se.FilePath = "Sounds/jap-story.wav";
|
||||
EventBroker->Publish(se);
|
||||
}
|
||||
|
||||
void Update(double dt) override
|
||||
{
|
||||
StoryboardFrame::Update(dt);
|
||||
@@ -209,7 +188,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
GUI::LoadingFrame* m_LoadingFrame = nullptr;
|
||||
TextureFrame* m_Spacebar = nullptr;
|
||||
|
||||
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
|
||||
@@ -220,25 +198,17 @@ private:
|
||||
}
|
||||
|
||||
if (event.KeyCode == GLFW_KEY_SPACE) {
|
||||
m_LoadingFrame->CancelPreload();
|
||||
Events::GameStart e;
|
||||
EventBroker->Publish(e);
|
||||
Events::StopSound se;
|
||||
se.FilePath = "Sounds/jap-story.wav";
|
||||
EventBroker->Publish(se);
|
||||
Hide();
|
||||
auto hud = new GUI::HUD(BaseFrame, "HUD");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
EventRelay<Frame, Events::LoadingFrameComplete> m_ELoadingFrameComplete;
|
||||
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
|
||||
{
|
||||
if (event.FrameName == "Story1LoadingFrame") {
|
||||
event.Frame->Hide();
|
||||
m_Spacebar->Hide();
|
||||
Play();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ public:
|
||||
m_Timeline.push_back(transition);
|
||||
}
|
||||
|
||||
void Play()
|
||||
virtual void Play()
|
||||
{
|
||||
m_Playing = true;
|
||||
}
|
||||
|
||||
void Skip()
|
||||
virtual void Skip()
|
||||
{
|
||||
m_Playing = false;
|
||||
OnComplete();
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
#include "Rendering/CAnimation.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
//#include "Core/Camera.h" Camera Component
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user