Skip to content

Commit

Permalink
feat(SAI): add dynamic names/tooltips to Target* fields
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi committed May 23, 2020
1 parent 8c10377 commit a1c6eb3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
10 changes: 10 additions & 0 deletions src/app/shared/modules/sai-editor/constants/sai-targets.ts
Expand Up @@ -40,10 +40,18 @@ export const SAI_TARGET_PARAM1_NAMES = [];
export const SAI_TARGET_PARAM2_NAMES = [];
export const SAI_TARGET_PARAM3_NAMES = [];
export const SAI_TARGET_PARAM4_NAMES = [];
export const SAI_TARGET_X_NAMES = [];
export const SAI_TARGET_Y_NAMES = [];
export const SAI_TARGET_Z_NAMES = [];
export const SAI_TARGET_O_NAMES = [];
export const SAI_TARGET_PARAM1_TOOLTIPS = [];
export const SAI_TARGET_PARAM2_TOOLTIPS = [];
export const SAI_TARGET_PARAM3_TOOLTIPS = [];
export const SAI_TARGET_PARAM4_TOOLTIPS = [];
export const SAI_TARGET_X_TOOLTIPS = [];
export const SAI_TARGET_Y_TOOLTIPS = [];
export const SAI_TARGET_Z_TOOLTIPS = [];
export const SAI_TARGET_O_TOOLTIPS = [];

// SMART_TARGET_NONE
SAI_TARGET_TOOLTIPS[SAI_TARGETS.NONE] = 'No specified target. Only use this if you\'re sure the action type does not use targets at all (and event then it could not be safe. It\'s usually smart to default to SMART_TARGET_SELF (1)).';
Expand Down Expand Up @@ -194,3 +202,5 @@ SAI_TARGET_PARAM2_NAMES[SAI_TARGETS.PLAYER_WITH_AURA] = 'Negation';
SAI_TARGET_PARAM3_NAMES[SAI_TARGETS.PLAYER_WITH_AURA] = 'distMax';
SAI_TARGET_PARAM4_NAMES[SAI_TARGETS.PLAYER_WITH_AURA] = 'distMin';
SAI_TARGET_PARAM2_TOOLTIPS[SAI_TARGETS.PLAYER_WITH_AURA] = '(0/1) makes it inverted.';
SAI_TARGET_O_NAMES[SAI_TARGETS.PLAYER_WITH_AURA] = 'Resize';
SAI_TARGET_O_TOOLTIPS[SAI_TARGETS.PLAYER_WITH_AURA] = 'if set, it will resize the list of targets to this value';
32 changes: 28 additions & 4 deletions src/app/shared/modules/sai-editor/sai-editor.component.html
Expand Up @@ -425,7 +425,13 @@

<div class="form-row">
<div class="form-group col-5">
<label class="control-label">TargetX</label>
<label class="control-label" id="label-target-x">
{{ getName('TargetX', TARGET_X_NAMES[selectedTarget]) }} <i
class="fas fa-info-circle ml-1" [placement]="'auto'"
[hidden]="!TARGET_X_TOOLTIPS[selectedTarget]"
[tooltip]="TARGET_X_TOOLTIPS[selectedTarget]"
></i>
</label>
</div>

<div class="form-group col-7">
Expand All @@ -435,7 +441,13 @@

<div class="form-row">
<div class="form-group col-5">
<label class="control-label">TargetY</label>
<label class="control-label" id="label-target-y">
{{ getName('TargetY', TARGET_Y_NAMES[selectedTarget]) }} <i
class="fas fa-info-circle ml-1" [placement]="'auto'"
[hidden]="!TARGET_Y_TOOLTIPS[selectedTarget]"
[tooltip]="TARGET_Y_TOOLTIPS[selectedTarget]"
></i>
</label>
</div>

<div class="form-group col-7">
Expand All @@ -445,7 +457,13 @@

<div class="form-row">
<div class="form-group col-5">
<label class="control-label">TargetZ</label>
<label class="control-label" id="label-target-z">
{{ getName('TargetZ', TARGET_Z_NAMES[selectedTarget]) }} <i
class="fas fa-info-circle ml-1" [placement]="'auto'"
[hidden]="!TARGET_Z_TOOLTIPS[selectedTarget]"
[tooltip]="TARGET_Z_TOOLTIPS[selectedTarget]"
></i>
</label>
</div>

