Add tracking assimilate attacking behaviot #39
@ -57,8 +57,11 @@ const EN_US = {
|
||||
"Popup.Action.No": "Cancel",
|
||||
"Popup.Action.Objects.Confirm.Title": "Confirm Delete",
|
||||
"Popup.Action.Objects.Confirm.Delete": "Delete",
|
||||
"Popup.Action.Objects.Confirm.Restore.Title": "Confirm Restore",
|
||||
"Popup.Action.Objects.Confirm.Restore": "Restore",
|
||||
"Popup.Delete.Objects.Confirm": "Are you sure you want to delete this object(s)? The object is deleted and cannot be recalled.",
|
||||
"Popup.Delete.Behavior.Confirm": "Are you sure you want to delete this behavior? The behavior is deleted and cannot be recalled.",
|
||||
"Popup.Restore.Behavior.Confirm": "Are you sure you want to reset all parameters of this behavior? This operation cannot be recalled.",
|
||||
"Popup.Setting.Title": "Preferences setting",
|
||||
"Popup.Add.Behavior.Title": "Add behavior",
|
||||
"Popup.Add.Behavior.Action.Add": "Add all select behavior",
|
||||
@ -108,6 +111,7 @@ const EN_US = {
|
||||
"Common.Attr.Key.Generation.Error.Invalid.Label": "The specified label has expired",
|
||||
"Common.Attr.Key.Kill.Random": "Random kill",
|
||||
"Common.Attr.Key.Kill.Count": "Kill count",
|
||||
"Common.Attr.Key.Behavior.Restore": "Restore default parameters",
|
||||
"Common.Render.Attr.Key.Display.Shape": "Display Shape",
|
||||
"Common.Render.Attr.Key.Display.Shape.Square": "Square",
|
||||
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "Hollow square",
|
||||
|
@ -57,8 +57,11 @@ const ZH_CN = {
|
||||
"Popup.Action.No": "取消",
|
||||
"Popup.Action.Objects.Confirm.Title": "删除确认",
|
||||
"Popup.Action.Objects.Confirm.Delete": "删除",
|
||||
"Popup.Action.Objects.Confirm.Restore.Title": "重置确认",
|
||||
"Popup.Action.Objects.Confirm.Restore": "重置",
|
||||
"Popup.Delete.Objects.Confirm": "你确定要删除这个(些)对象吗?对象被删除将无法撤回。",
|
||||
"Popup.Delete.Behavior.Confirm": "你确定要删除这个行为吗?行为被删除将无法撤回。",
|
||||
"Popup.Restore.Behavior.Confirm": "你确定要重置此行为的全部参数吗?此操作无法撤回。",
|
||||
"Popup.Setting.Title": "首选项设置",
|
||||
"Popup.Add.Behavior.Title": "添加行为",
|
||||
"Popup.Add.Behavior.Action.Add": "添加全部选中行为",
|
||||
@ -108,6 +111,7 @@ const ZH_CN = {
|
||||
"Common.Attr.Key.Generation.Error.Invalid.Label": "指定的标签已失效",
|
||||
"Common.Attr.Key.Kill.Random": "随机消除",
|
||||
"Common.Attr.Key.Kill.Count": "消除数量",
|
||||
"Common.Attr.Key.Behavior.Restore": "还原默认参数",
|
||||
"Common.Render.Attr.Key.Display.Shape": "显示形状",
|
||||
"Common.Render.Attr.Key.Display.Shape.Square": "方形",
|
||||
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "空心方形",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Component, ReactNode} from "react";
|
||||
import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting";
|
||||
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
|
||||
import { getDefaultValue } from "@Model/Parameter";
|
||||
import { IAnyBehavior } from "@Model/Behavior";
|
||||
import { Message } from "@Input/Message/Message";
|
||||
import { AttrInput } from "@Input/AttrInput/AttrInput";
|
||||
@ -12,9 +13,17 @@ import "./BehaviorDetails.scss";
|
||||
|
||||
interface IBehaviorDetailsProps {}
|
||||
|
||||
interface IBehaviorDetailsState {
|
||||
updateId: number;
|
||||
}
|
||||
|
||||
@useSettingWithEvent("language")
|
||||
@useStatusWithEvent("focusBehaviorChange", "behaviorAttrChange")
|
||||
class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProps & IMixinSettingProps> {
|
||||
class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProps & IMixinSettingProps, IBehaviorDetailsState> {
|
||||
|
||||
public state: Readonly<IBehaviorDetailsState> = {
|
||||
updateId: 1
|
||||
};
|
||||
|
||||
private handelDeleteBehavior = (behavior: IAnyBehavior) => {
|
||||
if (this.props.status) {
|
||||
@ -32,6 +41,28 @@ class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProp
|
||||
}
|
||||
}
|
||||
|
||||
private handelRestoreBehavior = (behavior: IAnyBehavior) => {
|
||||
if (this.props.status) {
|
||||
const status = this.props.status;
|
||||
status.popup.showPopup(ConfirmPopup, {
|
||||
infoI18n: "Popup.Restore.Behavior.Confirm",
|
||||
titleI18N: "Popup.Action.Objects.Confirm.Restore.Title",
|
||||
yesI18n: "Popup.Action.Objects.Confirm.Restore",
|
||||
red: "yes",
|
||||
yes: () => {
|
||||
status.changeBehaviorAttrib(
|
||||
behavior.id, "parameter",
|
||||
getDefaultValue(behavior.parameterOption) as any,
|
||||
true
|
||||
);
|
||||
this.setState({
|
||||
updateId: this.state.updateId + 1
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private renderFrom(behavior: IAnyBehavior): ReactNode {
|
||||
|
||||
return <>
|
||||
@ -60,9 +91,17 @@ class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProp
|
||||
this.handelDeleteBehavior(behavior)
|
||||
}}
|
||||
/>
|
||||
|
||||
<TogglesInput
|
||||
keyI18n="Common.Attr.Key.Behavior.Restore" red
|
||||
onIconName="ReplyAll" offIconName="ReplyAll"
|
||||
valueChange={() => {
|
||||
this.handelRestoreBehavior(behavior)
|
||||
}}
|
||||
/>
|
||||
|
||||
<Parameter
|
||||
key={behavior.id}
|
||||
key={`${behavior.id}-${this.state.updateId}`}
|
||||
option={behavior.parameterOption}
|
||||
value={behavior.parameter}
|
||||
i18n={(name, language) => behavior.getTerms(name, language)}
|
||||
|
Loading…
Reference in New Issue
Block a user