mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Also improve flow typing of Debugger Toolbar
Note that the way translations are done might be changed later, but this is for reference if needed.
This commit is contained in:

committed by
Florian Rival

parent
7d52165a82
commit
389deadac5
@@ -1,11 +1,11 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { translate, type TranslatorProps } from 'react-i18next';
|
||||
import { translate, type TFunction, type Translator } from 'react-i18next';
|
||||
import { ToolbarGroup } from 'material-ui/Toolbar';
|
||||
import ToolbarIcon from '../UI/ToolbarIcon';
|
||||
import ToolbarSeparator from '../UI/ToolbarSeparator';
|
||||
|
||||
type Props = {|
|
||||
type OwnProps = {|
|
||||
onPlay: () => void,
|
||||
canPlay: boolean,
|
||||
onPause: () => void,
|
||||
@@ -13,7 +13,12 @@ type Props = {|
|
||||
onOpenProfiler: () => void,
|
||||
|};
|
||||
|
||||
export class Toolbar extends React.PureComponent<Props & TranslatorProps> {
|
||||
type Props = {|
|
||||
t: TFunction,
|
||||
...OwnProps,
|
||||
|};
|
||||
|
||||
export class Toolbar extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const {
|
||||
t,
|
||||
@@ -49,4 +54,5 @@ export class Toolbar extends React.PureComponent<Props & TranslatorProps> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate()(Toolbar);
|
||||
const translator: Translator<OwnProps, Props> = translate();
|
||||
export default translator(Toolbar);
|
||||
|
29
newIDE/app/src/Hints/index.js
Normal file
29
newIDE/app/src/Hints/index.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// @flow
|
||||
|
||||
export const getDeprecatedBehaviorsInformation = (
|
||||
t: string => string,
|
||||
): { [string]: {| warning: string |} } => ({
|
||||
'PhysicsBehavior::PhysicsBehavior': {
|
||||
warning: t(
|
||||
'A new physics engine (Physics Engine 2.0) is now available. You should prefer using it for new game. For existing games, note that the two behaviors are not compatible, so you should only use one of them with your objects.'
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
export const getDeprecatedInstructionInformation = (
|
||||
t: string => string,
|
||||
type: string
|
||||
): ?{| warning: string |} => {
|
||||
if (type.indexOf('PhysicsBehavior::') === 0) {
|
||||
return {
|
||||
warning: t(
|
||||
`This action is deprecated and should not be used anymore. Instead,
|
||||
use for all your objects the behavior called "Physics2" and the
|
||||
associated actions (in this case, all objects must be set up to use
|
||||
Physics2, you can't mix the behaviors).`
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
Reference in New Issue
Block a user