Skip to content

Game: Rename Story Simulator references to Game Simulator #2805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const getStaffNavlinkInfo = ({
hiddenInBreakpoints: ['xs', 'sm', 'md']
},
{
to: `/courses/${courseId}/storysimulator`,
to: `/courses/${courseId}/gamesimulator`,
icon: IconNames.CROWN,
text: 'Game Simulator',
disabled: !isStaffOrAdmin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jest.mock('react-redux', () => ({
const useSelectorMock = useSelector as jest.Mock;

const assessmentTypes = ['Missions', 'Quests', 'Paths', 'Contests', 'Others'];
const staffRoutes = ['grading', 'groundcontrol', 'sourcereel', 'storysimulator', 'dashboard'];
const staffRoutes = ['grading', 'groundcontrol', 'sourcereel', 'gamesimulator', 'dashboard'];
const adminRoutes = ['adminpanel'];
const courseId = 0;
const createCoursePath = (path: string) => `/courses/${courseId}/${path}`;
Expand Down Expand Up @@ -43,7 +43,7 @@ const mockProps = {
};
const element = <AcademyNavigationBar {...mockProps} />;

test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks do NOT render for Role.Student', () => {
test('MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Grading and AdminPanel NavLinks do NOT render for Role.Student', () => {
useSelectorMock.mockReturnValue({
role: Role.Student,
courseId
Expand All @@ -57,7 +57,7 @@ test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grad
validateAdminPaths(tree, false);
});

test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard and Grading NavLinks render for Role.Staff', () => {
test('MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard and Grading NavLinks render for Role.Staff', () => {
useSelectorMock.mockReturnValueOnce({
role: Role.Staff,
courseId
Expand All @@ -71,7 +71,7 @@ test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard and G
validateAdminPaths(tree, false);
});

test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin', () => {
test('MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin', () => {
useSelectorMock.mockReturnValueOnce({
role: Role.Admin,
courseId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard and Grading NavLinks render for Role.Staff 1`] = `
exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard and Grading NavLinks render for Role.Staff 1`] = `
<Blueprint5.Navbar
className="NavigationBar secondary-navbar"
>
Expand Down Expand Up @@ -182,7 +182,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an
<NavLink
className={[Function]}
title="Game Simulator"
to="/courses/0/storysimulator"
to="/courses/0/gamesimulator"
>
<Blueprint5.Icon
autoLoad={true}
Expand Down Expand Up @@ -215,7 +215,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an
</Blueprint5.Navbar>
`;

exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks do NOT render for Role.Student 1`] = `
exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Grading and AdminPanel NavLinks do NOT render for Role.Student 1`] = `
<Blueprint5.Navbar
className="NavigationBar secondary-navbar"
>
Expand Down Expand Up @@ -346,7 +346,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
</Blueprint5.Navbar>
`;

exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin 1`] = `
exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin 1`] = `
<Blueprint5.Navbar
className="NavigationBar secondary-navbar"
>
Expand Down Expand Up @@ -528,7 +528,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
<NavLink
className={[Function]}
title="Game Simulator"
to="/courses/0/storysimulator"
to="/courses/0/gamesimulator"
>
<Blueprint5.Icon
autoLoad={true}
Expand Down
14 changes: 7 additions & 7 deletions src/features/game/SourceAcademyGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import RoomPreview from 'src/features/game/scenes/roomPreview/RoomPreview';
import Settings from 'src/features/game/scenes/settings/Settings';
import GameSoundManager from 'src/features/game/sound/GameSoundManager';
import { mandatory } from 'src/features/game/utils/GameUtils';
import { StorySimState } from 'src/features/storySimulator/StorySimulatorTypes';
import { GameSimState } from 'src/features/gameSimulator/GameSimulatorTypes';

import { AchievementGoal, AchievementItem } from '../achievement/AchievementTypes';
import { fetchGameChapters } from './chapter/GameChapterHelpers';
Expand Down Expand Up @@ -47,7 +47,7 @@ type GlobalGameProps = {
roomCode: string;
roomPreviewMapping: Map<ItemId, AssetPath>;
saveManager: GameSaveManager;
setStorySimState: (value: React.SetStateAction<string>) => void;
setGameSimState: (value: React.SetStateAction<string>) => void;
soundManager: GameSoundManager;
ssChapterSimFilenames: string[];
userStateManager: GameUserStateManager;
Expand All @@ -74,7 +74,7 @@ export default class SourceAcademyGame extends Phaser.Game {
roomCode: '',
roomPreviewMapping: new Map<ItemId, AssetPath>(),
saveManager: new GameSaveManager(),
setStorySimState: Constants.nullFunction,
setGameSimState: Constants.nullFunction,
soundManager: new GameSoundManager(),
ssChapterSimFilenames: [],
userStateManager: new GameUserStateManager()
Expand Down Expand Up @@ -107,8 +107,8 @@ export default class SourceAcademyGame extends Phaser.Game {
this.global.goals = goals;
}

public setStorySimStateSetter(setStorySimState: (value: React.SetStateAction<string>) => void) {
this.setStorySimState = setStorySimState;
public setGameSimStateSetter(setGameSimState: (value: React.SetStateAction<string>) => void) {
this.setGameSimState = setGameSimState;
}

public setRoomPreviewMapping(mapping: Map<ItemId, AssetPath>) {
Expand All @@ -123,8 +123,8 @@ export default class SourceAcademyGame extends Phaser.Game {
this.global.roomCode = await getRoomPreviewCode();
}

public setStorySimState(state: StorySimState) {
this.global.setStorySimState(state);
public setGameSimState(state: GameSimState) {
this.global.setGameSimState(state);
}

public setCurrentSceneRef(scene: Phaser.Scene) {
Expand Down
2 changes: 1 addition & 1 deletion src/features/game/escape/GameEscapeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class GameEscapeManager implements IGameUI {
callback: () => {
this.cleanUp();
if (SourceAcademyGame.getInstance().isGameType(GameType.Simulator)) {
this.scene.scene.start('StorySimulatorMenu');
this.scene.scene.start('GameSimulatorMenu');
} else {
this.scene.scene.start('MainMenu');
}
Expand Down
4 changes: 2 additions & 2 deletions src/features/game/save/GameSaveManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class GameSaveManager {
* Updates the save manager with chapter number and checkpoint number
* if player has chosen a chapter/checkpoint to play with.
*
* Chapter number and checkpoint number can be -1 if inside the Story Simulator,
* Chapter number and checkpoint number can be -1 if inside the Game Simulator,
*
* @param chapterNum chapter number
* @param checkpointNum checkpoint number
Expand All @@ -56,7 +56,7 @@ export default class GameSaveManager {
* informtion from GameManager, GameStateManager, or other in-game managers,
* and converts them into JSON format to be saved to backend.
*
* Only called when playing the Game (not Story Simulator), because Story Simulator
* Only called when playing the Game (not Game Simulator), because Game Simulator
* shouldn't save game state to backend.
*/
public async saveGame() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import CheckpointConstants, { transitionTextStyle } from './CheckpointTransition
* Internally, we use this scene to fully load the next checkpoint,
* before finally loading the next scene.
*
* In story simulator, the next checkpoint is loaded based on the
* In Game simulator, the next checkpoint is loaded based on the
* chapterSimStack using the callGameManagerForSim function.
*
* We cannot load these informations at the start of GameManager as
Expand Down
2 changes: 1 addition & 1 deletion src/features/game/utils/TxtLoaderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function callGameManagerForSim() {
const scene = SourceAcademyGame.getInstance().getCurrentSceneRef();
const checkpointFilenames = SourceAcademyGame.getInstance().getSSChapterSimFilenames();
if (!checkpointFilenames.length) {
scene.scene.start('StorySimulatorMenu');
scene.scene.start('GameSimulatorMenu');
return;
}
const filename = checkpointFilenames.pop() as string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';

import { sendAdminStoryRequest, sendAssetRequest, sendStoryRequest } from './StorySimulatorRequest';
import { ChapterDetail } from './StorySimulatorTypes';
import { sendAdminStoryRequest, sendAssetRequest, sendStoryRequest } from './GameSimulatorRequest';
import { ChapterDetail } from './GameSimulatorTypes';

/**
* List of all folders to fetch S3 assets from
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum StorySimState {
export enum GameSimState {
Default = 'Default',
ObjectPlacement = 'ObjectPlacement',
AssetUploader = 'AssetUploader',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AssetMap, AssetType, ImageAsset } from 'src/features/game/assets/AssetsTypes';

const SSImageAssets: AssetMap<ImageAsset> = {
storySimBg: {
gameSimBg: {
type: AssetType.Image,
key: 'student-room',
path: '/locations/deathCube_ext/shields-down.png'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { loadImage } from '../../game/utils/LoaderUtils';
import ObjectPlacement from '../scenes/ObjectPlacement/ObjectPlacement';

/**
* This manager manages the background for Story Simulator's Object Placement scene
* This manager manages the background for Game Simulator's Object Placement scene
* It handles (1) storing of information on the chosen background (2) Rendering background
*/
export default class SSBackgroundManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ObjectPlacement from '../scenes/ObjectPlacement/ObjectPlacement';
import { SSBBoxDetail } from './SSBBoxManagerTypes';

/**
* This manager manages the bounding boxes for Story Simulator's Object Placement scene
* This manager manages the bounding boxes for Game Simulator's Object Placement scene
*
* It handles:
* (1) Storing of information on bounding boxes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ObjectPlacement from '../scenes/ObjectPlacement/ObjectPlacement';
import { SSObjectDetail } from './SSObjectManagerTypes';

/**
* This manager manages the object (image assets) for Story Simulator's Object Placement scene
* This manager manages the object (image assets) for Game Simulator's Object Placement scene
*
* It handles:
* (1) Storing of information on image assets used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import SSBackgroundManager from '../../background/SSBackgroundManager';
import SSBBoxManager from '../../boundingBoxes/SSBBoxManager';
import SSCursorMode from '../../cursorMode/SSCursorMode';
import { CursorMode } from '../../cursorMode/SSCursorModeTypes';
import { GameSimState } from '../../GameSimulatorTypes';
import SSLogManager from '../../logger/SSLogManager';
import SSObjectManager from '../../objects/SSObjectManager';
import { StorySimState } from '../../StorySimulatorTypes';
import SSTransformManager from '../../transform/SSTransformManager';
import ObjPlacementConstants from './ObjectPlacementConstants';

Expand Down Expand Up @@ -95,8 +95,8 @@ export default class ObjectPlacement extends Phaser.Scene {
const uiContainer = new Phaser.GameObjects.Container(this, 0, 0);
const backButton = new CommonBackButton(this, () => {
this.cleanUp();
SourceAcademyGame.getInstance().setStorySimState(StorySimState.Default);
this.scene.start('StorySimulatorMenu');
SourceAcademyGame.getInstance().setGameSimState(GameSimState.Default);
this.scene.start('GameSimulatorMenu');
});

this.cursorModes = new SSCursorMode(
Expand All @@ -117,7 +117,7 @@ export default class ObjectPlacement extends Phaser.Scene {
this,
screenCenter.x,
screenCenter.y,
SSImageAssets.storySimBg.key
SSImageAssets.gameSimBg.key
);
backgroundImg.setDisplaySize(screenSize.x, screenSize.y);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import { mandatory, toS3Path } from 'src/features/game/utils/GameUtils';
import { calcTableFormatPos } from 'src/features/game/utils/StyleUtils';

import SSImageAssets from '../../assets/ImageAssets';
import { StorySimState } from '../../StorySimulatorTypes';
import { GameSimState } from '../../GameSimulatorTypes';
import mainMenuConstants, { mainMenuOptStyle } from './MainMenuConstants';

/**
* Entry point for story simulator.
* Entry point for Game simulator.
*
* User can access different story simulator
* User can access different Game simulator
* functionalities from here.
*/
class MainMenu extends Phaser.Scene {
private layerManager?: GameLayerManager;

constructor() {
super('StorySimulatorMenu');
super('GameSimulatorMenu');
}

public preload() {
Expand All @@ -47,7 +47,7 @@ class MainMenu extends Phaser.Scene {

public async create() {
if (SourceAcademyGame.getInstance().getAccountInfo().role === 'student') {
console.log('Students cannot use story sim');
console.log('Students cannot use Game sim');
return;
}
this.renderBackground();
Expand Down Expand Up @@ -84,27 +84,27 @@ class MainMenu extends Phaser.Scene {
{
text: 'Object Placement',
callback: () => {
SourceAcademyGame.getInstance().setStorySimState(StorySimState.ObjectPlacement);
SourceAcademyGame.getInstance().setGameSimState(GameSimState.ObjectPlacement);
this.getLayerManager().clearAllLayers();
this.scene.start('ObjectPlacement');
}
},
{
text: 'Checkpoint Simulator',
callback: () => {
SourceAcademyGame.getInstance().setStorySimState(StorySimState.CheckpointSim);
SourceAcademyGame.getInstance().setGameSimState(GameSimState.CheckpointSim);
}
},
{
text: 'Asset Uploader',
callback: () => {
SourceAcademyGame.getInstance().setStorySimState(StorySimState.AssetUploader);
SourceAcademyGame.getInstance().setGameSimState(GameSimState.AssetUploader);
}
},
{
text: 'Chapter Simulator',
callback: () => {
SourceAcademyGame.getInstance().setStorySimState(StorySimState.ChapterSim);
SourceAcademyGame.getInstance().setGameSimState(GameSimState.ChapterSim);
}
}
];
Expand Down Expand Up @@ -149,7 +149,7 @@ class MainMenu extends Phaser.Scene {
this,
screenCenter.x,
screenCenter.y,
SSImageAssets.storySimBg.key
SSImageAssets.gameSimBg.key
);
backgroundImg.setDisplaySize(screenSize.x, screenSize.y);
const backgroundUnderlay = new Phaser.GameObjects.Image(
Expand Down
4 changes: 2 additions & 2 deletions src/pages/academy/Academy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import Sourcecast from '../sourcecast/Sourcecast';
import AdminPanel from './adminPanel/AdminPanel';
import Dashboard from './dashboard/Dashboard';
import Game from './game/Game';
import GameSimulator from './gameSimulator/GameSimulator';
import Grading from './grading/Grading';
import GroundControl from './groundControl/GroundControlContainer';
import NotiPreference from './notiPreference/NotiPreference';
import Sourcereel from './sourcereel/Sourcereel';
import StorySimulator from './storySimulator/StorySimulator';

const Academy: React.FC<{}> = () => {
const dispatch = useDispatch();
Expand All @@ -42,7 +42,7 @@ const Academy: React.FC<{}> = () => {
<Route path="groundcontrol" element={<GroundControl />} key={0} />,
<Route path={`grading/${gradingRegExp}`} element={<Grading />} key={1} />,
<Route path="sourcereel" element={<Sourcereel />} key={2} />,
<Route path="storysimulator" element={<StorySimulator />} key={3} />,
<Route path="gamesimulator" element={<GameSimulator />} key={3} />,
<Route path="dashboard" element={<Dashboard />} key={4} />
]
: null;
Expand Down
Loading