1
0
Fork 0

Polish implementation

hfjnulyz-patch-1
Jun Koyama 2021-06-26 22:41:25 +09:00
parent 8040d3fc6b
commit bec7c21ac4
No known key found for this signature in database
GPG Key ID: 04354943629F07D3
2 changed files with 19 additions and 21 deletions

View File

@ -8,7 +8,6 @@
import { CubismIdHandle } from '../id/cubismid'; import { CubismIdHandle } from '../id/cubismid';
import { CubismFramework } from '../live2dcubismframework'; import { CubismFramework } from '../live2dcubismframework';
import { csmString } from '../type/csmstring'; import { csmString } from '../type/csmstring';
import { csmVector } from '../type/csmvector';
import { CubismJson } from '../utils/cubismjson'; import { CubismJson } from '../utils/cubismjson';
// JSON keys // JSON keys
@ -226,12 +225,12 @@ export class CubismMotionJson {
* @return false * @return false
*/ */
public isExistMotionCurveFadeInTime(curveIndex: number): boolean { public isExistMotionCurveFadeInTime(curveIndex: number): boolean {
const value = this._json return !this._json
.getRoot() .getRoot()
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(FadeInTime); .getValueByString(FadeInTime)
return !(value.isNull() || value.isError()); .isNull();
} }
/** /**
@ -241,12 +240,12 @@ export class CubismMotionJson {
* @return false * @return false
*/ */
public isExistMotionCurveFadeOutTime(curveIndex: number): boolean { public isExistMotionCurveFadeOutTime(curveIndex: number): boolean {
const value = this._json return !this._json
.getRoot() .getRoot()
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(FadeOutTime); .getValueByString(FadeOutTime)
return !(value.isNull() || value.isError()); .isNull();
} }
/** /**
@ -288,7 +287,7 @@ export class CubismMotionJson {
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(Segments) .getValueByString(Segments)
.getVector(new csmVector()) .getVector()
.getSize(); .getSize();
} }

View File

@ -74,7 +74,7 @@ export abstract class Value {
/** /**
* (array) * (array)
*/ */
public getVector(defaultValue?: csmVector<Value>): csmVector<Value> { public getVector(defaultValue = new csmVector<Value>()): csmVector<Value> {
return defaultValue; return defaultValue;
} }
@ -192,11 +192,8 @@ export abstract class Value {
public static staticInitializeNotForClientCall(): void { public static staticInitializeNotForClientCall(): void {
JsonBoolean.trueValue = new JsonBoolean(true); JsonBoolean.trueValue = new JsonBoolean(true);
JsonBoolean.falseValue = new JsonBoolean(false); JsonBoolean.falseValue = new JsonBoolean(false);
Value.errorValue = new JsonError('ERROR', true);
JsonError.errorValue = new JsonError('ERROR', true); Value.nullValue = new JsonNullvalue();
this.nullValue = new JsonNullvalue();
this.errorValue = new JsonError('ERROR', true);
Value.s_dummyKeys = new csmVector<string>(); Value.s_dummyKeys = new csmVector<string>();
} }
@ -206,13 +203,7 @@ export abstract class Value {
public static staticReleaseNotForClientCall(): void { public static staticReleaseNotForClientCall(): void {
JsonBoolean.trueValue = null; JsonBoolean.trueValue = null;
JsonBoolean.falseValue = null; JsonBoolean.falseValue = null;
JsonError.errorValue = null; Value.errorValue = null;
Value.nullValue = null;
Value.s_dummyKeys = null;
JsonBoolean.trueValue = null;
JsonBoolean.falseValue = null;
JsonError.errorValue = null;
Value.nullValue = null; Value.nullValue = null;
Value.s_dummyKeys = null; Value.s_dummyKeys = null;
} }
@ -971,6 +962,14 @@ export class JsonNullvalue extends Value {
return true; return true;
} }
/**
* Value
*/
public setErrorNotForClientCall(s: string): Value {
this._stringBuffer = s;
return JsonError.nullValue;
}
/** /**
* *
*/ */