Skip to content

Commit 5a70956

Browse files
committed
Added modules
1 parent 9b137ac commit 5a70956

16 files changed

Lines changed: 767 additions & 164 deletions

.idea/workspace.xml

Lines changed: 222 additions & 146 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/scripting/Compatibility.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Compatibility 兼容性
2+
============================================
3+
We try to replicate as much functionality as we can, but sometimes it is just
4+
very hard to do. In such cases we will usually silently drop the functionality
5+
and issue a warning. If a functionality is critical to execution, it may also
6+
raise an error or fatal error. These cases are very rare.
7+
8+
我们在实现兼容层时尽可能保证了还原函数库,不过有时这样做确实很难。在这些情况下,我们可能会静默的
9+
抛弃一个方法实现,并输出一个警告。有时一个函数关乎运行的正确性时,我们才会抛出一个错误或者一个致命性
10+
错误。
11+
12+
Fatal Errors 致命性错误
13+
--------------------------------------------
14+
15+
### Syntax Error 语法错误
16+
语法错误,比如代码结尾多了 `}` 或者不遵循 ECMAScript 标准的代码將在解析时引发致命性错误。这些
17+
情况下你的代码將不被执行。
18+
19+
### Undeclared Variable 未定义对象
20+
未定义对象对于方法会引发致命性错误。在调用方法时如果有未定义对象,或者没有很好的执行空指针检查则会
21+
导致当前的执行空间引发致命性错误。如果此错误在回调函数中,则错误只会影响到函数本身,如果错误在你的
22+
代码的总命名空间下,则出现错误之后的代码将不会被执行。
23+
24+
### Security Error 安全冲突
25+
26+
Errors 错误
27+
---------------------------------------------
28+
在 CCL 引擎中,有两种引发普通错误的可能性。一种是引发了内部普通错误,另一种是引发了`new Error()`
29+
引发内部普通错误时,你的代码不会获知错误,这种情况的错误主要是由于我们API还原上的互换性问题。在这个
30+
情况下,你的其余代码还將继续执行。
31+
32+
另一种错误是引发了一个 JS Exception,这有可能是引发了自建错误,也可能是引发了 CCLScripter 模拟
33+
的错误。这种错误可以被 `try{...}catch(..){...}` 捕获,但是如果你的代码里没有进行捕获,则会变成
34+
一个致命性错误进而阻止之后代码的运行。
35+
36+
37+
Warnings 警告
38+
----------------------------------------------
39+
警告包括如下三种:
40+
41+
### Deprecation Warning 功能退役警告
42+
Deprecation Warning触发应该是因为你调用了一个即将退役的函数。函数在大多数情况下还会继续返回正确
43+
的结果,不过也有可能会失效。这些信息会在警告中给出。
44+
45+
### Unsupported Warning 非关键性互换性警告
46+
Unsupported Warning是CCLScripter产生的非关键性的“未实现”警告。产生警告的函数一般会模拟一种
47+
操作来最接近你的请求。最差的情况是函数完全没有作用。这个警告的原因可能是CCL还无法实现某个方法的还原
48+
或者CCL自建的体系不支持该操作(如,在HTML5下并没有/尚未产生对这个函数效果的还原方法)。
49+
50+
### Illegal Operation Warning 非法操作警告
51+
非法操作警告多出现于试图写入只读属性,或是试图调用非法函数,调用方法不正确等的警告。一般说明某个操作
52+
无效,但是不会影响执行。
53+
54+
Log 日志
55+
----------------------------------------------
56+
日志可以通过 `trace()` 产生。有时内部函数也会 trace 自己,不过这种情况很少。用户可以关闭日志和
57+
警告的产生,但是不能关闭错误。

docs/scripting/Scripting-Diagram.svg

Lines changed: 421 additions & 0 deletions
Loading

src/scripting/src/api/Display.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/scripting/src/api/Display/Bitmap.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/**
2-
* Created by jim on 5/19/14.
2+
* Bitmap Polyfill for AS3
3+
* Author: Jim Chen
4+
* Part of the CCLScripter
35
*/
46
module Display {
57
class Bitmap extends DisplayObject {

src/scripting/src/api/Display/CommentBitmap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Created by jim on 5/19/14.
2+
* Compliant CommentBitmap Polyfill For BiliScriptEngine
33
*/
44
module Display {
55
class CommentBitmap extends DisplayObject implements IComment {

src/scripting/src/api/Display/CommentData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* CommentData Adapter
2+
* Partially Compliant CommentData Adapter
33
*/
44
class CommentData {
55
private _dbid = 0;

src/scripting/src/api/Display/CommentField.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* Compliant CommentShape Polyfill For BiliScriptEngine
2+
* Compliant CommentField Polyfill For BiliScriptEngine
33
*/
44
module Display {
55
class CommentField extends TextField implements IComment {
66
private _mM:MotionManager = new MotionManager(this);
77

8-
constructor(params:Object) {
8+
constructor(text:string, params:Object) {
99
this.initStyle(params);
1010
}
1111

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Display Adapter
3+
* Author: Jim Chen
4+
*/
5+
6+
/// <reference path="ISerializable.ts" />
7+
/// <reference path="MotionManager.ts" />
8+
/// <reference path="DisplayObject.ts" />
9+
/// <reference path="IComment.ts" />
10+
/// <reference path="Sprite.ts" />
11+
/// <reference path="Bitmap.ts" />
12+
/// <reference path="Filter.ts" />
13+
/// <reference path="Graphics.ts" />
14+
/// <reference path="Shapes.ts" />
15+
module Display {
16+
var _root:DisplayObject;
17+
Object.defineProperty(Bar, 'qua', {
18+
get: function() { return _qua; },
19+
set: function(value) { _qua = value; }
20+
});
21+
export function createComment(text:string, params:Object):CommentField {
22+
return new CommentField(text, params);
23+
}
24+
25+
export function createCanvas(params:Object):CommentCanvas {
26+
return new CommentCanvas(params);
27+
}
28+
29+
export function createShape(params:Object):CommentShape {
30+
return new CommentShape(params);
31+
}
32+
33+
export function createButton(params:Object):CommentButton {
34+
return new CommentButton(params);
35+
}
36+
37+
export function createGlowFilter(color:number, alpha:number = 1.0, blurX:number = 6.0, blurY:number = 6.0, strength:number = 2, quality, inner:boolean = false, knockout:boolean = false) {
38+
39+
}
40+
}

src/scripting/src/api/Display/DisplayObject.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
/** This represents an element in the HTML rendering **/
1+
/**
2+
* Shape Polyfill for AS3.
3+
* Author: Jim Chen
4+
* Part of the CCLScripter
5+
*/
26
module Display {
37
class DisplayObject implements ISerializable {
8+
/** This represents an element in the HTML rendering **/
49
private _id:string = Runtime.getId();
510
private _alpha:number = 1;
611
private _x:number = 0;

0 commit comments

Comments
 (0)