remove tutorialGame from game.construct

This commit is contained in:
Mashy 2019-12-05 15:55:14 +10:00
parent eb12a0a96e
commit 8e90e6e0e3
3 changed files with 8 additions and 11 deletions

View File

@ -89,7 +89,6 @@ const addState = connect(
animText, animText,
gameSkillInfo, gameSkillInfo,
itemInfo, itemInfo,
tutorialGame,
} = state; } = state;
function selectSkillTarget(targetConstructId) { function selectSkillTarget(targetConstructId) {
@ -109,7 +108,6 @@ const addState = connect(
selectSkillTarget, selectSkillTarget,
gameSkillInfo, gameSkillInfo,
itemInfo, itemInfo,
tutorialGame,
}; };
}, },
@ -118,11 +116,7 @@ const addState = connect(
dispatch(actions.setGameEffectInfo(info)); dispatch(actions.setGameEffectInfo(info));
} }
function setTutorialGameClear(activeSkill, tutorialGame) { return { setGameEffectInfo };
if (activeSkill && tutorialGame) dispatch(actions.setTutorialGame(null));
}
return { setGameEffectInfo, setTutorialGameClear };
} }
); );
@ -157,7 +151,6 @@ class GameConstruct extends preact.Component {
if (newProps.animating !== this.props.animating) return true; if (newProps.animating !== this.props.animating) return true;
if (newProps.construct !== this.props.construct) return true; if (newProps.construct !== this.props.construct) return true;
if (newProps.player !== this.props.player) return true; if (newProps.player !== this.props.player) return true;
if (newProps.tutorialGame !== this.props.tutorialGame) return true;
if (newProps.gameSkillInfo !== this.props.gameSkillInfo) return true; if (newProps.gameSkillInfo !== this.props.gameSkillInfo) return true;
return false; return false;
} }
@ -171,14 +164,12 @@ class GameConstruct extends preact.Component {
animating, animating,
construct, construct,
player, player,
tutorialGame,
gameSkillInfo, gameSkillInfo,
// Constants // Constants
i, i,
itemInfo, itemInfo,
// Functions // Functions
selectSkillTarget, selectSkillTarget,
setTutorialGameClear,
setGameEffectInfo, setGameEffectInfo,
} = this.props; } = this.props;
@ -233,7 +224,6 @@ class GameConstruct extends preact.Component {
<div <div
onClick={() => { onClick={() => {
selectSkillTarget(construct.id); selectSkillTarget(construct.id);
setTutorialGameClear(activeSkill, tutorialGame);
}} }}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
class={`game-construct ${ko} ${cssClass}`}> class={`game-construct ${ko} ${cssClass}`}>

View File

@ -32,6 +32,11 @@ function registerEvents(store) {
} }
function clearTutorialGame() {
store.dispatch(actions.setTutorialGame(null));
}
function setPing(ping) { function setPing(ping) {
store.dispatch(actions.setPing(ping)); store.dispatch(actions.setPing(ping));
} }
@ -351,6 +356,7 @@ function registerEvents(store) {
clearInstance, clearInstance,
clearMtxActive, clearMtxActive,
clearTutorial, clearTutorial,
clearTutorialGame,
setAccount, setAccount,
setAccountInstances, setAccountInstances,
setActiveItem, setActiveItem,

View File

@ -129,6 +129,7 @@ function createSocket(events) {
{ game_id: gameId, construct_id: constructId, target_construct_id: targetConstructId, skill }, { game_id: gameId, construct_id: constructId, target_construct_id: targetConstructId, skill },
]); ]);
events.setActiveSkill(null); events.setActiveSkill(null);
events.clearTutorialGame();
} }
function sendGameSkillClear(gameId) { function sendGameSkillClear(gameId) {