@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
} ;
37
37
import showMessage from './message.js' ;
38
38
import randomSelection from './utils.js' ;
39
- var Model = /** @class */ ( function ( ) {
39
+ var Model = ( function ( ) {
40
40
function Model ( config ) {
41
41
this . modelList = null ;
42
42
var apiPath = config . apiPath , cdnPath = config . cdnPath ;
@@ -62,14 +62,14 @@ var Model = /** @class */ (function () {
62
62
var response , _a ;
63
63
return __generator ( this , function ( _b ) {
64
64
switch ( _b . label ) {
65
- case 0 : return [ 4 /*yield*/ , fetch ( "" . concat ( this . cdnPath , "model_list.json" ) ) ] ;
65
+ case 0 : return [ 4 , fetch ( "" . concat ( this . cdnPath , "model_list.json" ) ) ] ;
66
66
case 1 :
67
67
response = _b . sent ( ) ;
68
68
_a = this ;
69
- return [ 4 /*yield*/ , response . json ( ) ] ;
69
+ return [ 4 , response . json ( ) ] ;
70
70
case 2 :
71
71
_a . modelList = _b . sent ( ) ;
72
- return [ 2 /*return*/ ] ;
72
+ return [ 2 ] ;
73
73
}
74
74
} ) ;
75
75
} ) ;
@@ -83,21 +83,21 @@ var Model = /** @class */ (function () {
83
83
localStorage . setItem ( 'modelId' , modelId . toString ( ) ) ;
84
84
localStorage . setItem ( 'modelTexturesId' , modelTexturesId . toString ( ) ) ;
85
85
showMessage ( message , 4000 , 10 ) ;
86
- if ( ! ( this . useCDN && this . modelList ) ) return [ 3 /*break*/ , 3 ] ;
87
- if ( ! ! this . modelList ) return [ 3 /*break*/ , 2 ] ;
88
- return [ 4 /*yield*/ , this . loadModelList ( ) ] ;
86
+ if ( ! ( this . useCDN && this . modelList ) ) return [ 3 , 3 ] ;
87
+ if ( ! ! this . modelList ) return [ 3 , 2 ] ;
88
+ return [ 4 , this . loadModelList ( ) ] ;
89
89
case 1 :
90
90
_a . sent ( ) ;
91
91
_a . label = 2 ;
92
92
case 2 :
93
93
target = randomSelection ( this . modelList . models [ modelId ] ) ;
94
94
loadlive2d ( 'live2d' , "" . concat ( this . cdnPath , "model/" ) . concat ( target , "/index.json" ) ) ;
95
- return [ 3 /*break*/ , 4 ] ;
95
+ return [ 3 , 4 ] ;
96
96
case 3 :
97
97
loadlive2d ( 'live2d' , "" . concat ( this . apiPath , "get/?id=" ) . concat ( modelId , "-" ) . concat ( modelTexturesId ) ) ;
98
98
console . log ( "Live2D Model " . concat ( modelId , "-" ) . concat ( modelTexturesId , " Loaded" ) ) ;
99
99
_a . label = 4 ;
100
- case 4 : return [ 2 /*return*/ ] ;
100
+ case 4 : return [ 2 ] ;
101
101
}
102
102
} ) ;
103
103
} ) ;
@@ -111,19 +111,18 @@ var Model = /** @class */ (function () {
111
111
case 0 :
112
112
modelId = Number ( localStorage . getItem ( 'modelId' ) ) ;
113
113
modelTexturesId = Number ( localStorage . getItem ( 'modelTexturesId' ) ) ;
114
- if ( ! ( this . useCDN && modelId && this . modelList ) ) return [ 3 /*break*/ , 3 ] ;
115
- if ( ! ! this . modelList ) return [ 3 /*break*/ , 2 ] ;
116
- return [ 4 /*yield*/ , this . loadModelList ( ) ] ;
114
+ if ( ! ( this . useCDN && modelId && this . modelList ) ) return [ 3 , 3 ] ;
115
+ if ( ! ! this . modelList ) return [ 3 , 2 ] ;
116
+ return [ 4 , this . loadModelList ( ) ] ;
117
117
case 1 :
118
118
_a . sent ( ) ;
119
119
_a . label = 2 ;
120
120
case 2 :
121
121
target = randomSelection ( this . modelList . models [ modelId ] ) ;
122
122
loadlive2d ( 'live2d' , "" . concat ( this . cdnPath , "model/" ) . concat ( target , "/index.json" ) ) ;
123
123
showMessage ( '我的新衣服好看嘛?' , 4000 , 10 ) ;
124
- return [ 3 /*break*/ , 4 ] ;
124
+ return [ 3 , 4 ] ;
125
125
case 3 :
126
- // Optional "rand" (Random), "switch" (Switch by order)
127
126
fetch ( "" . concat ( this . apiPath , "rand_textures/?id=" ) . concat ( modelId , "-" ) . concat ( modelTexturesId ) )
128
127
. then ( function ( response ) { return response . json ( ) ; } )
129
128
. then ( function ( result ) {
@@ -136,7 +135,7 @@ var Model = /** @class */ (function () {
136
135
}
137
136
} ) ;
138
137
_a . label = 4 ;
139
- case 4 : return [ 2 /*return*/ ] ;
138
+ case 4 : return [ 2 ] ;
140
139
}
141
140
} ) ;
142
141
} ) ;
@@ -149,24 +148,24 @@ var Model = /** @class */ (function () {
149
148
switch ( _a . label ) {
150
149
case 0 :
151
150
modelId = Number ( localStorage . getItem ( 'modelId' ) ) ;
152
- if ( ! ( this . useCDN && modelId && this . modelList ) ) return [ 3 /*break*/ , 3 ] ;
153
- if ( ! ! this . modelList ) return [ 3 /*break*/ , 2 ] ;
154
- return [ 4 /*yield*/ , this . loadModelList ( ) ] ;
151
+ if ( ! ( this . useCDN && modelId && this . modelList ) ) return [ 3 , 3 ] ;
152
+ if ( ! ! this . modelList ) return [ 3 , 2 ] ;
153
+ return [ 4 , this . loadModelList ( ) ] ;
155
154
case 1 :
156
155
_a . sent ( ) ;
157
156
_a . label = 2 ;
158
157
case 2 :
159
158
index = ++ modelId >= this . modelList . models . length ? 0 : modelId ;
160
159
void this . loadModel ( index , 0 , this . modelList . messages [ index ] ) ;
161
- return [ 3 /*break*/ , 4 ] ;
160
+ return [ 3 , 4 ] ;
162
161
case 3 :
163
162
fetch ( "" . concat ( this . apiPath , "switch/?id=" ) . concat ( modelId ) )
164
163
. then ( function ( response ) { return response . json ( ) ; } )
165
164
. then ( function ( result ) {
166
165
_this . loadModel ( result . model . id , 0 , result . model . message ) ;
167
166
} ) ;
168
167
_a . label = 4 ;
169
- case 4 : return [ 2 /*return*/ ] ;
168
+ case 4 : return [ 2 ] ;
170
169
}
171
170
} ) ;
172
171
} ) ;
0 commit comments