├── .DS_Store ├── .gitignore ├── LICENSE.txt ├── README.md ├── build ├── fairygui.esm.js ├── fairygui.esm.js.map ├── fairygui.js ├── fairygui.js.map └── types │ ├── AssetProxy.d.ts │ ├── AsyncOperation.d.ts │ ├── Controller.d.ts │ ├── DragDropManager.d.ts │ ├── Events.d.ts │ ├── FieldTypes.d.ts │ ├── GBasicTextField.d.ts │ ├── GButton.d.ts │ ├── GComboBox.d.ts │ ├── GComponent.d.ts │ ├── GGraph.d.ts │ ├── GGroup.d.ts │ ├── GImage.d.ts │ ├── GJoyStick.d.ts │ ├── GLabel.d.ts │ ├── GList.d.ts │ ├── GLoader.d.ts │ ├── GMovieClip.d.ts │ ├── GObject.d.ts │ ├── GObjectPool.d.ts │ ├── GProgressBar.d.ts │ ├── GRichTextField.d.ts │ ├── GRoot.d.ts │ ├── GScrollBar.d.ts │ ├── GSlider.d.ts │ ├── GTextField.d.ts │ ├── GTextInput.d.ts │ ├── GTree.d.ts │ ├── GTreeNode.d.ts │ ├── IUISource.d.ts │ ├── Margin.d.ts │ ├── PackageItem.d.ts │ ├── PopupMenu.d.ts │ ├── RelationItem.d.ts │ ├── Relations.d.ts │ ├── ScrollPane.d.ts │ ├── Test.d.ts │ ├── Transition.d.ts │ ├── TranslationHelper.d.ts │ ├── UIConfig.d.ts │ ├── UIObjectFactory.d.ts │ ├── UIPackage.d.ts │ ├── Window.d.ts │ ├── action │ ├── ChangePageAction.d.ts │ ├── ControllerAction.d.ts │ ├── PlayTransitionAction.d.ts │ └── index.d.ts │ ├── display │ ├── BitmapFont.d.ts │ ├── FillUtils.d.ts │ ├── Graphics.d.ts │ ├── Image.d.ts │ ├── InputTextField.d.ts │ ├── MovieClip.d.ts │ ├── UIStage.d.ts │ ├── displayobject │ │ ├── DisplayObject.d.ts │ │ ├── Origin.d.ts │ │ ├── Pipeline.d.ts │ │ └── Transform.d.ts │ ├── index.d.ts │ └── text │ │ ├── MeasureText.d.ts │ │ ├── TextField.d.ts │ │ ├── Types.d.ts │ │ ├── WrapText.d.ts │ │ ├── bbcode │ │ └── Parser.d.ts │ │ ├── canvastext │ │ ├── CanvasText.d.ts │ │ ├── DrawMethods.d.ts │ │ └── SyncContextMethods.d.ts │ │ ├── const.d.ts │ │ ├── hitareamanager │ │ └── HitAreaManager.d.ts │ │ ├── imagemanager │ │ ├── IImageManager.d.ts │ │ └── ImageManager.d.ts │ │ ├── penmanager │ │ ├── Line.d.ts │ │ ├── Pen.d.ts │ │ ├── PenManager.d.ts │ │ ├── TextMetrics.d.ts │ │ └── UpdatePenManager.d.ts │ │ ├── renderer │ │ ├── CanvasRenderer.d.ts │ │ └── WebGLRenderer.d.ts │ │ └── style │ │ └── TextStyle.d.ts │ ├── event │ ├── DisplayObjectEvent.d.ts │ ├── Event.d.ts │ └── index.d.ts │ ├── gears │ ├── GearAnimation.d.ts │ ├── GearBase.d.ts │ ├── GearColor.d.ts │ ├── GearDisplay.d.ts │ ├── GearDisplay2.d.ts │ ├── GearFontSize.d.ts │ ├── GearIcon.d.ts │ ├── GearLook.d.ts │ ├── GearSize.d.ts │ ├── GearText.d.ts │ ├── GearXY.d.ts │ └── index.d.ts │ ├── index.d.ts │ ├── input │ └── InputManager.d.ts │ ├── texture │ └── TextureManager.d.ts │ ├── tween │ ├── EaseManager.d.ts │ ├── EaseType.d.ts │ ├── GPath.d.ts │ ├── GPathPoint.d.ts │ ├── GTween.d.ts │ ├── GTweener.d.ts │ ├── TweenManager.d.ts │ ├── TweenValue.d.ts │ └── index.d.ts │ └── utils │ ├── Byte.d.ts │ ├── ByteBuffer.d.ts │ ├── ChildHitArea.d.ts │ ├── ColorMatrix.d.ts │ ├── DOMEventManager.d.ts │ ├── Handler.d.ts │ ├── HitArea.d.ts │ ├── PixelHitTest.d.ts │ ├── Pool.d.ts │ ├── ToolSet.d.ts │ ├── UBBParser.d.ts │ ├── Utils.d.ts │ ├── colorShader │ ├── BlueShaderPipeline.d.ts │ ├── ColorShaderPipeline.d.ts │ ├── GrayShaderPipeline.d.ts │ ├── GreenShaderPipeline.d.ts │ ├── RedShaderPipeline.d.ts │ └── SingleShaderPipeline.d.ts │ ├── index.d.ts │ └── outlineShader │ └── OutlineShaderPipeline.d.ts ├── docs ├── _config.yml ├── index.md └── publish │ ├── assets │ ├── Bag.fui │ ├── Bag_atlas0.png │ ├── Basic.fui │ ├── Basic_atlas0.png │ ├── Basics.fui │ ├── Basics_atlas0.png │ ├── Basics_gojg7u.wav │ ├── Basics_o4lt7w.wav │ ├── Chat.fui │ ├── Chat_atlas0.png │ ├── ColorShaderPipeline.js │ ├── MainMenu.fui │ ├── MainMenu_atlas0.png │ ├── Package1.fui │ ├── Package1_atlas0.png │ ├── PullToRefresh.fui │ ├── PullToRefresh_atlas0.png │ ├── ScrollPane.fui │ ├── ScrollPane_atlas0.jpg │ ├── Tooqing.fui │ ├── Tooqing_atlas0.png │ ├── TreeView.fui │ ├── TreeView_atlas0.png │ ├── blue.png │ ├── gif-0.webp │ ├── particles │ │ └── red.png │ ├── snow_(1).png │ ├── snow_(10).png │ ├── snow_(2).png │ ├── snow_(3).png │ ├── snow_(4).png │ ├── snow_(5).png │ ├── snow_(6).png │ ├── snow_(7).png │ ├── snow_(8).png │ ├── snow_(9).png │ ├── star0.jpg │ ├── star1.jpg │ ├── star10.jpg │ ├── star11.jpg │ ├── star12.jpg │ ├── star13.jpg │ ├── star14.jpg │ ├── star15.jpg │ ├── star16.jpg │ ├── star17.jpg │ ├── star18.jpg │ ├── star19.jpg │ ├── star2.jpg │ ├── star20.jpg │ ├── star21.jpg │ ├── star22.jpg │ ├── star23.jpg │ ├── star24.jpg │ ├── star25.jpg │ ├── star26.jpg │ ├── star27.jpg │ ├── star28.jpg │ ├── star29.jpg │ ├── star3.jpg │ ├── star4.jpg │ ├── star5.jpg │ ├── star6.jpg │ ├── star7.jpg │ ├── star8.jpg │ ├── star9.jpg │ └── webfont │ │ ├── 04B.ttf │ │ ├── SketchStyleNumber.fnt │ │ ├── tt0173m_.ttf │ │ └── webfont.js │ ├── index.html │ └── main.js ├── dts-bundle.json ├── gulpfile.js ├── package.json ├── rollup.config.js ├── src ├── .DS_Store ├── AssetProxy.ts ├── AsyncOperation.ts ├── Controller.ts ├── DragDropManager.ts ├── Events.ts ├── FieldTypes.ts ├── GBasicTextField.ts ├── GButton.ts ├── GComboBox.ts ├── GComponent.ts ├── GGraph.ts ├── GGroup.ts ├── GImage.ts ├── GJoyStick.ts ├── GLabel.ts ├── GList.ts ├── GLoader.ts ├── GMovieClip.ts ├── GObject.ts ├── GObjectPool.ts ├── GProgressBar.ts ├── GRichTextField.ts ├── GRoot.ts ├── GScrollBar.ts ├── GSlider.ts ├── GTextField.ts ├── GTextInput.ts ├── GTree.ts ├── GTreeNode.ts ├── IUISource.ts ├── Margin.ts ├── PackageItem.ts ├── PopupMenu.ts ├── RelationItem.ts ├── Relations.ts ├── ScrollPane.ts ├── Test.ts ├── Transition.ts ├── TranslationHelper.ts ├── UIConfig.ts ├── UIObjectFactory.ts ├── UIPackage.ts ├── Window.ts ├── action │ ├── ChangePageAction.ts │ ├── ControllerAction.ts │ ├── PlayTransitionAction.ts │ └── index.ts ├── display │ ├── BitmapFont.ts │ ├── FillUtils.ts │ ├── Graphics.ts │ ├── Image.ts │ ├── InputTextField.ts │ ├── MovieClip.ts │ ├── UIStage.ts │ ├── displayobject │ │ ├── DisplayObject.ts │ │ ├── Origin.ts │ │ ├── Pipeline.ts │ │ └── Transform.ts │ ├── index.ts │ └── text │ │ ├── LinePool.ts │ │ ├── MeasureText.ts │ │ ├── TextField.ts │ │ ├── Types.ts │ │ ├── WrapText.ts │ │ ├── bbcode │ │ └── Parser.ts │ │ ├── canvastext │ │ ├── CanvasText.ts │ │ ├── DrawMethods.ts │ │ └── SyncContextMethods.ts │ │ ├── const.ts │ │ ├── hitareamanager │ │ └── HitAreaManager.ts │ │ ├── imagemanager │ │ ├── IImageManager.ts │ │ └── ImageManager.ts │ │ ├── penmanager │ │ ├── Line.ts │ │ ├── Pen.ts │ │ ├── PenManager.ts │ │ ├── TextMetrics.ts │ │ └── UpdatePenManager.ts │ │ ├── renderer │ │ ├── CanvasRenderer.ts │ │ └── WebGLRenderer.ts │ │ └── style │ │ └── TextStyle.ts ├── event │ ├── DisplayObjectEvent.ts │ ├── Event.ts │ └── index.ts ├── gears │ ├── GearAnimation.ts │ ├── GearBase.ts │ ├── GearColor.ts │ ├── GearDisplay.ts │ ├── GearDisplay2.ts │ ├── GearFontSize.ts │ ├── GearIcon.ts │ ├── GearLook.ts │ ├── GearSize.ts │ ├── GearText.ts │ ├── GearXY.ts │ └── index.ts ├── index.ts ├── input │ └── InputManager.ts ├── texture │ └── TextureManager.ts ├── tween │ ├── EaseManager.ts │ ├── EaseType.ts │ ├── GPath.ts │ ├── GPathPoint.ts │ ├── GTween.ts │ ├── GTweener.ts │ ├── TweenManager.ts │ ├── TweenValue.ts │ └── index.ts └── utils │ ├── Byte.ts │ ├── ByteBuffer.ts │ ├── ChildHitArea.ts │ ├── ColorMatrix.ts │ ├── DOMEventManager.ts │ ├── Handler.ts │ ├── HitArea.ts │ ├── ObjectUtils.ts │ ├── PixelHitTest.ts │ ├── Pool.ts │ ├── ToolSet.ts │ ├── UBBParser.ts │ ├── Utils.ts │ ├── colorShader │ ├── BlueShaderPipeline.ts │ ├── ColorShaderPipeline.ts │ ├── GrayShaderPipeline.ts │ ├── GreenShaderPipeline.ts │ ├── RedShaderPipeline.ts │ └── SingleShaderPipeline.ts │ ├── index.ts │ └── outlineShader │ └── OutlineShaderPipeline.ts ├── test.html ├── tree.html ├── tsconfig.json ├── typings └── global.d.ts ├── version.js ├── yarn-error.log └── yarn.lock /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | .DS_Store 4 | .vscode 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2022 Scott Chacon and others 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FairyGUI-Phaser(For Phaser3 V3.55.0 ) 2 | ==== 3 | 4 | A flexible UI framework for Phaser3, working with the FREE professional Game UI Editor: FairyGUI Editor. 5 | 6 | [Demo Project](https://github.com/akeboshi1/fairygui-phaser-test.git) 7 | [Examples](https://ApowoGames.github.io/FairyGUI-Phaser/publish/) 8 | [API Reference](https://www.fairygui.com/learn) 9 | [Related Editor](https://www.fairygui.com/download) 10 | 11 | 12 | P.S. If you have any questions, please submit an issue. The plugin is still under development. We can help the project grow better. :)
13 | **The phaser version under this link (https://github.com/ApowoGames/phaser3.git) is used in the project, and the color filters, graphics deformation and other modifications are added internally, which are generally based on the v3.55.0 version of the original project** 14 | 15 | -------------------------------------------------------------------------------- /build/types/AssetProxy.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum LoaderType { 2 | IMAGE = "image", 3 | ATLAS = "atlas", 4 | AUDIO = "audio", 5 | VIDEO = "video", 6 | JSON = "json", 7 | SCRIPT = "script", 8 | GLSL = "glsl", 9 | BITMAPFONT = "bitmapFont", 10 | SPRITESHEET = "spritesheet" 11 | } 12 | export interface IResCallBackObj { 13 | id: string; 14 | completeCallBack: Function; 15 | errorCallBack?: Function; 16 | context?: any; 17 | } 18 | export declare class AssetProxy { 19 | private _resMap; 20 | private _resCallBackMap; 21 | private _emitter; 22 | constructor(); 23 | get emitter(): Phaser.Events.EventEmitter; 24 | private static _inst; 25 | static get inst(): AssetProxy; 26 | getRes(id: string, key: string, type: string): Promise; 27 | load(id: string, key: string, url: any, type: string, completeCallBack: Function, errorCallBack?: Function, context?: any): void; 28 | addListen(type: string, key: string): void; 29 | removeListen(): void; 30 | startLoad(): void; 31 | private totalComplete; 32 | private onLoadComplete; 33 | private onLoadError; 34 | } 35 | -------------------------------------------------------------------------------- /build/types/AsyncOperation.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './GObject'; 2 | export declare class AsyncOperation { 3 | /** 4 | * this.callback(obj:GObject) 5 | */ 6 | callback: (obj: GObject) => void; 7 | private _itemList; 8 | private _objectPool; 9 | private _index; 10 | constructor(); 11 | createObject(pkgName: string, resName: string): void; 12 | createObjectFromURL(url: string): void; 13 | cancel(): void; 14 | private internalCreateObject; 15 | private collectComponentChildren; 16 | private collectListChildren; 17 | private run; 18 | } 19 | -------------------------------------------------------------------------------- /build/types/Controller.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GComponent } from "./GComponent"; 3 | export declare class Controller extends Phaser.Events.EventEmitter { 4 | private _selectedIndex; 5 | private _previousIndex; 6 | private _pageIds; 7 | private _pageNames; 8 | private _actions?; 9 | name: string; 10 | parent: GComponent; 11 | autoRadioGroupDepth?: boolean; 12 | changing: boolean; 13 | constructor(); 14 | dispose(): void; 15 | get selectedIndex(): number; 16 | set selectedIndex(value: number); 17 | /** 18 | * 功能和设置selectedIndex一样,但不会触发事件 19 | */ 20 | setSelectedIndex(value: number): void; 21 | get previsousIndex(): number; 22 | get selectedPage(): string; 23 | set selectedPage(val: string); 24 | /** 25 | * 功能和设置selectedPage一样,但不会触发事件 26 | */ 27 | setSelectedPage(value: string): void; 28 | get previousPage(): string; 29 | get pageCount(): number; 30 | getPageName(index: number): string; 31 | addPage(name: string): void; 32 | addPageAt(name: string, index: number): void; 33 | removePage(name: string): void; 34 | removePageAt(index: number): void; 35 | clearPages(): void; 36 | hasPage(aName: string): boolean; 37 | getPageIndexById(aId: string): number; 38 | getPageIdByName(aName: string): string; 39 | getPageNameById(aId: string): string; 40 | getPageId(index: number): string; 41 | get selectedPageId(): string; 42 | set selectedPageId(val: string); 43 | set oppositePageId(val: string); 44 | get previousPageId(): string; 45 | runActions(): void; 46 | setup(buffer: ByteBuffer): void; 47 | } 48 | -------------------------------------------------------------------------------- /build/types/DragDropManager.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './GObject'; 2 | export declare class DragDropManager { 3 | private _agent; 4 | private _sourceData; 5 | private static _inst; 6 | static get inst(): DragDropManager; 7 | constructor(); 8 | get dragAgent(): GObject; 9 | get dragging(): boolean; 10 | startDrag(source: GObject, icon: string, sourceData?: any, touchID?: number): void; 11 | cancel(): void; 12 | private __dragEnd; 13 | } 14 | -------------------------------------------------------------------------------- /build/types/Events.d.ts: -------------------------------------------------------------------------------- 1 | import { InteractiveEvent } from "./event/DisplayObjectEvent"; 2 | export declare class Events { 3 | static STATE_CHANGED: string; 4 | static XY_CHANGED: string; 5 | static SIZE_CHANGED: string; 6 | static SIZE_DELAY_CHANGE: string; 7 | static CLICK_ITEM: string; 8 | static SCROLL: string; 9 | static SCROLL_END: string; 10 | static DROP: string; 11 | static DRAG_START: string; 12 | static DRAG_MOVE: string; 13 | static DRAG_END: string; 14 | static PULL_DOWN_RELEASE: string; 15 | static PULL_UP_RELEASE: string; 16 | static GEAR_STOP: string; 17 | static LOADER_COMPLETE: string; 18 | static $event: InteractiveEvent; 19 | static createEvent(type: string, target: Phaser.GameObjects.GameObject, source?: { 20 | target?: Phaser.GameObjects.GameObject; 21 | touchId?: number; 22 | }): InteractiveEvent; 23 | static dispatch(type: string, target: Phaser.GameObjects.GameObject, source?: { 24 | target?: Phaser.GameObjects.GameObject; 25 | touchId?: number; 26 | }): void; 27 | } 28 | -------------------------------------------------------------------------------- /build/types/GBasicTextField.d.ts: -------------------------------------------------------------------------------- 1 | import { GTextField } from './GTextField'; 2 | import { TextField } from './display/text/TextField'; 3 | import { ByteBuffer } from '.'; 4 | import { HAlignModeString, VAlignModeString } from './display/text/Types'; 5 | export declare class GBasicTextField extends GTextField { 6 | protected _textField: TextField; 7 | private _textWidth; 8 | private _textHeight; 9 | private _bitmapFont?; 10 | private _lines?; 11 | constructor(scene: Phaser.Scene, type: number); 12 | private i18nChange; 13 | get adaptiveScaleX(): number; 14 | get adaptiveScaleY(): number; 15 | set adaptiveScaleX(val: number); 16 | set adaptiveScaleY(val: number); 17 | createDisplayObject(): void; 18 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 19 | setResolution(val: any): void; 20 | get nativeText(): TextField; 21 | set text(value: any); 22 | get text(): any; 23 | get font(): string; 24 | set font(value: string); 25 | get fontSize(): number; 26 | set fontSize(value: number); 27 | get color(): string; 28 | set color(value: string); 29 | get align(): HAlignModeString; 30 | set align(value: HAlignModeString); 31 | get valign(): VAlignModeString; 32 | set valign(value: VAlignModeString); 33 | get leading(): number; 34 | set leading(value: number); 35 | get letterSpacing(): number; 36 | set letterSpacing(value: number); 37 | get bold(): boolean; 38 | set bold(value: boolean); 39 | get italic(): boolean; 40 | set italic(value: boolean); 41 | get underline(): boolean; 42 | set underline(value: boolean); 43 | get singleLine(): boolean; 44 | set singleLine(value: boolean); 45 | get stroke(): number; 46 | set stroke(value: number); 47 | get strokeColor(): string; 48 | set strokeColor(value: string); 49 | setStroke(color: string, thickness: number): void; 50 | setShadowStyle(color: string): void; 51 | setShadowOffset(x: number, y: number): void; 52 | protected updateAutoSize(): void; 53 | get textWidth(): number; 54 | get textHeight(): number; 55 | ensureSizeCorrect(): void; 56 | typeset(): void; 57 | protected updateSize(): void; 58 | dispose(): void; 59 | private renderWithBitmapFont; 60 | protected handleGrayedChanged(): void; 61 | protected doAlign(): void; 62 | protected handleXYChanged1(): void; 63 | flushVars(): void; 64 | } 65 | export interface LineInfo { 66 | width: number; 67 | height: number; 68 | textHeight: number; 69 | text: string; 70 | y: number; 71 | } 72 | -------------------------------------------------------------------------------- /build/types/GButton.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GTextField } from './GTextField'; 3 | import { Controller } from './Controller'; 4 | import { GObject } from './GObject'; 5 | import { GComponent } from "./GComponent"; 6 | export declare class GButton extends GComponent { 7 | protected _titleObject: GObject; 8 | protected _iconObject: GObject; 9 | private _mode; 10 | private _selected; 11 | private _title; 12 | private _selectedTitle; 13 | private _icon; 14 | private _selectedIcon; 15 | private _sound; 16 | private _soundVolumeScale; 17 | private _buttonController; 18 | private _relatedController; 19 | private _relatedPageId; 20 | private _changeStateOnClick; 21 | private _linkedPopup?; 22 | private _downEffect; 23 | private _downEffectValue; 24 | private _downScaled?; 25 | private _down; 26 | private _over; 27 | static UP: string; 28 | static DOWN: string; 29 | static OVER: string; 30 | static SELECTED_OVER: string; 31 | static DISABLED: string; 32 | static SELECTED_DISABLED: string; 33 | constructor(scene: Phaser.Scene, type: any); 34 | createDisplayObject(): void; 35 | get icon(): string; 36 | set icon(value: string); 37 | get selectedIcon(): string; 38 | set selectedIcon(value: string); 39 | get title(): string; 40 | set title(value: string); 41 | get text(): string; 42 | set text(value: string); 43 | get selectedTitle(): string; 44 | set selectedTitle(value: string); 45 | get titleColor(): string; 46 | set titleColor(value: string); 47 | get titleFontSize(): number; 48 | set titleFontSize(value: number); 49 | get sound(): string; 50 | set sound(val: string); 51 | get soundVolumeScale(): number; 52 | set soundVolumeScale(value: number); 53 | set selected(val: boolean); 54 | get selected(): boolean; 55 | get mode(): number; 56 | set mode(value: number); 57 | get relatedController(): Controller; 58 | set relatedController(val: Controller); 59 | get relatedPageId(): string; 60 | set relatedPageId(val: string); 61 | get changeStateOnClick(): boolean; 62 | set changeStateOnClick(value: boolean); 63 | get linkedPopup(): GObject; 64 | set linkedPopup(value: GObject); 65 | getTextField(): GTextField; 66 | protected setState(val: string): void; 67 | changeInteractive(): void; 68 | handleControllerChanged(c: Controller): void; 69 | protected handleGrayedChanged(): void; 70 | getProp(index: number): any; 71 | setProp(index: number, value: any): void; 72 | protected constructExtension(buffer: ByteBuffer): Promise; 73 | addListener(): void; 74 | removeListener(): void; 75 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): Promise; 76 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 77 | constructFromResource2(objectPool: GObject[], poolIndex: number): Promise; 78 | private __rollover; 79 | private __rollout; 80 | private __mousedown; 81 | private __mouseup; 82 | private __click; 83 | } 84 | -------------------------------------------------------------------------------- /build/types/GComboBox.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GTextField } from './GTextField'; 3 | import { Controller } from './Controller'; 4 | import { PopupDirection } from './FieldTypes'; 5 | import { GList } from './GList'; 6 | import { GObject } from './GObject'; 7 | import { GComponent } from "./GComponent"; 8 | export declare class GComboBox extends GComponent { 9 | dropdown: GComponent; 10 | protected _titleObject: GObject; 11 | protected _iconObject: GObject; 12 | protected _list: GList; 13 | protected _items: string[]; 14 | protected _icons?: string[]; 15 | protected _values: string[]; 16 | protected _popupDirection: PopupDirection; 17 | private _visibleItemCount; 18 | private _itemsUpdated; 19 | private _selectedIndex; 20 | private _buttonController; 21 | private _selectionController?; 22 | private _down; 23 | private _over; 24 | constructor(scene: Phaser.Scene, type: any); 25 | setSize(wv: number, hv: number, ignorePivot?: boolean): void; 26 | get text(): string; 27 | set text(value: string); 28 | get titleColor(): string; 29 | set titleColor(value: string); 30 | get titleFontSize(): number; 31 | set titleFontSize(value: number); 32 | get icon(): string; 33 | set icon(value: string); 34 | get visibleItemCount(): number; 35 | set visibleItemCount(value: number); 36 | get popupDirection(): number; 37 | set popupDirection(value: number); 38 | get items(): string[]; 39 | set items(value: string[]); 40 | get icons(): string[]; 41 | set icons(value: string[]); 42 | get values(): string[]; 43 | set values(value: string[]); 44 | get selectedIndex(): number; 45 | set selectedIndex(val: number); 46 | get value(): string; 47 | set value(val: string); 48 | getTextField(): GTextField; 49 | protected setState(val: string): void; 50 | get selectionController(): Controller; 51 | set selectionController(value: Controller); 52 | handleControllerChanged(c: Controller): void; 53 | private updateSelectionController; 54 | dispose(): void; 55 | getProp(index: number): any; 56 | setProp(index: number, value: any): void; 57 | protected constructExtension(buffer: ByteBuffer): Promise; 58 | private addListen; 59 | private removeListen; 60 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 61 | protected showDropdown(): Promise; 62 | private __popupWinClosed; 63 | private __clickItem; 64 | private __clickItem2; 65 | private __rollover; 66 | private __rollout; 67 | private __mousedown; 68 | private __mouseup; 69 | } 70 | -------------------------------------------------------------------------------- /build/types/GGraph.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GObject } from './GObject'; 3 | import { Graphics } from '.'; 4 | export declare class GGraph extends GObject { 5 | private _type; 6 | private _lineSize; 7 | private _lineColor; 8 | private _fillColor; 9 | private _cornerRadius?; 10 | private _hitArea?; 11 | private _sides?; 12 | private _startAngle?; 13 | private _polygonPoints?; 14 | private _distances?; 15 | private _graphics; 16 | constructor(scene: Phaser.Scene, type: any); 17 | get displayType(): number; 18 | get graphics(): Graphics; 19 | drawRect(lineSize: number, lineColor: string, fillColor: string, cornerRadius?: number[]): void; 20 | drawEllipse(lineSize: number, lineColor: string, fillColor: string): void; 21 | drawRegularPolygon(lineSize: number, lineColor: string, fillColor: string, sides: number, startAngle?: number, distances?: number[]): void; 22 | drawPolygon(lineSize: number, lineColor: string, fillColor: string, points: number[]): void; 23 | get distances(): number[]; 24 | set distances(value: number[]); 25 | get color(): string; 26 | set color(value: string); 27 | protected handleXYChanged(): void; 28 | private updateGraph; 29 | dealWithPolyPoints(basePosX?: number, basePosY?: number): void; 30 | replaceMe(target: GObject): void; 31 | addBeforeMe(target: GObject): void; 32 | addAfterMe(target: GObject): void; 33 | setNativeObject(obj: any): void; 34 | createDisplayObject(): void; 35 | getProp(index: number): any; 36 | setProp(index: number, value: any): void; 37 | protected handleSizeChanged(): void; 38 | setSkew(sx: number, sy: number): void; 39 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): void; 40 | } 41 | -------------------------------------------------------------------------------- /build/types/GGroup.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GObject } from './GObject'; 3 | export declare class GGroup extends GObject { 4 | private _layout; 5 | private _lineGap; 6 | private _columnGap; 7 | private _excludeInvisibles; 8 | private _autoSizeDisabled; 9 | private _mainGridIndex; 10 | private _mainGridMinSize; 11 | private _boundsChanged; 12 | private _percentReady; 13 | private _mainChildIndex; 14 | private _totalSize; 15 | private _numChildren; 16 | _updating: number; 17 | constructor(scene: Phaser.Scene, type: any); 18 | dispose(): void; 19 | /** 20 | * group 交互默认为false 21 | */ 22 | set touchable(value: boolean); 23 | get layout(): number; 24 | set layout(value: number); 25 | get lineGap(): number; 26 | set lineGap(value: number); 27 | get columnGap(): number; 28 | set columnGap(value: number); 29 | get excludeInvisibles(): boolean; 30 | set excludeInvisibles(value: boolean); 31 | get autoSizeDisabled(): boolean; 32 | set autoSizeDisabled(value: boolean); 33 | get mainGridMinSize(): number; 34 | set mainGridMinSize(value: number); 35 | get mainGridIndex(): number; 36 | set mainGridIndex(value: number); 37 | setBoundsChangedFlag(positionChangedOnly?: boolean): void; 38 | ensureSizeCorrect(): void; 39 | ensureBoundsCorrect(): void; 40 | private updateBounds; 41 | private handleLayout; 42 | moveChildren(dx: number, dy: number): void; 43 | resizeChildren(dw: number, dh: number): void; 44 | protected handleAlphaChanged(): void; 45 | handleVisibleChanged(): void; 46 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): void; 47 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 48 | } 49 | -------------------------------------------------------------------------------- /build/types/GImage.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { Image } from './display/Image'; 3 | import { GObject } from './GObject'; 4 | export declare class GImage extends GObject { 5 | private _image; 6 | private _flip; 7 | private _contentItem; 8 | constructor(scene: Phaser.Scene, type: number); 9 | get image(): Image; 10 | get color(): string; 11 | set color(value: string); 12 | get width(): number; 13 | get height(): number; 14 | set width(value: number); 15 | set height(value: number); 16 | get flip(): number; 17 | set flip(value: number); 18 | get fillMethod(): number; 19 | set fillMethod(value: number); 20 | get fillOrigin(): number; 21 | set fillOrigin(value: number); 22 | get fillClockwise(): boolean; 23 | set fillClockwise(value: boolean); 24 | get fillAmount(): number; 25 | set fillAmount(value: number); 26 | createDisplayObject(): void; 27 | constructFromResource(): Promise; 28 | handleSizeChanged(): void; 29 | protected handleXYChanged(): void; 30 | getProp(index: number): any; 31 | setProp(index: number, value: any): void; 32 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): Promise; 33 | } 34 | -------------------------------------------------------------------------------- /build/types/GJoyStick.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer, GComponent } from "."; 2 | export declare class GJoyStick extends GComponent { 3 | /** 4 | * 摇杆触控最大偏移 5 | */ 6 | static BIG_RANGE: number; 7 | /** 8 | * 摇杆背景 9 | */ 10 | private _bg; 11 | /** 12 | * 摇杆按钮 13 | */ 14 | private _btn; 15 | /** 16 | * 摇杆 17 | */ 18 | private _handle?; 19 | /** 20 | * 摇杆垫片 21 | */ 22 | private _gasKet?; 23 | private _down; 24 | private bgRadius; 25 | private _downPos; 26 | constructor(scene: Phaser.Scene, type: any); 27 | addEventListener(): void; 28 | removeEventListener(): void; 29 | private downHandler; 30 | private pointerMove; 31 | private upHandler; 32 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 33 | protected constructExtension(buffer: ByteBuffer): Promise; 34 | } 35 | -------------------------------------------------------------------------------- /build/types/GLabel.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GTextField } from './GTextField'; 3 | import { GObject } from './GObject'; 4 | import { GComponent } from "./GComponent"; 5 | export declare class GLabel extends GComponent { 6 | protected _titleObject: GObject; 7 | protected _iconObject: GObject; 8 | constructor(scene: Phaser.Scene, type: any); 9 | get icon(): string; 10 | set icon(value: string); 11 | get title(): string; 12 | set title(value: string); 13 | get text(): string; 14 | set text(value: string); 15 | get titleColor(): string; 16 | set titleColor(value: string); 17 | get titleFontSize(): number; 18 | set titleFontSize(value: number); 19 | get color(): string; 20 | set color(value: string); 21 | set editable(val: boolean); 22 | get editable(): boolean; 23 | getTextField(): GTextField; 24 | getProp(index: number): any; 25 | setProp(index: number, value: any): void; 26 | protected constructExtension(buffer: ByteBuffer): Promise; 27 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 28 | } 29 | -------------------------------------------------------------------------------- /build/types/GLoader.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { MovieClip } from './display/MovieClip'; 3 | import { GObject } from './GObject'; 4 | import { GComponent } from './GComponent'; 5 | export declare class GLoader extends GObject { 6 | private _url; 7 | private _align; 8 | private _valign; 9 | private _autoSize; 10 | private _fill; 11 | private _shrinkOnly; 12 | private _showErrorSign; 13 | private _contentItem; 14 | private _content; 15 | private _errorSign?; 16 | private _content2?; 17 | private _updatingLayout; 18 | private _isLoading; 19 | private static _errorSignPool; 20 | constructor(scene: Phaser.Scene, type: any); 21 | createDisplayObject(): void; 22 | dispose(): void; 23 | get url(): string; 24 | get touchable(): boolean; 25 | set touchable(value: boolean); 26 | changeInteractive(): void; 27 | set url(value: string); 28 | get icon(): string; 29 | set icon(value: string); 30 | get align(): string; 31 | set align(value: string); 32 | get verticalAlign(): string; 33 | set verticalAlign(value: string); 34 | get fill(): number; 35 | set fill(value: number); 36 | get shrinkOnly(): boolean; 37 | set shrinkOnly(value: boolean); 38 | get autoSize(): boolean; 39 | set autoSize(value: boolean); 40 | get playing(): boolean; 41 | set playing(value: boolean); 42 | get frame(): number; 43 | set frame(value: number); 44 | get color(): string; 45 | set color(value: string); 46 | get fillMethod(): number; 47 | set fillMethod(value: number); 48 | get fillOrigin(): number; 49 | set fillOrigin(value: number); 50 | get fillClockwise(): boolean; 51 | set fillClockwise(value: boolean); 52 | get fillAmount(): number; 53 | set fillAmount(value: number); 54 | get showErrorSign(): boolean; 55 | set showErrorSign(value: boolean); 56 | get content(): MovieClip; 57 | get component(): GComponent; 58 | protected loadContent(): Promise; 59 | protected loadFromPackage(itemURL: string): Promise; 60 | protected loadExternal(): Promise; 61 | protected freeExternal(texture: Phaser.Textures.Texture): void; 62 | protected onExternalLoadSuccess(texture: Phaser.Textures.Texture): void; 63 | protected onExternalLoadFailed(): void; 64 | private __getResCompleted; 65 | private setErrorState; 66 | private clearErrorState; 67 | private updateLayout; 68 | private clearContent; 69 | protected handleSizeChanged(): void; 70 | getProp(index: number): any; 71 | setProp(index: number, value: any): void; 72 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): Promise; 73 | } 74 | -------------------------------------------------------------------------------- /build/types/GMovieClip.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './GObject'; 2 | import { ByteBuffer } from './utils/ByteBuffer'; 3 | export declare class GMovieClip extends GObject { 4 | private _movieClip; 5 | private _contentItem; 6 | constructor(scene: Phaser.Scene, type: number); 7 | get color(): string; 8 | set color(value: string); 9 | createDisplayObject(): void; 10 | getChild(): GObject; 11 | get playing(): boolean; 12 | set playing(value: boolean); 13 | get frame(): number; 14 | set frame(value: number); 15 | get timeScale(): number; 16 | set timeScale(value: number); 17 | advance(timeInMiniseconds: number): void; 18 | setPlaySettings(start?: number, end?: number, times?: number, endAt?: number, endHandler?: () => void): void; 19 | set touchable(value: boolean); 20 | getProp(index: number): any; 21 | setProp(index: number, value: any): void; 22 | constructFromResource(): Promise; 23 | protected handleSizeChanged(): void; 24 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): void; 25 | protected handleXYChanged(): void; 26 | } 27 | -------------------------------------------------------------------------------- /build/types/GObjectPool.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './GObject'; 2 | export declare class GObjectPool { 3 | private _pool; 4 | private _count; 5 | constructor(); 6 | clear(): void; 7 | get count(): number; 8 | getObject(url: string): Promise; 9 | returnObject(obj: GObject): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/GProgressBar.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GTweener } from './tween/GTweener'; 3 | import { GComponent } from "./GComponent"; 4 | export declare class GProgressBar extends GComponent { 5 | private _min; 6 | private _max; 7 | private _value; 8 | private _titleType; 9 | private _reverse; 10 | private _titleObject; 11 | private _aniObject; 12 | private _barObjectH; 13 | private _barObjectV; 14 | private _barMaxWidth; 15 | private _barMaxHeight; 16 | private _barMaxWidthDelta; 17 | private _barMaxHeightDelta; 18 | private _barStartX; 19 | private _barStartY; 20 | constructor(scene: Phaser.Scene, type: any); 21 | get titleType(): number; 22 | set titleType(value: number); 23 | get min(): number; 24 | set min(value: number); 25 | get max(): number; 26 | set max(value: number); 27 | get value(): number; 28 | set value(value: number); 29 | tweenValue(value: number, duration: number): GTweener; 30 | update(newValue: number): void; 31 | private setFillAmount; 32 | protected constructExtension(buffer: ByteBuffer): Promise; 33 | protected handleSizeChanged(): void; 34 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 35 | } 36 | -------------------------------------------------------------------------------- /build/types/GRichTextField.d.ts: -------------------------------------------------------------------------------- 1 | import { GBasicTextField } from './GBasicTextField'; 2 | export declare class GRichTextField extends GBasicTextField { 3 | constructor(scene: Phaser.Scene, type: any); 4 | } 5 | -------------------------------------------------------------------------------- /build/types/GScrollBar.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { ScrollPane } from './ScrollPane'; 3 | import { GComponent } from "./GComponent"; 4 | export declare class GScrollBar extends GComponent { 5 | private _grip; 6 | private _arrowButton1; 7 | private _arrowButton2; 8 | private _bar; 9 | private _target; 10 | private _vertical; 11 | private _scrollPerc; 12 | private _fixedGripSize; 13 | private _dragOffset; 14 | private _gripDragging; 15 | constructor(scene: Phaser.Scene, type: any); 16 | get hasDrag(): boolean; 17 | setScrollPane(target: ScrollPane, vertical: boolean): void; 18 | setDisplayPerc(value: number): void; 19 | setScrollPerc(val: number): void; 20 | get minSize(): number; 21 | get gripDragging(): boolean; 22 | protected constructExtension(buffer: ByteBuffer): Promise; 23 | private __gripMouseDown; 24 | private __gripMouseMove; 25 | private __gripMouseUp; 26 | private __arrowButton1Click; 27 | private __arrowButton2Click; 28 | private __barMouseDown; 29 | } 30 | -------------------------------------------------------------------------------- /build/types/GSlider.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GComponent } from "./GComponent"; 3 | export declare class GSlider extends GComponent { 4 | private _min; 5 | private _max; 6 | private _value; 7 | private _titleType; 8 | private _reverse; 9 | private _wholeNumbers; 10 | private _titleObject; 11 | private _barObjectH; 12 | private _barObjectV; 13 | private _barMaxWidth; 14 | private _barMaxHeight; 15 | private _barMaxWidthDelta; 16 | private _barMaxHeightDelta; 17 | private _gripObject; 18 | private _clickPos; 19 | private _clickPercent; 20 | private _barStartX; 21 | private _barStartY; 22 | changeOnClick: boolean; 23 | /**是否可拖动开关**/ 24 | canDrag: boolean; 25 | constructor(scene: Phaser.Scene, type: any); 26 | get titleType(): number; 27 | set titleType(value: number); 28 | get wholeNumbers(): boolean; 29 | set wholeNumbers(value: boolean); 30 | get min(): number; 31 | set min(value: number); 32 | get max(): number; 33 | set max(value: number); 34 | get value(): number; 35 | set value(value: number); 36 | update(): void; 37 | private updateWithPercent; 38 | protected constructExtension(buffer: ByteBuffer): Promise; 39 | protected handleSizeChanged(): void; 40 | setup_afterAdd(buffer: ByteBuffer, beginPos: number): void; 41 | private __gripMouseDown; 42 | private __gripMouseMove; 43 | private __gripMouseUp; 44 | private __barMouseDown; 45 | } 46 | -------------------------------------------------------------------------------- /build/types/GTextInput.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GBasicTextField } from './GBasicTextField'; 3 | export declare class InputType { 4 | /** 常规文本域。*/ 5 | static TYPE_TEXT: string; 6 | /** password 类型用于密码域输入。*/ 7 | static TYPE_PASSWORD: string; 8 | /** email 类型用于应该包含 e-mail 地址的输入域。*/ 9 | static TYPE_EMAIL: string; 10 | /** url 类型用于应该包含 URL 地址的输入域。*/ 11 | static TYPE_URL: string; 12 | /** number 类型用于应该包含数值的输入域。*/ 13 | static TYPE_NUMBER: string; 14 | /** 15 | *

range 类型用于应该包含一定范围内数字值的输入域。

16 | *

range 类型显示为滑动条。

17 | *

您还能够设定对所接受的数字的限定。

18 | */ 19 | static TYPE_RANGE: string; 20 | /** 选取日、月、年。*/ 21 | static TYPE_DATE: string; 22 | /** month - 选取月、年。*/ 23 | static TYPE_MONTH: string; 24 | /** week - 选取周和年。*/ 25 | static TYPE_WEEK: string; 26 | /** time - 选取时间(小时和分钟)。*/ 27 | static TYPE_TIME: string; 28 | /** datetime - 选取时间、日、月、年(UTC 时间)。*/ 29 | static TYPE_DATE_TIME: string; 30 | /** datetime-local - 选取时间、日、月、年(本地时间)。*/ 31 | static TYPE_DATE_TIME_LOCAL: string; 32 | /** 33 | *

search 类型用于搜索域,比如站点搜索或 Google 搜索。

34 | *

search 域显示为常规的文本域。

35 | */ 36 | static TYPE_SEARCH: string; 37 | } 38 | export declare class GTextInput extends GBasicTextField { 39 | constructor(scene: Phaser.Scene, type: any); 40 | createDisplayObject(): void; 41 | get nativeInput(): any; 42 | set text(value: string); 43 | get text(): string; 44 | get password(): boolean; 45 | set password(value: boolean); 46 | get keyboardType(): string; 47 | set keyboardType(value: string); 48 | set editable(value: boolean); 49 | get editable(): boolean; 50 | set maxLength(value: number); 51 | get maxLength(): number; 52 | set placeholder(value: string); 53 | get placeholder(): string; 54 | set restrict(value: string); 55 | get restrict(): string; 56 | requestFocus(): void; 57 | init(): void; 58 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): void; 59 | private get inputTextField(); 60 | } 61 | -------------------------------------------------------------------------------- /build/types/GTree.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GObject } from './GObject'; 3 | import { GTreeNode } from './GTreeNode'; 4 | import { GList } from './GList'; 5 | import { Handler } from './utils/Handler'; 6 | export declare class GTree extends GList { 7 | /** 8 | * (node: GTreeNode, obj: GComponent) => void 9 | */ 10 | treeNodeRender: Handler; 11 | /** 12 | * (node: GTreeNode, expanded: boolean) => void; 13 | */ 14 | treeNodeWillExpand: Handler; 15 | private _indent; 16 | private _clickToExpand; 17 | private _rootNode; 18 | private _expandedStatusInEvt; 19 | constructor(scene: Phaser.Scene, type: any); 20 | dispose(): void; 21 | get rootNode(): GTreeNode; 22 | get indent(): number; 23 | set indent(value: number); 24 | get clickToExpand(): number; 25 | set clickToExpand(value: number); 26 | getSelectedNode(): GTreeNode; 27 | getSelectedNodes(result?: Array): Array; 28 | selectNode(node: GTreeNode, scrollItToView?: boolean): void; 29 | unselectNode(node: GTreeNode): void; 30 | expandAll(folderNode?: GTreeNode): void; 31 | collapseAll(folderNode?: GTreeNode): void; 32 | private createCell; 33 | _afterInserted(node: GTreeNode): Promise; 34 | private getInsertIndexForNode; 35 | _afterRemoved(node: GTreeNode): void; 36 | _afterExpanded(node: GTreeNode): void; 37 | _afterCollapsed(node: GTreeNode): void; 38 | _afterMoved(node: GTreeNode): void; 39 | private getFolderEndIndex; 40 | private checkChildren; 41 | private hideFolderNode; 42 | private removeNode; 43 | private __cellMouseDown; 44 | private __expandedStateChanged; 45 | protected dispatchItemEvent(item: GObject, evt: any): void; 46 | setup_beforeAdd(buffer: ByteBuffer, beginPos: number): Promise; 47 | protected readItems(buffer: ByteBuffer): Promise; 48 | } 49 | -------------------------------------------------------------------------------- /build/types/GTreeNode.d.ts: -------------------------------------------------------------------------------- 1 | import { GComponent } from "./GComponent"; 2 | import { GTree } from "./GTree"; 3 | export declare class GTreeNode { 4 | data: any; 5 | private _parent; 6 | private _children; 7 | private _expanded; 8 | private _level; 9 | private _tree; 10 | _cell: GComponent; 11 | _resURL?: string; 12 | constructor(hasChild: boolean, resURL?: string); 13 | set expanded(value: boolean); 14 | get expanded(): boolean; 15 | get isFolder(): boolean; 16 | get parent(): GTreeNode; 17 | get text(): string; 18 | set text(value: string); 19 | get icon(): string; 20 | set icon(value: string); 21 | get cell(): GComponent; 22 | get level(): number; 23 | _setLevel(value: number): void; 24 | addChild(child: GTreeNode): Promise; 25 | addChildAt(child: GTreeNode, index: number): Promise; 26 | removeChild(child: GTreeNode): GTreeNode; 27 | removeChildAt(index: number): GTreeNode; 28 | removeChildren(beginIndex?: number, endIndex?: number): void; 29 | getChildAt(index: number): GTreeNode; 30 | getChildIndex(child: GTreeNode): number; 31 | getPrevSibling(): GTreeNode; 32 | getNextSibling(): GTreeNode; 33 | setChildIndex(child: GTreeNode, index: number): void; 34 | swapChildren(child1: GTreeNode, child2: GTreeNode): void; 35 | swapChildrenAt(index1: number, index2: number): void; 36 | get numChildren(): number; 37 | expandToRoot(): void; 38 | get tree(): GTree; 39 | _setTree(value: GTree): void; 40 | } 41 | -------------------------------------------------------------------------------- /build/types/IUISource.d.ts: -------------------------------------------------------------------------------- 1 | export interface IUISource { 2 | fileName: string; 3 | loaded: boolean; 4 | load(callback: Function, thisObj: any): void; 5 | } 6 | -------------------------------------------------------------------------------- /build/types/Margin.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Margin { 2 | left: number; 3 | right: number; 4 | top: number; 5 | bottom: number; 6 | copy(source: Margin): void; 7 | } 8 | -------------------------------------------------------------------------------- /build/types/PackageItem.d.ts: -------------------------------------------------------------------------------- 1 | import { BitmapFont } from './display/BitmapFont'; 2 | import { PixelHitTestData } from './utils/PixelHitTest'; 3 | import { ByteBuffer } from './utils/ByteBuffer'; 4 | import { UIPackage } from './UIPackage'; 5 | export declare class PackageItem { 6 | owner: UIPackage; 7 | type: number; 8 | objectType?: number; 9 | id: string; 10 | name: string; 11 | x: number; 12 | y: number; 13 | tx: number; 14 | ty: number; 15 | width: number; 16 | height: number; 17 | file: string; 18 | decoded?: boolean; 19 | loading?: Array; 20 | rawData?: ByteBuffer; 21 | highResolution?: Array; 22 | branches?: Array; 23 | scale9Grid?: Phaser.Geom.Rectangle; 24 | scaleByTile?: boolean; 25 | tileGridIndice?: number; 26 | smoothing?: boolean; 27 | texture?: Phaser.Textures.Texture; 28 | pixelHitTestData?: PixelHitTestData; 29 | interval?: number; 30 | repeatDelay?: number; 31 | swing?: boolean; 32 | frames?: Phaser.Textures.Frame[]; 33 | extensionType?: any; 34 | bitmapFont?: BitmapFont; 35 | skeletonAnchor?: Phaser.Geom.Point; 36 | private _isHighRes; 37 | constructor(); 38 | getBranch(): PackageItem; 39 | getHighResolution(): PackageItem; 40 | get isHighRes(): boolean; 41 | set isHighRes(val: boolean); 42 | toString(): string; 43 | load(): Promise; 44 | } 45 | -------------------------------------------------------------------------------- /build/types/PopupMenu.d.ts: -------------------------------------------------------------------------------- 1 | import { PopupDirection } from './FieldTypes'; 2 | import { GButton } from './GButton'; 3 | import { GObject } from './GObject'; 4 | import { GList } from './GList'; 5 | import { GComponent } from "./GComponent"; 6 | export declare class PopupMenu { 7 | protected _scene: Phaser.Scene; 8 | private resourceURL?; 9 | protected _contentPane: GComponent; 10 | protected _list: GList; 11 | constructor(_scene: Phaser.Scene, resourceURL?: string); 12 | init(): Promise; 13 | dispose(): void; 14 | /** 15 | * 一次创建一个item 16 | * @param caption 17 | * @param handler 18 | * @returns 19 | */ 20 | addItem(caption: string, handler?: (item?: GObject, evt?: Event) => void): Promise; 21 | /** 22 | * 一次创建多个items,由于异步问题,会导致promise返回后显示对象的添加的先后顺序错乱(index 5先被添加到0,0位置) 23 | * @param captions 24 | * @param handler 25 | * @returns 26 | */ 27 | addItems(captions: string[], handler?: (item?: GObject, evt?: Event) => void): Promise; 28 | addItemAt(caption: string, index: number, handler?: (item?: GObject, evt?: Event) => void): Promise; 29 | addSeperator(): void; 30 | getItemName(index: number): string; 31 | setItemText(name: string, caption: string): void; 32 | setItemVisible(name: string, visible: boolean): void; 33 | setItemGrayed(name: string, grayed: boolean): void; 34 | setItemCheckable(name: string, checkable: boolean): void; 35 | setItemChecked(name: string, checked: boolean): void; 36 | isItemChecked(name: string): boolean; 37 | removeItem(name: string): boolean; 38 | clearItems(): void; 39 | get itemCount(): number; 40 | get contentPane(): GComponent; 41 | get list(): GList; 42 | show(target?: GObject, dir?: PopupDirection | boolean): void; 43 | private __clickItem; 44 | private __clickItem2; 45 | } 46 | -------------------------------------------------------------------------------- /build/types/RelationItem.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from "./GObject"; 2 | export declare class RelationItem { 3 | private _owner; 4 | private _target; 5 | private _defs; 6 | private _targetX; 7 | private _targetY; 8 | private _targetWidth; 9 | private _targetHeight; 10 | constructor(owner: GObject); 11 | get owner(): GObject; 12 | set target(value: GObject); 13 | get target(): GObject; 14 | add(relationType: number, usePercent: boolean): void; 15 | internalAdd(relationType: number, usePercent: boolean): void; 16 | remove(relationType: number): void; 17 | copyFrom(source: RelationItem): void; 18 | dispose(): void; 19 | get isEmpty(): boolean; 20 | applyOnSelfResized(dWidth: number, dHeight: number, applyPivot: boolean): void; 21 | private applyOnXYChanged; 22 | private applyOnSizeChanged; 23 | private addRefTarget; 24 | private __targetSizeWillChange; 25 | private releaseRefTarget; 26 | private __targetXYChanged; 27 | private __targetSizeChanged; 28 | } 29 | -------------------------------------------------------------------------------- /build/types/Relations.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { RelationItem } from './RelationItem'; 3 | import { GObject } from './GObject'; 4 | export declare class Relations { 5 | private _owner; 6 | private _items; 7 | handling: GObject; 8 | sizeDirty?: boolean; 9 | constructor(owner: GObject); 10 | get items(): RelationItem[]; 11 | add(target: GObject, relationType: number, usePercent?: boolean): void; 12 | remove(target: GObject, relationType?: number): void; 13 | contains(target: GObject): boolean; 14 | clearFor(target: GObject): void; 15 | clearAll(): void; 16 | copyFrom(source: Relations): void; 17 | dispose(): void; 18 | onOwnerSizeChanged(dWidth: number, dHeight: number, applyPivot: boolean): void; 19 | ensureRelationsSizeCorrect(): void; 20 | get empty(): boolean; 21 | setup(buffer: ByteBuffer, parentToChild: boolean): void; 22 | } 23 | -------------------------------------------------------------------------------- /build/types/Test.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Test { 2 | constructor(); 3 | } 4 | -------------------------------------------------------------------------------- /build/types/Transition.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './utils/ByteBuffer'; 2 | import { GObject } from './GObject'; 3 | import { GComponent } from "./GComponent"; 4 | export declare class Transition { 5 | name: string; 6 | private _owner; 7 | private _ownerBaseX; 8 | private _ownerBaseY; 9 | private _items; 10 | private _totalTimes; 11 | private _totalTasks; 12 | private _playing; 13 | private _paused; 14 | private _onComplete; 15 | private _options; 16 | private _reversed; 17 | private _totalDuration; 18 | private _autoPlay; 19 | private _autoPlayTimes; 20 | private _autoPlayDelay; 21 | private _timeScale; 22 | private _startTime; 23 | private _endTime; 24 | constructor(owner: GComponent); 25 | checkItemInTransition(id: string): boolean; 26 | play(onComplete?: () => void, times?: number, delay?: number, startTime?: number, endTime?: number): void; 27 | playReverse(onComplete?: () => void, times?: number, delay?: number, startTime?: number, endTime?: number): void; 28 | changePlayTimes(value: number): void; 29 | setAutoPlay(value: boolean, times?: number, delay?: number): void; 30 | private _play; 31 | stop(setToComplete?: boolean, processCallback?: boolean): void; 32 | private stopItem; 33 | setPaused(paused: boolean): void; 34 | dispose(): void; 35 | get playing(): boolean; 36 | setValue(label: string, ...args: any[]): void; 37 | setHook(label: string, callback: (label?: string) => void): void; 38 | clearHooks(): void; 39 | setTarget(label: string, newTarget: GObject): void; 40 | setDuration(label: string, value: number): void; 41 | getLabelTime(label: string): number; 42 | get timeScale(): number; 43 | set timeScale(value: number); 44 | updateFromRelations(targetId: string, dx: number, dy: number): void; 45 | onOwnerAddedToStage(): void; 46 | onOwnerRemovedFromStage(): void; 47 | private onDelayedPlay; 48 | private internalPlay; 49 | private playItem; 50 | private skipAnimations; 51 | private onDelayedPlayItem; 52 | private onTweenStart; 53 | private onTweenUpdate; 54 | private onTweenComplete; 55 | private onPlayTransCompleted; 56 | private callHook; 57 | private checkAllComplete; 58 | private applyValue; 59 | setup(buffer: ByteBuffer): void; 60 | private decodeValue; 61 | } 62 | -------------------------------------------------------------------------------- /build/types/TranslationHelper.d.ts: -------------------------------------------------------------------------------- 1 | import { PackageItem } from './PackageItem'; 2 | export declare class TranslationHelper { 3 | static strings: { 4 | [index: string]: { 5 | [index: string]: string; 6 | }; 7 | }; 8 | static loadFromXML(source: string): void; 9 | static translateComponent(item: PackageItem): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/UIConfig.d.ts: -------------------------------------------------------------------------------- 1 | export declare class UIConfig { 2 | constructor(); 3 | static defaultFont: string; 4 | static windowModalWaiting: string; 5 | static globalModalWaiting: string; 6 | static modalLayerColor: string; 7 | static buttonSound: string; 8 | static buttonSoundVolumeScale: number; 9 | static horizontalScrollBar: string; 10 | static verticalScrollBar: string; 11 | static defaultScrollStep: number; 12 | static defaultScrollDecelerationRate: number; 13 | static defaultScrollBarDisplay: number; 14 | static defaultScrollTouchEffect: boolean; 15 | static defaultScrollBounceEffect: boolean; 16 | /** 17 | * 当滚动容器设置为“贴近ITEM”时,判定贴近到哪一个ITEM的滚动距离阀值。 18 | */ 19 | static defaultScrollSnappingThreshold: number; 20 | /** 21 | * 当滚动容器设置为“页面模式”时,判定翻到哪一页的滚动距离阀值。 22 | */ 23 | static defaultScrollPagingThreshold: number; 24 | static popupMenu: string; 25 | static popupMenu_seperator: string; 26 | static loaderErrorSign: string; 27 | static tooltipsWin: string; 28 | static defaultComboBoxVisibleItemCount: number; 29 | static touchScrollSensitivity: number; 30 | static touchDragSensitivity: number; 31 | static clickDragSensitivity: number; 32 | static bringWindowToFrontOnClick: boolean; 33 | static frameTimeForAsyncUIConstruction: number; 34 | static textureLinearSampling: boolean; 35 | static packageFileExtension: string; 36 | } 37 | -------------------------------------------------------------------------------- /build/types/UIObjectFactory.d.ts: -------------------------------------------------------------------------------- 1 | import { GComponent } from "./GComponent"; 2 | import { GObject } from './GObject'; 3 | import { PackageItem } from './PackageItem'; 4 | import { GLoader } from './GLoader'; 5 | export declare class UIObjectFactory { 6 | static extensions: { 7 | [index: string]: new () => GComponent; 8 | }; 9 | static loaderType: new () => GLoader; 10 | constructor(); 11 | static setExtension(url: string, type: new () => GComponent): void; 12 | static setPackageItemExtension(url: string, type: new () => GComponent): void; 13 | static setLoaderExtension(type: new () => GLoader): void; 14 | static resolveExtension(pi: PackageItem): void; 15 | static newObject(type: number | PackageItem, userClass?: new () => GObject): GObject; 16 | } 17 | -------------------------------------------------------------------------------- /build/types/UIPackage.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './GObject'; 2 | import { PackageItem } from './PackageItem'; 3 | export declare class UIPackage { 4 | private _id; 5 | private _name; 6 | private _items; 7 | private _itemsById; 8 | private _itemsByName; 9 | private _resKey; 10 | private _customId; 11 | private _sprites; 12 | private _dependencies; 13 | private _branches; 14 | _branchIndex: number; 15 | static _constructing: number; 16 | private static _instById; 17 | private static _instByName; 18 | private static _branch; 19 | private static _vars; 20 | constructor(); 21 | static get branch(): string; 22 | static set branch(value: string); 23 | static getVar(key: string): string; 24 | static setVar(key: string, value: string): void; 25 | static getById(id: string): UIPackage; 26 | static getByName(name: string): UIPackage; 27 | static addPackage(resKey: string, descData?: ArrayBuffer): UIPackage; 28 | static loadPackages(resKeys: string[]): Promise; 29 | static loadPackage(resKey: string, onProgress?: (event: ProgressEvent) => void): Promise; 30 | static removePackage(packageIdOrName: string): void; 31 | static createObject(pkgName: string, resName: string, userClass?: new () => GObject): Promise; 32 | static createObjectFromURL(url: string, userClass?: new () => GObject): Promise; 33 | static getItemURL(pkgName: string, resName: string): string; 34 | static getItemByURL(url: string): PackageItem; 35 | static getItemAssetByURL(url: string): Promise; 36 | static normalizeURL(url: string): string; 37 | static setStringsSource(source: string): void; 38 | private loadPackage; 39 | loadAllAssets(): void; 40 | unloadAssets(): void; 41 | dispose(): void; 42 | get id(): string; 43 | get name(): string; 44 | get customId(): string; 45 | set customId(value: string); 46 | createObject(resName: string, userClass?: new () => GObject): Promise; 47 | /** 48 | * 创建内部子对象 49 | * @param item 50 | * @param userClass 51 | * @returns 52 | */ 53 | internalCreateObject(item: PackageItem, userClass?: new () => GObject): Promise; 54 | getItemById(itemId: string): PackageItem; 55 | getItemByName(resName: string): PackageItem; 56 | getItemAssetByName(resName: string): Promise; 57 | private checkHasFrame; 58 | getItemAsset(item: PackageItem, parentID?: string): Promise; 59 | getItemAssetAsync(item: PackageItem, onComplete?: (err: any, item: PackageItem) => void): void; 60 | private loadMovieClip; 61 | private loadFont; 62 | private loadSpine; 63 | private loadDragonBones; 64 | } 65 | export interface IObjectFactoryType { 66 | resolveExtension(pi: PackageItem): void; 67 | newObject(type: number | PackageItem, userClass?: new () => GObject): GObject; 68 | } 69 | export declare var Decls: { 70 | UIObjectFactory?: IObjectFactoryType; 71 | }; 72 | -------------------------------------------------------------------------------- /build/types/Window.d.ts: -------------------------------------------------------------------------------- 1 | import { GRoot } from './GRoot'; 2 | import { IUISource } from './IUISource'; 3 | import { GObject } from './GObject'; 4 | import "phaser3"; 5 | import { GComponent } from "./GComponent"; 6 | export declare class Window extends GComponent { 7 | protected _contentPane: GComponent; 8 | protected _modalWaitPane: GObject; 9 | protected _closeButton: GObject; 10 | protected _dragArea: GObject; 11 | protected _contentArea: GObject; 12 | protected _frame: GComponent; 13 | protected _modal: boolean; 14 | protected _uiSources?: IUISource[]; 15 | protected _inited?: boolean; 16 | protected _loading?: boolean; 17 | protected _requestingCmd: number; 18 | bringToFontOnClick: boolean; 19 | constructor(scene: Phaser.Scene); 20 | createDisplayObject(): void; 21 | addUISource(source: IUISource): void; 22 | set contentPane(val: GComponent); 23 | get contentPane(): GComponent; 24 | get frame(): GComponent; 25 | get closeButton(): GObject; 26 | set closeButton(value: GObject); 27 | get dragArea(): GObject; 28 | set dragArea(value: GObject); 29 | get contentArea(): GObject; 30 | set contentArea(value: GObject); 31 | show(): void; 32 | showOn(root: GRoot): void; 33 | hide(): void; 34 | hideImmediately(): void; 35 | centerOn(r: GRoot, restraint?: boolean): void; 36 | toggleStatus(): void; 37 | get isShowing(): boolean; 38 | get isTop(): boolean; 39 | get modal(): boolean; 40 | set modal(val: boolean); 41 | bringToFront(): void; 42 | showModalWait(requestingCmd?: number): void; 43 | protected layoutModalWaitPane(): void; 44 | closeModalWait(requestingCmd?: number): boolean; 45 | get modalWaiting(): boolean; 46 | init(): void; 47 | protected onInit(): void; 48 | protected onShown(): void; 49 | protected onHide(): void; 50 | protected doShowAnimation(): void; 51 | protected doHideAnimation(): void; 52 | private __uiLoadComplete; 53 | private _init; 54 | dispose(): void; 55 | protected closeEventHandler(): void; 56 | __onShown(): void; 57 | protected __onHidden(): void; 58 | protected __mouseDown(): void; 59 | private __dragStart; 60 | } 61 | -------------------------------------------------------------------------------- /build/types/action/ChangePageAction.d.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from './../Controller'; 2 | import { ByteBuffer } from './../utils/ByteBuffer'; 3 | import { ControllerAction } from './ControllerAction'; 4 | export declare class ChangePageAction extends ControllerAction { 5 | objectId: string; 6 | controllerName: string; 7 | targetPage: string; 8 | constructor(); 9 | protected enter(controller: Controller): void; 10 | setup(buffer: ByteBuffer): void; 11 | } 12 | -------------------------------------------------------------------------------- /build/types/action/ControllerAction.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { Controller } from './../Controller'; 3 | export declare class ControllerAction { 4 | fromPage: string[]; 5 | toPage: string[]; 6 | constructor(); 7 | run(controller: Controller, prevPage: string, curPage: string): void; 8 | protected enter(controller: Controller): void; 9 | protected leave(controller: Controller): void; 10 | setup(buffer: ByteBuffer): void; 11 | } 12 | -------------------------------------------------------------------------------- /build/types/action/PlayTransitionAction.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { Controller } from './../Controller'; 3 | import { ControllerAction } from './ControllerAction'; 4 | export declare class PlayTransitionAction extends ControllerAction { 5 | transitionName: string; 6 | playTimes: number; 7 | delay: number; 8 | stopOnExit: boolean; 9 | private _currentTransition?; 10 | constructor(); 11 | protected enter(controller: Controller): void; 12 | protected leave(controller: Controller): void; 13 | setup(buffer: ByteBuffer): void; 14 | } 15 | -------------------------------------------------------------------------------- /build/types/action/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./ChangePageAction"; 2 | export * from "./ControllerAction"; 3 | export * from "./PlayTransitionAction"; 4 | -------------------------------------------------------------------------------- /build/types/display/BitmapFont.d.ts: -------------------------------------------------------------------------------- 1 | export declare class BitmapFont { 2 | id: string; 3 | size: number; 4 | ttf?: boolean; 5 | glyphs: { 6 | [index: string]: BMGlyph; 7 | }; 8 | resizable?: boolean; 9 | tint?: boolean; 10 | constructor(); 11 | } 12 | export interface BMGlyph { 13 | x?: number; 14 | y?: number; 15 | width?: number; 16 | height?: number; 17 | advance?: number; 18 | lineHeight?: number; 19 | channel?: number; 20 | texture?: Phaser.Textures.Texture; 21 | } 22 | -------------------------------------------------------------------------------- /build/types/display/FillUtils.d.ts: -------------------------------------------------------------------------------- 1 | export declare function fillImage(w: number, h: number, method: number, origin: number, clockwise: boolean, amount: number): number[]; 2 | -------------------------------------------------------------------------------- /build/types/display/Graphics.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum GRAPHICSTYPE { 2 | RECTANGLE = "rectangle", 3 | CIRCLE = "circle", 4 | POLY = "POLY", 5 | ELLIPSE = "ellipse" 6 | } 7 | export declare class Graphics extends Phaser.GameObjects.Graphics { 8 | private _graphicsType; 9 | private _width; 10 | private _height; 11 | private _radius; 12 | private _points; 13 | constructor(scene: Phaser.Scene); 14 | get width(): number; 15 | get height(): number; 16 | get radius(): number; 17 | get points(): Phaser.Geom.Point[]; 18 | fillRect(x: number, y: number, width: number, height: number): this; 19 | strokeRect(x: number, y: number, width: number, height: number): this; 20 | fillCircle(x: number, y: number, radius: number): this; 21 | strokeCircle(x: number, y: number, radius: number): this; 22 | fillTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): this; 23 | fillEllipse(x: number, y: number, width: number, height: number, smoothness?: number): this; 24 | fillRoundedRect(x: number, y: number, width: number, height: number, radius?: Phaser.Types.GameObjects.Graphics.RoundedRectRadius | number): this; 25 | strokeRoundedRect(x: number, y: number, width: number, height: number, radius?: Phaser.Types.GameObjects.Graphics.RoundedRectRadius | number): this; 26 | get graphicsType(): GRAPHICSTYPE; 27 | set graphicsType(value: GRAPHICSTYPE); 28 | clear(): this; 29 | } 30 | -------------------------------------------------------------------------------- /build/types/display/InputTextField.d.ts: -------------------------------------------------------------------------------- 1 | import { GBasicTextField } from "../GBasicTextField"; 2 | import { TextField } from "./text/TextField"; 3 | export declare class InputTextField extends TextField { 4 | maxLength: number; 5 | keyboardType: string; 6 | restrict: string; 7 | editable: boolean; 8 | password: boolean; 9 | private _editing; 10 | private _text2; 11 | private _promptText; 12 | /** 13 | * 输入文本dom元素 14 | */ 15 | private _element; 16 | private _inputNode; 17 | private _width; 18 | private _height; 19 | private mRectangle; 20 | constructor(owner: GBasicTextField); 21 | destroy(): void; 22 | updateText(runWrap?: boolean): this; 23 | private onFocusHandler; 24 | private onBlurHandler; 25 | private createElement; 26 | private updateTextField; 27 | /** 28 | * Don"t propagate touch/mouse events to parent(game canvas) 29 | * @param element 30 | */ 31 | stopPropagationTouchEvents(e: any): void; 32 | routeEvents(gameObject: any, element: any, elementEvents: any): void; 33 | getText(): string; 34 | setText(value: string): this; 35 | selectText(): this; 36 | get placeholder(): string; 37 | set placeholder(value: string); 38 | setPlaceholder(value: any): this; 39 | setEnabled(enabled: any): this; 40 | setBlur(): this; 41 | setFocus(): this; 42 | setSize(width: number, height: number): this; 43 | private onPointerSceneHandler; 44 | private checkInBounds; 45 | } 46 | -------------------------------------------------------------------------------- /build/types/display/MovieClip.d.ts: -------------------------------------------------------------------------------- 1 | import { Image } from "./Image"; 2 | export declare class MovieClip extends Image { 3 | swing: boolean; 4 | repeatDelay: number; 5 | timeScale: number; 6 | private _interval; 7 | private _endHandler?; 8 | private _frameElapsed; 9 | private _reversed; 10 | private _repeatedCount; 11 | private _curKey; 12 | private _sprite; 13 | private _image; 14 | private _sourceWidth; 15 | private _sourceHeight; 16 | private _pipeline; 17 | constructor(scene: Phaser.Scene); 18 | get display(): any; 19 | setFilter(colorPipeLine: Phaser.Renderer.WebGL.Pipelines.MultiPipeline): void; 20 | set interval(val: number); 21 | get interval(): number; 22 | get frames(): Phaser.Textures.Frame[]; 23 | set frames(value: Phaser.Textures.Frame[]); 24 | get frameCount(): number; 25 | get frame(): number; 26 | set frame(value: number); 27 | get playing(): boolean; 28 | set playing(value: boolean); 29 | advance(timeInMiniseconds: number): void; 30 | private drawFrame; 31 | protected rebuild(): void; 32 | destroy(): void; 33 | private checkTimer; 34 | } 35 | -------------------------------------------------------------------------------- /build/types/display/UIStage.d.ts: -------------------------------------------------------------------------------- 1 | import { UISceneDisplay } from "../GRoot"; 2 | export declare const enum StageOrientation { 3 | AUTO = "auto", 4 | PORTRAIT = "portrait", 5 | LANDSCAPE = "landscape" 6 | } 7 | export declare const enum StageScaleMode { 8 | NO_SCALE = "noScale", 9 | SHOW_ALL = "showAll", 10 | NO_BORDER = "noBorder", 11 | EXACT_FIT = "exactFit", 12 | FIXED_WIDTH = "fixedWidth", 13 | FIXED_HEIGHT = "fixedHeight", 14 | FIXED_AUTO = "fixedAuto" 15 | } 16 | export declare const enum StageAlign { 17 | LEFT = 0, 18 | CENTER = 1, 19 | RIGHT = 2, 20 | TOP = 3, 21 | MIDDLE = 4, 22 | BOTTOM = 5 23 | } 24 | export interface UIStageOptions { 25 | osd: string; 26 | res: string; 27 | resUI: string; 28 | isDesk: boolean; 29 | scaleMode?: StageScaleMode; 30 | orientation?: StageOrientation; 31 | dpr: number; 32 | x: number; 33 | y: number; 34 | designWidth: number; 35 | designHeight: number; 36 | width: number; 37 | height: number; 38 | alignV?: StageAlign; 39 | alignH?: StageAlign; 40 | fallbackWidth?: number; 41 | fallbackHeight?: number; 42 | } 43 | export declare class DefaultUIStageOptions implements UIStageOptions { 44 | scaleMode?: StageScaleMode; 45 | orientation?: StageOrientation; 46 | dpr: number; 47 | isDesk: boolean; 48 | designWidth: number; 49 | designHeight: number; 50 | width: number; 51 | height: number; 52 | x: number; 53 | y: number; 54 | alignV?: StageAlign; 55 | alignH?: StageAlign; 56 | fallbackWidth: number; 57 | fallbackHeight: number; 58 | osd: string; 59 | res: string; 60 | resUI: string; 61 | } 62 | export declare class UIStage extends Phaser.Events.EventEmitter { 63 | private scene; 64 | protected containerMap: Map; 65 | protected $options: UIStageOptions; 66 | protected $width: number; 67 | protected $height: number; 68 | protected $scaleX: number; 69 | protected $scaleY: number; 70 | protected $canvasMatrix: Phaser.GameObjects.Components.TransformMatrix; 71 | offsetX: number; 72 | offsetY: number; 73 | private $sizeCalcer; 74 | constructor(scene: Phaser.Scene); 75 | get stageOption(): UIStageOptions; 76 | getContainer(sortIndex: UISceneDisplay): Phaser.GameObjects.Container; 77 | get containersNum(): number; 78 | get nativeStage(): Phaser.Input.InputPlugin; 79 | get stageWidth(): number; 80 | get stageHeight(): number; 81 | addChild(child: Phaser.GameObjects.GameObject, type: number, index?: number): void; 82 | removeChild(child: Phaser.GameObjects.GameObject): void; 83 | /**@internal */ 84 | updateScreenSize(): void; 85 | } 86 | -------------------------------------------------------------------------------- /build/types/display/displayobject/Origin.d.ts: -------------------------------------------------------------------------------- 1 | import { DisplayObject } from "./DisplayObject"; 2 | export declare function SetOrigin(display: DisplayObject): void; 3 | -------------------------------------------------------------------------------- /build/types/display/displayobject/Pipeline.d.ts: -------------------------------------------------------------------------------- 1 | export declare function InitPipeline(pipeline: Phaser.Renderer.WebGL.WebGLRenderer | string): void; 2 | -------------------------------------------------------------------------------- /build/types/display/displayobject/Transform.d.ts: -------------------------------------------------------------------------------- 1 | export declare function GetLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix; 2 | export declare function GetWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): any; 3 | export declare function GetLocalPoint(x: number, y: number, point: Phaser.Math.Vector2, camera: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2; 4 | -------------------------------------------------------------------------------- /build/types/display/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./BitmapFont"; 2 | export * from "./FillUtils"; 3 | export * from "./Graphics"; 4 | export * from "./Image"; 5 | export * from "./MovieClip"; 6 | export * from "./UIStage"; 7 | -------------------------------------------------------------------------------- /build/types/display/text/MeasureText.d.ts: -------------------------------------------------------------------------------- 1 | export declare function MeasureText(textStyle: any): { 2 | ascent: number; 3 | descent: number; 4 | fontSize: number; 5 | }; 6 | -------------------------------------------------------------------------------- /build/types/display/text/TextField.d.ts: -------------------------------------------------------------------------------- 1 | import { DisplayObject } from '../displayobject/DisplayObject'; 2 | import { CanvasText } from './canvastext/CanvasText'; 3 | import { ImageManager } from './imagemanager/ImageManager'; 4 | import { TextStyle } from './style/TextStyle'; 5 | import { FillStyleType, HAlignModeString, VAlignModeString } from './Types'; 6 | export declare class TextField extends DisplayObject { 7 | canvas: HTMLCanvasElement; 8 | context: CanvasRenderingContext2D | null; 9 | frame: Phaser.Textures.Frame; 10 | texture: Phaser.Textures.Texture; 11 | padding: Phaser.Geom.Rectangle; 12 | dirty: boolean; 13 | protected _text: string; 14 | protected _imageManager: ImageManager; 15 | protected _canvasText: CanvasText; 16 | protected _style: TextStyle; 17 | private _baseFontSize; 18 | constructor(scene: Phaser.Scene); 19 | initRTL(): void; 20 | setText(value: string | string[]): this; 21 | addImage(key: string, config: string): this; 22 | drawAreaBounds(graphics: any, color: any): this; 23 | updateText(runWrap?: boolean): this; 24 | setPosition(x?: number, y?: number): this; 25 | setWordWrapWidth(width: number, useAdvancedWrap?: boolean): void; 26 | setResolution(resolution: number): void; 27 | setSingleLine(val: boolean): void; 28 | setInteractive(hitArea?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): this; 29 | disableInteractive(): this; 30 | renderCanvas(renderer: Phaser.Renderer.Canvas.CanvasRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void; 31 | renderWebGL(renderer: Phaser.Renderer.WebGL.WebGLRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void; 32 | setColor(val: string): void; 33 | setAlign(val: HAlignModeString): void; 34 | setVAlign(val: VAlignModeString): void; 35 | setBold(val: boolean): void; 36 | setItalic(val: boolean): void; 37 | setUnderline(thickness?: number, style?: FillStyleType, offsetY?: number): void; 38 | setShadowStyle(color: string): void; 39 | setShadowOffset(x: number, y: number): void; 40 | setShadowFill(val: boolean): void; 41 | setLetterSpacing(val: number): void; 42 | setStroke(color: FillStyleType, thickness: number): void; 43 | setLineSpacing(val: number): this; 44 | setFont(font: string): this; 45 | setFontSize(fontSize: string | number): this; 46 | setValign(val: VAlignModeString): void; 47 | protected onContextRestored(): void; 48 | preDestroy(): void; 49 | get imageManager(): ImageManager; 50 | get canvasText(): CanvasText; 51 | get style(): TextStyle; 52 | get text(): string; 53 | set text(val: string); 54 | } 55 | -------------------------------------------------------------------------------- /build/types/display/text/Types.d.ts: -------------------------------------------------------------------------------- 1 | export declare type FillStyleType = string | CanvasGradient | CanvasPattern; 2 | export declare enum HAlignMode { 3 | left = 0, 4 | center = 1, 5 | right = 2 6 | } 7 | export declare type HAlignModeString = 'left' | 'center' | 'right'; 8 | export declare enum VAlignMode { 9 | top = 0, 10 | center = 1, 11 | bottom = 2 12 | } 13 | export declare type VAlignModeString = 'top' | 'center' | 'bottom'; 14 | -------------------------------------------------------------------------------- /build/types/display/text/WrapText.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum WrapMode { 2 | none = 0, 3 | word = 1, 4 | char = 2 5 | } 6 | export declare enum NewLineMode { 7 | none = 0, 8 | raw = 1, 9 | wrapped = 2 10 | } 11 | export declare type LineInfo = { 12 | text: string; 13 | width: number; 14 | newLineMode: NewLineMode; 15 | }; 16 | export declare type GetTextWidthCallbackType = (text: string, context?: unknown) => number; 17 | export declare const SplitTextRegExp: RegExp; 18 | export declare function WrapText(text: string, getTextWidthCallback: GetTextWidthCallbackType, context: unknown, wrapMode: WrapMode, wrapWidth: number, offset?: number): LineInfo[]; 19 | -------------------------------------------------------------------------------- /build/types/display/text/bbcode/Parser.d.ts: -------------------------------------------------------------------------------- 1 | import { ITextStyle } from "../style/TextStyle"; 2 | declare type PropType = { 3 | b?: true; 4 | i?: true; 5 | size?: string; 6 | color?: string; 7 | stroke?: string | true; 8 | u?: string | true; 9 | shadow?: true; 10 | y?: number; 11 | img?: string | true; 12 | url?: string; 13 | }; 14 | export declare class Parser { 15 | constructor(); 16 | splitText(text: string, isPlainTextMode?: boolean): string[]; 17 | tagTextToProp(text: string, prevProp: PropType): { 18 | text: any; 19 | prop: any; 20 | }; 21 | propToContextStyle(defaultStyle: ITextStyle, prop: PropType): ITextStyle; 22 | propToTagText(text: string, prop: PropType, prevProp: any): string; 23 | protected updateProp(prop: any, op: any, key: string, value?: any): void; 24 | protected getFontStyle(isBold: boolean, isItalic: boolean): "" | "bold italic" | "bold" | "italic"; 25 | } 26 | export {}; 27 | -------------------------------------------------------------------------------- /build/types/display/text/canvastext/CanvasText.d.ts: -------------------------------------------------------------------------------- 1 | import { Parser } from "../bbcode/Parser"; 2 | import { HitAreaManager } from "../hitareamanager/HitAreaManager"; 3 | import { Pen } from "../penmanager/Pen"; 4 | import { PenManager } from "../penmanager/PenManager"; 5 | import { TextField } from "../TextField"; 6 | import { WrapMode } from "../WrapText"; 7 | export declare class CanvasText { 8 | hitAreaManager: HitAreaManager; 9 | private _parent; 10 | private _context; 11 | private _canvas; 12 | private _parser; 13 | private defaultStyle; 14 | private autoRound; 15 | private penPool; 16 | private _penManager; 17 | private _tmpPenManager; 18 | private getTextWidth; 19 | constructor(config: any); 20 | updatePenManager(text: string, wrapMode: WrapMode, wrapWidth: number, penManager?: PenManager): PenManager; 21 | draw(x: number, y: number, width: number, height: number, textScrollX?: number, textScrollY?: number): Promise; 22 | destroy(): void; 23 | getPlainText(text: string, start: number, end: number): string; 24 | getPenManager(text: any, retPenManager: any): any; 25 | getText(text: string, start: number, end: number, wrap?: boolean): string; 26 | clonePenManager(ret: PenManager, src: PenManager): PenManager; 27 | getLastPen(penManager?: PenManager): Pen; 28 | setInteractive(): void; 29 | disableInteractive(): void; 30 | clear(): void; 31 | protected pointerDownHandler(pointer: Phaser.Input.Pointer, localX: number, localY: number, event: any): void; 32 | protected pointerUpHandler(pointer: Phaser.Input.Pointer, localX: number, localY: number, event: any): void; 33 | protected fireEvent(eventName: string, pointer: Phaser.Input.Pointer, localX: number, localY: number): void; 34 | get imageManager(): import("../imagemanager/ImageManager").ImageManager; 35 | get startXOffset(): number; 36 | get startYOffset(): any; 37 | get lines(): import("../penmanager/Line").Line[]; 38 | get context(): CanvasRenderingContext2D; 39 | get canvas(): HTMLCanvasElement; 40 | get penManager(): PenManager; 41 | get textWidth(): number; 42 | get textHeight(): number; 43 | get parent(): TextField; 44 | get parser(): Parser; 45 | } 46 | -------------------------------------------------------------------------------- /build/types/display/text/canvastext/DrawMethods.d.ts: -------------------------------------------------------------------------------- 1 | import { Pen } from "../penmanager/Pen"; 2 | import { PenManager } from "../penmanager/PenManager"; 3 | import { CanvasText } from "./CanvasText"; 4 | export declare function Draw(canvasText: CanvasText, drawBoundX: number, drawBoundY: number, drawBoundWidth: number, drawBoundHeight: number, textScrollX?: number, textScrollY?: number, penManager?: PenManager): Promise; 5 | export declare function DrawPen(canvasText: CanvasText, pen: Pen, offsetX: number, offsetY: number): Promise; 6 | -------------------------------------------------------------------------------- /build/types/display/text/canvastext/SyncContextMethods.d.ts: -------------------------------------------------------------------------------- 1 | import { ITextStyle } from "../style/TextStyle"; 2 | export declare function SyncFont(context: CanvasRenderingContext2D, style: ITextStyle): void; 3 | export declare function SyncStyle(context: CanvasRenderingContext2D, style: ITextStyle): void; 4 | export declare function SyncShadow(context: CanvasRenderingContext2D, style: ITextStyle, enable: boolean): void; 5 | -------------------------------------------------------------------------------- /build/types/display/text/const.d.ts: -------------------------------------------------------------------------------- 1 | export declare const CONST: { 2 | NO_NEWLINE: number; 3 | RAW_NEWLINE: number; 4 | WRAPPED_NEWLINE: number; 5 | NO_WRAP: number; 6 | WORD_WRAP: number; 7 | CHAR_WRAP: number; 8 | SPLITREGEXP: RegExp; 9 | }; 10 | -------------------------------------------------------------------------------- /build/types/display/text/hitareamanager/HitAreaManager.d.ts: -------------------------------------------------------------------------------- 1 | export declare class HitAreaManager { 2 | private hitAreas; 3 | constructor(); 4 | destroy(): void; 5 | clear(): this; 6 | add(key: string, x: number, y: number, width: number, height: number): this; 7 | getFirstHitArea(x: number, y: number): HitAreaRectangle; 8 | } 9 | declare class HitAreaRectangle extends Phaser.Geom.Rectangle { 10 | key: string; 11 | } 12 | export {}; 13 | -------------------------------------------------------------------------------- /build/types/display/text/imagemanager/IImageManager.d.ts: -------------------------------------------------------------------------------- 1 | export declare type ImageInfo = { 2 | key: string; 3 | frame?: string; 4 | width?: number; 5 | height?: number; 6 | y?: number; 7 | left?: number; 8 | right?: number; 9 | top?: number; 10 | bottom?: number; 11 | }; 12 | export interface IImageManager { 13 | images: Map; 14 | } 15 | -------------------------------------------------------------------------------- /build/types/display/text/imagemanager/ImageManager.d.ts: -------------------------------------------------------------------------------- 1 | import { IImageManager, ImageInfo } from "./IImageManager"; 2 | export declare class ImageManager implements IImageManager { 3 | images: Map; 4 | constructor(); 5 | add(key: any, config: any): this; 6 | remove(key: string): this; 7 | get(key: string): ImageInfo; 8 | destroy(): void; 9 | getOuterWidth(key: string): number; 10 | getOuterHeight(key: string): number; 11 | protected _add(key: any, config?: any): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/display/text/penmanager/Line.d.ts: -------------------------------------------------------------------------------- 1 | import { Pen } from "./Pen"; 2 | export declare class Line { 3 | pens: Pen[]; 4 | y: number; 5 | height: number; 6 | destroy(): void; 7 | addPen(pen: Pen): this; 8 | hasPen(): boolean; 9 | get firstPen(): Pen; 10 | get lastPen(): Pen; 11 | get pensCounts(): number; 12 | get startIndex(): number; 13 | get width(): number; 14 | } 15 | -------------------------------------------------------------------------------- /build/types/display/text/penmanager/Pen.d.ts: -------------------------------------------------------------------------------- 1 | import { NewLineMode } from "../WrapText"; 2 | export declare class Pen { 3 | text: string; 4 | x: number; 5 | y: number; 6 | width: number; 7 | height: number; 8 | ascent: number; 9 | descent: number; 10 | prop: any; 11 | newLineMode: NewLineMode; 12 | startIndex: number; 13 | set(text?: string, x?: number, y?: number, width?: number, height?: number, ascent?: number, descent?: number, prop?: any, newLineMode?: NewLineMode, startIndex?: number): this; 14 | clone(): Pen; 15 | get plainText(): string; 16 | get wrapText(): string; 17 | get plainTextLength(): number; 18 | get endIndex(): number; 19 | get lastX(): number; 20 | get isTextPen(): boolean; 21 | get isImagePen(): boolean; 22 | get hasAreaMarker(): boolean; 23 | } 24 | -------------------------------------------------------------------------------- /build/types/display/text/penmanager/PenManager.d.ts: -------------------------------------------------------------------------------- 1 | import { NewLineMode } from "../WrapText"; 2 | import { Line } from "./Line"; 3 | import { Pen } from "./Pen"; 4 | declare type PropType = { 5 | [key: string]: any; 6 | }; 7 | export declare class PenManager { 8 | pens: Pen[]; 9 | lines: Line[]; 10 | maxLineWidth: number; 11 | totalLineHeight: number; 12 | private penPool; 13 | constructor({ penPool: penPool }: { 14 | penPool: any; 15 | }); 16 | destroy(): void; 17 | freePens(): this; 18 | getLineStartIndex(index: number): any; 19 | getLineEndIndex(index: number): number; 20 | getLineWidth(index: number): number; 21 | getLineWidths(): any[]; 22 | addTextPen(text: string, x: number, y: number, width: number, height: number, ascent: number, descent: number, prop: PropType, newLineMode?: NewLineMode): this; 23 | addImagePen(x: number, y: number, width: number, height: number, prop: PropType): this; 24 | addNewLinePen(newLineMode: NewLineMode): this; 25 | addPen(pen: Pen): this; 26 | getSliceTagText(propToTextCallback: ((text: string, prop: PropType, prevProp: PropType) => string), propToTextCallbackScope?: any, start?: number, end?: number, wrap?: boolean): string; 27 | clone(targetPenManager?: PenManager): PenManager; 28 | get lastPen(): Pen; 29 | get lastLine(): Line; 30 | get linesCount(): number; 31 | get plainText(): string; 32 | get rawTextLength(): number; 33 | } 34 | export {}; 35 | -------------------------------------------------------------------------------- /build/types/display/text/penmanager/TextMetrics.d.ts: -------------------------------------------------------------------------------- 1 | export declare function GetTextWidth(text: string, context: CanvasRenderingContext2D): number; 2 | export declare type TextHeightResultType = { 3 | ascent: number; 4 | descent: number; 5 | height: number; 6 | }; 7 | export declare function GetTextHeightMetrics(text: string, context: CanvasRenderingContext2D, defaultTextHeight?: number): TextHeightResultType; 8 | -------------------------------------------------------------------------------- /build/types/display/text/penmanager/UpdatePenManager.d.ts: -------------------------------------------------------------------------------- 1 | import { CanvasText } from "../canvastext/CanvasText"; 2 | import { WrapMode } from "../WrapText"; 3 | import { PenManager } from "./PenManager"; 4 | export declare function UpdatePenManager(penManager: PenManager, text: string, canvasText: CanvasText, wrapMode: WrapMode, wrapWidth: number): PenManager; 5 | -------------------------------------------------------------------------------- /build/types/display/text/renderer/CanvasRenderer.d.ts: -------------------------------------------------------------------------------- 1 | import { TextField } from "../TextField"; 2 | export declare function TextCanvasRenderer(renderer: Phaser.Renderer.Canvas.CanvasRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void; 3 | -------------------------------------------------------------------------------- /build/types/display/text/renderer/WebGLRenderer.d.ts: -------------------------------------------------------------------------------- 1 | import { TextField } from "../TextField"; 2 | export declare function TextWebGLRenderer(renderer: Phaser.Renderer.WebGL.WebGLRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void; 3 | -------------------------------------------------------------------------------- /build/types/event/DisplayObjectEvent.d.ts: -------------------------------------------------------------------------------- 1 | export declare class DisplayObjectEvent { 2 | static I18N_CHANGE: string; 3 | static XY_CHANGED: string; 4 | static SIZE_CHANGED: string; 5 | static VISIBLE_CHANGED: string; 6 | static SIZE_DELAY_CHANGE: string; 7 | static MOUSE_WHEEL: string; 8 | static ADDTOSTAGE: string; 9 | static REMOVEFROMSTAGE: string; 10 | static PULL_DOWN_RELEASE: string; 11 | static PULL_UP_RELEASE: string; 12 | } 13 | export declare class InteractiveEvent { 14 | static POINTER_DOWN: string; 15 | static POINTER_UP: string; 16 | static POINTER_OVER: string; 17 | static POINTER_OUT: string; 18 | static POINTER_MOVE: string; 19 | static GAMEOBJECT_DOWN: string; 20 | static GAMEOBJECT_UP: string; 21 | static GAMEOBJECT_OVER: string; 22 | static GAMEOBJECT_OUT: string; 23 | static GAMEOBJECT_MOVE: string; 24 | /** 事件类型。*/ 25 | type: string; 26 | /** 原生浏览器事件。*/ 27 | nativeEvent: any; 28 | /** 事件目标触发对象。*/ 29 | target: Phaser.GameObjects.GameObject; 30 | /** 事件当前冒泡对象。*/ 31 | currentTarget: Phaser.GameObjects.GameObject; 32 | /** @internal */ 33 | _stoped: boolean; 34 | /** 分配给触摸点的唯一标识号(作为 int)。*/ 35 | touchId: number; 36 | /**键盘值*/ 37 | /**滚轮滑动增量*/ 38 | /** 39 | * 设置事件数据。 40 | * @param type 事件类型。 41 | * @param currentTarget 事件目标触发对象。 42 | * @param target 事件当前冒泡对象。 43 | * @return 返回当前 Event 对象。 44 | */ 45 | setTo(type: string, currentTarget: Phaser.GameObjects.GameObject, target: Phaser.GameObjects.GameObject): DisplayObjectEvent; 46 | /** 47 | * 阻止对事件流中当前节点的后续节点中的所有事件侦听器进行处理。此方法不会影响当前节点 (currentTarget) 中的任何事件侦听器。 48 | */ 49 | stopPropagation(): void; 50 | /** 51 | * 触摸点列表。 52 | */ 53 | get touches(): any[]; 54 | } 55 | -------------------------------------------------------------------------------- /build/types/event/Event.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Event { 2 | } 3 | -------------------------------------------------------------------------------- /build/types/event/index.d.ts: -------------------------------------------------------------------------------- 1 | export { DisplayObjectEvent, InteractiveEvent } from "./DisplayObjectEvent"; 2 | export * from "./Event"; 3 | -------------------------------------------------------------------------------- /build/types/gears/GearAnimation.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearAnimation extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | updateState(): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/gears/GearBase.d.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from "../Controller"; 2 | import { GTweener } from "../tween"; 3 | import { ByteBuffer } from "../utils"; 4 | /** 5 | * 与controller关联,eg:一张按钮中的图片可在控制器中不同帧中表现不同 6 | */ 7 | export declare class GearBase { 8 | static disableAllTweenEffect: boolean; 9 | _owner: any; 10 | protected _controller: Controller; 11 | protected _tweenConfig?: GearTweenConfig; 12 | dispose(): void; 13 | get controller(): Controller; 14 | set controller(val: Controller); 15 | get tweenConfig(): GearTweenConfig; 16 | setup(buffer: ByteBuffer): void; 17 | updateFromRelations(dx: number, dy: number): void; 18 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 19 | protected init(): void; 20 | apply(): void; 21 | updateState(): void; 22 | } 23 | export declare class GearTweenConfig { 24 | tween: boolean; 25 | easeType: number; 26 | duration: number; 27 | delay: number; 28 | _displayLockToken: number; 29 | _tweener: GTweener; 30 | constructor(); 31 | } 32 | -------------------------------------------------------------------------------- /build/types/gears/GearColor.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearColor extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | updateState(): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/gears/GearDisplay.d.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | export declare class GearDisplay extends GearBase { 3 | pages: string[]; 4 | private _visible; 5 | private _displayLockToken; 6 | protected init(): void; 7 | apply(): void; 8 | addLock(): number; 9 | releaseLock(token: number): void; 10 | get connected(): boolean; 11 | } 12 | -------------------------------------------------------------------------------- /build/types/gears/GearDisplay2.d.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | export declare class GearDisplay2 extends GearBase { 3 | pages: string[]; 4 | condition: number; 5 | private _visible; 6 | protected init(): void; 7 | apply(): void; 8 | evaluate(connected: boolean): boolean; 9 | } 10 | -------------------------------------------------------------------------------- /build/types/gears/GearFontSize.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearFontSize extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | updateState(): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/gears/GearIcon.d.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | import { ByteBuffer } from './../utils/ByteBuffer'; 3 | export declare class GearIcon extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | updateState(): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/gears/GearLook.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearLook extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | private __tweenUpdate; 10 | private __tweenComplete; 11 | updateState(): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/gears/GearSize.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearSize extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | private __tweenUpdate; 10 | private __tweenComplete; 11 | updateState(): void; 12 | updateFromRelations(dx: number, dy: number): void; 13 | } 14 | -------------------------------------------------------------------------------- /build/types/gears/GearText.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearText extends GearBase { 4 | private _storage; 5 | private _default; 6 | protected init(): void; 7 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 8 | apply(): void; 9 | updateState(): void; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/gears/GearXY.d.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export declare class GearXY extends GearBase { 4 | positionsInPercent: boolean; 5 | private _storage; 6 | private _default; 7 | protected init(): void; 8 | protected addStatus(pageId: string, buffer: ByteBuffer): void; 9 | addExtStatus(pageId: string, buffer: ByteBuffer): void; 10 | apply(): void; 11 | private __tweenUpdate; 12 | private __tweenComplete; 13 | updateState(): void; 14 | updateFromRelations(dx: number, dy: number): void; 15 | } 16 | -------------------------------------------------------------------------------- /build/types/gears/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./GearAnimation"; 2 | export * from "./GearBase"; 3 | export * from "./GearColor"; 4 | export * from "./GearDisplay"; 5 | export * from "./GearDisplay2"; 6 | export * from "./GearFontSize"; 7 | export * from "./GearIcon"; 8 | export * from "./GearLook"; 9 | export * from "./GearSize"; 10 | export * from "./GearText"; 11 | export * from "./GearXY"; 12 | -------------------------------------------------------------------------------- /build/types/index.d.ts: -------------------------------------------------------------------------------- 1 | export { GGroup } from "./GGroup"; 2 | export { GObject } from "./GObject"; 3 | export { GGraph } from "./GGraph"; 4 | export { GImage } from "./GImage"; 5 | export { GMovieClip } from "./GMovieClip"; 6 | export { GRoot } from "./GRoot"; 7 | export { GTextField } from "./GTextField"; 8 | export { GRichTextField } from "./GRichTextField"; 9 | export { GTextInput } from "./GTextInput"; 10 | export { GLoader } from "./GLoader"; 11 | export { GComponent } from "./GComponent"; 12 | export { GLabel } from "./GLabel"; 13 | export { GButton } from "./GButton"; 14 | export { GComboBox } from "./GComboBox"; 15 | export { GSlider } from "./GSlider"; 16 | export { GProgressBar } from "./GProgressBar"; 17 | export { GScrollBar } from "./GScrollBar"; 18 | export { GList } from "./GList"; 19 | export { GTree } from "./GTree"; 20 | export { GTreeNode } from "./GTreeNode"; 21 | export { Window } from "./Window"; 22 | export { PopupMenu } from "./PopupMenu"; 23 | export { Controller } from "./Controller"; 24 | export { Transition } from "./Transition"; 25 | export { ScrollPane } from "./ScrollPane"; 26 | export { RelationType } from "./FieldTypes"; 27 | export { UIPackage } from "./UIPackage"; 28 | export { PackageItem } from "./PackageItem"; 29 | export { GObjectPool } from "./GObjectPool"; 30 | export { UIObjectFactory } from "./UIObjectFactory"; 31 | export { UIConfig } from "./UIConfig"; 32 | export { DragDropManager } from "./DragDropManager"; 33 | export { AsyncOperation } from "./AsyncOperation"; 34 | export { TranslationHelper } from "./TranslationHelper"; 35 | export * from "./FieldTypes"; 36 | export * from "./display"; 37 | export * from "./event"; 38 | export * from "./tween"; 39 | export * from "./utils"; 40 | -------------------------------------------------------------------------------- /build/types/input/InputManager.d.ts: -------------------------------------------------------------------------------- 1 | export interface IInteractiveObj { 2 | fun: Function; 3 | context?: any; 4 | } 5 | export declare class InputManager { 6 | private _scene; 7 | private _downHandlerMap; 8 | private _upHandlerMap; 9 | private _moveHandlerMap; 10 | private _overHandlerMap; 11 | private _outHandlerMap; 12 | constructor(); 13 | setScene(scene: Phaser.Scene): void; 14 | clear(): void; 15 | destroy(): void; 16 | addToListener(type: string, gameObject: Phaser.GameObjects.GameObject, fun: Function, context: any): void; 17 | removeFromListener(type: string, gameObject: Phaser.GameObjects.GameObject, context: any): void; 18 | protected addListener(): void; 19 | protected removeListener(): void; 20 | protected gameOver(pointer: Phaser.Input.Pointer, gameObject: Phaser.GameObjects.GameObject): void; 21 | protected gameOut(pointer: Phaser.Input.Pointer, gameObject: Phaser.GameObjects.GameObject): void; 22 | protected gameDown(pointer: Phaser.Input.Pointer, gameObject: Phaser.GameObjects.GameObject): void; 23 | protected gameUp(pointer: Phaser.Input.Pointer, gameObject: Phaser.GameObjects.GameObject): void; 24 | protected gameMove(pointer: Phaser.Input.Pointer, gameObject: Phaser.GameObjects.GameObject): void; 25 | } 26 | -------------------------------------------------------------------------------- /build/types/texture/TextureManager.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 用于管理faiygui贴图加载的管理器 3 | * 持续更新 4 | */ 5 | export declare class TextureManager { 6 | private _addTextureMap; 7 | constructor(); 8 | add(key: string): void; 9 | get(key: string): boolean; 10 | } 11 | -------------------------------------------------------------------------------- /build/types/tween/EaseManager.d.ts: -------------------------------------------------------------------------------- 1 | export declare function evaluateEase(easeType: number, time: number, duration: number, overshootOrAmplitude: number, period: number): number; 2 | -------------------------------------------------------------------------------- /build/types/tween/EaseType.d.ts: -------------------------------------------------------------------------------- 1 | export declare class EaseType { 2 | static Linear: number; 3 | static SineIn: number; 4 | static SineOut: number; 5 | static SineInOut: number; 6 | static QuadIn: number; 7 | static QuadOut: number; 8 | static QuadInOut: number; 9 | static CubicIn: number; 10 | static CubicOut: number; 11 | static CubicInOut: number; 12 | static QuartIn: number; 13 | static QuartOut: number; 14 | static QuartInOut: number; 15 | static QuintIn: number; 16 | static QuintOut: number; 17 | static QuintInOut: number; 18 | static ExpoIn: number; 19 | static ExpoOut: number; 20 | static ExpoInOut: number; 21 | static CircIn: number; 22 | static CircOut: number; 23 | static CircInOut: number; 24 | static ElasticIn: number; 25 | static ElasticOut: number; 26 | static ElasticInOut: number; 27 | static BackIn: number; 28 | static BackOut: number; 29 | static BackInOut: number; 30 | static BounceIn: number; 31 | static BounceOut: number; 32 | static BounceInOut: number; 33 | static Custom: number; 34 | } 35 | -------------------------------------------------------------------------------- /build/types/tween/GPath.d.ts: -------------------------------------------------------------------------------- 1 | import { GPathPoint } from './GPathPoint'; 2 | export declare class GPath { 3 | private _segments; 4 | private _points; 5 | private _fullLength; 6 | constructor(); 7 | get length(): number; 8 | create(pt1: Array | GPathPoint, pt2?: GPathPoint, pt3?: GPathPoint, pt4?: GPathPoint): void; 9 | private createSplineSegment; 10 | clear(): void; 11 | getPointAt(t: number, result?: Phaser.Geom.Point): Phaser.Geom.Point; 12 | get segmentCount(): number; 13 | getAnchorsInSegment(segmentIndex: number, points?: Array): Array; 14 | getPointsInSegment(segmentIndex: number, t0: number, t1: number, points?: Array, ts?: Array, pointDensity?: number): Array; 15 | getAllPoints(points?: Array, ts?: Array, pointDensity?: number): Array; 16 | private onCRSplineCurve; 17 | private onBezierCurve; 18 | } 19 | -------------------------------------------------------------------------------- /build/types/tween/GPathPoint.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum CurveType { 2 | CRSpline = 0, 3 | Bezier = 1, 4 | CubicBezier = 2, 5 | Straight = 3 6 | } 7 | export declare class GPathPoint { 8 | x: number; 9 | y: number; 10 | control1_x: number; 11 | control1_y: number; 12 | control2_x: number; 13 | control2_y: number; 14 | curveType: number; 15 | constructor(); 16 | static newPoint(x?: number, y?: number, curveType?: number): GPathPoint; 17 | static newBezierPoint(x?: number, y?: number, control1_x?: number, control1_y?: number): GPathPoint; 18 | static newCubicBezierPoint(x?: number, y?: number, control1_x?: number, control1_y?: number, control2_x?: number, control2_y?: number): GPathPoint; 19 | clone(): GPathPoint; 20 | } 21 | -------------------------------------------------------------------------------- /build/types/tween/GTween.d.ts: -------------------------------------------------------------------------------- 1 | import { GTweener } from './GTweener'; 2 | export declare class GTween { 3 | static catchCallbackExceptions: boolean; 4 | static to(start: number, end: number, duration: number): GTweener; 5 | static to2(start: number, start2: number, end: number, end2: number, duration: number): GTweener; 6 | static to3(start: number, start2: number, start3: number, end: number, end2: number, end3: number, duration: number): GTweener; 7 | static to4(start: number, start2: number, start3: number, start4: number, end: number, end2: number, end3: number, end4: number, duration: number): GTweener; 8 | static toColor(start: number, end: number, duration: number): GTweener; 9 | static delayedCall(delay: number): GTweener; 10 | static shake(startX: number, startY: number, amplitude: number, duration: number): GTweener; 11 | static isTweening(target: any, propType?: any): Boolean; 12 | static kill(target: any, complete?: boolean, propType?: any): void; 13 | static getTween(target: any, propType?: any): GTweener; 14 | } 15 | -------------------------------------------------------------------------------- /build/types/tween/TweenManager.d.ts: -------------------------------------------------------------------------------- 1 | import { GTweener } from './GTweener'; 2 | export declare class TweenManager { 3 | private static updateTween; 4 | static createTween(): GTweener; 5 | static isTweening(target: any, propType: any): boolean; 6 | static killTweens(target: any, completed: boolean, propType: any): boolean; 7 | static getTween(target: any, propType: any): GTweener; 8 | static update(): void; 9 | } 10 | -------------------------------------------------------------------------------- /build/types/tween/TweenValue.d.ts: -------------------------------------------------------------------------------- 1 | export declare class TweenValue { 2 | x: number; 3 | y: number; 4 | z: number; 5 | w: number; 6 | constructor(); 7 | get color(): number; 8 | set color(value: number); 9 | getField(index: number): number; 10 | setField(index: number, value: number): void; 11 | setZero(): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/tween/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./EaseManager"; 2 | export * from "./EaseType"; 3 | export * from "./GPath"; 4 | export * from "./GPathPoint"; 5 | export * from "./GTween"; 6 | export * from "./GTweener"; 7 | export * from "./TweenManager"; 8 | export * from "./TweenValue"; 9 | -------------------------------------------------------------------------------- /build/types/utils/ByteBuffer.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ByteBuffer { 2 | stringTable: Array; 3 | version: number; 4 | littleEndian: boolean; 5 | protected _view: DataView; 6 | protected _bytes: Uint8Array; 7 | protected _pos: number; 8 | protected _length: number; 9 | constructor(buffer: ArrayBuffer, offset?: number, length?: number); 10 | canRead(): boolean; 11 | get data(): Uint8Array; 12 | get position(): number; 13 | set position(value: number); 14 | skip(count: number): void; 15 | private validate; 16 | readByte(): number; 17 | readUbyte(): number; 18 | readBool(): boolean; 19 | readShort(): number; 20 | readUshort(): number; 21 | readInt(): number; 22 | readUint(): number; 23 | readFloat(): number; 24 | readString(len?: number): string; 25 | readS(): string; 26 | readSArray(cnt: number): Array; 27 | writeS(value: string): void; 28 | readColor(hasAlpha?: boolean): number; 29 | readColorS(hasAlpha?: boolean): string; 30 | readChar(): string; 31 | readBuffer(): ByteBuffer; 32 | seek(indexTablePos: number, blockIndex: number): boolean; 33 | } 34 | -------------------------------------------------------------------------------- /build/types/utils/ChildHitArea.d.ts: -------------------------------------------------------------------------------- 1 | import { HitArea } from './HitArea'; 2 | import { GObject } from './../GObject'; 3 | export declare class ChildHitArea extends HitArea { 4 | private _child; 5 | private _reversed; 6 | private _tPos; 7 | constructor(child: GObject, reversed?: boolean); 8 | contains(x: number, y: number): boolean; 9 | } 10 | -------------------------------------------------------------------------------- /build/types/utils/ColorMatrix.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ColorMatrix { 2 | readonly matrix: Array; 3 | constructor(p_brightness?: number, p_contrast?: number, p_saturation?: number, p_hue?: number); 4 | reset(): void; 5 | invert(): void; 6 | adjustColor(p_brightness: number, p_contrast: number, p_saturation: number, p_hue: number): void; 7 | adjustBrightness(p_val: number): void; 8 | adjustContrast(p_val: number): void; 9 | adjustSaturation(p_val: number): void; 10 | adjustHue(p_val: number): void; 11 | concat(p_matrix: Array): void; 12 | clone(): ColorMatrix; 13 | protected copyMatrix(p_matrix: Array): void; 14 | protected multiplyMatrix(p_matrix: Array): void; 15 | protected cleanValue(p_val: number, p_limit: number): number; 16 | } 17 | -------------------------------------------------------------------------------- /build/types/utils/DOMEventManager.d.ts: -------------------------------------------------------------------------------- 1 | export declare class DOMEventManager extends Phaser.Events.EventEmitter { 2 | static inst: DOMEventManager; 3 | constructor(); 4 | private notifyResizeEvents; 5 | private onMouseWheel; 6 | private retEvent; 7 | private lowestDelta; 8 | private nullLowestDeltaTimeout; 9 | private nullLowestDelta; 10 | /*******************keys*******************/ 11 | private $pressedKeys; 12 | private $releasedKeys; 13 | private $downKeys; 14 | isKeyDown(key: number): boolean; 15 | isKeyPressed(key: number): boolean; 16 | isKeyReleased(key: number): boolean; 17 | private onWindowKeyDown; 18 | private onWindowKeyUp; 19 | } 20 | -------------------------------------------------------------------------------- /build/types/utils/Handler.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | *

Handler 是事件处理器类。

3 | *

推荐使用 Handler.create() 方法从对象池创建,减少对象创建消耗。创建的 Handler 对象不再使用后,可以使用 Handler.recover() 将其回收到对象池,回收后不要再使用此对象,否则会导致不可预料的错误。

4 | *

注意:由于鼠标事件也用本对象池,不正确的回收及调用,可能会影响鼠标事件的执行。

5 | */ 6 | export declare class Handler { 7 | /**@private handler对象池*/ 8 | protected static _pool: Handler[]; 9 | /**@private */ 10 | private static _gid; 11 | /** 执行域(this)。*/ 12 | caller: Object | null; 13 | /** 处理方法。*/ 14 | method: Function | null; 15 | /** 参数。*/ 16 | args: any[] | null; 17 | /** 表示是否只执行一次。如果为true,回调后执行recover()进行回收,回收后会被再利用,默认为false 。*/ 18 | once: boolean; 19 | /**@private */ 20 | protected _id: number; 21 | /** 22 | * 根据指定的属性值,创建一个 Handler 类的实例。 23 | * @param caller 执行域。 24 | * @param method 处理函数。 25 | * @param args 函数参数。 26 | * @param once 是否只执行一次。 27 | */ 28 | constructor(caller?: Object | null, method?: Function | null, args?: any[] | null, once?: boolean); 29 | /** 30 | * 设置此对象的指定属性值。 31 | * @param caller 执行域(this)。 32 | * @param method 回调方法。 33 | * @param args 携带的参数。 34 | * @param once 是否只执行一次,如果为true,执行后执行recover()进行回收。 35 | * @return 返回 handler 本身。 36 | */ 37 | setTo(caller: any, method: Function | null, args: any[] | null, once?: boolean): Handler; 38 | /** 39 | * 执行处理器。 40 | */ 41 | run(): any; 42 | /** 43 | * 执行处理器,并携带额外数据。 44 | * @param data 附加的回调数据,可以是单数据或者Array(作为多参)。 45 | */ 46 | runWith(data: any): any; 47 | /** 48 | * 清理对象引用。 49 | */ 50 | clear(): Handler; 51 | /** 52 | * 清理并回收到 Handler 对象池内。 53 | */ 54 | recover(): void; 55 | /** 56 | * 从对象池内创建一个Handler,默认会执行一次并立即回收,如果不需要自动回收,设置once参数为false。 57 | * @param caller 执行域(this)。 58 | * @param method 回调方法。 59 | * @param args 携带的参数。 60 | * @param once 是否只执行一次,如果为true,回调后执行recover()进行回收,默认为true。 61 | * @return 返回创建的handler实例。 62 | */ 63 | static create(caller: any, method: Function | null, args?: any[] | null, once?: boolean): Handler; 64 | } 65 | -------------------------------------------------------------------------------- /build/types/utils/HitArea.d.ts: -------------------------------------------------------------------------------- 1 | import { Graphics } from "../display/Graphics"; 2 | /** 3 | * 鼠标点击区域,可以设置绘制一系列矢量图作为点击区域和非点击区域(目前只支持圆形,矩形,多边形) 4 | * 5 | */ 6 | export declare class HitArea { 7 | /**@private */ 8 | private static _rect; 9 | /**@private */ 10 | private static _ptPoint; 11 | /**@private */ 12 | private _hit; 13 | /**@private */ 14 | private _unHit; 15 | /** 16 | * 检测对象是否包含指定的点。 17 | * @param x 点的 X 轴坐标值(水平位置)。 18 | * @param y 点的 Y 轴坐标值(垂直位置)。 19 | * @return 如果包含指定的点,则值为 true;否则为 false。 20 | */ 21 | contains(x: number, y: number): boolean; 22 | /** 23 | * @internal 24 | * 是否击中Graphic 25 | */ 26 | static _isHitGraphic(x: number, y: number, graphic: Graphics): boolean; 27 | /** 28 | * @internal 29 | * 是否击中绘图指令 30 | */ 31 | static _isHitCmd(x: number, y: number, g: Graphics): boolean; 32 | /** 33 | * @internal 34 | * 坐标是否在多边形内 35 | */ 36 | static _ptInPolygon(x: number, y: number, areaPoints: any[]): boolean; 37 | /** 38 | * 可点击区域,可以设置绘制一系列矢量图作为点击区域(目前只支持圆形,矩形,多边形) 39 | */ 40 | get hit(): Graphics; 41 | set hit(value: Graphics); 42 | /** 43 | * 不可点击区域,可以设置绘制一系列矢量图作为非点击区域(目前只支持圆形,矩形,多边形) 44 | */ 45 | get unHit(): Graphics; 46 | set unHit(value: Graphics); 47 | } 48 | -------------------------------------------------------------------------------- /build/types/utils/PixelHitTest.d.ts: -------------------------------------------------------------------------------- 1 | import { Byte } from './Byte'; 2 | import { HitArea } from './HitArea'; 3 | export declare class PixelHitTest extends HitArea { 4 | private _data; 5 | offsetX: number; 6 | offsetY: number; 7 | scaleX: number; 8 | scaleY: number; 9 | constructor(data: PixelHitTestData, offsetX: number, offsetY: number); 10 | contains(x: number, y: number): boolean; 11 | } 12 | export declare class PixelHitTestData { 13 | pixelWidth: number; 14 | scale: number; 15 | pixels: number[]; 16 | constructor(); 17 | load(ba: Byte): void; 18 | } 19 | -------------------------------------------------------------------------------- /build/types/utils/Pool.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Pool { 2 | items: T[]; 3 | constructor(); 4 | pop(): T; 5 | push(l: T): this; 6 | clear(): this; 7 | pushMultiple(item: T[]): this; 8 | destroy(): void; 9 | } 10 | -------------------------------------------------------------------------------- /build/types/utils/ToolSet.d.ts: -------------------------------------------------------------------------------- 1 | import { GObject } from './../GObject'; 2 | export declare class ToolSet { 3 | static Color: string; 4 | static Gray: string; 5 | static Red: string; 6 | static Green: string; 7 | static Blue: string; 8 | static startsWith(source: string, str: string, ignoreCase?: boolean): boolean; 9 | static endsWith(source: string, str: string, ignoreCase?: boolean): boolean; 10 | static trimRight(targetString: string): string; 11 | static convertToHtmlColor(argb: number, hasAlpha?: boolean): string; 12 | static convertFromHtmlColor(str: string, hasAlpha?: boolean): number; 13 | static displayObjectToGObject(obj: any): GObject; 14 | static encodeHTML(str: string): string; 15 | static clamp(value: number, min: number, max: number): number; 16 | static clamp01(value: number): number; 17 | static lerp(start: number, end: number, percent: number): number; 18 | static repeat(t: number, length: number): number; 19 | static distance(x1: number, y1: number, x2: number, y2: number): number; 20 | static setColorFilter(obj: any, color?: string | number[] | boolean): void; 21 | /** 22 | * rgb值转换成十六进制 23 | * @param rgbStr 24 | * @returns 25 | */ 26 | static colorHex(rgbStr: string): string; 27 | /** 28 | * 十六进制转换成rgb值 29 | * @param colorStr 30 | * @returns 31 | */ 32 | static colorRgb(colorStr: string): string; 33 | } 34 | -------------------------------------------------------------------------------- /build/types/utils/UBBParser.d.ts: -------------------------------------------------------------------------------- 1 | export declare class UBBParser { 2 | private _text; 3 | private _readPos; 4 | _handlers: { 5 | [index: string]: (tagName: string, end: boolean, attr: string) => string; 6 | }; 7 | defaultImgWidth: number; 8 | defaultImgHeight: number; 9 | lastColor: string; 10 | lastSize: string; 11 | static inst: UBBParser; 12 | constructor(); 13 | protected onTag_URL(tagName: string, end: boolean, attr: string): string; 14 | protected onTag_IMG(tagName: string, end: boolean, attr: string): string; 15 | protected onTag_B(tagName: string, end: boolean, attr: string): string; 16 | protected onTag_I(tagName: string, end: boolean, attr: string): string; 17 | protected onTag_U(tagName: string, end: boolean, attr: string): string; 18 | protected onTag_Simple(tagName: string, end: boolean, attr: string): string; 19 | protected onTag_COLOR(tagName: string, end: boolean, attr: string): string; 20 | protected onTag_FONT(tagName: string, end: boolean, attr: string): string; 21 | protected onTag_SIZE(tagName: string, end: boolean, attr: string): string; 22 | protected getTagText(remove?: boolean): string; 23 | parse(text: string, remove?: boolean): string; 24 | } 25 | -------------------------------------------------------------------------------- /build/types/utils/Utils.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Utils { 2 | /**@private */ 3 | private static _gid; 4 | /**@private */ 5 | private static _pi; 6 | /**@private */ 7 | private static _pi2; 8 | static FPSTarget: number; 9 | /**@private */ 10 | protected static _extReg: RegExp; 11 | static toHexColor(color: number): string; 12 | /** 13 | * 必须是16进制的颜色值规范 “#xxxxxx” 14 | * @param color 15 | * @returns 16 | */ 17 | static toNumColor(color: string): number; 18 | /** 19 | * 角度转弧度。 20 | * @param angle 角度值。 21 | * @return 返回弧度值。 22 | */ 23 | static toRadian(angle: number): number; 24 | } 25 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/BlueShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图通用蓝色滤镜 只适用于texture (Phaser.Image/Phaser.Sprite) 且同一时间只能实现一种变色效果 3 | */ 4 | export declare class BlueShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean; 10 | constructor(game: any); 11 | onPreRender(): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/ColorShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图颜色滤镜 只适用于texture (Phaser.Image/Phaser.Sprite) 且同一时间只能实现一种变色效果 3 | */ 4 | export declare class ColorShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean; 10 | constructor(game: any); 11 | onPreRender(): void; 12 | set r(value: any); 13 | set g(value: any); 14 | set b(value: any); 15 | set a(value: any); 16 | } 17 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/GrayShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图灰色滤镜 只适用于texture 3 | */ 4 | export declare class GrayShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected renderBoo: boolean; 6 | private _a; 7 | constructor(game: any); 8 | onPreRender(): void; 9 | set a(value: any); 10 | } 11 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/GreenShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图绿色滤镜 只适用于texture 3 | */ 4 | export declare class GreenShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean; 10 | constructor(game: any); 11 | onPreRender(): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/RedShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图红色滤镜 只适用于texture 3 | */ 4 | export declare class RedShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean; 10 | constructor(game: any); 11 | onPreRender(): void; 12 | } 13 | -------------------------------------------------------------------------------- /build/types/utils/colorShader/SingleShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | export declare class SingleShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.SinglePipeline { 2 | protected _a: number; 3 | protected _r: number; 4 | protected _g: number; 5 | protected _b: number; 6 | protected renderBoo: boolean; 7 | constructor(game: Phaser.Game); 8 | onPreRender(): void; 9 | set r(value: any); 10 | set g(value: any); 11 | set b(value: any); 12 | set a(value: any); 13 | } 14 | -------------------------------------------------------------------------------- /build/types/utils/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./Byte"; 2 | export * from "./ByteBuffer"; 3 | export * from "./ChildHitArea"; 4 | export * from "./ColorMatrix"; 5 | export * from "./DOMEventManager"; 6 | export * from "./HitArea"; 7 | export * from "./PixelHitTest"; 8 | export * from "./ToolSet"; 9 | export * from "./UBBParser"; 10 | export * from "./Handler"; 11 | export * from "./Utils"; 12 | -------------------------------------------------------------------------------- /build/types/utils/outlineShader/OutlineShaderPipeline.d.ts: -------------------------------------------------------------------------------- 1 | export declare class OutlinePostFxPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { 2 | private thickness; 3 | private _outlineColor; 4 | private renderBoo; 5 | constructor(game: any); 6 | resetFromJSON(o: any): this; 7 | onPreRender(): void; 8 | setThickness(value: any): this; 9 | get outlineColor(): any; 10 | set outlineColor(value: any); 11 | setOutlineColor(value: any): this; 12 | } 13 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /docs/publish/assets/Bag.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Bag.fui -------------------------------------------------------------------------------- /docs/publish/assets/Bag_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Bag_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/Basic.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basic.fui -------------------------------------------------------------------------------- /docs/publish/assets/Basic_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basic_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/Basics.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basics.fui -------------------------------------------------------------------------------- /docs/publish/assets/Basics_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basics_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/Basics_gojg7u.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basics_gojg7u.wav -------------------------------------------------------------------------------- /docs/publish/assets/Basics_o4lt7w.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Basics_o4lt7w.wav -------------------------------------------------------------------------------- /docs/publish/assets/Chat.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Chat.fui -------------------------------------------------------------------------------- /docs/publish/assets/Chat_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Chat_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/ColorShaderPipeline.js: -------------------------------------------------------------------------------- 1 | const fragShader = ` 2 | precision mediump float; 3 | 4 | uniform sampler2D uMainSampler[%count%]; 5 | uniform float r; 6 | uniform float g; 7 | uniform float b; 8 | uniform float a; 9 | 10 | varying vec2 outTexCoord; 11 | varying float outTexId; 12 | varying vec4 outTint; 13 | varying vec2 fragCoord; 14 | 15 | void main() 16 | { 17 | vec4 texture; 18 | 19 | %forloop% 20 | 21 | gl_FragColor = texture; 22 | gl_FragColor.r = r * gl_FragColor.r; 23 | gl_FragColor.g = g * gl_FragColor.g; 24 | gl_FragColor.b = b * gl_FragColor.b; 25 | gl_FragColor.a = a * gl_FragColor.a; 26 | } 27 | `; 28 | 29 | // gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(r * gl_FragColor.r + g * gl_FragColor.g + b * gl_FragColor.b+ a * gl_FragColor.a), color); 30 | export default class ColorShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 31 | constructor(game) { 32 | super({ 33 | game, 34 | fragShader, 35 | uniforms: [ 36 | 'uProjectionMatrix', 37 | 'uMainSampler', 38 | 'r', 39 | "g", 40 | "b", 41 | "a" 42 | ] 43 | }); 44 | 45 | this._a = 1; 46 | this._b = 0; 47 | this._g = 0; 48 | this._r = 1; 49 | this.renderBoo = false; 50 | } 51 | 52 | startRender() { 53 | if (this.renderBoo) return; 54 | this.renderBoo = true; 55 | this.set1f("r", this._r); 56 | this.set1f("g", this._g); 57 | this.set1f("b", this._b); 58 | this.set1f("a", this._a); 59 | } 60 | 61 | set r(value) { 62 | this._r = value; 63 | this.renderBoo=false; 64 | } 65 | 66 | set g(value) { 67 | this._g = value; 68 | this.renderBoo=false; 69 | } 70 | 71 | set b(value) { 72 | this._b = value; 73 | this.renderBoo=false; 74 | } 75 | 76 | set a(value) { 77 | this._a = value; 78 | this.renderBoo=false; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /docs/publish/assets/MainMenu.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/MainMenu.fui -------------------------------------------------------------------------------- /docs/publish/assets/MainMenu_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/MainMenu_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/Package1.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Package1.fui -------------------------------------------------------------------------------- /docs/publish/assets/Package1_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Package1_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/PullToRefresh.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/PullToRefresh.fui -------------------------------------------------------------------------------- /docs/publish/assets/PullToRefresh_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/PullToRefresh_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/ScrollPane.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/ScrollPane.fui -------------------------------------------------------------------------------- /docs/publish/assets/ScrollPane_atlas0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/ScrollPane_atlas0.jpg -------------------------------------------------------------------------------- /docs/publish/assets/Tooqing.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Tooqing.fui -------------------------------------------------------------------------------- /docs/publish/assets/Tooqing_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/Tooqing_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/TreeView.fui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/TreeView.fui -------------------------------------------------------------------------------- /docs/publish/assets/TreeView_atlas0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/TreeView_atlas0.png -------------------------------------------------------------------------------- /docs/publish/assets/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/blue.png -------------------------------------------------------------------------------- /docs/publish/assets/gif-0.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/gif-0.webp -------------------------------------------------------------------------------- /docs/publish/assets/particles/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/particles/red.png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(1).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(10).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(10).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(2).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(3).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(3).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(4).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(4).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(5).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(5).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(6).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(7).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(7).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(8).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(8).png -------------------------------------------------------------------------------- /docs/publish/assets/snow_(9).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/snow_(9).png -------------------------------------------------------------------------------- /docs/publish/assets/star0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star0.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star1.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star10.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star11.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star12.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star13.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star14.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star15.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star16.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star17.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star18.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star19.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star2.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star20.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star21.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star22.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star23.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star24.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star25.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star26.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star27.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star27.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star28.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star29.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star29.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star3.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star4.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star5.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star6.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star7.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star8.jpg -------------------------------------------------------------------------------- /docs/publish/assets/star9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/star9.jpg -------------------------------------------------------------------------------- /docs/publish/assets/webfont/04B.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/webfont/04B.ttf -------------------------------------------------------------------------------- /docs/publish/assets/webfont/SketchStyleNumber.fnt: -------------------------------------------------------------------------------- 1 | info size=12 resizable=true colored=true 2 | char id=48 img=xfg9a0 xoffset=0 yoffset=0 xadvance=0 3 | char id=49 img=xfg9a1 xoffset=0 yoffset=0 xadvance=0 4 | char id=50 img=xfg9a2 xoffset=0 yoffset=0 xadvance=0 5 | char id=51 img=xfg9a3 xoffset=0 yoffset=0 xadvance=0 6 | char id=52 img=xfg9a4 xoffset=0 yoffset=0 xadvance=0 7 | char id=53 img=xfg9a5 xoffset=0 yoffset=0 xadvance=0 8 | char id=54 img=xfg9a6 xoffset=0 yoffset=0 xadvance=0 9 | char id=55 img=xfg9a7 xoffset=0 yoffset=0 xadvance=0 10 | char id=56 img=xfg9a8 xoffset=0 yoffset=0 xadvance=0 11 | char id=57 img=xfg9a9 xoffset=0 yoffset=0 xadvance=0 12 | char id=37 img=xfg9aa xoffset=0 yoffset=0 xadvance=0 13 | -------------------------------------------------------------------------------- /docs/publish/assets/webfont/tt0173m_.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/docs/publish/assets/webfont/tt0173m_.ttf -------------------------------------------------------------------------------- /docs/publish/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | FairyPhaser3-Test 7 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /dts-bundle.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fairygui-phaser", 3 | "main": "types/index.d.ts", 4 | "out": "../release/types/index.d.ts" 5 | } -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const gulp = require("gulp"); 3 | const minify = require('gulp-minify'); 4 | const ts = require('gulp-typescript'); 5 | const tsProject = ts.createProject('tsconfig.json'); 6 | const inject = require('gulp-inject-string'); 7 | 8 | gulp.task('buildJs', () => { 9 | return tsProject.src() 10 | .pipe(tsProject()) 11 | .js.pipe(inject.replace('var fgui;', '')) 12 | .pipe(inject.prepend('window.fgui = {};\nwindow.fairygui = window.fgui;\n')) 13 | .pipe(inject.replace('var __extends', 'window.__extends')) 14 | .pipe(minify({ ext: { min: ".min.js" } })) 15 | .pipe(gulp.dest('./bin')); 16 | }) 17 | 18 | gulp.task("buildDts", () => { 19 | return tsProject.src() 20 | .pipe(tsProject()) 21 | .dts.pipe(inject.append('import fairygui = fgui;')) 22 | .pipe(gulp.dest('./bin')); 23 | }); 24 | 25 | gulp.task("copy", () => { 26 | return gulp.src('bin/**/*') 27 | .pipe(gulp.dest('../demo/assets/Script/Lib/')) 28 | }); 29 | 30 | gulp.task('build', gulp.series( 31 | gulp.parallel('buildJs'), 32 | gulp.parallel('buildDts'), 33 | gulp.parallel('copy') 34 | ) 35 | ) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fairygui-phaser", 3 | "version": "0.0.78", 4 | "main": "build/fairygui.js", 5 | "description": "A flexible UI framework for Phaser3", 6 | "module": "build/fairygui.esm.js", 7 | "types": "build/types/index.d.ts", 8 | "license": "MIT", 9 | "scripts": { 10 | "build": "rimraf build && rollup -c && tsc -d --emitDeclarationOnly --declarationDir build/types", 11 | "ver": "genversion version.js", 12 | "patch": "yarn version --patch && yarn ver", 13 | "dts": "dts-bundle --configJson dts-bundle.json && rm -rf types" 14 | }, 15 | "dependencies": { 16 | "phaser3": "^0.4.34" 17 | }, 18 | "devDependencies": { 19 | "@babel/plugin-transform-runtime": "^7.16.5", 20 | "@rollup/plugin-node-resolve": "^13.0.4", 21 | "circular-dependency-plugin": "^5.2.2", 22 | "dts-bundle": "^0.7.3", 23 | "file-loader": "^6.2.0", 24 | "genversion": "^2.2.0", 25 | "rimraf": "^3.0.2", 26 | "rollup": "^2.56.2", 27 | "rollup-plugin-copy": "^3.4.0", 28 | "rollup-plugin-typescript": "^1.0.1", 29 | "ts-loader": "^7.0.5", 30 | "tslib": "^2.3.1", 31 | "typescript": "^3.9.6" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import { nodeResolve } from '@rollup/plugin-node-resolve'; 2 | import typescript from "rollup-plugin-typescript" 3 | const extensions = ['.js', '.jsx', '.ts', '.tsx']; 4 | export default { 5 | input: "src/index.ts", 6 | output: [ 7 | { 8 | file: "build/fairygui.js", 9 | format: "umd", 10 | name: "fgui", 11 | sourcemap: true, 12 | }, 13 | { 14 | file: "build/fairygui.esm.js", 15 | format: "esm", 16 | name: "fgui", 17 | sourcemap: true 18 | }], 19 | plugins: [ 20 | nodeResolve({ extensions, }), 21 | typescript(), 22 | ["@babel/plugin-transform-runtime"] 23 | ], 24 | external: ["phaser3"] 25 | } -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ApowoGames/FairyGUI-Phaser/91512bce97b0afa5a9f510da0706a1d5108b92c9/src/.DS_Store -------------------------------------------------------------------------------- /src/DragDropManager.ts: -------------------------------------------------------------------------------- 1 | import { Events } from './Events'; 2 | import { ObjectType } from './FieldTypes'; 3 | import { GObject } from './GObject'; 4 | import { GLoader } from './GLoader'; 5 | import { GRoot } from '.'; 6 | export class DragDropManager { 7 | 8 | private _agent: GLoader; 9 | private _sourceData: any; 10 | 11 | private static _inst: DragDropManager; 12 | public static get inst(): DragDropManager { 13 | if (!DragDropManager._inst) 14 | DragDropManager._inst = new DragDropManager(); 15 | return DragDropManager._inst; 16 | } 17 | 18 | constructor() { 19 | this._agent = new GLoader(GRoot.inst.scene, ObjectType.Loader); 20 | this._agent.draggable = true; 21 | this._agent.touchable = false;////important 22 | this._agent.setSize(100, 100); 23 | this._agent.setPivot(0.5, 0.5, true); 24 | this._agent.align = "center"; 25 | this._agent.verticalAlign = "middle"; 26 | this._agent.sortingOrder = 1000000; 27 | this._agent.displayObject.on("dragend", this.__dragEnd, this); 28 | } 29 | 30 | public get dragAgent(): GObject { 31 | return this._agent; 32 | } 33 | 34 | public get dragging(): boolean { 35 | return this._agent.parent != null; 36 | } 37 | 38 | public startDrag(source: GObject, icon: string, sourceData?: any, touchID?: number): void { 39 | if (this._agent.parent) 40 | return; 41 | 42 | this._sourceData = sourceData; 43 | this._agent.url = icon; 44 | GRoot.inst.addChild(this._agent); 45 | var pt: Phaser.Geom.Point = new Phaser.Geom.Point(GRoot.inst.scene.input.activePointer.worldX, GRoot.inst.scene.input.activePointer.worldY); 46 | this._agent.setXY(pt.x, pt.y); 47 | this._agent.startDrag(touchID); 48 | } 49 | 50 | public cancel(): void { 51 | if (this._agent.parent) { 52 | this._agent.stopDrag(); 53 | GRoot.inst.removeChild(this._agent); 54 | this._sourceData = null; 55 | } 56 | } 57 | 58 | private __dragEnd(evt: any): void { 59 | if (!this._agent.parent) //cancelled 60 | return; 61 | 62 | GRoot.inst.removeChild(this._agent); 63 | 64 | var sourceData: any = this._sourceData; 65 | this._sourceData = null; 66 | 67 | var obj: GObject = GObject.cast(evt.target); 68 | while (obj) { 69 | if (obj.displayObject.input.dropZone) { 70 | obj.requestFocus(); 71 | obj.displayObject.emit(Events.DROP, [sourceData, Events.createEvent(Events.DROP, obj.displayObject, evt)]); 72 | return; 73 | } 74 | 75 | obj = obj.parent; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Events.ts: -------------------------------------------------------------------------------- 1 | import { GRoot } from "."; 2 | import { InteractiveEvent } from "./event/DisplayObjectEvent"; 3 | 4 | export class Events { 5 | public static STATE_CHANGED: string = "fui_state_changed"; 6 | public static XY_CHANGED: string = "fui_xy_changed"; 7 | public static SIZE_CHANGED: string = "fui_size_changed"; 8 | public static SIZE_DELAY_CHANGE: string = "fui_size_delay_change"; 9 | public static CLICK_ITEM: string = "fui_click_item"; 10 | public static SCROLL: string = "fui_scroll"; 11 | public static SCROLL_END: string = "fui_scroll_end"; 12 | public static DROP: string = "fui_drop"; 13 | public static DRAG_START: string = "fui_drag_start"; 14 | public static DRAG_MOVE: string = "fui_drag_move"; 15 | public static DRAG_END: string = "fui_drag_end"; 16 | public static PULL_DOWN_RELEASE: string = "fui_pull_down_release"; 17 | public static PULL_UP_RELEASE: string = "fui_pull_up_release"; 18 | public static GEAR_STOP: string = "fui_gear_stop"; 19 | public static LOADER_COMPLETE: string = "fui_loader_complete"; 20 | 21 | public static $event: InteractiveEvent = new InteractiveEvent(); 22 | 23 | public static createEvent(type: string, target: Phaser.GameObjects.GameObject, source?: { target?: Phaser.GameObjects.GameObject, touchId?: number }): InteractiveEvent { 24 | this.$event.setTo(type, target, source ? (source.target || target) : target); 25 | this.$event.touchId = source ? (source.touchId || 0) : 0; 26 | this.$event.nativeEvent = source; 27 | this.$event["_stoped"] = false; 28 | return this.$event; 29 | } 30 | 31 | public static dispatch(type: string, target: Phaser.GameObjects.GameObject, source?: { target?: Phaser.GameObjects.GameObject, touchId?: number }): void { 32 | target.emit(type, this.createEvent(type, target, source)); 33 | // GRoot.inst.emitter.emit(type, target); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/GObjectPool.ts: -------------------------------------------------------------------------------- 1 | import { UIPackage } from './UIPackage'; 2 | import { GObject } from './GObject'; 3 | export class GObjectPool { 4 | private _pool: { [index: string]: Array }; 5 | private _count: number = 0; 6 | 7 | constructor() { 8 | this._pool = {}; 9 | } 10 | 11 | public clear(): void { 12 | for (var i1 in this._pool) { 13 | var arr: Array = this._pool[i1]; 14 | var cnt: number = arr.length; 15 | for (var i: number = 0; i < cnt; i++) 16 | arr[i].dispose(); 17 | } 18 | this._pool = {}; 19 | this._count = 0; 20 | } 21 | 22 | public get count(): number { 23 | return this._count; 24 | } 25 | 26 | public getObject(url: string): Promise { 27 | return new Promise((reslove, reject) => { 28 | url = UIPackage.normalizeURL(url); 29 | if (url == null) { 30 | // console.log("getObject null", url); 31 | return reslove(null); 32 | } 33 | 34 | 35 | var arr: Array = this._pool[url]; 36 | if (arr && arr.length > 0) { 37 | this._count--; 38 | // console.log("getObject arr.shift"); 39 | return reslove(arr.shift()); 40 | } 41 | 42 | UIPackage.createObjectFromURL(url).then((obj) => { 43 | // console.log("getObject create"); 44 | return reslove(obj); 45 | }); 46 | }); 47 | } 48 | 49 | public returnObject(obj: GObject): void { 50 | var url: string = obj.resourceURL; 51 | if (!url) 52 | return; 53 | 54 | var arr: Array = this._pool[url]; 55 | if (arr == null) { 56 | arr = []; 57 | this._pool[url] = arr; 58 | } 59 | 60 | this._count++; 61 | arr.push(obj); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/GRichTextField.ts: -------------------------------------------------------------------------------- 1 | import { GBasicTextField } from './GBasicTextField'; 2 | export class GRichTextField extends GBasicTextField { 3 | 4 | constructor(scene: Phaser.Scene, type) { 5 | super(scene, type); 6 | this._text = ""; 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /src/IUISource.ts: -------------------------------------------------------------------------------- 1 | export interface IUISource { 2 | fileName: string; 3 | loaded: boolean; 4 | load(callback: Function, thisObj: any): void; 5 | } -------------------------------------------------------------------------------- /src/Margin.ts: -------------------------------------------------------------------------------- 1 | export class Margin { 2 | public left: number = 0; 3 | public right: number = 0; 4 | public top: number = 0; 5 | public bottom: number = 0; 6 | 7 | public copy(source: Margin): void { 8 | this.top = source.top; 9 | this.bottom = source.bottom; 10 | this.left = source.left; 11 | this.right = source.right; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/PackageItem.ts: -------------------------------------------------------------------------------- 1 | import { BitmapFont } from './display/BitmapFont'; 2 | import { PixelHitTestData } from './utils/PixelHitTest'; 3 | import { ByteBuffer } from './utils/ByteBuffer'; 4 | import { UIPackage } from './UIPackage'; 5 | import { GRoot } from './GRoot'; 6 | export class PackageItem { 7 | public owner: UIPackage; 8 | 9 | public type: number; 10 | public objectType?: number; 11 | 12 | public id: string; 13 | public name: string; 14 | public x: number = 0; 15 | public y: number = 0; 16 | public tx: number = 0; 17 | public ty: number = 0; 18 | public width: number = 0; 19 | public height: number = 0; 20 | public file: string; 21 | public decoded?: boolean; 22 | public loading?: Array; 23 | public rawData?: ByteBuffer; 24 | 25 | public highResolution?: Array; 26 | public branches?: Array; 27 | 28 | //image 29 | public scale9Grid?: Phaser.Geom.Rectangle; 30 | public scaleByTile?: boolean; 31 | public tileGridIndice?: number; 32 | public smoothing?: boolean; 33 | public texture?: Phaser.Textures.Texture; 34 | public pixelHitTestData?: PixelHitTestData; 35 | 36 | //movieclip 37 | public interval?: number; 38 | public repeatDelay?: number; 39 | public swing?: boolean; 40 | public frames?: Phaser.Textures.Frame[]; 41 | 42 | //componenet 43 | public extensionType?: any; 44 | 45 | //font 46 | public bitmapFont?: BitmapFont; 47 | 48 | //skeleton 49 | // public templet?: Laya.Templet; 50 | public skeletonAnchor?: Phaser.Geom.Point; 51 | 52 | private _isHighRes: boolean = false; 53 | 54 | constructor() { 55 | } 56 | 57 | public getBranch(): PackageItem { 58 | if (this.branches && this.owner._branchIndex != -1) { 59 | var itemId: string = this.branches[this.owner._branchIndex]; 60 | if (itemId) 61 | return this.owner.getItemById(itemId); 62 | } 63 | 64 | return this; 65 | } 66 | 67 | public getHighResolution(): PackageItem { 68 | this._isHighRes = false; 69 | // if (this.highResolution && GRoot.contentDprLevel > 0) { 70 | // var itemId: string = this.highResolution[GRoot.contentDprLevel - 1]; 71 | // if (itemId) { 72 | // const item = this.owner.getItemById(itemId); 73 | // item.isHighRes = true; 74 | // this._isHighRes = true; 75 | // return item; 76 | // } 77 | // } 78 | return this; 79 | } 80 | 81 | public get isHighRes(): boolean { 82 | return this._isHighRes; 83 | } 84 | 85 | public set isHighRes(val) { 86 | this._isHighRes = val; 87 | } 88 | 89 | public toString(): string { 90 | return this.name; 91 | } 92 | 93 | public load(): Promise { 94 | return new Promise((resolve, reject) => { 95 | this.owner.getItemAsset(this).then((obj) => { 96 | resolve(obj); 97 | }); 98 | }); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/Test.ts: -------------------------------------------------------------------------------- 1 | export class Test { 2 | constructor() { 3 | } 4 | } -------------------------------------------------------------------------------- /src/UIConfig.ts: -------------------------------------------------------------------------------- 1 | import { ScrollBarDisplayType } from './FieldTypes'; 2 | export class UIConfig { 3 | constructor() { 4 | } 5 | 6 | //Default phaser font name 7 | public static defaultFont: string = "Courier"; 8 | 9 | //Resource using in Window.ShowModalWait for locking the window. 10 | public static windowModalWaiting: string; 11 | //Resource using in GRoot.ShowModalWait for locking the screen. 12 | public static globalModalWaiting: string; 13 | 14 | //When a modal window is in front, the background becomes dark. 15 | public static modalLayerColor: string = "rgba(240,255,255,0.8)"; 16 | 17 | //Default button click sound 18 | public static buttonSound: string; 19 | public static buttonSoundVolumeScale: number = 1; 20 | 21 | //Default button click sound 22 | public static horizontalScrollBar: string; 23 | public static verticalScrollBar: string; 24 | //Scrolling step in pixels 25 | public static defaultScrollStep: number = 25; 26 | //Deceleration ratio of scrollpane when its in touch dragging. 27 | public static defaultScrollDecelerationRate: number = 0.967; 28 | 29 | //Default scrollbar display mode. Recommened visible for Desktop and Auto for mobile. 30 | public static defaultScrollBarDisplay: number = ScrollBarDisplayType.Visible; 31 | //Allow dragging the content to scroll. Recommeded true for mobile. 32 | public static defaultScrollTouchEffect: boolean = true; 33 | //The "rebound" effect in the scolling container. Recommeded true for mobile. 34 | public static defaultScrollBounceEffect: boolean = true; 35 | 36 | /** 37 | * 当滚动容器设置为“贴近ITEM”时,判定贴近到哪一个ITEM的滚动距离阀值。 38 | */ 39 | public static defaultScrollSnappingThreshold: number = 0.1; 40 | 41 | /** 42 | * 当滚动容器设置为“页面模式”时,判定翻到哪一页的滚动距离阀值。 43 | */ 44 | public static defaultScrollPagingThreshold: number = 0.3; 45 | 46 | //Resources for PopupMenu. 47 | public static popupMenu: string; 48 | //Resources for seperator of PopupMenu. 49 | public static popupMenu_seperator: string; 50 | //In case of failure of loading content for GLoader, use this sign to indicate an error. 51 | public static loaderErrorSign: string; 52 | //Resources for tooltips. 53 | public static tooltipsWin: string; 54 | 55 | //Max items displayed in combobox without scrolling. 56 | public static defaultComboBoxVisibleItemCount: number = 10; 57 | 58 | // Pixel offsets of finger to trigger scrolling. 59 | public static touchScrollSensitivity: number = 20; 60 | 61 | // Pixel offsets of finger to trigger dragging. 62 | public static touchDragSensitivity: number = 10; 63 | 64 | // Pixel offsets of mouse pointer to trigger dragging. 65 | public static clickDragSensitivity: number = 2; 66 | 67 | // When click the window, brings to front automatically. 68 | public static bringWindowToFrontOnClick: boolean = true; 69 | 70 | public static frameTimeForAsyncUIConstruction: number = 2; 71 | 72 | public static textureLinearSampling: boolean = true; 73 | 74 | public static packageFileExtension: string = "fui"; 75 | } 76 | -------------------------------------------------------------------------------- /src/action/ChangePageAction.ts: -------------------------------------------------------------------------------- 1 | import { GComponent } from '../GComponent'; 2 | import { Controller } from './../Controller'; 3 | import { ByteBuffer } from './../utils/ByteBuffer'; 4 | import { ControllerAction } from './ControllerAction'; 5 | export class ChangePageAction extends ControllerAction { 6 | public objectId: string; 7 | public controllerName: string; 8 | public targetPage: string; 9 | 10 | constructor() { 11 | super(); 12 | } 13 | 14 | protected enter(controller: Controller): void { 15 | if (!this.controllerName) 16 | return; 17 | 18 | var gcom: GComponent; 19 | if (this.objectId) 20 | gcom = controller.parent.getChildById(this.objectId); 21 | else 22 | gcom = controller.parent; 23 | if (gcom) { 24 | var cc: Controller = gcom.getController(this.controllerName); 25 | if (cc && cc != controller && !cc.changing) { 26 | if (this.targetPage == "~1") { 27 | if (controller.selectedIndex < cc.pageCount) 28 | cc.selectedIndex = controller.selectedIndex; 29 | } 30 | else if (this.targetPage == "~2") 31 | cc.selectedPage = controller.selectedPage; 32 | else 33 | cc.selectedPageId = this.targetPage; 34 | } 35 | } 36 | } 37 | 38 | public setup(buffer: ByteBuffer): void { 39 | super.setup(buffer); 40 | 41 | this.objectId = buffer.readS(); 42 | this.controllerName = buffer.readS(); 43 | this.targetPage = buffer.readS(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/action/ControllerAction.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { Controller } from './../Controller'; 3 | export class ControllerAction { 4 | public fromPage: string[]; 5 | public toPage: string[]; 6 | 7 | constructor() { 8 | } 9 | 10 | public run(controller: Controller, prevPage: string, curPage: string): void { 11 | if ((this.fromPage == null || this.fromPage.length == 0 || this.fromPage.indexOf(prevPage) != -1) 12 | && (this.toPage == null || this.toPage.length == 0 || this.toPage.indexOf(curPage) != -1)) 13 | this.enter(controller); 14 | else 15 | this.leave(controller); 16 | } 17 | 18 | protected enter(controller: Controller): void { 19 | 20 | } 21 | 22 | protected leave(controller: Controller): void { 23 | 24 | } 25 | 26 | public setup(buffer: ByteBuffer): void { 27 | var cnt: number; 28 | var i: number; 29 | 30 | cnt = buffer.readShort(); 31 | this.fromPage = []; 32 | for (i = 0; i < cnt; i++) 33 | this.fromPage[i] = buffer.readS(); 34 | 35 | cnt = buffer.readShort(); 36 | this.toPage = []; 37 | for (i = 0; i < cnt; i++) 38 | this.toPage[i] = buffer.readS(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/action/PlayTransitionAction.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { Controller } from './../Controller'; 3 | import { Transition } from './../Transition'; 4 | import { ControllerAction } from './ControllerAction'; 5 | export class PlayTransitionAction extends ControllerAction { 6 | public transitionName: string; 7 | public playTimes: number; 8 | public delay: number; 9 | public stopOnExit: boolean; 10 | 11 | private _currentTransition?: Transition; 12 | 13 | constructor() { 14 | super(); 15 | } 16 | 17 | protected enter(controller: Controller): void { 18 | var trans: Transition = controller.parent.getTransition(this.transitionName); 19 | if (trans) { 20 | if (this._currentTransition && this._currentTransition.playing) 21 | trans.changePlayTimes(this.playTimes); 22 | else 23 | trans.play(null, this.playTimes, this.delay); 24 | this._currentTransition = trans; 25 | } 26 | } 27 | 28 | protected leave(controller: Controller): void { 29 | if (this.stopOnExit && this._currentTransition) { 30 | this._currentTransition.stop(); 31 | this._currentTransition = null; 32 | } 33 | } 34 | 35 | public setup(buffer: ByteBuffer): void { 36 | super.setup(buffer); 37 | 38 | this.transitionName = buffer.readS(); 39 | this.playTimes = buffer.readInt(); 40 | this.delay = buffer.readFloat(); 41 | this.stopOnExit = buffer.readBool(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/action/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./ChangePageAction"; 2 | export * from "./ControllerAction"; 3 | export * from "./PlayTransitionAction"; 4 | -------------------------------------------------------------------------------- /src/display/BitmapFont.ts: -------------------------------------------------------------------------------- 1 | export class BitmapFont { 2 | public id: string; 3 | public size: number = 0; 4 | public ttf?: boolean; 5 | public glyphs: { [index: string]: BMGlyph }; 6 | public resizable?: boolean; 7 | public tint?: boolean; 8 | 9 | constructor() { 10 | this.glyphs = {}; 11 | } 12 | } 13 | 14 | export interface BMGlyph { 15 | x?: number; 16 | y?: number; 17 | width?: number; 18 | height?: number; 19 | advance?: number; 20 | lineHeight?: number; 21 | channel?: number; 22 | texture?: Phaser.Textures.Texture; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/display/displayobject/Origin.ts: -------------------------------------------------------------------------------- 1 | import { DisplayObject } from "./DisplayObject"; 2 | 3 | export function SetOrigin(display: DisplayObject) { 4 | 5 | } -------------------------------------------------------------------------------- /src/display/displayobject/Pipeline.ts: -------------------------------------------------------------------------------- 1 | export function InitPipeline(pipeline: Phaser.Renderer.WebGL.WebGLRenderer | string) { 2 | 3 | } -------------------------------------------------------------------------------- /src/display/displayobject/Transform.ts: -------------------------------------------------------------------------------- 1 | export function GetLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix) { 2 | if (!tempMatrix) { 3 | tempMatrix = new Phaser.GameObjects.Components.TransformMatrix(); 4 | } 5 | return tempMatrix.applyITRS(this.x, this.y, this._rotation, this.scaleX, this.scaleY); 6 | } 7 | 8 | export function GetWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix) { 9 | if (!tempMatrix) { 10 | tempMatrix = new Phaser.GameObjects.Components.TransformMatrix(); 11 | } 12 | if (!parentMatrix) { 13 | parentMatrix = new Phaser.GameObjects.Components.TransformMatrix(); 14 | } 15 | 16 | let parent = this.parentContainer; 17 | if (!parent) { 18 | return this.getLocalTransformMatrix(tempMatrix); 19 | } 20 | tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); 21 | 22 | while (parent) { 23 | parentMatrix.applyITRS(parent.x, parent.y, parent.rotation, parent.scaleX, parent.scaleY); 24 | 25 | parentMatrix.multiply(tempMatrix, tempMatrix); 26 | 27 | parent = parent.parentContainer; 28 | } 29 | return tempMatrix; 30 | } 31 | 32 | export function GetLocalPoint(x: number, y: number, point: Phaser.Math.Vector2, camera: Phaser.Cameras.Scene2D.Camera) { 33 | if (!point) point = new Phaser.Math.Vector2(); 34 | if (!camera) camera = this.scene.sys.cameras.main; 35 | 36 | const csx = camera.scrollX; 37 | const csy = camera.scrollY; 38 | 39 | const px = x + (csx * this.scrollFactorX) - csx; 40 | const py = y + (csy * this.scrollFactorY) - csy; 41 | if (this.parentContainer) { 42 | this.getWorldTransformMatrix().applyInverse(px, py, point); 43 | } else { 44 | Phaser.Math.TransformXY(px, py, this.x, this.y, this._rotation, this.scaleX, this.scaleY, point); 45 | } 46 | 47 | // Normalize origin 48 | if (this._originComponent) { 49 | point.x += this._displayOriginX; 50 | point.y += this._displayOriginY; 51 | } 52 | return point; 53 | } -------------------------------------------------------------------------------- /src/display/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./BitmapFont"; 2 | export * from "./FillUtils"; 3 | export * from "./Graphics"; 4 | export * from "./Image"; 5 | export * from "./MovieClip"; 6 | export * from "./UIStage"; 7 | -------------------------------------------------------------------------------- /src/display/text/LinePool.ts: -------------------------------------------------------------------------------- 1 | import { Pool } from "../../utils/Pool"; 2 | import { LineInfo } from "./WrapText"; 3 | 4 | var LinesPool = new Pool(); 5 | 6 | export function FreeLine(line) { 7 | if (!line) { 8 | return; 9 | } 10 | LinesPool.push(line); 11 | } 12 | 13 | export function FreeLines(lines) { 14 | if (!lines) { 15 | return; 16 | } 17 | LinesPool.pushMultiple(lines); 18 | } 19 | 20 | export function GetLine(text: string, width: number, newLineMode: number): LineInfo { 21 | var l = LinesPool.pop(); 22 | if (!l) { 23 | l = { text: "", width: 0, newLineMode: 0 }; 24 | } 25 | l.text = text; 26 | l.width = width; 27 | l.newLineMode = newLineMode; 28 | return l; 29 | } -------------------------------------------------------------------------------- /src/display/text/Types.ts: -------------------------------------------------------------------------------- 1 | export type FillStyleType = string | CanvasGradient | CanvasPattern; 2 | 3 | export enum HAlignMode { 4 | left = 0, 5 | center = 1, 6 | right = 2 7 | } 8 | 9 | export type HAlignModeString = 'left' | 'center' | 'right'; 10 | 11 | export enum VAlignMode { 12 | top = 0, 13 | center = 1, 14 | bottom = 2 15 | } 16 | 17 | export type VAlignModeString = 'top' | 'center' | 'bottom'; -------------------------------------------------------------------------------- /src/display/text/canvastext/SyncContextMethods.ts: -------------------------------------------------------------------------------- 1 | import { ITextStyle } from "../style/TextStyle"; 2 | 3 | export function SyncFont(context: CanvasRenderingContext2D, style: ITextStyle) { 4 | context.font = style.font; 5 | } 6 | 7 | export function SyncStyle(context: CanvasRenderingContext2D, style: ITextStyle) { 8 | context.textBaseline = "alphabetic"; 9 | context.textAlign = "start"; 10 | 11 | context.fillStyle = style.fillStyle; 12 | context.strokeStyle = style.strokeStyle; 13 | 14 | context.lineWidth = style.strokeThickness; 15 | context.lineCap = "round"; 16 | context.lineJoin = "round"; 17 | context.imageSmoothingEnabled = true; 18 | } 19 | 20 | export function SyncShadow(context: CanvasRenderingContext2D, style: ITextStyle, enable: boolean) { 21 | if (enable) { 22 | context.shadowColor = style.shadowColor; 23 | context.shadowBlur = style.shadowBlur; 24 | context.shadowOffsetX = style.shadowOffsetX; 25 | context.shadowOffsetY = style.shadowOffsetY; 26 | } else { 27 | context.shadowColor = "#000"; 28 | context.shadowBlur = 0; 29 | context.shadowOffsetX = 0; 30 | context.shadowOffsetY = 0; 31 | } 32 | } -------------------------------------------------------------------------------- /src/display/text/const.ts: -------------------------------------------------------------------------------- 1 | export const CONST = { 2 | // new line mode 3 | NO_NEWLINE: 0, 4 | RAW_NEWLINE: 1, 5 | WRAPPED_NEWLINE: 2, 6 | 7 | // wrap mode 8 | NO_WRAP: 0, 9 | WORD_WRAP: 1, 10 | CHAR_WRAP: 2, 11 | 12 | // split lines 13 | SPLITREGEXP: /(?:\r\n|\r|\n)/ 14 | } -------------------------------------------------------------------------------- /src/display/text/hitareamanager/HitAreaManager.ts: -------------------------------------------------------------------------------- 1 | export class HitAreaManager { 2 | private hitAreas: HitAreaRectangle[]; 3 | constructor() { 4 | this.hitAreas = []; 5 | } 6 | 7 | destroy() { 8 | this.clear(); 9 | } 10 | 11 | clear() { 12 | return this; 13 | } 14 | 15 | add(key: string, x: number, y: number, width: number, height: number) { 16 | const rectangle = new HitAreaRectangle(x, y, width, height); 17 | rectangle.key = key; 18 | this.hitAreas.push(rectangle); 19 | return this; 20 | } 21 | 22 | getFirstHitArea(x: number, y: number) { 23 | for (const area of this.hitAreas) { 24 | if (area.contains(x, y)) { 25 | return area; 26 | } 27 | } 28 | } 29 | } 30 | 31 | class HitAreaRectangle extends Phaser.Geom.Rectangle { 32 | public key: string; 33 | } -------------------------------------------------------------------------------- /src/display/text/imagemanager/IImageManager.ts: -------------------------------------------------------------------------------- 1 | export type ImageInfo = { 2 | key: string, 3 | frame?: string, 4 | width?: number, 5 | height?: number, 6 | y?: number, 7 | left?: number, 8 | right?: number, 9 | top?: number, 10 | bottom?: number 11 | } 12 | 13 | export interface IImageManager { 14 | images: Map; 15 | } -------------------------------------------------------------------------------- /src/display/text/imagemanager/ImageManager.ts: -------------------------------------------------------------------------------- 1 | import { IImageManager, ImageInfo } from "./IImageManager"; 2 | 3 | export class ImageManager implements IImageManager { 4 | images: Map; 5 | 6 | constructor() { 7 | this.images = new Map(); 8 | } 9 | 10 | add(key, config) { 11 | if (typeof key === "string") { 12 | this._add(key, config); 13 | } else if (Array.isArray(key)) { 14 | for (const k of key) { 15 | this._add(k); 16 | } 17 | } else { 18 | const data = key; 19 | for (const key in data) { 20 | this._add(key, data[key]); 21 | } 22 | } 23 | return this; 24 | } 25 | 26 | remove(key: string) { 27 | this.images.delete(key); 28 | return this; 29 | } 30 | 31 | get(key: string) { 32 | return this.images.get(key); 33 | } 34 | 35 | destroy() { 36 | this.images.clear(); 37 | } 38 | 39 | getOuterWidth(key: string) { 40 | const imageInfo = this.images.get(key); 41 | return imageInfo ? (imageInfo.width + imageInfo.left + imageInfo.right) : 0; 42 | } 43 | 44 | getOuterHeight(key: string) { 45 | const imageInfo = this.images.get(key); 46 | return imageInfo ? (imageInfo.height + imageInfo.top + imageInfo.bottom) : 0; 47 | } 48 | 49 | protected _add(key, config?) { 50 | if (config === undefined) { 51 | config = { key }; 52 | } 53 | // TODO add image 54 | } 55 | } -------------------------------------------------------------------------------- /src/display/text/penmanager/Line.ts: -------------------------------------------------------------------------------- 1 | import { Pen } from "./Pen"; 2 | 3 | export class Line { 4 | pens: Pen[] = []; 5 | y: number; 6 | height: number; 7 | 8 | destroy() { 9 | this.pens.length = 0; 10 | } 11 | 12 | addPen(pen: Pen): this { 13 | this.pens.push(pen); 14 | return this; 15 | } 16 | 17 | hasPen(): boolean { 18 | return this.pens.length > 0; 19 | } 20 | 21 | get firstPen(): Pen { 22 | return this.pens[0]; 23 | } 24 | 25 | get lastPen(): Pen { 26 | return this.pens[this.pens.length - 1]; 27 | } 28 | 29 | get pensCounts(): number { 30 | return this.pens.length; 31 | } 32 | 33 | get startIndex(): number { 34 | const firstPen = this.pens[0]; 35 | return firstPen ? firstPen.startIndex : 0; 36 | } 37 | 38 | get width() { 39 | const lastPen = this.lastPen; 40 | return lastPen ? lastPen.lastX : 0; 41 | } 42 | } -------------------------------------------------------------------------------- /src/display/text/penmanager/Pen.ts: -------------------------------------------------------------------------------- 1 | import { NewLineMode } from "../WrapText"; 2 | 3 | export class Pen { 4 | text: string = ''; 5 | x: number = 0; 6 | y: number = 0; 7 | width: number = 0; 8 | height: number = 0; 9 | ascent: number = 0; 10 | descent: number = 0; 11 | prop: any = {}; 12 | newLineMode: NewLineMode = NewLineMode.none; 13 | startIndex: number = 0; 14 | 15 | set( 16 | text: string = '', 17 | x: number = 0, 18 | y: number = 0, 19 | width: number = 0, 20 | height: number = 0, 21 | ascent: number = 0, 22 | descent: number = 0, 23 | prop: any = {}, 24 | newLineMode: NewLineMode = NewLineMode.none, 25 | startIndex: number = 0 26 | ): this { 27 | this.text = text; 28 | this.x = x; 29 | this.y = y; 30 | this.width = width; 31 | this.height = height; 32 | this.ascent = ascent; 33 | this.descent = descent; 34 | this.prop = prop; 35 | this.newLineMode = newLineMode; 36 | this.startIndex = startIndex; 37 | 38 | return this; 39 | } 40 | 41 | clone() { 42 | const result = new Pen(); 43 | result.set(this.text, this.x, this.y, this.width, this.height, this.ascent, this.descent, Phaser.Utils.Objects.Clone(this.prop), this.newLineMode, this.startIndex); 44 | return result; 45 | } 46 | 47 | get plainText() { 48 | return (this.newLineMode === NewLineMode.raw) ? `${this.text}\n` : this.text; 49 | } 50 | 51 | get wrapText() { 52 | return (this.newLineMode !== NewLineMode.none) ? `${this.text}\n` : this.text; 53 | } 54 | 55 | get plainTextLength() { 56 | let len = this.text.length; 57 | if (this.newLineMode === NewLineMode.raw) { 58 | len += 1; 59 | } 60 | return len; 61 | } 62 | 63 | get endIndex() { 64 | return this.startIndex + this.plainTextLength; 65 | } 66 | 67 | get lastX() { 68 | return this.x + this.width; 69 | } 70 | 71 | get isTextPen() { 72 | return this.text !== ""; 73 | } 74 | 75 | get isImagePen() { 76 | return Boolean(this.prop.img); 77 | } 78 | 79 | get hasAreaMarker() { 80 | return Boolean(this.prop.url); 81 | } 82 | } -------------------------------------------------------------------------------- /src/display/text/penmanager/TextMetrics.ts: -------------------------------------------------------------------------------- 1 | import { GRoot } from "../../.."; 2 | 3 | export function GetTextWidth(text: string, context: CanvasRenderingContext2D) { 4 | return context.measureText(text).width; 5 | } 6 | 7 | export type TextHeightResultType = { 8 | ascent: number, 9 | descent: number, 10 | height: number 11 | } 12 | 13 | export function GetTextHeightMetrics( 14 | text: string, 15 | context: CanvasRenderingContext2D, 16 | defaultTextHeight: number = 0 17 | ): TextHeightResultType { 18 | 19 | let metrics = context.measureText(text); 20 | let ascent = metrics.actualBoundingBoxAscent; 21 | let descent = metrics.actualBoundingBoxDescent; 22 | if ((!ascent && !descent) || text === '') { 23 | ascent = defaultTextHeight; 24 | descent = 0; 25 | } 26 | 27 | TextHeightResult.ascent = ascent; 28 | TextHeightResult.descent = descent; 29 | TextHeightResult.height = Math.ceil(Math.abs(ascent) + Math.abs(descent)); 30 | return TextHeightResult; 31 | } 32 | 33 | let TextHeightResult: TextHeightResultType = { 34 | ascent: 0, 35 | descent: 0, 36 | height: 0 37 | } -------------------------------------------------------------------------------- /src/display/text/renderer/CanvasRenderer.ts: -------------------------------------------------------------------------------- 1 | import { TextField } from "../TextField"; 2 | 3 | export function TextCanvasRenderer(renderer: Phaser.Renderer.Canvas.CanvasRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix) { 4 | if (src.width === 0 || src.height === 0) { 5 | return; 6 | } 7 | 8 | camera.addToRenderList(src); 9 | 10 | renderer.batchSprite(src, src.frame, camera, parentMatrix); 11 | } -------------------------------------------------------------------------------- /src/display/text/renderer/WebGLRenderer.ts: -------------------------------------------------------------------------------- 1 | import { TextField } from "../TextField"; 2 | 3 | export function TextWebGLRenderer (renderer: Phaser.Renderer.WebGL.WebGLRenderer, src: TextField, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix: Phaser.GameObjects.Components.TransformMatrix) { 4 | if (src.width === 0 || src.height === 0) { 5 | return; 6 | } 7 | camera.addToRenderList(src); 8 | 9 | var frame = src.frame; 10 | var width = frame.width; 11 | var height = frame.height; 12 | var getTint = Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; 13 | var pipeline = renderer.pipelines.set(src.pipeline, src); 14 | var textureUnit = pipeline.setTexture2D(frame.glTexture); 15 | 16 | renderer.pipelines.preBatch(src); 17 | 18 | pipeline.batchTexture( 19 | src, 20 | frame.glTexture, 21 | width, height, 22 | src.x, src.y, 23 | width, height, 24 | src.scaleX, src.scaleY, 25 | src.rotation, 26 | src.flipX, src.flipY, 27 | src.scrollFactorX, src.scrollFactorY, 28 | src.displayOriginX, src.displayOriginY, 29 | 0, 0, width, height, 30 | getTint(src.tintTopLeft, camera.alpha * src.alphaTL), 31 | getTint(src.tintTopRight, camera.alpha * src.alphaTR), 32 | getTint(src.tintBottomLeft, camera.alpha * src.alphaBL), 33 | getTint(src.tintBottomRight, camera.alpha * src.alphaBR), 34 | 0, 35 | 0, 0, 36 | camera, 37 | parentMatrix, 38 | false, 39 | textureUnit 40 | ); 41 | 42 | renderer.pipelines.postBatch(src); 43 | } -------------------------------------------------------------------------------- /src/event/Event.ts: -------------------------------------------------------------------------------- 1 | export class Event { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/event/index.ts: -------------------------------------------------------------------------------- 1 | export { DisplayObjectEvent, InteractiveEvent } from "./DisplayObjectEvent"; 2 | export * from "./Event"; 3 | -------------------------------------------------------------------------------- /src/gears/GearAnimation.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { ObjectPropID } from './../FieldTypes'; 3 | import { GearBase } from './GearBase'; 4 | interface Value { 5 | playing?: boolean; 6 | frame?: number; 7 | } 8 | 9 | export class GearAnimation extends GearBase { 10 | private _storage: { [index: string]: Value }; 11 | private _default: Value; 12 | 13 | protected init(): void { 14 | this._default = { 15 | playing: this._owner.getProp(ObjectPropID.Playing), 16 | frame: this._owner.getProp(ObjectPropID.Frame) 17 | }; 18 | this._storage = {}; 19 | } 20 | 21 | protected addStatus(pageId: string, buffer: ByteBuffer): void { 22 | var gv: Value; 23 | if (pageId == null) 24 | gv = this._default; 25 | else 26 | this._storage[pageId] = gv = {}; 27 | gv.playing = buffer.readBool(); 28 | gv.frame = buffer.readInt(); 29 | } 30 | 31 | public apply(): void { 32 | this._owner._gearLocked = true; 33 | 34 | var gv: Value = this._storage[this._controller.selectedPageId]; 35 | if (!gv) 36 | gv = this._default; 37 | 38 | this._owner.setProp(ObjectPropID.Playing, gv.playing); 39 | this._owner.setProp(ObjectPropID.Frame, gv.frame); 40 | 41 | this._owner._gearLocked = false; 42 | } 43 | 44 | public updateState(): void { 45 | var gv: Value = this._storage[this._controller.selectedPageId]; 46 | if (!gv) 47 | this._storage[this._controller.selectedPageId] = gv = {}; 48 | 49 | gv.playing = this._owner.getProp(ObjectPropID.Playing); 50 | gv.frame = this._owner.getProp(ObjectPropID.Frame); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/gears/GearColor.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { ObjectPropID } from './../FieldTypes'; 3 | import { GearBase } from './GearBase'; 4 | 5 | interface Value { 6 | color?: string; 7 | strokeColor?: string; 8 | } 9 | 10 | export class GearColor extends GearBase { 11 | private _storage: { [index: string]: Value }; 12 | private _default: Value; 13 | 14 | protected init(): void { 15 | this._default = { 16 | color: this._owner.getProp(ObjectPropID.Color), 17 | strokeColor: this._owner.getProp(ObjectPropID.OutlineColor) 18 | }; 19 | this._storage = {}; 20 | } 21 | 22 | protected addStatus(pageId: string, buffer: ByteBuffer): void { 23 | var gv: Value; 24 | if (pageId == null) 25 | gv = this._default; 26 | else 27 | this._storage[pageId] = gv = {}; 28 | gv.color = buffer.readColorS(); 29 | gv.strokeColor = buffer.readColorS(); 30 | } 31 | 32 | public apply(): void { 33 | this._owner._gearLocked = true; 34 | 35 | var gv: Value = this._storage[this._controller.selectedPageId]; 36 | if (!gv) 37 | gv = this._default; 38 | 39 | this._owner.setProp(ObjectPropID.Color, gv.color); 40 | this._owner.setProp(ObjectPropID.OutlineColor, gv.strokeColor); 41 | 42 | this._owner._gearLocked = false; 43 | } 44 | 45 | public updateState(): void { 46 | var gv: Value = this._storage[this._controller.selectedPageId]; 47 | if (!gv) 48 | this._storage[this._controller.selectedPageId] = gv = {}; 49 | 50 | gv.color = this._owner.getProp(ObjectPropID.Color); 51 | gv.strokeColor = this._owner.getProp(ObjectPropID.OutlineColor); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/gears/GearDisplay.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | export class GearDisplay extends GearBase { 3 | public pages: string[]; 4 | private _visible: number; 5 | private _displayLockToken: number = 0; 6 | 7 | protected init(): void { 8 | this.pages = null; 9 | } 10 | 11 | public apply(): void { 12 | this._displayLockToken++; 13 | if (this._displayLockToken == 0) 14 | this._displayLockToken = 1; 15 | 16 | if (this.pages == null || this.pages.length == 0 17 | || this.pages.indexOf(this._controller.selectedPageId) != -1) 18 | this._visible = 1; 19 | else 20 | this._visible = 0; 21 | } 22 | 23 | 24 | public addLock(): number { 25 | this._visible++; 26 | return this._displayLockToken; 27 | } 28 | 29 | public releaseLock(token: number): void { 30 | if (token == this._displayLockToken) 31 | this._visible--; 32 | } 33 | 34 | public get connected(): boolean { 35 | return this._controller == null || this._visible > 0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/gears/GearDisplay2.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | export class GearDisplay2 extends GearBase { 3 | public pages: string[]; 4 | public condition: number; 5 | 6 | private _visible: number = 0; 7 | 8 | protected init(): void { 9 | this.pages = null; 10 | } 11 | 12 | public apply(): void { 13 | if (this.pages == null || this.pages.length == 0 14 | || this.pages.indexOf(this._controller.selectedPageId) != -1) 15 | this._visible = 1; 16 | else 17 | this._visible = 0; 18 | } 19 | 20 | public evaluate(connected: boolean): boolean { 21 | var v: boolean = this._controller == null || this._visible > 0; 22 | if (this.condition == 0) 23 | v = v && connected; 24 | else 25 | v = v || connected; 26 | return v; 27 | } 28 | } -------------------------------------------------------------------------------- /src/gears/GearFontSize.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { ObjectPropID } from './../FieldTypes'; 3 | import { GearBase } from './GearBase'; 4 | export class GearFontSize extends GearBase { 5 | private _storage: { [index: string]: number }; 6 | private _default: number = 0; 7 | 8 | protected init(): void { 9 | this._default = this._owner.getProp(ObjectPropID.FontSize); 10 | this._storage = {}; 11 | } 12 | 13 | protected addStatus(pageId: string, buffer: ByteBuffer): void { 14 | if (pageId == null) 15 | this._default = buffer.readInt(); 16 | else 17 | this._storage[pageId] = buffer.readInt(); 18 | } 19 | 20 | public apply(): void { 21 | this._owner._gearLocked = true; 22 | 23 | var data: any = this._storage[this._controller.selectedPageId]; 24 | if (data != undefined) 25 | this._owner.setProp(ObjectPropID.FontSize, data); 26 | else 27 | this._owner.setProp(ObjectPropID.FontSize, this._default); 28 | 29 | this._owner._gearLocked = false; 30 | } 31 | 32 | public updateState(): void { 33 | this._storage[this._controller.selectedPageId] = this._owner.getProp(ObjectPropID.FontSize); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/gears/GearIcon.ts: -------------------------------------------------------------------------------- 1 | import { GearBase } from './GearBase'; 2 | import { ByteBuffer } from './../utils/ByteBuffer'; 3 | export class GearIcon extends GearBase { 4 | private _storage: { [index: string]: string }; 5 | private _default: string; 6 | 7 | protected init(): void { 8 | this._default = this._owner.icon; 9 | this._storage = {}; 10 | } 11 | 12 | protected addStatus(pageId: string, buffer: ByteBuffer): void { 13 | if (pageId == null) 14 | this._default = buffer.readS(); 15 | else 16 | this._storage[pageId] = buffer.readS(); 17 | } 18 | 19 | public apply(): void { 20 | this._owner._gearLocked = true; 21 | 22 | var data: any = this._storage[this._controller.selectedPageId]; 23 | if (data !== undefined) 24 | this._owner.icon = data; 25 | else 26 | this._owner.icon = this._default; 27 | 28 | this._owner._gearLocked = false; 29 | } 30 | 31 | public updateState(): void { 32 | this._storage[this._controller.selectedPageId] = this._owner.icon; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/gears/GearText.ts: -------------------------------------------------------------------------------- 1 | import { ByteBuffer } from './../utils/ByteBuffer'; 2 | import { GearBase } from './GearBase'; 3 | export class GearText extends GearBase { 4 | private _storage: { [index: string]: string }; 5 | private _default: string; 6 | 7 | protected init(): void { 8 | this._default = this._owner.text; 9 | this._storage = {}; 10 | } 11 | 12 | protected addStatus(pageId: string, buffer: ByteBuffer): void { 13 | if (pageId == null) 14 | this._default = buffer.readS(); 15 | else 16 | this._storage[pageId] = buffer.readS(); 17 | } 18 | 19 | public apply(): void { 20 | this._owner._gearLocked = true; 21 | 22 | var data: any = this._storage[this._controller.selectedPageId]; 23 | if (data !== undefined) 24 | this._owner.text = data; 25 | else 26 | this._owner.text = this._default; 27 | 28 | this._owner._gearLocked = false; 29 | } 30 | 31 | public updateState(): void { 32 | this._storage[this._controller.selectedPageId] = this._owner.text; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/gears/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./GearAnimation"; 2 | export * from "./GearBase"; 3 | export * from "./GearColor"; 4 | export * from "./GearDisplay"; 5 | export * from "./GearDisplay2"; 6 | export * from "./GearFontSize"; 7 | export * from "./GearIcon"; 8 | export * from "./GearLook"; 9 | export * from "./GearSize"; 10 | export * from "./GearText"; 11 | export * from "./GearXY"; 12 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { GGroup } from "./GGroup"; 2 | export { GObject } from "./GObject"; 3 | export { GGraph } from "./GGraph"; 4 | export { GImage } from "./GImage"; 5 | export { GMovieClip } from "./GMovieClip"; 6 | export { GRoot } from "./GRoot"; 7 | export { GTextField } from "./GTextField"; 8 | export { GRichTextField } from "./GRichTextField"; 9 | export { GTextInput } from "./GTextInput"; 10 | export { GLoader } from "./GLoader"; 11 | export { GComponent } from "./GComponent"; 12 | export { GLabel } from "./GLabel"; 13 | export { GButton } from "./GButton"; 14 | export { GComboBox } from "./GComboBox"; 15 | export { GSlider } from "./GSlider"; 16 | export { GProgressBar } from "./GProgressBar"; 17 | export { GScrollBar } from "./GScrollBar"; 18 | export { GList } from "./GList"; 19 | export { GTree } from "./GTree"; 20 | export { GTreeNode } from "./GTreeNode"; 21 | export { Window } from "./Window"; 22 | export { PopupMenu } from "./PopupMenu"; 23 | export { Controller } from "./Controller"; 24 | export { Transition } from "./Transition"; 25 | export { ScrollPane } from "./ScrollPane"; 26 | export { RelationType } from "./FieldTypes"; 27 | export { UIPackage } from "./UIPackage"; 28 | export { PackageItem } from "./PackageItem"; 29 | export { GObjectPool } from "./GObjectPool"; 30 | export { UIObjectFactory } from "./UIObjectFactory"; 31 | export { UIConfig } from "./UIConfig"; 32 | export { DragDropManager } from "./DragDropManager"; 33 | export { AsyncOperation } from "./AsyncOperation"; 34 | export { TranslationHelper } from "./TranslationHelper"; 35 | export * from "./FieldTypes" 36 | export * from "./display"; 37 | export * from "./event"; 38 | export * from "./tween"; 39 | export * from "./utils" -------------------------------------------------------------------------------- /src/texture/TextureManager.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 用于管理faiygui贴图加载的管理器 3 | * 持续更新 4 | */ 5 | export class TextureManager { 6 | private _addTextureMap: Map; 7 | constructor() { 8 | this._addTextureMap = new Map(); 9 | } 10 | 11 | add(key: string) { 12 | if (!this._addTextureMap.get(key)) { 13 | this._addTextureMap.set(key, true); 14 | } 15 | } 16 | 17 | get(key: string): boolean { 18 | 19 | return this._addTextureMap.get(key); 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/tween/EaseType.ts: -------------------------------------------------------------------------------- 1 | export class EaseType { 2 | public static Linear: number = 0; 3 | public static SineIn: number = 1; 4 | public static SineOut: number = 2; 5 | public static SineInOut: number = 3; 6 | public static QuadIn: number = 4; 7 | public static QuadOut: number = 5; 8 | public static QuadInOut: number = 6; 9 | public static CubicIn: number = 7; 10 | public static CubicOut: number = 8; 11 | public static CubicInOut: number = 9; 12 | public static QuartIn: number = 10; 13 | public static QuartOut: number = 11; 14 | public static QuartInOut: number = 12; 15 | public static QuintIn: number = 13; 16 | public static QuintOut: number = 14; 17 | public static QuintInOut: number = 15; 18 | public static ExpoIn: number = 16; 19 | public static ExpoOut: number = 17; 20 | public static ExpoInOut: number = 18; 21 | public static CircIn: number = 19; 22 | public static CircOut: number = 20; 23 | public static CircInOut: number = 21; 24 | public static ElasticIn: number = 22; 25 | public static ElasticOut: number = 23; 26 | public static ElasticInOut: number = 24; 27 | public static BackIn: number = 25; 28 | public static BackOut: number = 26; 29 | public static BackInOut: number = 27; 30 | public static BounceIn: number = 28; 31 | public static BounceOut: number = 29; 32 | public static BounceInOut: number = 30; 33 | public static Custom: number = 31; 34 | } -------------------------------------------------------------------------------- /src/tween/GPathPoint.ts: -------------------------------------------------------------------------------- 1 | export enum CurveType { 2 | CRSpline, 3 | Bezier, 4 | CubicBezier, 5 | Straight 6 | } 7 | 8 | export class GPathPoint { 9 | public x: number; 10 | public y: number; 11 | 12 | public control1_x: number; 13 | public control1_y: number; 14 | 15 | public control2_x: number; 16 | public control2_y: number; 17 | 18 | public curveType: number; 19 | 20 | constructor() { 21 | this.x = 0; 22 | this.y = 0; 23 | this.control1_x = 0; 24 | this.control1_y = 0; 25 | this.control2_x = 0; 26 | this.control2_y = 0; 27 | this.curveType = 0; 28 | } 29 | 30 | public static newPoint(x: number = 0, y: number = 0, curveType: number = 0): GPathPoint { 31 | var pt: GPathPoint = new GPathPoint(); 32 | pt.x = x; 33 | pt.y = y; 34 | pt.control1_x = 0; 35 | pt.control1_y = 0; 36 | pt.control2_x = 0; 37 | pt.control2_y = 0; 38 | pt.curveType = curveType; 39 | 40 | return pt; 41 | } 42 | 43 | public static newBezierPoint(x: number = 0, y: number = 0, 44 | control1_x: number = 0, control1_y: number = 0): GPathPoint { 45 | var pt: GPathPoint = new GPathPoint(); 46 | pt.x = x; 47 | pt.y = y; 48 | pt.control1_x = control1_x; 49 | pt.control1_y = control1_y; 50 | pt.control2_x = 0; 51 | pt.control2_y = 0; 52 | pt.curveType = CurveType.Bezier; 53 | 54 | return pt; 55 | } 56 | 57 | public static newCubicBezierPoint(x: number = 0, y: number = 0, 58 | control1_x: number = 0, control1_y: number = 0, 59 | control2_x: number = 0, control2_y: number = 0): GPathPoint { 60 | var pt: GPathPoint = new GPathPoint(); 61 | pt.x = x; 62 | pt.y = y; 63 | pt.control1_x = control1_x; 64 | pt.control1_y = control1_y; 65 | pt.control2_x = control2_x; 66 | pt.control2_y = control2_y; 67 | pt.curveType = CurveType.CubicBezier; 68 | 69 | return pt; 70 | } 71 | 72 | public clone(): GPathPoint { 73 | var ret: GPathPoint = new GPathPoint(); 74 | ret.x = this.x; 75 | ret.y = this.y; 76 | ret.control1_x = this.control1_x; 77 | ret.control1_y = this.control1_y; 78 | ret.control2_x = this.control2_x; 79 | ret.control2_y = this.control2_y; 80 | ret.curveType = this.curveType; 81 | 82 | return ret; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/tween/GTween.ts: -------------------------------------------------------------------------------- 1 | import { GTweener } from './GTweener'; 2 | import { TweenManager } from './TweenManager'; 3 | export class GTween { 4 | public static catchCallbackExceptions: boolean = true; 5 | 6 | public static to(start: number, end: number, duration: number): GTweener { 7 | return TweenManager.createTween()._to(start, end, duration); 8 | } 9 | 10 | public static to2(start: number, start2: number, end: number, end2: number, duration: number): GTweener { 11 | return TweenManager.createTween()._to2(start, start2, end, end2, duration); 12 | } 13 | 14 | public static to3(start: number, start2: number, start3: number, 15 | end: number, end2: number, end3: number, duration: number): GTweener { 16 | return TweenManager.createTween()._to3(start, start2, start3, end, end2, end3, duration); 17 | } 18 | 19 | public static to4(start: number, start2: number, start3: number, start4: number, 20 | end: number, end2: number, end3: number, end4: number, duration: number): GTweener { 21 | return TweenManager.createTween()._to4(start, start2, start3, start4, end, end2, end3, end4, duration); 22 | } 23 | 24 | public static toColor(start: number, end: number, duration: number): GTweener { 25 | return TweenManager.createTween()._toColor(start, end, duration); 26 | } 27 | 28 | public static delayedCall(delay: number): GTweener { 29 | return TweenManager.createTween().setDelay(delay); 30 | } 31 | 32 | public static shake(startX: number, startY: number, amplitude: number, duration: number): GTweener { 33 | return TweenManager.createTween()._shake(startX, startY, amplitude, duration); 34 | } 35 | 36 | public static isTweening(target: any, propType?: any): Boolean { 37 | return TweenManager.isTweening(target, propType); 38 | } 39 | 40 | public static kill(target: any, complete?: boolean, propType?: any): void { 41 | TweenManager.killTweens(target, complete, propType); 42 | } 43 | 44 | public static getTween(target: any, propType?: any): GTweener { 45 | return TweenManager.getTween(target, propType); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/tween/TweenValue.ts: -------------------------------------------------------------------------------- 1 | export class TweenValue { 2 | public x: number; 3 | public y: number; 4 | public z: number; 5 | public w: number; 6 | 7 | public constructor() { 8 | this.x = this.y = this.z = this.w = 0; 9 | } 10 | 11 | public get color(): number { 12 | return (this.w << 24) + (this.x << 16) + (this.y << 8) + this.z; 13 | } 14 | 15 | public set color(value: number) { 16 | this.x = (value & 0xFF0000) >> 16; 17 | this.y = (value & 0x00FF00) >> 8; 18 | this.z = (value & 0x0000FF); 19 | this.w = (value & 0xFF000000) >> 24; 20 | } 21 | 22 | public getField(index: number): number { 23 | switch (index) { 24 | case 0: 25 | return this.x; 26 | case 1: 27 | return this.y; 28 | case 2: 29 | return this.z; 30 | case 3: 31 | return this.w; 32 | default: 33 | throw new Error("Index out of bounds: " + index); 34 | } 35 | } 36 | 37 | public setField(index: number, value: number): void { 38 | switch (index) { 39 | case 0: 40 | this.x = value; 41 | break; 42 | case 1: 43 | this.y = value; 44 | break; 45 | case 2: 46 | this.z = value; 47 | break; 48 | case 3: 49 | this.w = value; 50 | break; 51 | default: 52 | throw new Error("Index out of bounds: " + index); 53 | } 54 | } 55 | 56 | public setZero(): void { 57 | this.x = this.y = this.z = this.w = 0; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/tween/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./EaseManager"; 2 | export * from "./EaseType"; 3 | export * from "./GPath"; 4 | export * from "./GPathPoint"; 5 | export * from "./GTween"; 6 | export * from "./GTweener"; 7 | export * from "./TweenManager"; 8 | export * from "./TweenValue"; 9 | -------------------------------------------------------------------------------- /src/utils/ChildHitArea.ts: -------------------------------------------------------------------------------- 1 | import { HitArea } from './HitArea'; 2 | import { GObject } from './../GObject'; 3 | let _func: Function = HitArea["_isHitGraphic"]; 4 | 5 | export class ChildHitArea extends HitArea { 6 | 7 | private _child: GObject; 8 | private _reversed: boolean; 9 | private _tPos: Phaser.Geom.Point = new Phaser.Geom.Point();; 10 | 11 | constructor(child: GObject, reversed?: boolean) { 12 | super(); 13 | 14 | this._child = child; 15 | this._reversed = reversed; 16 | 17 | // if (this._reversed) 18 | // this.unHit = child.hitArea.hit; 19 | // else 20 | // this.hit = child.hitArea.hit; 21 | } 22 | 23 | public contains(x: number, y: number): boolean { 24 | var tPos: Phaser.Geom.Point; 25 | tPos = this._tPos; 26 | tPos.setTo(0, 0); 27 | tPos = this._child.toParentPoint(tPos); 28 | if (this._reversed) 29 | return !_func(x - tPos.x, y - tPos.y, this.unHit); 30 | else 31 | return _func(x - tPos.x, y - tPos.y, this.hit); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/utils/ObjectUtils.ts: -------------------------------------------------------------------------------- 1 | export class ObjectUtils { 2 | public static hasOwnProperty(object: any, key: string): boolean { 3 | return object.hasOwnProperty(key); 4 | } 5 | 6 | public static defineProperty(object: any, property: any): any { 7 | Object.defineProperties(object, property); 8 | return object; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/utils/PixelHitTest.ts: -------------------------------------------------------------------------------- 1 | import { Byte } from './Byte'; 2 | import { HitArea } from './HitArea'; 3 | export class PixelHitTest extends HitArea { 4 | private _data: PixelHitTestData; 5 | 6 | public offsetX: number; 7 | public offsetY: number; 8 | public scaleX: number; 9 | public scaleY: number; 10 | 11 | constructor(data: PixelHitTestData, offsetX: number, offsetY: number) { 12 | super(); 13 | 14 | this._data = data; 15 | this.offsetX = offsetX; 16 | this.offsetY = offsetY; 17 | 18 | this.scaleX = 1; 19 | this.scaleY = 1; 20 | } 21 | 22 | public contains(x: number, y: number): boolean { 23 | x = Math.floor((x / this.scaleX - this.offsetX) * this._data.scale); 24 | y = Math.floor((y / this.scaleY - this.offsetY) * this._data.scale); 25 | if (x < 0 || y < 0 || x >= this._data.pixelWidth) 26 | return false; 27 | 28 | var pos: number = y * this._data.pixelWidth + x; 29 | var pos2: number = Math.floor(pos / 8); 30 | var pos3: number = pos % 8; 31 | 32 | if (pos2 >= 0 && pos2 < this._data.pixels.length) 33 | return ((this._data.pixels[pos2] >> pos3) & 0x1) == 1; 34 | else 35 | return false; 36 | } 37 | } 38 | 39 | export class PixelHitTestData { 40 | public pixelWidth: number; 41 | public scale: number; 42 | public pixels: number[]; 43 | 44 | constructor() { 45 | } 46 | 47 | public load(ba: Byte): void { 48 | ba.getInt32(); 49 | this.pixelWidth = ba.getInt32(); 50 | this.scale = 1 / ba.readByte(); 51 | var len: number = ba.getInt32(); 52 | this.pixels = []; 53 | for (var i: number = 0; i < len; i++) { 54 | var j: number = ba.readByte(); 55 | if (j < 0) 56 | j += 256; 57 | 58 | this.pixels[i] = j; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/utils/Pool.ts: -------------------------------------------------------------------------------- 1 | export class Pool { 2 | items: T[]; 3 | 4 | constructor() { 5 | this.items = []; 6 | } 7 | 8 | pop(): T { 9 | if (this.items.length) { 10 | return this.items.pop(); 11 | } 12 | } 13 | 14 | push(l: T): this { 15 | this.items.push(l); 16 | return this; 17 | } 18 | 19 | clear() { 20 | this.items.length = 0; 21 | return this; 22 | } 23 | 24 | pushMultiple(item: T[]): this { 25 | this.items.push.apply(this.items, item); 26 | item.length = 0; 27 | return this; 28 | } 29 | 30 | destroy() { 31 | this.clear(); 32 | this.items = undefined; 33 | } 34 | } -------------------------------------------------------------------------------- /src/utils/Utils.ts: -------------------------------------------------------------------------------- 1 | export class Utils { 2 | /**@private */ 3 | private static _gid: number = 1; 4 | /**@private */ 5 | private static _pi: number = 180 / Math.PI; 6 | /**@private */ 7 | private static _pi2: number = Math.PI / 180; 8 | 9 | public static FPSTarget = 60; 10 | /**@private */ 11 | protected static _extReg: RegExp = /\.(\w+)\??/g; 12 | static toHexColor(color: number): string { 13 | if (color < 0 || isNaN(color)) return null; 14 | var str: string = color.toString(16); 15 | while (str.length < 6) str = "0" + str; 16 | return "#" + str; 17 | } 18 | 19 | /** 20 | * 必须是16进制的颜色值规范 “#xxxxxx” 21 | * @param color 22 | * @returns 23 | */ 24 | static toNumColor(color: string): number { 25 | return parseInt(color.replace(/^#/, ''), 16) 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | /** 35 | * 角度转弧度。 36 | * @param angle 角度值。 37 | * @return 返回弧度值。 38 | */ 39 | static toRadian(angle: number): number { 40 | return angle * Utils._pi2; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/utils/colorShader/BlueShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图通用蓝色滤镜 只适用于texture (Phaser.Image/Phaser.Sprite) 且同一时间只能实现一种变色效果 3 | */ 4 | export class BlueShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean = false; 10 | constructor(game) { 11 | super({ 12 | game, 13 | fragShader: ` 14 | precision mediump float; 15 | 16 | uniform sampler2D uMainSampler[%count%]; 17 | uniform float b 18 | 19 | varying vec2 outTexCoord; 20 | varying float outTexId; 21 | varying vec4 outTint; 22 | varying vec2 fragCoord; 23 | 24 | void main() 25 | { 26 | vec4 texture; 27 | 28 | %forloop% 29 | 30 | gl_FragColor = texture; 31 | gl_FragColor.r = 0 * gl_FragColor.r; 32 | gl_FragColor.g = 0 * gl_FragColor.g; 33 | gl_FragColor.b = b * gl_FragColor.b; 34 | gl_FragColor.a = 1 * gl_FragColor.a; 35 | } 36 | `, 37 | // @ts-ignore 38 | uniforms: [ 39 | 'uProjectionMatrix', 40 | 'uMainSampler', 41 | 'b', 42 | ] 43 | }); 44 | this.renderBoo = false; 45 | } 46 | 47 | onPreRender() { 48 | if (this.renderBoo) return; 49 | this.renderBoo = true; 50 | this.set1f("b", 1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/utils/colorShader/ColorShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图颜色滤镜 只适用于texture (Phaser.Image/Phaser.Sprite) 且同一时间只能实现一种变色效果 3 | */ 4 | export class ColorShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean = false; 10 | constructor(game) { 11 | super({ 12 | game, 13 | fragShader: ` 14 | precision mediump float; 15 | 16 | uniform sampler2D uMainSampler[%count%]; 17 | uniform vec4 rgba; 18 | 19 | varying vec2 outTexCoord; 20 | varying float outTexId; 21 | varying vec4 outTint; 22 | varying vec2 fragCoord; 23 | 24 | void main() 25 | { 26 | vec4 texture; 27 | 28 | %forloop% 29 | 30 | gl_FragColor = texture; 31 | gl_FragColor.r = rgba.x * gl_FragColor.r; 32 | gl_FragColor.g = rgba.y * gl_FragColor.g; 33 | gl_FragColor.b = rgba.z * gl_FragColor.b; 34 | gl_FragColor.a = rgba.w * gl_FragColor.a; 35 | } 36 | `, 37 | // @ts-ignore 38 | uniforms: [ 39 | 'uProjectionMatrix', 40 | 'uMainSampler', 41 | 'rgba', 42 | ] 43 | }); 44 | 45 | this._a = 0; 46 | this._b = 0; 47 | this._g = 0; 48 | this._r = 0; 49 | this.renderBoo = false; 50 | } 51 | 52 | onPreRender() { 53 | if (this.renderBoo) return; 54 | this.renderBoo = true; 55 | this.set4f("rgba", this._r, this._g, this._b, this._a); 56 | } 57 | 58 | set r(value) { 59 | this._r = value; 60 | this.renderBoo = false; 61 | } 62 | 63 | set g(value) { 64 | this._g = value; 65 | this.renderBoo = false; 66 | } 67 | 68 | set b(value) { 69 | this._b = value; 70 | this.renderBoo = false; 71 | } 72 | 73 | set a(value) { 74 | this._a = value; 75 | this.renderBoo = false; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/utils/colorShader/GrayShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图灰色滤镜 只适用于texture 3 | */ 4 | export class GrayShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected renderBoo: boolean = false; 6 | private _a: number = 1; 7 | constructor(game) { 8 | super({ 9 | game, 10 | fragShader: ` 11 | precision mediump float; 12 | 13 | uniform sampler2D uMainSampler[%count%]; 14 | uniform float a; 15 | 16 | varying vec2 outTexCoord; 17 | varying float outTexId; 18 | varying vec4 outTint; 19 | varying vec2 fragCoord; 20 | 21 | void main() 22 | { 23 | vec4 texture; 24 | 25 | %forloop% 26 | 27 | gl_FragColor = texture; 28 | gl_FragColor.rgb = mix(gl_FragColor.rgb,vec3(0.2126 * gl_FragColor.r + 0.7152 * gl_FragColor.g + 0.0722 * gl_FragColor.b),a); 29 | } 30 | `, 31 | // @ts-ignore 32 | uniforms: [ 33 | 'uProjectionMatrix', 34 | 'uMainSampler', 35 | 'a', 36 | ] 37 | }); 38 | this.renderBoo = false; 39 | } 40 | 41 | onPreRender() { 42 | if (this.renderBoo) return; 43 | this.renderBoo = true; 44 | this.set1f("a", this._a); 45 | } 46 | 47 | set a(value) { 48 | this._a = value; 49 | this.renderBoo = false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/utils/colorShader/GreenShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图绿色滤镜 只适用于texture 3 | */ 4 | export class GreenShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean = false; 10 | constructor(game) { 11 | super({ 12 | game, 13 | fragShader: ` 14 | precision mediump float; 15 | 16 | uniform sampler2D uMainSampler[%count%]; 17 | uniform float g; 18 | 19 | varying vec2 outTexCoord; 20 | varying float outTexId; 21 | varying vec4 outTint; 22 | varying vec2 fragCoord; 23 | 24 | void main() 25 | { 26 | vec4 texture; 27 | 28 | %forloop% 29 | 30 | gl_FragColor = texture; 31 | gl_FragColor.r = 0 * gl_FragColor.r; 32 | gl_FragColor.g = g * gl_FragColor.g; 33 | gl_FragColor.b = 0 * gl_FragColor.b; 34 | gl_FragColor.a = 1 * gl_FragColor.a; 35 | } 36 | `, 37 | // @ts-ignore 38 | uniforms: [ 39 | 'uProjectionMatrix', 40 | 'uMainSampler', 41 | 'g' 42 | ] 43 | }); 44 | this.renderBoo = false; 45 | } 46 | 47 | onPreRender() { 48 | if (this.renderBoo) return; 49 | this.renderBoo = true; 50 | this.set1f("g", 1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/utils/colorShader/RedShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 贴图红色滤镜 只适用于texture 3 | */ 4 | export class RedShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { 5 | protected _a: number; 6 | protected _r: number; 7 | protected _g: number; 8 | protected _b: number; 9 | protected renderBoo: boolean = false; 10 | constructor(game) { 11 | super({ 12 | game, 13 | fragShader: ` 14 | precision mediump float; 15 | 16 | uniform sampler2D uMainSampler[%count%]; 17 | uniform float r; 18 | 19 | varying vec2 outTexCoord; 20 | varying float outTexId; 21 | varying vec4 outTint; 22 | varying vec2 fragCoord; 23 | 24 | void main() 25 | { 26 | vec4 texture; 27 | 28 | %forloop% 29 | 30 | gl_FragColor = texture; 31 | gl_FragColor.r = r * gl_FragColor.r; 32 | gl_FragColor.g = 0 * gl_FragColor.g; 33 | gl_FragColor.b = 0 * gl_FragColor.b; 34 | gl_FragColor.a = 1 * gl_FragColor.a; 35 | } 36 | `, 37 | // @ts-ignore 38 | uniforms: [ 39 | 'uProjectionMatrix', 40 | 'uMainSampler', 41 | 'r' 42 | ] 43 | }); 44 | this.renderBoo = false; 45 | } 46 | 47 | onPreRender() { 48 | if (this.renderBoo) return; 49 | this.renderBoo = true; 50 | this.set1f("g", 1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/utils/colorShader/SingleShaderPipeline.ts: -------------------------------------------------------------------------------- 1 | export class SingleShaderPipeline extends Phaser.Renderer.WebGL.Pipelines.SinglePipeline { 2 | protected _a: number; 3 | protected _r: number; 4 | protected _g: number; 5 | protected _b: number; 6 | protected renderBoo: boolean = false; 7 | constructor(game: Phaser.Game) { 8 | super({ 9 | game, fragShader: ` 10 | precision mediump float; 11 | 12 | uniform sampler2D uMainSampler; 13 | uniform vec4 rgba; 14 | 15 | varying vec2 outTexCoord; 16 | varying vec4 outTint; 17 | 18 | 19 | void main() 20 | { 21 | vec4 texture = texture2D(uMainSampler, outTexCoord); 22 | 23 | texture *= vec4(outTint.rgb * outTint.a, outTint.a); 24 | 25 | gl_FragColor = texture; 26 | gl_FragColor.r = rgba.x * gl_FragColor.r; 27 | gl_FragColor.g = rgba.y * gl_FragColor.g; 28 | gl_FragColor.b = rgba.z * gl_FragColor.b; 29 | gl_FragColor.a = rgba.w * gl_FragColor.a; 30 | } 31 | `, 32 | // @ts-ignore 33 | uniforms: [ 34 | 'uProjectionMatrix', 35 | 'uViewMatrix', 36 | 'uModelMatrix', 37 | 'uMainSampler', 38 | 'rgba', 39 | ] 40 | }); 41 | this._a = 0; 42 | this._b = 0; 43 | this._g = 0; 44 | this._r = 0; 45 | this.renderBoo = false; 46 | } 47 | 48 | onPreRender() { 49 | if (this.renderBoo) return; 50 | this.renderBoo = true; 51 | this.set4f("rgba", this._r, this._g, this._b, this._a); 52 | } 53 | 54 | set r(value) { 55 | this._r = value; 56 | this.renderBoo = false; 57 | } 58 | 59 | set g(value) { 60 | this._g = value; 61 | this.renderBoo = false; 62 | } 63 | 64 | set b(value) { 65 | this._b = value; 66 | this.renderBoo = false; 67 | } 68 | 69 | set a(value) { 70 | this._a = value; 71 | this.renderBoo = false; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Byte"; 2 | export * from "./ByteBuffer"; 3 | export * from "./ChildHitArea"; 4 | export * from "./ColorMatrix"; 5 | export * from "./DOMEventManager"; 6 | export * from "./HitArea"; 7 | export * from "./PixelHitTest"; 8 | export * from "./ToolSet"; 9 | export * from "./UBBParser"; 10 | export * from "./Handler"; 11 | export * from "./Utils"; 12 | -------------------------------------------------------------------------------- /test.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "es6", 5 | "module": "es6", 6 | "moduleResolution": "Node", 7 | "sourceMap": true, 8 | }, 9 | "include": [ 10 | "./src/**/*", 11 | "./typings/*", 12 | "./plugin/webfont.js" 13 | ], 14 | "exclude": [ 15 | "node_modules" 16 | ] 17 | } -------------------------------------------------------------------------------- /typings/global.d.ts: -------------------------------------------------------------------------------- 1 | declare let WebFont: any; 2 | -------------------------------------------------------------------------------- /version.js: -------------------------------------------------------------------------------- 1 | // generated by genversion 2 | module.exports = '0.0.3' 3 | --------------------------------------------------------------------------------