<div class="form-group col-7">
Expand All @@ -455,7 +473,13 @@

<div class="form-row">
<div class="form-group col-5">
<label class="control-label">TargetO</label>
<label class="control-label" id="label-target-o">
{{ getName('TargetO', TARGET_O_NAMES[selectedTarget]) }} <i
class="fas fa-info-circle ml-1" [placement]="'auto'"
[hidden]="!TARGET_O_TOOLTIPS[selectedTarget]"
[tooltip]="TARGET_O_TOOLTIPS[selectedTarget]"
></i>
</label>
</div>

<div class="form-group col-7">
Expand Down
12 changes: 11 additions & 1 deletion src/app/shared/modules/sai-editor/sai-editor.component.ts
Expand Up @@ -30,7 +30,9 @@ import {
SAI_TARGET_PARAM2_TOOLTIPS, SAI_TARGET_PARAM3_NAMES,
SAI_TARGET_PARAM3_TOOLTIPS,
SAI_TARGET_PARAM4_NAMES,
SAI_TARGET_PARAM4_TOOLTIPS, SAI_TARGET_TOOLTIPS, SAI_TARGETS, SAI_TARGETS_KEYS
SAI_TARGET_PARAM4_TOOLTIPS, SAI_TARGET_TOOLTIPS, SAI_TARGETS, SAI_TARGETS_KEYS,
SAI_TARGET_X_NAMES, SAI_TARGET_Y_NAMES, SAI_TARGET_Z_NAMES, SAI_TARGET_O_NAMES,
SAI_TARGET_X_TOOLTIPS, SAI_TARGET_Y_TOOLTIPS, SAI_TARGET_Z_TOOLTIPS, SAI_TARGET_O_TOOLTIPS,
} from './constants/sai-targets';
import { EVENT_PHASE_MASK } from '../../constants/flags/event-phase-mask';
import { SMART_EVENT_FLAGS } from '../../constants/flags/smart-event-flags';
Expand Down Expand Up @@ -68,6 +70,10 @@ export class SaiEditorComponent extends MultiRowEditorComponent<SmartScripts> im
public readonly TARGET_PARAM2_NAMES = SAI_TARGET_PARAM2_NAMES;
public readonly TARGET_PARAM3_NAMES = SAI_TARGET_PARAM3_NAMES;
public readonly TARGET_PARAM4_NAMES = SAI_TARGET_PARAM4_NAMES;
public readonly TARGET_X_NAMES = SAI_TARGET_X_NAMES;
public readonly TARGET_Y_NAMES = SAI_TARGET_Y_NAMES;
public readonly TARGET_Z_NAMES = SAI_TARGET_Z_NAMES;
public readonly TARGET_O_NAMES = SAI_TARGET_O_NAMES;
public readonly EVENT_PARAM1_TOOLTIPS = SAI_EVENT_PARAM1_TOOLTIPS;
public readonly EVENT_PARAM2_TOOLTIPS = SAI_EVENT_PARAM2_TOOLTIPS;
public readonly EVENT_PARAM3_TOOLTIPS = SAI_EVENT_PARAM3_TOOLTIPS;
Expand All @@ -83,6 +89,10 @@ export class SaiEditorComponent extends MultiRowEditorComponent<SmartScripts> im
public readonly TARGET_PARAM2_TOOLTIPS = SAI_TARGET_PARAM2_TOOLTIPS;
public readonly TARGET_PARAM3_TOOLTIPS = SAI_TARGET_PARAM3_TOOLTIPS;
public readonly TARGET_PARAM4_TOOLTIPS = SAI_TARGET_PARAM4_TOOLTIPS;
public readonly TARGET_X_TOOLTIPS = SAI_TARGET_X_TOOLTIPS;
public readonly TARGET_Y_TOOLTIPS = SAI_TARGET_Y_TOOLTIPS;
public readonly TARGET_Z_TOOLTIPS = SAI_TARGET_Z_TOOLTIPS;
public readonly TARGET_O_TOOLTIPS = SAI_TARGET_O_TOOLTIPS;

get selectedEvent(): number {
return this.editorService.form.controls.event_type.value;
Expand Down

0 comments on commit a1c6eb3

Please sign in to comment.