Input typing and condition

This commit is contained in:
barsdeveloper
2022-11-11 21:51:53 +01:00
parent 48065a4777
commit c3743572fc
15 changed files with 90 additions and 26 deletions

View File

@@ -55,9 +55,11 @@ export default class Configuration {
"/Script/CoreUObject.Rotator": css`152, 171, 241`,
"/Script/CoreUObject.Transform": css`241, 110, 1`,
"/Script/CoreUObject.Vector": css`215, 202, 11`,
"/Script/Engine.Actor": css`0, 168, 240`,
"bool": css`117, 0, 0`,
"default": css`167, 167, 167`,
"exec": css`240, 240, 240`,
"int": css`32, 224, 173`,
"name": css`203, 129, 252`,
"real": css`50, 187, 0`,
"string": css`213, 0, 176`,

View File

@@ -2,6 +2,7 @@ import BoolPinTemplate from "../template/BoolPinTemplate"
import Configuration from "../Configuration"
import ExecPinTemplate from "../template/ExecPinTemplate"
import IElement from "./IElement"
import IntPinTemplate from "../template/IntPinTemplate"
import ISerializer from "../serialization/ISerializer"
import LinearColorEntity from "../entity/LinearColorEntity"
import LinearColorPinTemplate from "../template/LinearColorPinTemplate"
@@ -37,6 +38,7 @@ export default class PinElement extends IElement {
"/Script/CoreUObject.Vector": VectorPinTemplate,
"bool": BoolPinTemplate,
"exec": ExecPinTemplate,
"int": IntPinTemplate,
"MUTABLE_REFERENCE": ReferencePinTemplate,
"name": NamePinTemplate,
"real": RealPinTemplate,

View File

@@ -1,6 +1,7 @@
import CalculatedType from "./CalculatedType"
import GuidEntity from "./GuidEntity"
import IEntity from "./IEntity"
import IntegerEntity from "./IntegerEntity"
import LinearColorEntity from "./LinearColorEntity"
import LocalizedTextEntity from "./LocalizedTextEntity"
import ObjectReferenceEntity from "./ObjectReferenceEntity"
@@ -22,6 +23,7 @@ export default class PinEntity extends IEntity {
"/Script/CoreUObject.Vector": VectorEntity,
"bool": Boolean,
"exec": String,
"int": IntegerEntity,
"name": String,
"real": Number,
"string": String,
@@ -115,7 +117,7 @@ export default class PinEntity extends IEntity {
}
getType() {
if (this.PinType.PinCategory == "struct") {
if (this.PinType.PinCategory == "struct" || this.PinType.PinCategory == "object") {
return this.PinType.PinSubCategoryObject.path
}
return this.PinType.PinCategory

View File

@@ -32,7 +32,7 @@ export default class BoolPinTemplate extends PinTemplate {
}
renderInput() {
if (this.element.isInput()) {
if (this.element.isInput() && !this.element.isLinked) {
return html`
<input type="checkbox" class="ueb-pin-input" ?checked="${this.element.defaultValue}" />
`

View File

@@ -96,7 +96,7 @@ export default class IInputPinTemplate extends PinTemplate {
}
renderInput() {
if (this.element.isInput()) {
if (this.element.isInput() && !this.element.isLinked) {
// @ts-expect-error
const singleLine = this.constructor.singleLineInput
// @ts-expect-error

View File

@@ -0,0 +1,24 @@
import { html, nothing } from "lit"
import INumericPinTemplate from "./INumericPinTemplate"
/** @typedef {import("../entity/IntegerEntity").default} IntEntity */
/** @extends INumericPinTemplate<IntEntity> */
export default class IntPinTemplate extends INumericPinTemplate {
setDefaultValue(values = [], rawValues = values) {
this.element.setDefaultValue(values[0])
}
renderInput() {
if (this.element.isInput() && !this.element.isLinked) {
return html`
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}" .innerText="${this.element.entity.DefaultValue.toString()}">
</ueb-input>
</div>
`
}
return nothing
}
}

View File

@@ -66,7 +66,7 @@ export default class LinearColorPinTemplate extends IInputPinTemplate {
}
renderInput() {
if (this.element.isInput()) {
if (this.element.isInput() && !this.element.isLinked) {
return html`
<span class="ueb-pin-input" data-linear-color="${this.element.defaultValue.toString()}"
style="--ueb-linear-color: rgba(${this.element.defaultValue.toString()})">

View File

@@ -1,4 +1,4 @@
import { html } from "lit"
import { html, nothing } from "lit"
import IInputPinTemplate from "./IInputPinTemplate"
import INumericPinTemplate from "./INumericPinTemplate"
import Utility from "../Utility"
@@ -14,7 +14,7 @@ export default class RealPinTemplate extends INumericPinTemplate {
}
renderInput() {
if (this.element.isInput()) {
if (this.element.isInput() && !this.element.isLinked) {
return html`
<div class="ueb-pin-input">
<ueb-input .singleLine="${true}"
@@ -23,6 +23,6 @@ export default class RealPinTemplate extends INumericPinTemplate {
</div>
`
}
return html``
return nothing
}
}