dynamic casting, extra sounds, fixes

This commit is contained in:
KeyboardCombination
2023-04-30 15:58:10 -04:00
parent fd3679fb6b
commit b7f2b8f5a7
9 changed files with 66 additions and 9 deletions

BIN
Parts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -37,7 +37,7 @@ namespace Enum
enum Value {
NoSound = 0, Victory = 1, Boing = 2, Bomb = 3,
Ping = 4, Break = 5, Splat = 6, Swoosh = 7,
Snap = 8, Page = 9
Snap = 8, Page = 9, Click = 10, Clock = 11, Step = 12, StepOn = 13,
};
}
}

View File

@@ -8,6 +8,7 @@
#include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/DataModelInstance.h"
#include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/SoundService.h"
#include "XplicitNgine/XplicitNgine.h"
#include "CameraController.h"
#include "AudioPlayer.h"
@@ -512,7 +513,7 @@ void Application::onMouseWheel(int x,int y,short delta)
if (mouseOnScreen==true)
if (cameraController.onMouseWheel(x, y, delta))
{
AudioPlayer::playSound(cameraSound);
_dataModel->getSoundService()->playSound(_dataModel->getSoundService()->findFirstChild("Step"));
}
tool->onMouseScroll(mouse);
}

View File

@@ -593,7 +593,7 @@ bool DataModelInstance::getOpen()
of.lpstrFile = szFile ;
of.lpstrFile[0]='\0';
of.nMaxFile=500;
of.lpstrTitle="Hello";
of.lpstrTitle="Open";
of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of);
@@ -616,7 +616,7 @@ bool DataModelInstance::getOpenModel()
of.lpstrFile = szFile ;
of.lpstrFile[0]='\0';
of.nMaxFile=500;
of.lpstrTitle="Hello";
of.lpstrTitle="Open";
of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of);

View File

@@ -6,6 +6,7 @@
#include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/ToggleImageButtonInstance.h"
#include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/SelectionService.h"
#include "DataModelV2/ImageButtonInstance.h"
#include "Globals.h"
#include "StringFunctions.h"
@@ -502,6 +503,9 @@ void GuiRootInstance::update()
Instance * obj3 = this->findFirstChild("UnGroup");
Instance * obj4 = this->findFirstChild("Rotate");
Instance * obj5 = this->findFirstChild("Tilt");
SelectionService* SelectionSvc = g_dataModel->getSelectionService();
if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL)
{
BaseButtonInstance* button = (BaseButtonInstance*)obj;
@@ -516,8 +520,8 @@ void GuiRootInstance::update()
button4->disabled = true;
button5->disabled = true;
button6->disabled = true;
for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
for(size_t i = 0; i < SelectionSvc->getSelection().size(); i++)
if(SelectionSvc->getSelection()[i]->canDelete)
{
button->disabled = false;
button4->disabled = false;
@@ -525,11 +529,11 @@ void GuiRootInstance::update()
button6->disabled = false;
if (g_dataModel->getSelectionService()->getSelection().size() > 1){
if (SelectionSvc->getSelection().size() > 1){
button2->disabled = false;
}
if (g_dataModel->getSelectionService()->getSelection()[i]->getClassName() == "GroupInstance"){
if (dynamic_cast<GroupInstance*>(SelectionSvc->getSelection()[i])){
button3->disabled = false;
}

View File

@@ -495,6 +495,14 @@ static TCHAR* strSoundType(int option)
return "Swoosh";
case Enum::Sound::Page:
return "Page";
case Enum::Sound::Click:
return "Click";
case Enum::Sound::Clock:
return "Clock";
case Enum::Sound::Step:
return "Step";
case Enum::Sound::StepOn:
return "StepOn";
}
return "NoSound";
}
@@ -521,6 +529,14 @@ static Enum::Sound::Value EnumOnTouchSoundType(TCHAR* option)
return Enum::Sound::Ping;
if(strcmp("Snap", option) == 0)
return Enum::Sound::Snap;
if(strcmp("Click", option) == 0)
return Enum::Sound::Click;
if(strcmp("Clock", option) == 0)
return Enum::Sound::Clock;
if(strcmp("Step", option) == 0)
return Enum::Sound::Step;
if(strcmp("StepOn", option) == 0)
return Enum::Sound::StepOn;
return Enum::Sound::NoSound;
}
@@ -585,6 +601,18 @@ void PartInstance::onTouch()
case Enum::Sound::Swoosh:
sndService->playSound(sndService->findFirstChild("Swoosh"));
break;
case Enum::Sound::Click:
sndService->playSound(sndService->findFirstChild("Click"));
break;
case Enum::Sound::Clock:
sndService->playSound(sndService->findFirstChild("Clock"));
break;
case Enum::Sound::Step:
sndService->playSound(sndService->findFirstChild("Step"));
break;
case Enum::Sound::StepOn:
sndService->playSound(sndService->findFirstChild("StepOn"));
break;
}
}
@@ -728,7 +756,7 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
"What sound plays when touched",
(LPARAM)strSoundType(OnTouchSound),
PIT_COMBO,
TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0")
TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0Click\0Clock\0Step\0StepOn")
));
sprintf_s(changeScoreTxt, "%d", changeScore);

View File

@@ -67,6 +67,30 @@ SoundService::SoundService()
stockSound->setName("Page");
stockSound->setSoundId("/content/sounds/pageturn.wav");
stockSound->setParent(this);
// Click
stockSound = new SoundInstance();
stockSound->setName("Click");
stockSound->setSoundId("/content/sounds/switch.wav");
stockSound->setParent(this);
// Clock
stockSound = new SoundInstance();
stockSound->setName("Clock");
stockSound->setSoundId("/content/sounds/clickfast.wav");
stockSound->setParent(this);
// Step
stockSound = new SoundInstance();
stockSound->setName("Step");
stockSound->setSoundId("/content/sounds/SWITCH3.wav");
stockSound->setParent(this);
// StepOn
stockSound = new SoundInstance();
stockSound->setName("StepOn");
stockSound->setSoundId("/content/sounds/flashbulb.wav");
stockSound->setParent(this);
}
SoundService::~SoundService(void)