Add behavior pop up

This commit is contained in:
MrKBear 2022-03-26 13:39:36 +08:00
parent ffdb796e8f
commit ce5e6a34d8
5 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,6 @@
@import "../Theme/Theme.scss";
div.behavior-popup {
width: 100%;
height: 100%;
}

View File

@ -0,0 +1,34 @@
import { Component, ReactNode } from "react";
import { Popup } from "@Context/Popups";
import { Theme } from "@Component/Theme/Theme";
import { Localization } from "@Component/Localization/Localization";
import "./BehaviorPopup.scss";
interface IBehaviorPopupProps {
}
class BehaviorPopup extends Popup<IBehaviorPopupProps> {
public minWidth: number = 400;
public minHeight: number = 300;
public width: number = 600;
public height: number = 450;
public onRenderHeader(): ReactNode {
return <Localization i18nKey="Popup.Add.Behavior.Title"/>
}
public render(): ReactNode {
return <BehaviorPopupComponent {...this.props}/>
}
}
class BehaviorPopupComponent extends Component<IBehaviorPopupProps> {
public render(): ReactNode {
return <Theme className="behavior-popup"></Theme>
}
}
export { BehaviorPopup };

View File

@ -4,7 +4,8 @@ import { LocalizationTooltipHost } from "../Localization/LocalizationTooltipHost
import { useSetting, IMixinSettingProps } from "@Context/Setting"; import { useSetting, IMixinSettingProps } from "@Context/Setting";
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
import { AllI18nKeys } from "../Localization/Localization"; import { AllI18nKeys } from "../Localization/Localization";
import { SettingPopup } from "@Component/SettingPopup/SettingPopup"; import { SettingPopup } from "../SettingPopup/SettingPopup";
import { BehaviorPopup } from "../BehaviorPopup/BehaviorPopup";
import { Component, ReactNode } from "react"; import { Component, ReactNode } from "react";
import { MouseMod } from "@GLRender/ClassicRenderer"; import { MouseMod } from "@GLRender/ClassicRenderer";
import "./CommandBar.scss"; import "./CommandBar.scss";
@ -58,7 +59,13 @@ class CommandBar extends Component<ICommandBarProps & IMixinSettingProps & IMixi
this.props.status ? this.props.status.newRange() : undefined; this.props.status ? this.props.status.newRange() : undefined;
} }
})} })}
{this.getRenderButton({ iconName: "Running", i18NKey: "Command.Bar.Add.Behavior.Info" })} {this.getRenderButton({
iconName: "Running",
i18NKey: "Command.Bar.Add.Behavior.Info",
click: () => {
this.props.status?.popup.showPopup(BehaviorPopup, {});
}
})}
{this.getRenderButton({ {this.getRenderButton({
iconName: "Tag", iconName: "Tag",
i18NKey: "Command.Bar.Add.Tag.Info", i18NKey: "Command.Bar.Add.Tag.Info",

View File

@ -52,6 +52,7 @@ const EN_US = {
"Popup.Action.Objects.Confirm.Delete": "Delete", "Popup.Action.Objects.Confirm.Delete": "Delete",
"Popup.Delete.Objects.Confirm": "Are you sure you want to delete this object(s)? The object is deleted and cannot be recalled.", "Popup.Delete.Objects.Confirm": "Are you sure you want to delete this object(s)? The object is deleted and cannot be recalled.",
"Popup.Setting.Title": "Preferences setting", "Popup.Setting.Title": "Preferences setting",
"Popup.Add.Behavior.Title": "Add behavior",
"Build.In.Label.Name.All.Group": "All group", "Build.In.Label.Name.All.Group": "All group",
"Build.In.Label.Name.All.Range": "All range", "Build.In.Label.Name.All.Range": "All range",
"Behavior.Template.Title": "Behavior", "Behavior.Template.Title": "Behavior",

View File

@ -52,6 +52,7 @@ const ZH_CN = {
"Popup.Action.Objects.Confirm.Delete": "删除", "Popup.Action.Objects.Confirm.Delete": "删除",
"Popup.Delete.Objects.Confirm": "你确定要删除这个(些)对象吗?对象被删除将无法撤回。", "Popup.Delete.Objects.Confirm": "你确定要删除这个(些)对象吗?对象被删除将无法撤回。",
"Popup.Setting.Title": "首选项设置", "Popup.Setting.Title": "首选项设置",
"Popup.Add.Behavior.Title": "添加行为",
"Build.In.Label.Name.All.Group": "全部群", "Build.In.Label.Name.All.Group": "全部群",
"Build.In.Label.Name.All.Range": "全部范围", "Build.In.Label.Name.All.Range": "全部范围",
"Behavior.Template.Title": "行为", "Behavior.Template.Title": "行为",