Polish implementation

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

View File

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