├── .DS_Store ├── README.md └── YiyuanGameProgrammingPatterns ├── .gitignore ├── README.md ├── assets ├── Scene.meta ├── Scene │ ├── helloworld.fire │ └── helloworld.fire.meta ├── Script.meta ├── Script │ ├── AbstractFactory.meta │ ├── AbstractFactory │ │ ├── AbstractFactory.ts │ │ ├── AbstractFactory.ts.meta │ │ ├── AbstractFactoryTest.ts │ │ └── AbstractFactoryTest.ts.meta │ ├── Adapter.meta │ ├── Adapter │ │ ├── Adapter.ts │ │ ├── Adapter.ts.meta │ │ ├── AdapterTest.ts │ │ └── AdapterTest.ts.meta │ ├── Bridge.meta │ ├── Bridge │ │ ├── Bridge.ts │ │ ├── Bridge.ts.meta │ │ ├── BridgeTest.ts │ │ └── BridgeTest.ts.meta │ ├── Builder.meta │ ├── Builder │ │ ├── Builder.ts │ │ ├── Builder.ts.meta │ │ ├── BuilderTest.ts │ │ └── BuilderTest.ts.meta │ ├── Cache.meta │ ├── Cache │ │ ├── Cache.ts │ │ ├── Cache.ts.meta │ │ ├── CacheTest.ts │ │ └── CacheTest.ts.meta │ ├── CoR.meta │ ├── CoR │ │ ├── CoR.ts │ │ ├── CoR.ts.meta │ │ ├── CoRTest.ts │ │ └── CoRTest.ts.meta │ ├── Command.meta │ ├── Command │ │ ├── Command.ts │ │ ├── Command.ts.meta │ │ ├── CommandTest.ts │ │ └── CommandTest.ts.meta │ ├── Composite.meta │ ├── Composite │ │ ├── CompositeTest.ts │ │ └── CompositeTest.ts.meta │ ├── Decorator.meta │ ├── Decorator │ │ ├── Decorator.ts │ │ ├── Decorator.ts.meta │ │ ├── DecoratorTest.ts │ │ └── DecoratorTest.ts.meta │ ├── Facade.meta │ ├── Facade │ │ ├── Facade.ts │ │ ├── Facade.ts.meta │ │ ├── FacadeTest.ts │ │ └── FacadeTest.ts.meta │ ├── FactoryMethod.meta │ ├── FactoryMethod │ │ ├── FactoryMethod.ts │ │ ├── FactoryMethod.ts.meta │ │ ├── FactoryMethodTest.ts │ │ ├── FactoryMethodTest.ts.meta │ │ ├── NoFactoryMethod.ts │ │ └── NoFactoryMethod.ts.meta │ ├── Helloworld.ts │ ├── Helloworld.ts.meta │ ├── Iterator.meta │ ├── Iterator │ │ ├── Iterator.ts │ │ ├── Iterator.ts.meta │ │ ├── IteratorTest.ts │ │ └── IteratorTest.ts.meta │ ├── Mediator.meta │ ├── Mediator │ │ ├── Mediator.ts │ │ ├── Mediator.ts.meta │ │ ├── MediatorTest.ts │ │ └── MediatorTest.ts.meta │ ├── Memento.meta │ ├── Memento │ │ ├── Memento.ts │ │ ├── Memento.ts.meta │ │ ├── MementoTest.ts │ │ └── MementoTest.ts.meta │ ├── Observer.meta │ ├── Observer │ │ ├── Observer.ts │ │ ├── Observer.ts.meta │ │ ├── ObserverTest.ts │ │ └── ObserverTest.ts.meta │ ├── Prototype.meta │ ├── Prototype │ │ ├── Prototype.ts │ │ ├── Prototype.ts.meta │ │ ├── PrototypeTest.ts │ │ └── PrototypeTest.ts.meta │ ├── Proxy.meta │ ├── Proxy │ │ ├── Proxy.ts │ │ ├── Proxy.ts.meta │ │ ├── ProxyTest.ts │ │ └── ProxyTest.ts.meta │ ├── Singleton.meta │ ├── Singleton │ │ ├── Singleton.ts │ │ ├── Singleton.ts.meta │ │ ├── SingletonTest.ts │ │ └── SingletonTest.ts.meta │ ├── State.meta │ ├── State │ │ ├── FrameAnim.ts │ │ ├── FrameAnim.ts.meta │ │ ├── State.ts │ │ ├── State.ts.meta │ │ ├── StateTest.ts │ │ └── StateTest.ts.meta │ ├── Strategy.meta │ ├── Strategy │ │ ├── Strategy.ts │ │ ├── Strategy.ts.meta │ │ ├── StrategyTest.ts │ │ └── StrategyTest.ts.meta │ ├── TemplateMethod.meta │ ├── TemplateMethod │ │ ├── TemplateMethod.ts │ │ ├── TemplateMethod.ts.meta │ │ ├── TemplateMethodTest.ts │ │ └── TemplateMethodTest.ts.meta │ ├── Visitor.meta │ └── Visitor │ │ ├── Visitor.ts │ │ ├── Visitor.ts.meta │ │ ├── VisitorTest.ts │ │ └── VisitorTest.ts.meta ├── Texture.meta ├── Texture │ ├── HelloWorld.png │ ├── HelloWorld.png.meta │ ├── singleColor.png │ └── singleColor.png.meta ├── migration.meta ├── migration │ ├── use_v2.1-2.2.1_cc.Toggle_event.js │ └── use_v2.1-2.2.1_cc.Toggle_event.js.meta ├── resources.meta └── resources │ ├── Iterator.meta │ ├── Iterator │ ├── monster_0.json │ ├── monster_0.json.meta │ ├── monster_0.png │ ├── monster_0.png.meta │ ├── monster_1.json │ ├── monster_1.json.meta │ ├── monster_1.png │ ├── monster_1.png.meta │ ├── monster_2.json │ ├── monster_2.json.meta │ ├── monster_2.png │ ├── monster_2.png.meta │ ├── monster_3.json │ ├── monster_3.json.meta │ ├── monster_3.png │ ├── monster_3.png.meta │ ├── monster_4.json │ ├── monster_4.json.meta │ ├── monster_4.png │ ├── monster_4.png.meta │ ├── monster_5.json │ ├── monster_5.json.meta │ ├── monster_5.png │ ├── monster_5.png.meta │ ├── monster_6.json │ ├── monster_6.json.meta │ ├── monster_6.png │ ├── monster_6.png.meta │ ├── monster_7.json │ ├── monster_7.json.meta │ ├── monster_7.png │ ├── monster_7.png.meta │ ├── monster_8.json │ ├── monster_8.json.meta │ ├── monster_8.png │ ├── monster_8.png.meta │ ├── monster_9.json │ ├── monster_9.json.meta │ ├── monster_9.png │ └── monster_9.png.meta │ ├── State.meta │ ├── State │ ├── scenePlayer_0.json │ ├── scenePlayer_0.json.meta │ ├── scenePlayer_0.png │ └── scenePlayer_0.png.meta │ ├── Strategy.meta │ └── Strategy │ ├── scenePlayer_0_attack.json │ ├── scenePlayer_0_attack.json.meta │ ├── scenePlayer_0_attack.png │ ├── scenePlayer_0_attack.png.meta │ ├── scenePlayer_1_attack.json │ ├── scenePlayer_1_attack.json.meta │ ├── scenePlayer_1_attack.png │ └── scenePlayer_1_attack.png.meta ├── creator.d.ts ├── jsconfig.json ├── project.json ├── settings ├── builder.json ├── builder.panel.json ├── project.json └── services.json ├── template-banner.png ├── template.json └── tsconfig.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YiyuanGameProgrammingPatterns 2 | 微信公众号:亿元程序员 。一位有着8年游戏行业经验的主程。本系列是《和8年游戏主程一起学习设计模式》让糟糕的代码在潜移默化中升华,欢迎大家关注分享收藏订阅。 3 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | /library/ 6 | /temp/ 7 | /local/ 8 | /build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # npm files 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | npm-debug.log 15 | node_modules/ 16 | 17 | #///////////////////////////////////////////////////////////////////////////// 18 | # Logs and databases 19 | #///////////////////////////////////////////////////////////////////////////// 20 | 21 | *.log 22 | *.sql 23 | *.sqlite 24 | 25 | #///////////////////////////////////////////////////////////////////////////// 26 | # files for debugger 27 | #///////////////////////////////////////////////////////////////////////////// 28 | 29 | *.sln 30 | *.pidb 31 | *.suo 32 | 33 | #///////////////////////////////////////////////////////////////////////////// 34 | # OS generated files 35 | #///////////////////////////////////////////////////////////////////////////// 36 | 37 | .DS_Store 38 | ehthumbs.db 39 | Thumbs.db 40 | 41 | #///////////////////////////////////////////////////////////////////////////// 42 | # WebStorm files 43 | #///////////////////////////////////////////////////////////////////////////// 44 | 45 | .idea/ 46 | 47 | #////////////////////////// 48 | # VS Code files 49 | #////////////////////////// 50 | 51 | .vscode/ 52 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/README.md: -------------------------------------------------------------------------------- 1 | # hello-world 2 | Hello world new project template. 3 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Scene/helloworld.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.3.2", 3 | "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49", 4 | "importer": "scene", 5 | "asyncLoadAssets": false, 6 | "autoReleaseAssets": false, 7 | "subMetas": {} 8 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/AbstractFactory.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "83c5e2b7-7f78-4164-b27d-e78c6bc742d0", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/AbstractFactory/AbstractFactory.ts: -------------------------------------------------------------------------------- 1 | // 游戏单位接口 2 | export interface Unit { 3 | display(): string; 4 | } 5 | 6 | // 武器接口 7 | export interface Weapon { 8 | attack(): string; 9 | } 10 | 11 | // 玩家类 12 | export class Player implements Unit { 13 | display() { 14 | return "玩家"; 15 | } 16 | } 17 | 18 | // 敌人类 19 | export class Enemy implements Unit { 20 | display() { 21 | return "敌人"; 22 | } 23 | } 24 | 25 | // 剑类 26 | export class Sword implements Weapon { 27 | attack() { 28 | return "挥动剑"; 29 | } 30 | } 31 | 32 | // 法杖类 33 | export class Staff implements Weapon { 34 | attack() { 35 | return "释放法术"; 36 | } 37 | } 38 | 39 | // 游戏工厂接口 40 | export interface GameFactory { 41 | createUnit(): Unit; 42 | createWeapon(): Weapon; 43 | } 44 | 45 | // 玩家工厂 46 | export class PlayerFactory implements GameFactory { 47 | createUnit() { 48 | return new Player(); 49 | } 50 | 51 | createWeapon() { 52 | return new Sword(); 53 | } 54 | } 55 | 56 | // 敌人工厂 57 | export class EnemyFactory implements GameFactory { 58 | createUnit() { 59 | return new Enemy(); 60 | } 61 | 62 | createWeapon() { 63 | return new Staff(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/AbstractFactory/AbstractFactory.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "22efebba-8e96-4d15-a5e3-4b73701cbebd", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/AbstractFactory/AbstractFactoryTest.ts: -------------------------------------------------------------------------------- 1 | import { EnemyFactory, PlayerFactory } from "./AbstractFactory"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class AbstractFactoryTest extends cc.Component { 7 | 8 | @property(cc.Label) 9 | label: cc.Label = null; 10 | 11 | @property 12 | text: string = 'hello'; 13 | 14 | // LIFE-CYCLE CALLBACKS: 15 | 16 | // onLoad () {} 17 | 18 | start() { 19 | // 使用玩家工厂创建玩家和剑 20 | const playerFactory = new PlayerFactory(); 21 | const player = playerFactory.createUnit(); 22 | const playerWeapon = playerFactory.createWeapon(); 23 | 24 | console.log(`玩家类型: ${player.display()}`); 25 | console.log(`玩家攻击: ${playerWeapon.attack()}`); 26 | 27 | // 使用敌人工厂创建敌人和法杖 28 | const enemyFactory = new EnemyFactory(); 29 | const enemy = enemyFactory.createUnit(); 30 | const enemyWeapon = enemyFactory.createWeapon(); 31 | 32 | console.log(`敌人类型: ${enemy.display()}`); 33 | console.log(`敌人攻击: ${enemyWeapon.attack()}`); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/AbstractFactory/AbstractFactoryTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "c2b4cdf2-b8fc-4041-bf11-26a4e41466a5", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Adapter.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "54c6903e-a8de-41b5-976a-19eb3b7dc08e", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Adapter/Adapter.ts: -------------------------------------------------------------------------------- 1 | // 第三方物理引擎库的接口 2 | export class ThirdPartyPhysicsEngine { 3 | constructor() { } 4 | 5 | simulatePhysics() { 6 | // 实现物理模拟逻辑 7 | } 8 | } 9 | 10 | // Cocos Creator的物理引擎适配器 11 | export class CocosPhysicsAdapter { 12 | private physicsEngine: ThirdPartyPhysicsEngine; 13 | 14 | constructor() { 15 | this.physicsEngine = new ThirdPartyPhysicsEngine(); 16 | } 17 | 18 | simulate() { 19 | // 使用适配器将Cocos Creator的接口转换成第三方库的接口 20 | this.physicsEngine.simulatePhysics(); 21 | } 22 | } 23 | 24 | 25 | export interface PlatformAdapter { 26 | playBackgroundMusic(audioPath: string): void; 27 | pauseBackgroundMusic(): void; 28 | } 29 | 30 | export class WebPlatformAdapter implements PlatformAdapter { 31 | playBackgroundMusic(audioPath: string) { 32 | // 在Web平台上播放背景音乐的实现 33 | } 34 | 35 | pauseBackgroundMusic() { 36 | // 在Web平台上暂停背景音乐的实现 37 | } 38 | } 39 | 40 | export class iOSPlatformAdapter implements PlatformAdapter { 41 | playBackgroundMusic(audioPath: string) { 42 | // 在iOS平台上播放背景音乐的实现 43 | } 44 | 45 | pauseBackgroundMusic() { 46 | // 在iOS平台上暂停背景音乐的实现 47 | } 48 | } 49 | 50 | export class CameraAdapter { 51 | private cameraComponent: cc.Camera; 52 | 53 | constructor(cameraComponent: cc.Camera) { 54 | this.cameraComponent = cameraComponent; 55 | } 56 | 57 | // 设置相机的位置 58 | public setPosition(x: number, y: number, z: number) { 59 | this.cameraComponent.node.setPosition(x, y, z); 60 | } 61 | 62 | // 获取相机的位置 63 | public getPosition(): cc.Vec3 { 64 | return this.cameraComponent.node.position; 65 | } 66 | } 67 | 68 | export class OldPlayer { 69 | receiveDamage(damage: number) { 70 | cc.log("OldPlayer receiveDamage " + damage); 71 | } 72 | attackEnemy() { 73 | cc.log("OldPlayer attackEnemy"); 74 | } 75 | movePlayer() { 76 | cc.log("OldPlayer movePlayer"); 77 | } 78 | } 79 | 80 | export class NewPlayer { 81 | attack() { 82 | cc.log("NewPlayer attack"); 83 | } 84 | run() { 85 | cc.log("NewPlayer run"); 86 | } 87 | takeDamage(damage: number) { 88 | cc.log("NewPlayer takeDamage " + damage); 89 | } 90 | } 91 | 92 | export interface Player { 93 | move(): void; 94 | attack(): void; 95 | takeDamage(damage: number): void; 96 | } 97 | 98 | export class PlayerAdapter implements Player { 99 | private player: OldPlayer | NewPlayer; 100 | 101 | constructor(player: OldPlayer | NewPlayer) { 102 | this.player = player; 103 | } 104 | 105 | move() { 106 | if (this.player instanceof OldPlayer) { 107 | this.player.movePlayer(); 108 | } else { 109 | this.player.run(); 110 | } 111 | } 112 | 113 | attack() { 114 | if (this.player instanceof OldPlayer) { 115 | this.player.attackEnemy(); 116 | } else { 117 | this.player.attack(); 118 | } 119 | } 120 | 121 | takeDamage(damage: number) { 122 | if (this.player instanceof OldPlayer) { 123 | this.player.receiveDamage(damage); 124 | } else { 125 | this.player.takeDamage(damage); 126 | } 127 | } 128 | } 129 | 130 | 131 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Adapter/Adapter.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "bb1cc6a5-1b11-43f4-aeab-6afe82f79396", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Adapter/AdapterTest.ts: -------------------------------------------------------------------------------- 1 | import { NewPlayer, OldPlayer, PlayerAdapter } from "./Adapter"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class AdapterTest extends cc.Component { 7 | start() { 8 | const oldPlayer = new OldPlayer(); 9 | const newPlayer = new NewPlayer(); 10 | 11 | const oldPlayerAdapter = new PlayerAdapter(oldPlayer); 12 | const newPlayerAdapter = new PlayerAdapter(newPlayer); 13 | 14 | oldPlayerAdapter.move(); 15 | oldPlayerAdapter.attack(); 16 | oldPlayerAdapter.takeDamage(10); 17 | 18 | newPlayerAdapter.move(); 19 | newPlayerAdapter.attack(); 20 | newPlayerAdapter.takeDamage(10); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Adapter/AdapterTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "da1596b5-da3e-4161-b33c-05fb6266ec63", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Bridge.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "8c980014-98f9-4ad9-a216-7d72ee7f4e83", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Bridge/Bridge.ts: -------------------------------------------------------------------------------- 1 | // 抽象角色类 2 | abstract class Character { 3 | constructor(private weapon: Weapon) { } 4 | 5 | attack() { 6 | console.log(`Character attacks with ${this.weapon.useWeapon()}`); 7 | } 8 | } 9 | 10 | // 抽象武器类 11 | abstract class Weapon { 12 | abstract useWeapon(): string; 13 | } 14 | 15 | // 具体角色类 16 | export class Knight extends Character { 17 | constructor(weapon: Weapon) { 18 | super(weapon); 19 | } 20 | } 21 | 22 | export class Wizard extends Character { 23 | constructor(weapon: Weapon) { 24 | super(weapon); 25 | } 26 | } 27 | 28 | // 具体武器类 29 | export class Sword extends Weapon { 30 | useWeapon(): string { 31 | return "Sword"; 32 | } 33 | } 34 | 35 | export class Staff extends Weapon { 36 | useWeapon(): string { 37 | return "Staff"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Bridge/Bridge.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "d8293fcc-1a37-45b4-ae21-adf918b78485", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Bridge/BridgeTest.ts: -------------------------------------------------------------------------------- 1 | import { Knight, Staff, Sword, Wizard } from "./Bridge"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class BridgeTest extends cc.Component { 7 | start() { 8 | // 创建角色和武器 9 | const knight = new Knight(new Sword()); 10 | const wizard = new Wizard(new Staff()); 11 | 12 | // 角色攻击 13 | knight.attack(); // Output: Character attacks with Sword 14 | wizard.attack(); // Output: Character attacks with Staff 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Bridge/BridgeTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "09c18233-1dea-4af4-b72b-ac803ee093e2", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Builder.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "d1f6b32d-3b88-4169-9360-f70baf7372ec", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Builder/Builder.ts: -------------------------------------------------------------------------------- 1 | // 游戏角色接口 2 | export interface GameCharacterBuilder { 3 | getCharacter(): GameCharacter; 4 | buildCharacterModel(): void; 5 | buildCharacterStats(): void; 6 | buildCharacterAbilities(): void; 7 | } 8 | 9 | // 具体的游戏角色建造者类 10 | export class WarriorBuilder implements GameCharacterBuilder { 11 | private character: GameCharacter; 12 | 13 | constructor() { 14 | this.character = new GameCharacter(); 15 | } 16 | 17 | buildCharacterModel(): void { 18 | this.character.model = "Warrior"; 19 | } 20 | 21 | buildCharacterStats(): void { 22 | this.character.strength = 10; 23 | this.character.agility = 5; 24 | this.character.intelligence = 2; 25 | } 26 | 27 | buildCharacterAbilities(): void { 28 | this.character.abilities.push("Slash", "Shield Block"); 29 | } 30 | 31 | getCharacter(): GameCharacter { 32 | return this.character; 33 | } 34 | } 35 | 36 | export class MageBuilder implements GameCharacterBuilder { 37 | private character: GameCharacter; 38 | 39 | constructor() { 40 | this.character = new GameCharacter(); 41 | } 42 | 43 | buildCharacterModel(): void { 44 | this.character.model = "Mage"; 45 | } 46 | 47 | buildCharacterStats(): void { 48 | this.character.strength = 2; 49 | this.character.agility = 3; 50 | this.character.intelligence = 10; 51 | } 52 | 53 | buildCharacterAbilities(): void { 54 | this.character.abilities.push("Fireball", "Teleport"); 55 | } 56 | 57 | getCharacter(): GameCharacter { 58 | return this.character; 59 | } 60 | } 61 | 62 | // 游戏角色类 63 | export class GameCharacter { 64 | public model: string = ""; 65 | public strength: number = 0; 66 | public agility: number = 0; 67 | public intelligence: number = 0; 68 | public abilities: string[] = []; 69 | 70 | public describeCharacter(): void { 71 | console.log(`Character Model: ${this.model}`); 72 | console.log(`Strength: ${this.strength}`); 73 | console.log(`Agility: ${this.agility}`); 74 | console.log(`Intelligence: ${this.intelligence}`); 75 | console.log(`Abilities: ${this.abilities.join(", ")}`); 76 | } 77 | } 78 | 79 | // 游戏角色创建指导者 80 | export class CharacterDirector { 81 | private builder: GameCharacterBuilder; 82 | 83 | constructor(builder: GameCharacterBuilder) { 84 | this.builder = builder; 85 | } 86 | 87 | constructCharacter(): void { 88 | this.builder.buildCharacterModel(); 89 | this.builder.buildCharacterStats(); 90 | this.builder.buildCharacterAbilities(); 91 | } 92 | 93 | getCharacter(): GameCharacter { 94 | return this.builder.getCharacter(); 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Builder/Builder.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "023dfdde-5aa9-49a7-a7f2-1258c96646a2", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Builder/BuilderTest.ts: -------------------------------------------------------------------------------- 1 | import { CharacterDirector, MageBuilder, WarriorBuilder } from "./Builder"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class BuilderTest extends cc.Component { 7 | 8 | start() { 9 | const warriorBuilder = new WarriorBuilder(); 10 | const warriorDirector = new CharacterDirector(warriorBuilder); 11 | 12 | const mageBuilder = new MageBuilder(); 13 | const mageDirector = new CharacterDirector(mageBuilder); 14 | 15 | console.log("Creating a Warrior character:"); 16 | warriorDirector.constructCharacter(); 17 | const warriorCharacter = warriorDirector.getCharacter(); 18 | warriorCharacter.describeCharacter(); 19 | 20 | console.log("\nCreating a Mage character:"); 21 | mageDirector.constructCharacter(); 22 | const mageCharacter = mageDirector.getCharacter(); 23 | mageCharacter.describeCharacter(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Builder/BuilderTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "0c899306-5875-4629-b426-534d750a1765", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Cache.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "16303085-f9e0-49b8-8cf5-e142cbf4f477", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Cache/Cache.ts: -------------------------------------------------------------------------------- 1 | class SharedData { 2 | private texture: string; 3 | private model: string; 4 | 5 | constructor(texture: string, model: string) { 6 | this.texture = texture; 7 | this.model = model; 8 | } 9 | 10 | getTexture(): string { 11 | return this.texture; 12 | } 13 | 14 | getModel(): string { 15 | return this.model; 16 | } 17 | } 18 | 19 | export class FlyweightFactory { 20 | private flyweights: { [key: string]: SharedData } = {}; 21 | 22 | getFlyweight(texture: string, model: string): SharedData { 23 | const key = `${texture}-${model}`; 24 | if (!this.flyweights[key]) { 25 | this.flyweights[key] = new SharedData(texture, model); 26 | } 27 | return this.flyweights[key]; 28 | } 29 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Cache/Cache.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "9e87feef-2e5a-41b6-8915-3f3873ab79bd", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Cache/CacheTest.ts: -------------------------------------------------------------------------------- 1 | import { FlyweightFactory } from "./Cache"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class CacheTest extends cc.Component { 7 | 8 | start() { 9 | const factory = new FlyweightFactory(); 10 | 11 | // 创建多个游戏对象,它们共享相同的纹理和模型 12 | const object1 = factory.getFlyweight("texture1.png", "model1.obj"); 13 | const object2 = factory.getFlyweight("texture1.png", "model1.obj"); 14 | const object3 = factory.getFlyweight("texture2.png", "model2.obj"); 15 | 16 | // 在游戏中使用这些对象 17 | // object1、object2和object3都共享相同的纹理和模型数据 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Cache/CacheTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "3965866d-b7d7-43cb-abba-005fb94bbf5b", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/CoR.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "d664b611-5a6b-42c3-8753-9acb2091312e", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/CoR/CoR.ts: -------------------------------------------------------------------------------- 1 | // 基本处理器类 2 | abstract class Handler { 3 | private nextHandler: Handler | null = null; 4 | 5 | setNext(handler: Handler): Handler { 6 | this.nextHandler = handler; 7 | return handler; 8 | } 9 | 10 | // 处理请求的方法,具体逻辑由子类实现 11 | abstract handleRequest(request: any): void; 12 | 13 | // 尝试将请求传递给下一个处理器 14 | passRequest(request: any) { 15 | if (this.nextHandler) { 16 | this.nextHandler.handleRequest(request); 17 | } 18 | } 19 | } 20 | 21 | // 具体处理器1 22 | export class ConcreteHandler1 extends Handler { 23 | handleRequest(request: any) { 24 | if (true/* 条件满足 */) { 25 | // 处理请求的逻辑 26 | } else { 27 | // 将请求传递给下一个处理器 28 | this.passRequest(request); 29 | } 30 | } 31 | } 32 | 33 | // 具体处理器2 34 | export class ConcreteHandler2 extends Handler { 35 | handleRequest(request: any) { 36 | if (true/* 条件满足 */) { 37 | // 处理请求的逻辑 38 | } else { 39 | // 将请求传递给下一个处理器 40 | this.passRequest(request); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/CoR/CoR.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "e18586f9-532e-405d-bdad-6c36acec64b2", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/CoR/CoRTest.ts: -------------------------------------------------------------------------------- 1 | import { ConcreteHandler1, ConcreteHandler2 } from "./CoR"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class CoRTest extends cc.Component { 7 | start() { 8 | // 创建处理器对象 9 | const handler1 = new ConcreteHandler1(); 10 | const handler2 = new ConcreteHandler2(); 11 | 12 | // 构建责任链 13 | handler1.setNext(handler2); 14 | 15 | // 处理请求 16 | const request = ""/* 游戏事件或输入 */; 17 | handler1.handleRequest(request); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/CoR/CoRTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "167a08c4-ac44-422e-a2d6-ff5472e13439", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Command.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "1dec9742-a5ce-43a4-93cd-819e490bcd02", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Command/Command.ts: -------------------------------------------------------------------------------- 1 | export interface Command { 2 | execute(): void; 3 | undo(): void; 4 | } 5 | 6 | export class MoveLeftCommand implements Command { 7 | constructor(private character: cc.Node) { } 8 | 9 | execute() { 10 | this.character.x -= 10; 11 | console.log("Move Left"); 12 | } 13 | 14 | undo() { 15 | this.character.x += 10; 16 | console.log("Undo Move Left"); 17 | } 18 | } 19 | 20 | export class MoveRightCommand implements Command { 21 | constructor(private character: cc.Node) { } 22 | 23 | execute() { 24 | this.character.x += 10; 25 | console.log("Move Right"); 26 | } 27 | 28 | undo() { 29 | this.character.x -= 10; 30 | console.log("Undo Move Right"); 31 | } 32 | } 33 | 34 | export class JumpCommand implements Command { 35 | constructor(private character: cc.Node) { } 36 | 37 | execute() { 38 | this.character.runAction(cc.jumpBy(0.5, 0, 0, 50, 1)); 39 | console.log("Jump"); 40 | } 41 | 42 | undo() { 43 | // Jump command cannot be undone in this example 44 | } 45 | } 46 | 47 | export class CommandQueue { 48 | private commands: Command[] = []; 49 | 50 | addCommand(command: Command) { 51 | this.commands.push(command); 52 | } 53 | 54 | undoLastCommand() { 55 | const lastCommand = this.commands.pop(); 56 | if (lastCommand) { 57 | lastCommand.undo(); 58 | } 59 | } 60 | 61 | reCommond(index) { 62 | this.commands[index].execute(); 63 | } 64 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Command/Command.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "f0f9e93c-874e-4506-8a7f-2bd2898c7635", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Command/CommandTest.ts: -------------------------------------------------------------------------------- 1 | import { Command, CommandQueue, JumpCommand, MoveLeftCommand, MoveRightCommand } from "./Command"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class CommandTest extends cc.Component { 7 | @property(cc.Node) 8 | player: cc.Node = null; 9 | 10 | private commandQueue: CommandQueue = new CommandQueue(); 11 | private commandTime: number[] = []; 12 | private reCommanding: boolean = false; 13 | private reCommandIndex: number = 0; 14 | 15 | onLoad() { 16 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 17 | this.player = cc.find("Canvas/cocos"); 18 | const label = cc.find("Canvas/label").getComponent(cc.Label); 19 | label.node.color = cc.Color.RED; 20 | label.string = "和8年主程一起学习设计模式之\n命令模式"; 21 | } 22 | 23 | onDestroy() { 24 | cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 25 | } 26 | 27 | onKeyDown(event: cc.Event.EventKeyboard) { 28 | if (this.reCommanding) return; 29 | switch (event.keyCode) { 30 | case cc.macro.KEY.a: 31 | this.executeCommand(new MoveLeftCommand(this.player)); 32 | break; 33 | case cc.macro.KEY.d: 34 | this.executeCommand(new MoveRightCommand(this.player)); 35 | break; 36 | case cc.macro.KEY.space: 37 | this.executeCommand(new JumpCommand(this.player)); 38 | break; 39 | case cc.macro.KEY.r: 40 | this.reComand(); 41 | break; 42 | } 43 | } 44 | 45 | executeCommand(command: Command) { 46 | command.execute(); 47 | this.commandQueue.addCommand(command); 48 | this.commandTime.push(new Date().getTime()); 49 | } 50 | 51 | undoLastCommand() { 52 | this.commandQueue.undoLastCommand(); 53 | } 54 | 55 | reComand() { 56 | if (this.commandTime.length > 0) { 57 | this.player.x = 0; 58 | this.player.y = 50; 59 | let timestamp = new Date().getTime(); 60 | let timeDiff = timestamp - this.commandTime[0]; 61 | for (let i = 0; i < this.commandTime.length; i++) { 62 | this.commandTime[i] += timeDiff; 63 | } 64 | this.reCommandIndex = 0; 65 | this.reCommanding = true; 66 | } 67 | } 68 | 69 | update() { 70 | if (this.reCommanding) { 71 | let timestamp = new Date().getTime(); 72 | if (timestamp >= this.commandTime[this.reCommandIndex]) { 73 | this.commandQueue.reCommond(this.reCommandIndex); 74 | if (++this.reCommandIndex >= this.commandTime.length) { 75 | this.reCommanding = false; 76 | } 77 | } 78 | } 79 | } 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Command/CommandTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "d2cb09f4-4b61-4a67-9af1-0127c572e400", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Composite.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "a8bd869d-f324-4b92-847d-761f9c754308", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Composite/CompositeTest.ts: -------------------------------------------------------------------------------- 1 | const { ccclass, property } = cc._decorator; 2 | 3 | @ccclass 4 | export default class CompositeTest extends cc.Component { 5 | start() { 6 | // 创建一个场景 7 | const gameScene = new cc.Scene(); 8 | 9 | // 添加精灵到场景 10 | const playerSprite = new cc.Node(); 11 | playerSprite.addComponent(cc.Sprite); 12 | gameScene.addChild(playerSprite); 13 | 14 | // 切换到游戏场景 15 | cc.director.loadScene('GameScene'); 16 | 17 | // 创建一个父游戏对象 18 | const player = new cc.Node(); 19 | 20 | // 添加子游戏对象 21 | const weapon = new cc.Node(); 22 | weapon.addComponent(cc.Sprite); 23 | player.addChild(weapon); 24 | 25 | // 移除子游戏对象 26 | player.removeChild(weapon); 27 | 28 | // 创建一个UI容器 29 | const menu = new cc.Node(); 30 | 31 | // 添加按钮到容器 32 | const startButton = new cc.Node(); 33 | startButton.addComponent(cc.Button); 34 | menu.addChild(startButton); 35 | 36 | // 处理按钮点击事件 37 | startButton.on('click', () => { 38 | // 启动游戏 39 | }); 40 | 41 | // 创建一个粒子系统 42 | const explosion = new cc.Node(); 43 | explosion.addComponent(cc.ParticleSystem); 44 | 45 | // 将粒子系统添加到游戏对象 46 | const enemy = new cc.Node(); 47 | enemy.addChild(explosion); 48 | 49 | // 创建一个精灵 50 | const characterSprite = new cc.Node(); 51 | characterSprite.addComponent(cc.Sprite); 52 | 53 | // 添加动画组件 54 | 55 | const animation = characterSprite.addComponent(cc.Animation); 56 | 57 | // 添加动画帧 58 | const attackAnimationClip = new cc.AnimationClip(); 59 | animation.addClip(attackAnimationClip); 60 | 61 | // 播放动画 62 | animation.play('attack'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Composite/CompositeTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "e1543c54-3e19-4079-a109-a8bec3bd8e5b", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Decorator.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "a59a38b9-939e-4dd8-9ac9-74b375988010", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Decorator/Decorator.ts: -------------------------------------------------------------------------------- 1 | export class Character { 2 | draw() { 3 | console.log("绘制角色"); 4 | } 5 | } 6 | 7 | export class WeaponDecorator { 8 | constructor(private character: Character) { } 9 | 10 | draw() { 11 | this.character.draw(); 12 | console.log("添加武器"); 13 | } 14 | } 15 | 16 | export class ArmorDecorator { 17 | constructor(private character: Character) { } 18 | 19 | draw() { 20 | this.character.draw(); 21 | console.log("添加装甲"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Decorator/Decorator.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "4ab1c94e-75b9-496b-b1a0-1fbd2cd765f8", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Decorator/DecoratorTest.ts: -------------------------------------------------------------------------------- 1 | import { ArmorDecorator, Character, WeaponDecorator } from "./Decorator"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class DecoratorTest extends cc.Component { 7 | start() { 8 | const character = new Character(); 9 | const characterWithWeapon = new WeaponDecorator(character); 10 | const characterWithArmor = new ArmorDecorator(character); 11 | 12 | character.draw(); // 输出:绘制角色 13 | characterWithWeapon.draw(); // 输出:绘制角色 添加武器 14 | characterWithArmor.draw(); // 输出:绘制角色 添加装甲 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Decorator/DecoratorTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "7953de49-e10a-450a-af10-927258bc4df1", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Facade.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "75fdee48-5929-4d0a-afc9-af58958ac3d2", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Facade/Facade.ts: -------------------------------------------------------------------------------- 1 | export class GameFacade { 2 | private audioManager: AudioManager; 3 | private levelManager: LevelManager; 4 | private resourceManager: ResourceManager; 5 | 6 | constructor() { 7 | this.audioManager = new AudioManager(); 8 | this.levelManager = new LevelManager(); 9 | this.resourceManager = new ResourceManager(); 10 | } 11 | 12 | startGame() { 13 | this.resourceManager.loadGameAssets(); 14 | this.levelManager.loadInitialLevel(); 15 | this.audioManager.playBackgroundMusic(); 16 | } 17 | 18 | playSound(soundName: string) { 19 | this.audioManager.playSound(soundName); 20 | } 21 | 22 | loadNextLevel() { 23 | this.levelManager.loadNextLevel(); 24 | } 25 | 26 | // 更多游戏相关操作可以在此添加 27 | } 28 | 29 | class AudioManager { 30 | playBackgroundMusic() { 31 | // 实现播放背景音乐的逻辑 32 | } 33 | 34 | playSound(soundName: string) { 35 | // 实现播放音效的逻辑 36 | } 37 | } 38 | 39 | class LevelManager { 40 | loadInitialLevel() { 41 | // 实现加载初始关卡的逻辑 42 | } 43 | 44 | loadNextLevel() { 45 | // 实现加载下一个关卡的逻辑 46 | } 47 | } 48 | 49 | class ResourceManager { 50 | loadGameAssets() { 51 | // 实现加载游戏资源的逻辑 52 | } 53 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Facade/Facade.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "c1621a8d-cb3b-48bf-89b4-af092deef85e", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Facade/FacadeTest.ts: -------------------------------------------------------------------------------- 1 | import { GameFacade } from "./Facade"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class FacadeTest extends cc.Component { 7 | start() { 8 | const game = new GameFacade(); 9 | 10 | // 启动游戏 11 | game.startGame(); 12 | 13 | // 在游戏中播放音效 14 | game.playSound('explosion.wav'); 15 | 16 | // 加载下一个关卡 17 | game.loadNextLevel(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Facade/FacadeTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "4865b184-2fac-43b0-b363-1bba4b0f3757", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "539f1147-c7a5-41f1-a4e4-f4e058cf15ff", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/FactoryMethod.ts: -------------------------------------------------------------------------------- 1 | // 定义敌人接口 2 | export interface Enemy { 3 | init(): void; 4 | } 5 | 6 | // 具体的敌人类 7 | export class ZombieEnemy implements Enemy { 8 | init() { 9 | console.log("初始化僵尸敌人的属性和行为"); 10 | } 11 | } 12 | 13 | export class SkeletonEnemy implements Enemy { 14 | init() { 15 | console.log("初始化骷髅敌人的属性和行为"); 16 | } 17 | } 18 | 19 | export class AlienEnemy implements Enemy { 20 | init() { 21 | console.log("初始化外星人敌人的属性和行为"); 22 | } 23 | } 24 | 25 | // 敌人工厂接口 26 | export interface EnemyFactory { 27 | createEnemy(): Enemy; 28 | } 29 | 30 | // 具体的敌人工厂类 31 | export class ZombieEnemyFactory implements EnemyFactory { 32 | createEnemy(): Enemy { 33 | return new ZombieEnemy(); 34 | } 35 | } 36 | 37 | export class SkeletonEnemyFactory implements EnemyFactory { 38 | createEnemy(): Enemy { 39 | return new SkeletonEnemy(); 40 | } 41 | } 42 | 43 | export class AlienEnemyFactory implements EnemyFactory { 44 | createEnemy(): Enemy { 45 | return new AlienEnemy(); 46 | } 47 | } 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/FactoryMethod.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "457d7354-71f2-4a29-b3e6-895e3f3ba747", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/FactoryMethodTest.ts: -------------------------------------------------------------------------------- 1 | import { AlienEnemyFactory, SkeletonEnemyFactory, ZombieEnemyFactory } from "./FactoryMethod"; 2 | import { NoFactoryMethod } from "./NoFactoryMethod"; 3 | 4 | const { ccclass, property } = cc._decorator; 5 | 6 | @ccclass 7 | export default class FactoryMethodTest extends cc.Component { 8 | 9 | start() { 10 | 11 | // const zombie = new NoFactoryMethod.Enemy("Zombie"); 12 | // const skeleton = new NoFactoryMethod.Enemy("Skeleton"); 13 | // const alien = new NoFactoryMethod.Enemy("Alien"); 14 | 15 | // 使用不同的工厂创建不同类型的敌人 16 | const zombieFactory = new ZombieEnemyFactory(); 17 | const zombie = zombieFactory.createEnemy(); 18 | zombie.init(); 19 | const skeletonFactory = new SkeletonEnemyFactory(); 20 | const skeleton = skeletonFactory.createEnemy(); 21 | skeleton.init(); 22 | const alienFactory = new AlienEnemyFactory(); 23 | const alien = alienFactory.createEnemy(); 24 | alien.init(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/FactoryMethodTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "d6fec5c6-2803-40e8-9c80-27b5aeee45a2", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/NoFactoryMethod.ts: -------------------------------------------------------------------------------- 1 | export namespace NoFactoryMethod { 2 | export class Enemy { 3 | constructor(type: string) { 4 | if (type === "Zombie") { 5 | // 创建僵尸敌人 6 | this.initZombie(); 7 | } else if (type === "Skeleton") { 8 | // 创建骷髅敌人 9 | this.initSkeleton(); 10 | } else if (type === "Alien") { 11 | // 创建外星人敌人 12 | this.initAlien(); 13 | } 14 | } 15 | 16 | private initZombie() { 17 | // 初始化僵尸敌人的属性和行为 18 | cc.log("初始化僵尸敌人的属性和行为"); 19 | } 20 | 21 | private initSkeleton() { 22 | // 初始化骷髅敌人的属性和行为 23 | cc.log("初始化骷髅敌人的属性和行为"); 24 | } 25 | 26 | private initAlien() { 27 | // 初始化外星人敌人的属性和行为 28 | cc.log("初始化外星人敌人的属性和行为"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/FactoryMethod/NoFactoryMethod.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "75057487-aa42-4850-8083-9ba0f28d887a", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Helloworld.ts: -------------------------------------------------------------------------------- 1 | import AbstractFactoryTest from "./AbstractFactory/AbstractFactoryTest"; 2 | import AdapterTest from "./Adapter/AdapterTest"; 3 | import BridgeTest from "./Bridge/BridgeTest"; 4 | import BuilderTest from "./Builder/BuilderTest"; 5 | import CacheTest from "./Cache/CacheTest"; 6 | import CoRTest from "./CoR/CoRTest"; 7 | import CommandTest from "./Command/CommandTest"; 8 | import CompositeTest from "./Composite/CompositeTest"; 9 | import DecoratorTest from "./Decorator/DecoratorTest"; 10 | import FacadeTest from "./Facade/FacadeTest"; 11 | import FactoryMethodTest from "./FactoryMethod/FactoryMethodTest"; 12 | import IteratorTest from "./Iterator/IteratorTest"; 13 | import MediatorTest from "./Mediator/MediatorTest"; 14 | import MementoTest from "./Memento/MementoTest"; 15 | import ObserverTest from "./Observer/ObserverTest"; 16 | import PrototypeTest from "./Prototype/PrototypeTest"; 17 | import ProxyTest from "./Proxy/ProxyTest"; 18 | import SingletonTest from "./Singleton/SingletonTest"; 19 | import { StateTest } from "./State/StateTest"; 20 | import StrategyTest from "./Strategy/StrategyTest"; 21 | import TemplateMethodTest from "./TemplateMethod/TemplateMethodTest"; 22 | import VisitorTest from "./Visitor/VisitorTest"; 23 | 24 | const { ccclass, property } = cc._decorator; 25 | 26 | @ccclass 27 | export default class Helloworld extends cc.Component { 28 | 29 | @property(cc.Label) 30 | label: cc.Label = null; 31 | 32 | @property 33 | text: string = 'hello'; 34 | 35 | start() { 36 | // init logic 37 | this.label.string = this.text; 38 | 39 | // this.addComponent(FactoryMethodTest); 40 | // this.addComponent(AbstractFactoryTest); 41 | // this.addComponent(BuilderTest); 42 | // this.addComponent(SingletonTest); 43 | // this.addComponent(PrototypeTest); 44 | // this.addComponent(AdapterTest); 45 | // this.addComponent(BridgeTest); 46 | // this.addComponent(CompositeTest); 47 | // this.addComponent(DecoratorTest); 48 | // this.addComponent(FacadeTest); 49 | // this.addComponent(CacheTest); 50 | // this.addComponent(ProxyTest); 51 | // this.addComponent(CoRTest); 52 | // this.addComponent(CommandTest); 53 | // this.addComponent(StateTest); 54 | // this.addComponent(IteratorTest); 55 | // this.addComponent(MementoTest); 56 | // this.addComponent(ObserverTest); 57 | // this.addComponent(TemplateMethodTest); 58 | // this.addComponent(StrategyTest); 59 | // this.addComponent(MediatorTest); 60 | this.addComponent(VisitorTest); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Helloworld.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "e1b90feb-a217-4493-849d-9a611900d683", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Iterator.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "93989e24-d8f4-40cc-9778-7f1d1d885f85", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Iterator/Iterator.ts: -------------------------------------------------------------------------------- 1 | export class Character { 2 | public name: string; 3 | public imagePath: string; 4 | constructor(name, imagePath) { 5 | this.name = name; 6 | this.imagePath = imagePath; 7 | } 8 | } 9 | 10 | export class CharacterIterator { 11 | private characters: Character[]; 12 | private index: number; 13 | constructor(characters) { 14 | this.characters = characters; 15 | this.index = 0; 16 | } 17 | 18 | hasNext() { 19 | return this.index < this.characters.length; 20 | } 21 | 22 | next() { 23 | if (!this.hasNext()) { 24 | throw new Error("No more characters"); 25 | } 26 | const character = this.characters[this.index]; 27 | this.index++; 28 | return character; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Iterator/Iterator.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "0b958fd9-77a0-48fe-835b-f1f259d99a7c", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Iterator/IteratorTest.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | import { Character, CharacterIterator } from "./Iterator"; 3 | 4 | const { ccclass, property } = cc._decorator; 5 | 6 | @ccclass 7 | export default class IteratorTest extends cc.Component { 8 | private player: cc.Node; 9 | private characterIterator: CharacterIterator; 10 | 11 | onLoad() { 12 | // 初始化玩家角色 13 | this.player = cc.find("Canvas/cocos"); 14 | const label = cc.find("Canvas/label").getComponent(cc.Label); 15 | label.node.color = cc.Color.RED; 16 | label.string = "和8年主程一起学习设计模式之\n迭代器模式"; 17 | 18 | this.player.addComponent(FrameAnim); 19 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 20 | 21 | let characters = []; 22 | for (let i = 0; i < 10; i++) { 23 | characters.push(new Character(i, "Iterator/monster_" + i)); 24 | } 25 | 26 | this.characterIterator = new CharacterIterator(characters); 27 | } 28 | 29 | onDestroy() { 30 | cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 31 | } 32 | 33 | onKeyDown(event: cc.Event.EventKeyboard) { 34 | switch (event.keyCode) { 35 | case cc.macro.KEY.space: 36 | if (this.characterIterator.hasNext()) { 37 | var character = this.characterIterator.next(); 38 | this.player.getComponent(FrameAnim).SetUrl(character.imagePath, "move", 3, true); 39 | } 40 | break; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Iterator/IteratorTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "df4d1a0f-71e7-451d-9f3a-cb2091be0c6d", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Mediator.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "fc052174-fc94-47b2-9058-2c3398c671df", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Mediator/Mediator.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | 3 | export class Character { 4 | protected anim: FrameAnim; 5 | constructor(private node: cc.Node, private url: string) { 6 | this.anim = node.addComponent(FrameAnim); 7 | this.anim.SetUrl(url, "stand", 2, true); 8 | } 9 | 10 | Anim() { 11 | return this.anim; 12 | } 13 | } 14 | 15 | export class Player extends Character { 16 | // 发送请求给中介者 17 | attack(target: Enemy) { 18 | Mediator.handleAttack(this, target); 19 | } 20 | 21 | chase(target: Enemy) { 22 | Mediator.handleChase(this, target); 23 | } 24 | 25 | Stop(target: Enemy) { 26 | Mediator.handleStop(this, target); 27 | } 28 | } 29 | 30 | export class Enemy extends Character { 31 | // 发送请求给中介者 32 | takeDamage(attacker: Player, damage: number) { 33 | Mediator.handleDamage(this, attacker, damage); 34 | } 35 | 36 | escape(attacker: Player) { 37 | Mediator.handleEscape(attacker, this); 38 | } 39 | } 40 | 41 | export class Mediator { 42 | static instance: Mediator; 43 | 44 | onLoad() { 45 | Mediator.instance = this; 46 | } 47 | 48 | // 处理玩家攻击敌人的请求 49 | static handleAttack(player: Player, enemy: Enemy) { 50 | // 处理攻击逻辑,例如计算伤害 51 | const damage = 10; // 假设固定伤害 52 | player.Anim().DoFrameAnim("attack", 2, false, () => { 53 | player.Anim().DoFrameAnim("stand", 2, true); 54 | enemy.takeDamage(player, damage); 55 | }, this); 56 | } 57 | 58 | // 处理敌人受伤的请求 59 | static handleDamage(enemy: Enemy, attacker: Player, damage: number) { 60 | // 处理受伤逻辑,例如减少敌人的生命值 61 | const currentHealth = 100; // 假设初始生命值 62 | const newHealth = currentHealth - damage; 63 | // 更新敌人生命值等逻辑 64 | enemy.Anim().DoFrameAnim("die", 2, false, () => { 65 | }, this); 66 | } 67 | 68 | static handleChase(player: Player, enemy: Enemy) { 69 | enemy.escape(player); 70 | player.Anim().DoFrameAnim("move", 2, true); 71 | } 72 | 73 | static handleEscape(player: Player, enemy: Enemy) { 74 | enemy.Anim().DoFrameAnim("move", 2, true); 75 | } 76 | 77 | static handleStop(player: Player, enemy: Enemy) { 78 | player.Anim().DoFrameAnim("stand", 2, true); 79 | enemy.Anim().DoFrameAnim("stand", 2, true); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Mediator/Mediator.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "ff227ec2-0afc-4a0d-8ab3-7b34eb0ee456", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Mediator/MediatorTest.ts: -------------------------------------------------------------------------------- 1 | import { Enemy, Player } from "./Mediator"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class MediatorTest extends cc.Component { 7 | 8 | private keyDownMap: any = {}; 9 | 10 | onLoad() { 11 | // 初始化玩家角色 12 | var player = cc.find("Canvas/cocos"); 13 | const label = cc.find("Canvas/label").getComponent(cc.Label); 14 | label.node.color = cc.Color.RED; 15 | label.string = "和8年主程一起学习设计模式之\n中介者模式"; 16 | 17 | var c1 = new Player(player, "Iterator/monster_0"); 18 | player.x -= 100; 19 | 20 | var enemy = cc.instantiate(player); 21 | enemy.parent = player.parent; 22 | enemy.x += 200; 23 | var c2 = new Enemy(enemy, "State/scenePlayer_0"); 24 | 25 | let that = this; 26 | let checkKeyState = function () { 27 | if (that.keyDownMap[cc.macro.KEY.d]) { 28 | c1.chase(c2); 29 | } 30 | } 31 | 32 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, (event: cc.Event.EventKeyboard) => { 33 | switch (event.keyCode) { 34 | case cc.macro.KEY.space: 35 | c1.attack(c2); 36 | break; 37 | case cc.macro.KEY.d: 38 | this.keyDownMap[event.keyCode] = 1; 39 | checkKeyState(); 40 | break; 41 | } 42 | }, this); 43 | 44 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, (event: cc.Event.EventKeyboard) => { 45 | if (event.keyCode == cc.macro.KEY.d) { 46 | this.keyDownMap[event.keyCode] = 0; 47 | c1.Stop(c2); 48 | } 49 | }, this); 50 | } 51 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Mediator/MediatorTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "545b7904-18fd-455f-a5f3-ffec708661e5", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Memento.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "b873d7a5-0a13-42b6-9b05-bdb83fc08bca", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Memento/Memento.ts: -------------------------------------------------------------------------------- 1 | export class Memento { 2 | public posX: number; 3 | public posY: number; 4 | constructor(posX: number, posY: number) { 5 | this.posX = posX; 6 | this.posY = posY; 7 | } 8 | } 9 | 10 | export class Caretaker { 11 | private mementos: Memento[] = []; 12 | private originator: Originator; 13 | 14 | constructor(originator: Originator) { 15 | this.originator = originator; 16 | this.save(); 17 | } 18 | 19 | save() { 20 | this.mementos.push(this.originator.save()); 21 | } 22 | 23 | restore() { 24 | if (!this.mementos.length) { 25 | return; 26 | } 27 | const memento = this.mementos.pop(); 28 | this.originator.restore(memento); 29 | } 30 | } 31 | 32 | export class Originator { 33 | public player: cc.Node 34 | 35 | constructor(player: cc.Node) { 36 | this.player = player; 37 | } 38 | 39 | public save(): Memento { 40 | return new Memento(this.player.x, this.player.y); 41 | } 42 | 43 | public restore(memento: Memento): void { 44 | this.player.x = memento.posX; 45 | this.player.y = memento.posY; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Memento/Memento.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "d2d51689-6ee6-4ca6-a0d5-c113a9d6b2c1", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Memento/MementoTest.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | import { Caretaker, Originator } from "./Memento"; 3 | 4 | const { ccclass, property } = cc._decorator; 5 | 6 | @ccclass 7 | export default class MementoTest extends cc.Component { 8 | private player: cc.Node; 9 | private caretaker: Caretaker; 10 | private offset: cc.Vec2; 11 | 12 | onLoad() { 13 | // 初始化玩家角色 14 | this.player = cc.find("Canvas/cocos"); 15 | const label = cc.find("Canvas/label").getComponent(cc.Label); 16 | label.node.color = cc.Color.RED; 17 | label.string = "和8年主程一起学习设计模式之\n备忘录模式"; 18 | 19 | var anim = this.player.addComponent(FrameAnim); 20 | anim.SetUrl("Iterator/monster_3", "move", 3, true); 21 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 22 | 23 | var originator = new Originator(this.player); 24 | this.caretaker = new Caretaker(originator); 25 | 26 | // 添加鼠标事件监听 27 | this.node.on(cc.Node.EventType.MOUSE_DOWN, (event) => { 28 | // 计算鼠标点击位置与精灵中心的偏移 29 | const spritePosition = this.player.getPosition(); 30 | this.offset = cc.v2(event.getLocationX() - spritePosition.x, event.getLocationY() - spritePosition.y); 31 | }, this); 32 | this.node.on(cc.Node.EventType.MOUSE_MOVE, (event) => { 33 | if (this.offset) { 34 | // 根据鼠标移动位置来更新精灵位置 35 | this.player.setPosition(event.getLocationX() - this.offset.x, event.getLocationY() - this.offset.y); 36 | } 37 | }, this); 38 | this.node.on(cc.Node.EventType.MOUSE_UP, () => { 39 | // 清除偏移值 40 | this.offset = null; 41 | }, this); 42 | } 43 | 44 | onDestroy() { 45 | cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 46 | } 47 | 48 | onKeyDown(event: cc.Event.EventKeyboard) { 49 | switch (event.keyCode) { 50 | case cc.macro.KEY.s: 51 | this.caretaker.save(); 52 | break; 53 | case cc.macro.KEY.r: 54 | this.caretaker.restore(); 55 | break; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Memento/MementoTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "705e06f8-d7a8-4ea9-9bce-d54bc909af8e", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Observer.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "4f594e01-90b8-4755-b44f-494565236936", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Observer/Observer.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | 3 | export class Subject { 4 | /** 5 | * @type {number} 为了简单起见,Subject的状态(对所有订阅者都很重要)存储在这个变量中。 6 | */ 7 | public state: number; 8 | 9 | /** 10 | * @type {Observer[]} 订阅者列表。在现实生活中,订阅者列表可以更全面地存储(按事件类型分类等)。 11 | */ 12 | private observers: Observer[] = []; 13 | 14 | /** 15 | * 订阅管理方法。 16 | */ 17 | public attach(observer: Observer): void { 18 | const isExist = this.observers.includes(observer); 19 | if (isExist) { 20 | return console.log('Subject: Observer已经附加过了。'); 21 | } 22 | 23 | console.log('Subject: 附加了一个观察者。'); 24 | this.observers.push(observer); 25 | } 26 | 27 | public detach(observer: Observer): void { 28 | const observerIndex = this.observers.indexOf(observer); 29 | if (observerIndex === -1) { 30 | return console.log('Subject: 不存在的观察者。'); 31 | } 32 | 33 | this.observers.splice(observerIndex, 1); 34 | console.log('Subject: 分离了一个观察者。'); 35 | } 36 | 37 | /** 38 | * 在每个订阅者中触发一个更新。 39 | */ 40 | public notify(): void { 41 | console.log('Subject: 正在通知观察者...'); 42 | for (const observer of this.observers) { 43 | observer.update(this.state); 44 | } 45 | } 46 | 47 | /** 48 | * 通常,订阅逻辑只是Subject真正能做的一小部分。Subject通常会持有一些重要的业务逻辑,每当有重要的事情即将发生(或之后)时,就会触发一个通知方法。 49 | */ 50 | public someBusinessLogic(state: number): void { 51 | console.log('Subject: 我正在做一些重要的事情。'); 52 | this.state = state; 53 | 54 | console.log(`Subject: 我的状态刚刚变为:${this.state}`); 55 | this.notify(); 56 | } 57 | } 58 | 59 | /** 60 | * Observer对由它们所附加的主题发布的更新做出反应。 61 | */ 62 | export class Observer implements Observer { 63 | constructor(private state: number, private player: cc.Node) { 64 | 65 | } 66 | public update(state: number): void { 67 | if (state == this.state) { 68 | this.player.getComponent(FrameAnim).DoFrameAnim("attack", 3, false, () => { 69 | this.player.getComponent(FrameAnim).DoFrameAnim("stand", 3, true); 70 | }, this); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Observer/Observer.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "d1f912d8-e2e7-4386-b3e3-16120d79b954", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Observer/ObserverTest.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | import { Observer, Subject } from "./Observer"; 3 | 4 | const { ccclass, property } = cc._decorator; 5 | 6 | @ccclass 7 | export default class ObserverTest extends cc.Component { 8 | private subject: Subject; 9 | onLoad() { 10 | // 初始化玩家角色 11 | var player = cc.find("Canvas/cocos"); 12 | const label = cc.find("Canvas/label").getComponent(cc.Label); 13 | label.node.color = cc.Color.RED; 14 | label.string = "和8年主程一起学习设计模式之\n观察者模式"; 15 | 16 | // player.addComponent(FrameAnim).SetUrl("Iterator/monster_3", "stand", 3, true); 17 | // var player2 = cc.instantiate(player); 18 | // player2.parent = player.parent; 19 | // player2.x -= 100; 20 | // player2.getComponent(FrameAnim).SetUrl("Iterator/monster_1", "stand", 3, true); 21 | // var player3 = cc.instantiate(player); 22 | // player3.parent = player.parent; 23 | // player3.x += 100; 24 | // player3.getComponent(FrameAnim).SetUrl("Iterator/monster_2", "stand", 3, true); 25 | 26 | this.subject = new Subject(); 27 | 28 | player.addComponent(FrameAnim).SetUrl("Iterator/monster_3", "stand", 3, true); 29 | this.subject.attach(new Observer(1, player)); 30 | 31 | var player2 = cc.instantiate(player); 32 | player2.parent = player.parent; 33 | player2.x -= 100; 34 | player2.getComponent(FrameAnim).SetUrl("Iterator/monster_1", "stand", 3, true); 35 | this.subject.attach(new Observer(2, player2)); 36 | 37 | var player3 = cc.instantiate(player); 38 | player3.parent = player.parent; 39 | player3.x += 100; 40 | player3.getComponent(FrameAnim).SetUrl("Iterator/monster_2", "stand", 3, true); 41 | this.subject.attach(new Observer(3, player3)); 42 | 43 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, (event: cc.Event.EventKeyboard) => { 44 | switch (event.keyCode) { 45 | case cc.macro.KEY.space: 46 | // var players = [player, player2, player3]; 47 | // var randomPlayer = players[Math.floor(Math.random() * 3)]; 48 | // randomPlayer.getComponent(FrameAnim).DoFrameAnim("attack", 3, false, () => { 49 | // randomPlayer.getComponent(FrameAnim).DoFrameAnim("stand", 3, true); 50 | // }, this); 51 | this.subject.someBusinessLogic(Math.floor(Math.random() * 3) + 1); 52 | break; 53 | } 54 | }, this); 55 | } 56 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Observer/ObserverTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "34cf880e-5955-4318-b23e-96b2ba3228b3", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Prototype.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "7f12aa0c-cec7-4ddd-b301-34ace50ac822", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Prototype/Prototype.ts: -------------------------------------------------------------------------------- 1 | export class EnemyPrototype { 2 | constructor(public name: string, public health: number) { } 3 | 4 | clone(): EnemyPrototype { 5 | // 使用 Object.create() 来创建一个新对象,并将原型链设置为当前对象 6 | const clone = Object.create(this); 7 | clone.name = this.name; 8 | clone.health = this.health; 9 | return clone; 10 | } 11 | 12 | attack() { 13 | console.log(`${this.name} is attacking!`); 14 | } 15 | } 16 | 17 | export class PrototypeManager { 18 | private prototypes: { [key: string]: EnemyPrototype } = {}; 19 | 20 | registerPrototype(name: string, prototype: EnemyPrototype) { 21 | this.prototypes[name] = prototype; 22 | } 23 | 24 | createClone(name: string): EnemyPrototype | null { 25 | const prototype = this.prototypes[name]; 26 | if (prototype) { 27 | return prototype.clone(); 28 | } else { 29 | return null; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Prototype/Prototype.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "0d0006b5-0dce-4d5a-81ed-49576c6c8197", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Prototype/PrototypeTest.ts: -------------------------------------------------------------------------------- 1 | import { EnemyPrototype, PrototypeManager } from "./Prototype"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class PrototypeTest extends cc.Component { 7 | 8 | start() { 9 | 10 | const manager = new PrototypeManager(); 11 | 12 | // 注册不同类型的敌人原型 13 | manager.registerPrototype("Zombie", new EnemyPrototype("Zombie", 100)); 14 | manager.registerPrototype("Skeleton", new EnemyPrototype("Skeleton", 80)); 15 | 16 | // 创建敌人的副本 17 | const zombiePrototype = manager.createClone("Zombie"); 18 | const skeletonPrototype = manager.createClone("Skeleton"); 19 | 20 | if (zombiePrototype && skeletonPrototype) { 21 | zombiePrototype.attack(); // 输出:Zombie is attacking! 22 | skeletonPrototype.attack(); // 输出:Skeleton is attacking! 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Prototype/PrototypeTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "c19a0b3e-abdb-41da-8fa6-2ca207ef583d", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Proxy.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "efa7aabb-c6a2-48e8-8ace-d8b35e88b696", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Proxy/Proxy.ts: -------------------------------------------------------------------------------- 1 | // 接口定义资源加载方法 2 | interface ResourceLoader { 3 | loadResource(): void; 4 | } 5 | 6 | // 游戏资源加载类 7 | class GameResourceLoader implements ResourceLoader { 8 | loadResource() { 9 | console.log("加载游戏资源..."); 10 | // 实际的资源加载逻辑 11 | } 12 | } 13 | 14 | // 代理类 15 | export class ResourceLoaderProxy implements ResourceLoader { 16 | private resourceLoader: ResourceLoader; 17 | 18 | constructor() { 19 | // 在代理类中,延迟实例化真正的资源加载类 20 | this.resourceLoader = new GameResourceLoader(); 21 | } 22 | 23 | loadResource() { 24 | // 代理类可以在必要时创建资源加载类的实例 25 | this.resourceLoader.loadResource(); 26 | } 27 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Proxy/Proxy.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "8f1ca928-bfd5-4400-ba26-6549b1cf3b8e", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Proxy/ProxyTest.ts: -------------------------------------------------------------------------------- 1 | import { ResourceLoaderProxy } from "./Proxy"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class ProxyTest extends cc.Component { 7 | start() { 8 | // 使用代理加载游戏资源 9 | const resourceLoader = new ResourceLoaderProxy(); 10 | 11 | // 游戏中的某个场景需要加载资源 12 | resourceLoader.loadResource(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Proxy/ProxyTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "b20393ef-2a4c-4f9d-9178-7f8d1a96b632", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Singleton.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "973a1a9e-3cbe-4dd0-991e-6f95b3aff87e", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Singleton/Singleton.ts: -------------------------------------------------------------------------------- 1 | export class Singleton { 2 | private static instance: Singleton; 3 | 4 | private constructor() { } 5 | 6 | public static getInstance(): Singleton { 7 | if (!Singleton.instance) { 8 | Singleton.instance = new Singleton(); 9 | } 10 | 11 | return Singleton.instance; 12 | } 13 | 14 | public someBusinessLogic() { 15 | // 游戏开发中的业务逻辑可以在这里执行 16 | } 17 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Singleton/Singleton.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "7de7a986-9056-4660-91af-fa5ad826fd5b", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Singleton/SingletonTest.ts: -------------------------------------------------------------------------------- 1 | import { Singleton } from "./Singleton"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class SingletonTest extends cc.Component { 7 | 8 | start() { 9 | 10 | const s1 = Singleton.getInstance(); 11 | const s2 = Singleton.getInstance(); 12 | 13 | if (s1 === s2) { 14 | console.log('Singleton works, both variables contain the same instance.'); 15 | 16 | // 在这里可以调用单例的业务逻辑方法 17 | s1.someBusinessLogic(); 18 | } else { 19 | console.log('Singleton failed, variables contain different instances.'); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Singleton/SingletonTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "6b640166-5cae-44b4-bbc0-1b8f18915107", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "c378c457-9577-419b-85ca-d8a8661a893c", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/FrameAnim.ts: -------------------------------------------------------------------------------- 1 | const { ccclass, property } = cc._decorator; 2 | 3 | @ccclass 4 | export class FrameAnim extends cc.Component { 5 | 6 | @property 7 | url: string = 'State/scenePlayer_0'; 8 | 9 | private sprite: cc.Sprite = null; 10 | private spriteFrame: cc.SpriteFrame; 11 | private curAnim: string; 12 | private curDir: number; 13 | private curFrame: number = 0; 14 | private startFrame: number; 15 | private endFrame: number; 16 | private frameData: any = null; 17 | private frameResData: any; 18 | private frameInternal: number = 1 / 8; 19 | private frameTick: number = 0; 20 | private loop: boolean; 21 | private onDoFrameAnimCB: any = null; 22 | private onDoFrameAnimCBObj: any = null; 23 | 24 | onLoad() { 25 | this.sprite = this.getComponent(cc.Sprite); 26 | // this.loadRes(); 27 | } 28 | 29 | loadRes() { 30 | cc.resources.release(this.url); 31 | cc.resources.load(this.url, cc.SpriteFrame, (err, spriteFrame) => { 32 | if (!err) { 33 | this.spriteFrame = spriteFrame; 34 | cc.resources.load(this.url, cc.JsonAsset, (err, jsonAsset) => { 35 | if (!err) { 36 | var jsonData = jsonAsset.json; 37 | this.frameData = jsonData.mc.data; 38 | this.frameResData = jsonData.res; 39 | this.DoFrameAnim(this.curAnim, this.curDir, this.loop); 40 | } else { 41 | console.error("Error loading json asset: " + err); 42 | } 43 | }); 44 | } else { 45 | console.error("Error loading sprite frame: " + err); 46 | } 47 | }); 48 | } 49 | 50 | update(dt: number) { 51 | if (this.curFrame > 0) { 52 | this.frameTick += dt; 53 | if (this.frameTick >= this.frameInternal) { 54 | this.frameTick = 0; 55 | var resKey = this.frameData.frames[this.curFrame - 1].res; 56 | var res = this.frameResData[resKey]; 57 | var rect = cc.rect(res.x, res.y, res.w, res.h); 58 | this.sprite.spriteFrame = new cc.SpriteFrame(this.spriteFrame.getTexture(), rect); 59 | this.curFrame++; 60 | if (this.curFrame > this.endFrame) { 61 | if (this.loop) { 62 | this.curFrame = this.startFrame; 63 | } 64 | else { 65 | this.curFrame = 0; 66 | if (this.onDoFrameAnimCB) { 67 | this.onDoFrameAnimCB.call(this.onDoFrameAnimCBObj); 68 | } 69 | } 70 | } 71 | } 72 | } 73 | } 74 | 75 | public DoFrameAnim(anim: string, dir: number, loop: boolean = false, onDoFrameAnimCB: any = null, onDoFrameAnimCBObj: any = null) { 76 | if (anim == this.curAnim) return; 77 | this.curAnim = anim; 78 | this.curDir = dir; 79 | this.loop = loop; 80 | this.onDoFrameAnimCB = onDoFrameAnimCB; 81 | this.onDoFrameAnimCBObj = onDoFrameAnimCBObj; 82 | var anim = anim + "_" + dir; 83 | if (!this.spriteFrame || !this.frameData) return; 84 | for (let i = 0; i < this.frameData.labels.length; i++) { 85 | if (this.frameData.labels[i].name == anim) { 86 | this.startFrame = this.frameData.labels[i].frame; 87 | this.endFrame = this.frameData.labels[i].end; 88 | this.frameTick = this.frameInternal; 89 | this.curFrame = this.startFrame; 90 | break; 91 | } 92 | } 93 | } 94 | 95 | public SetUrl(url: string, anim: string, dir: number, loop = false) { 96 | this.url = url; 97 | this.curAnim = anim; 98 | this.curDir = dir; 99 | this.loop = loop; 100 | this.loadRes(); 101 | } 102 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/FrameAnim.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "b750ae34-999b-4252-bdbd-6fea8d25a561", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/State.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "./FrameAnim"; 2 | 3 | export interface IPlayerState { 4 | enter(): void; 5 | exit(): void; 6 | update(dt: number): void; 7 | } 8 | 9 | export class NormalState implements IPlayerState { 10 | constructor(private player: cc.Node) { 11 | } 12 | 13 | enter() { 14 | // 正常状态下的逻辑 15 | this.player.getComponent(FrameAnim).DoFrameAnim("stand", 3, true); 16 | } 17 | 18 | exit() { 19 | // 退出正常状态时的逻辑 20 | } 21 | 22 | update(dt: number) { 23 | // 更新正常状态下的行为 24 | } 25 | } 26 | 27 | export class MoveState implements IPlayerState { 28 | constructor(private player: cc.Node) { 29 | } 30 | 31 | enter() { 32 | // 正常状态下的逻辑 33 | this.player.getComponent(FrameAnim).DoFrameAnim("move", 3, true); 34 | } 35 | 36 | exit() { 37 | // 退出正常状态时的逻辑 38 | } 39 | 40 | update(dt: number) { 41 | // 更新正常状态下的行为 42 | } 43 | } 44 | 45 | export class AttackState implements IPlayerState { 46 | constructor(private player: cc.Node) { } 47 | 48 | enter() { 49 | // 受伤状态下的逻辑 50 | this.player.getComponent(FrameAnim).DoFrameAnim("attack", 3, true); 51 | } 52 | 53 | exit() { 54 | // 退出受伤状态时的逻辑 55 | } 56 | 57 | update(dt: number) { 58 | // 更新受伤状态下的行为 59 | } 60 | } 61 | 62 | export class DeadState implements IPlayerState { 63 | constructor(private player: cc.Node) { } 64 | 65 | enter() { 66 | // 死亡状态下的逻辑 67 | this.player.getComponent(FrameAnim).DoFrameAnim("die", 3); 68 | } 69 | 70 | exit() { 71 | // 退出死亡状态时的逻辑 72 | } 73 | 74 | update(dt: number) { 75 | // 更新死亡状态下的行为 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/State.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "ef338a9d-160d-4874-89b6-b48c8cfe1ded", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/StateTest.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "./FrameAnim"; 2 | import { AttackState, DeadState, IPlayerState, MoveState, NormalState } from "./State"; 3 | 4 | const { ccclass, property } = cc._decorator; 5 | 6 | @ccclass 7 | export class StateTest extends cc.Component { 8 | private currentState: IPlayerState; 9 | private player: cc.Node; 10 | 11 | onLoad() { 12 | // 初始化玩家角色 13 | this.player = cc.find("Canvas/cocos"); 14 | const label = cc.find("Canvas/label").getComponent(cc.Label); 15 | label.node.color = cc.Color.RED; 16 | label.string = "和8年主程一起学习设计模式之\n状态模式"; 17 | 18 | this.player.addComponent(FrameAnim).SetUrl("State/scenePlayer_0", "stand", 3, true); 19 | this.currentState = new NormalState(this.player); 20 | this.currentState.enter(); 21 | 22 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 23 | } 24 | 25 | onDestroy() { 26 | cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 27 | } 28 | 29 | onKeyDown(event: cc.Event.EventKeyboard) { 30 | switch (event.keyCode) { 31 | case cc.macro.KEY.q: 32 | this.switchToNormalState(); 33 | break; 34 | case cc.macro.KEY.w: 35 | this.switchToMoveState(); 36 | break; 37 | case cc.macro.KEY.e: 38 | this.switchToAttackState(); 39 | break; 40 | case cc.macro.KEY.r: 41 | this.switchToDeadState(); 42 | break; 43 | } 44 | } 45 | 46 | switchToNormalState() { 47 | this.currentState.exit(); 48 | this.currentState = new NormalState(this.player); 49 | this.currentState.enter(); 50 | } 51 | 52 | switchToMoveState() { 53 | this.currentState.exit(); 54 | this.currentState = new MoveState(this.player); 55 | this.currentState.enter(); 56 | } 57 | 58 | switchToAttackState() { 59 | this.currentState.exit(); 60 | this.currentState = new AttackState(this.player); 61 | this.currentState.enter(); 62 | } 63 | 64 | switchToDeadState() { 65 | this.currentState.exit(); 66 | this.currentState = new DeadState(this.player); 67 | this.currentState.enter(); 68 | } 69 | 70 | update(dt: number) { 71 | this.currentState.update(dt); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/State/StateTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "289f27b0-301b-4fcd-93c3-eabc7ca012d4", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Strategy.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "87b43834-659f-4df9-8238-f0e3214ef7f2", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Strategy/Strategy.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | 3 | export class Character { 4 | protected anim: FrameAnim; 5 | protected skill: Skill; 6 | 7 | constructor(private node: cc.Node, private url: string) { 8 | this.anim = this.node.addComponent(FrameAnim); 9 | this.anim.SetUrl(this.url, "stand", 3, true); 10 | } 11 | 12 | public attack() { 13 | this.anim.DoFrameAnim("attack", 3, false, () => { 14 | this.anim.DoFrameAnim("stand", 3, true); 15 | }, this); 16 | if (this.skill) { 17 | this.skill.attack(); 18 | } 19 | } 20 | 21 | public learnSkill(skill: Skill) { 22 | this.skill = skill; 23 | } 24 | } 25 | 26 | export class Skill { 27 | protected anim: FrameAnim; 28 | 29 | constructor(private node: cc.Node, private url: string) { 30 | this.anim = node.addComponent(FrameAnim); 31 | this.node.active = false; 32 | this.anim.SetUrl(this.url, "attack", 3, false); 33 | } 34 | 35 | public attack() { 36 | this.node.active = true; 37 | this.anim.DoFrameAnim("attack", 3, false, () => { 38 | this.node.active = false; 39 | }, this); 40 | } 41 | } 42 | 43 | export class Skill0 extends Skill { 44 | constructor(node: cc.Node) { 45 | super(node, "Strategy/scenePlayer_0_attack"); 46 | } 47 | } 48 | 49 | export class Skill1 extends Skill { 50 | constructor(node: cc.Node) { 51 | super(node, "Strategy/scenePlayer_1_attack"); 52 | } 53 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Strategy/Strategy.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "ba0bf5f0-121f-4950-aa17-2d2f7d2a4613", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Strategy/StrategyTest.ts: -------------------------------------------------------------------------------- 1 | import { Character, Skill, Skill0, Skill1 } from "./Strategy"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class StrategyTest extends cc.Component { 7 | onLoad() { 8 | // 初始化玩家角色 9 | var player = cc.find("Canvas/cocos"); 10 | const label = cc.find("Canvas/label").getComponent(cc.Label); 11 | label.node.color = cc.Color.RED; 12 | label.string = "和8年主程一起学习设计模式之\n策略模式"; 13 | 14 | let c1 = new Character(player, "State/scenePlayer_0"); 15 | let node1 = new cc.Node(); 16 | node1.addComponent(cc.Sprite); 17 | player.addChild(node1); 18 | let skill1 = new Skill0(node1); 19 | 20 | let node2 = new cc.Node(); 21 | node2.addComponent(cc.Sprite); 22 | player.addChild(node2); 23 | let skill2 = new Skill1(node2); 24 | 25 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, (event: cc.Event.EventKeyboard) => { 26 | switch (event.keyCode) { 27 | case cc.macro.KEY.q: 28 | c1.learnSkill(null); 29 | c1.attack(); 30 | break; 31 | case cc.macro.KEY.w: 32 | c1.learnSkill(skill1); 33 | c1.attack(); 34 | break; 35 | case cc.macro.KEY.e: 36 | c1.learnSkill(skill2); 37 | c1.attack(); 38 | break; 39 | } 40 | }, this); 41 | } 42 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Strategy/StrategyTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "41adbc4f-b146-489c-8a92-50465323a429", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/TemplateMethod.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "bb16caa2-9675-497e-93eb-80415cbc2b8d", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/TemplateMethod/TemplateMethod.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | 3 | export class Character { 4 | protected anim: FrameAnim; 5 | constructor(private node: cc.Node, private url: string) { 6 | this.anim = node.addComponent(FrameAnim); 7 | this.anim.SetUrl(url, "stand", 3, true); 8 | } 9 | 10 | public attack() { 11 | this.anim.DoFrameAnim("attack", 3, false, () => { 12 | this.anim.DoFrameAnim("stand", 3, true); 13 | }, this); 14 | } 15 | } 16 | 17 | export class SmallRCharacter extends Character { 18 | 19 | public attack() { 20 | this.anim.DoFrameAnim("move", 3, false, () => { 21 | this.anim.DoFrameAnim("attack", 3, false, () => { 22 | this.anim.DoFrameAnim("die", 3, false); 23 | }, this); 24 | }, this); 25 | } 26 | } 27 | 28 | export class BigRCharacter extends Character { 29 | 30 | public attack() { 31 | this.anim.DoFrameAnim("move", 3, false, () => { 32 | this.anim.DoFrameAnim("attack", 3, false, () => { 33 | this.anim.DoFrameAnim("stand", 3, true); 34 | }, this); 35 | }, this); 36 | } 37 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/TemplateMethod/TemplateMethod.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "fb250ae8-bfc6-4e66-b7db-476363dacd05", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/TemplateMethod/TemplateMethodTest.ts: -------------------------------------------------------------------------------- 1 | import { BigRCharacter, Character, SmallRCharacter } from "./TemplateMethod"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class TemplateMethodTest extends cc.Component { 7 | onLoad() { 8 | // 初始化玩家角色 9 | var player = cc.find("Canvas/cocos"); 10 | const label = cc.find("Canvas/label").getComponent(cc.Label); 11 | label.node.color = cc.Color.RED; 12 | label.string = "和8年主程一起学习设计模式之\n模板方法模式"; 13 | 14 | var c1 = new Character(player, "Iterator/monster_4"); 15 | 16 | var player2 = cc.instantiate(player); 17 | player2.parent = player.parent; 18 | player2.x -= 100; 19 | var c2 = new SmallRCharacter(player2, "State/scenePlayer_0"); 20 | 21 | var player3 = cc.instantiate(player); 22 | player3.parent = player.parent; 23 | player3.x += 100; 24 | var c3 = new BigRCharacter(player3, "Iterator/monster_9"); 25 | 26 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, (event: cc.Event.EventKeyboard) => { 27 | switch (event.keyCode) { 28 | case cc.macro.KEY.q: 29 | c1.attack(); 30 | break; 31 | case cc.macro.KEY.w: 32 | c2.attack(); 33 | break; 34 | case cc.macro.KEY.e: 35 | c3.attack(); 36 | break; 37 | } 38 | }, this); 39 | } 40 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/TemplateMethod/TemplateMethodTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "adce437b-3167-47c6-9321-cdc6728dac6a", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Visitor.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "9f65ba0d-9154-41be-8328-4ba0cf70eb21", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Visitor/Visitor.ts: -------------------------------------------------------------------------------- 1 | import { FrameAnim } from "../State/FrameAnim"; 2 | 3 | class GameObject { 4 | accept(visitor: Visitor): void { 5 | throw new Error("Method 'accept()' must be implemented."); 6 | } 7 | 8 | protected anim: FrameAnim; 9 | constructor(private node: cc.Node, private url: string) { 10 | this.anim = node.addComponent(FrameAnim); 11 | this.anim.SetUrl(url, "stand", 2, true); 12 | } 13 | 14 | attack() { 15 | this.anim.DoFrameAnim("attack", 2, false, () => { 16 | this.anim.DoFrameAnim("stand", 2, true); 17 | }, this); 18 | } 19 | } 20 | 21 | export class ConcreteGameObjectA extends GameObject { 22 | accept(visitor: Visitor): void { 23 | visitor.visitConcreteGameObjectA(this); 24 | this.attack(); 25 | } 26 | } 27 | 28 | export class ConcreteGameObjectB extends GameObject { 29 | accept(visitor: Visitor): void { 30 | visitor.visitConcreteGameObjectB(this); 31 | this.attack(); 32 | } 33 | } 34 | 35 | 36 | interface Visitor { 37 | visitConcreteGameObjectA(gameObjectA: ConcreteGameObjectA): void; 38 | visitConcreteGameObjectB(gameObjectB: ConcreteGameObjectB): void; 39 | } 40 | 41 | export class ConcreteVisitor implements Visitor { 42 | visitConcreteGameObjectA(gameObjectA: ConcreteGameObjectA): void { 43 | console.log("访问者访问了游戏对象A"); 44 | } 45 | 46 | visitConcreteGameObjectB(gameObjectB: ConcreteGameObjectB): void { 47 | console.log("访问者访问了游戏对象B"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Visitor/Visitor.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "7ca50982-6596-4376-bf5c-c8c3693c26cd", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Visitor/VisitorTest.ts: -------------------------------------------------------------------------------- 1 | import { ConcreteGameObjectA, ConcreteGameObjectB, ConcreteVisitor } from "./Visitor"; 2 | 3 | const { ccclass, property } = cc._decorator; 4 | 5 | @ccclass 6 | export default class VisitorTest extends cc.Component { 7 | 8 | private keyDownMap: any = {}; 9 | 10 | onLoad() { 11 | // 初始化玩家角色 12 | var player = cc.find("Canvas/cocos"); 13 | const label = cc.find("Canvas/label").getComponent(cc.Label); 14 | label.node.color = cc.Color.RED; 15 | label.string = "和8年主程一起学习设计模式之\n访问者模式"; 16 | 17 | var c1 = new ConcreteGameObjectA(player, "Iterator/monster_6"); 18 | player.x -= 100; 19 | 20 | var player2 = cc.instantiate(player); 21 | player2.parent = player.parent; 22 | player2.x += 200; 23 | player2.scaleX = -1; 24 | var c2 = new ConcreteGameObjectB(player2, "Iterator/monster_8"); 25 | 26 | const visitor = new ConcreteVisitor(); 27 | 28 | player.on(cc.Node.EventType.TOUCH_END, () => { 29 | c1.accept(visitor); 30 | }, this); 31 | 32 | player2.on(cc.Node.EventType.TOUCH_END, () => { 33 | c2.accept(visitor); 34 | }, this); 35 | } 36 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Script/Visitor/VisitorTest.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "9e55e955-219f-4c80-85da-0732e5df5913", 4 | "importer": "typescript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Texture/HelloWorld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/Texture/HelloWorld.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Texture/HelloWorld.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 256, 12 | "height": 256, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "HelloWorld": { 16 | "ver": "1.0.6", 17 | "uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 3.5, 24 | "offsetY": 1, 25 | "trimX": 44, 26 | "trimY": 14, 27 | "width": 175, 28 | "height": 226, 29 | "rawWidth": 256, 30 | "rawHeight": 256, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Texture/singleColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/Texture/singleColor.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/Texture/singleColor.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 2, 12 | "height": 2, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "singleColor": { 16 | "ver": "1.0.6", 17 | "uuid": "410fb916-8721-4663-bab8-34397391ace7", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 0, 26 | "trimY": 0, 27 | "width": 2, 28 | "height": 2, 29 | "rawWidth": 2, 30 | "rawHeight": 2, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/migration.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "8a14b1c8-b2c0-4afd-80dd-4afae9fd25af", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This script is automatically generated by Cocos Creator and is only used for projects compatible with the v2.1.0 ~ 2.2.1 version. 3 | * You do not need to manually add this script in any other project. 4 | * If you don't use cc.Toggle in your project, you can delete this script directly. 5 | * If your project is hosted in VCS such as git, submit this script together. 6 | * 7 | * 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0 ~ 2.2.1 版本的工程, 8 | * 你无需在任何其它项目中手动添加此脚本。 9 | * 如果你的项目中没用到 Toggle,可直接删除该脚本。 10 | * 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。 11 | */ 12 | 13 | if (cc.Toggle) { 14 | // Whether to trigger 'toggle' and 'checkEvents' events when modifying 'toggle.isChecked' in the code 15 | // 在代码中修改 'toggle.isChecked' 时是否触发 'toggle' 与 'checkEvents' 事件 16 | cc.Toggle._triggerEventInScript_isChecked = true; 17 | } 18 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "b92fcc2a-fb0f-4241-b1ef-b29b4b0131c3", 4 | "importer": "javascript", 5 | "isPlugin": false, 6 | "loadPluginInWeb": true, 7 | "loadPluginInNative": true, 8 | "loadPluginInEditor": false, 9 | "subMetas": {} 10 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "5ed1459f-f1e2-4d2c-8bb9-e792b4b63280", 4 | "importer": "folder", 5 | "isBundle": true, 6 | "bundleName": "resources", 7 | "priority": 8, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "92af6190-c307-431b-8fb3-b42d741f31ec", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_0.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"FF0FE48", 31 | "x":157, 32 | "y":165 33 | }, 34 | { 35 | "res":"68B05ED6", 36 | "x":157, 37 | "y":163 38 | }, 39 | { 40 | "res":"20C0B18B", 41 | "x":157, 42 | "y":163 43 | }, 44 | { 45 | "res":"C102CE80", 46 | "x":157, 47 | "y":163 48 | }, 49 | { 50 | "res":"1D138349", 51 | "x":145, 52 | "y":166 53 | }, 54 | { 55 | "res":"47E459E2", 56 | "x":142, 57 | "y":164 58 | }, 59 | { 60 | "res":"A8CA97B0", 61 | "x":132, 62 | "y":163 63 | }, 64 | { 65 | "res":"AADDF79E", 66 | "x":127, 67 | "y":164 68 | }, 69 | { 70 | "res":"169FC08F", 71 | "x":124, 72 | "y":176 73 | }, 74 | { 75 | "res":"5706F40A", 76 | "x":126, 77 | "y":175 78 | }, 79 | { 80 | "res":"1689CE5F", 81 | "x":123, 82 | "y":175 83 | }, 84 | { 85 | "res":"B2F444D5", 86 | "x":118, 87 | "y":175 88 | }, 89 | { 90 | "res":"F761D819", 91 | "x":141, 92 | "y":185 93 | }, 94 | { 95 | "res":"C29D335C", 96 | "x":143, 97 | "y":178 98 | }, 99 | { 100 | "res":"9CCC4E37", 101 | "x":147, 102 | "y":170 103 | }, 104 | { 105 | "res":"195AF5BD", 106 | "x":146, 107 | "y":174 108 | }, 109 | { 110 | "res":"1C8DECD7", 111 | "x":157, 112 | "y":178 113 | }, 114 | { 115 | "res":"411685C7", 116 | "x":157, 117 | "y":173 118 | }, 119 | { 120 | "res":"366E9190", 121 | "x":157, 122 | "y":165 123 | }, 124 | { 125 | "res":"2CB2F51D", 126 | "x":157, 127 | "y":169 128 | }, 129 | { 130 | "res":"1A2C7AD6", 131 | "x":157, 132 | "y":168 133 | }, 134 | { 135 | "res":"C62DD697", 136 | "x":157, 137 | "y":184 138 | }, 139 | { 140 | "res":"8EC4550D", 141 | "x":157, 142 | "y":189 143 | }, 144 | { 145 | "res":"93F0088E", 146 | "x":157, 147 | "y":131 148 | }, 149 | { 150 | "res":"67FDCA10", 151 | "x":157, 152 | "y":183 153 | }, 154 | { 155 | "res":"EE55FE1F", 156 | "x":157, 157 | "y":194 158 | }, 159 | { 160 | "res":"FF096204", 161 | "x":157, 162 | "y":191 163 | }, 164 | { 165 | "res":"EF3C8CA4", 166 | "x":144, 167 | "y":169 168 | }, 169 | { 170 | "res":"BCF8FB56", 171 | "x":128, 172 | "y":188 173 | }, 174 | { 175 | "res":"DAC69B6F", 176 | "x":127, 177 | "y":197 178 | }, 179 | { 180 | "res":"AA586766", 181 | "x":157, 182 | "y":134 183 | }, 184 | { 185 | "res":"DDB7CAFA", 186 | "x":148, 187 | "y":190 188 | }, 189 | { 190 | "res":"9463C310", 191 | "x":130, 192 | "y":199 193 | }, 194 | { 195 | "res":"EC0F55C3", 196 | "x":131, 197 | "y":196 198 | }, 199 | { 200 | "res":"F191454F", 201 | "x":127, 202 | "y":182 203 | }, 204 | { 205 | "res":"9DA37ABE", 206 | "x":104, 207 | "y":192 208 | }, 209 | { 210 | "res":"CFE74B13", 211 | "x":109, 212 | "y":181 213 | }, 214 | { 215 | "res":"4B0B56EF", 216 | "x":155, 217 | "y":155 218 | }, 219 | { 220 | "res":"6F572B32", 221 | "x":138, 222 | "y":200 223 | }, 224 | { 225 | "res":"3206FF7D", 226 | "x":117, 227 | "y":203 228 | }, 229 | { 230 | "res":"6CA507EC", 231 | "x":114, 232 | "y":198 233 | }, 234 | { 235 | "res":"CE9AA7A5", 236 | "x":140, 237 | "y":182 238 | }, 239 | { 240 | "res":"88C342EC", 241 | "x":131, 242 | "y":173 243 | }, 244 | { 245 | "res":"BB680B53", 246 | "x":132, 247 | "y":161 248 | }, 249 | { 250 | "res":"F7172C9B", 251 | "x":157, 252 | "y":176 253 | }, 254 | { 255 | "res":"909BA733", 256 | "x":155, 257 | "y":195 258 | }, 259 | { 260 | "res":"6798FD96", 261 | "x":139, 262 | "y":187 263 | }, 264 | { 265 | "res":"80F6F193", 266 | "x":137, 267 | "y":176 268 | }, 269 | { 270 | "res":"64F1EB38", 271 | "x":157, 272 | "y":174 273 | }, 274 | { 275 | "res":"F9B2042C", 276 | "x":157, 277 | "y":165 278 | }, 279 | { 280 | "res":"5FAA16C3", 281 | "x":157, 282 | "y":155 283 | }, 284 | { 285 | "res":"A1BE1F40", 286 | "x":157, 287 | "y":182 288 | }, 289 | { 290 | "res":"DF46B664", 291 | "x":157, 292 | "y":192 293 | }, 294 | { 295 | "res":"9F116AEB", 296 | "x":155, 297 | "y":180 298 | }, 299 | { 300 | "res":"6926D85E", 301 | "x":157, 302 | "y":168 303 | }, 304 | { 305 | "res":"7686AB59", 306 | "x":157, 307 | "y":167 308 | }, 309 | { 310 | "res":"FEE0FC17", 311 | "x":157, 312 | "y":166 313 | }, 314 | { 315 | "res":"2C9FC08A", 316 | "x":157, 317 | "y":167 318 | }, 319 | { 320 | "res":"AE7CCC74", 321 | "x":157, 322 | "y":166 323 | }, 324 | { 325 | "res":"C20EE0B6", 326 | "x":139, 327 | "y":168 328 | }, 329 | { 330 | "res":"56809BAB", 331 | "x":138, 332 | "y":167 333 | }, 334 | { 335 | "res":"438FDA15", 336 | "x":132, 337 | "y":168 338 | }, 339 | { 340 | "res":"32B9F517", 341 | "x":128, 342 | "y":167 343 | }, 344 | { 345 | "res":"18695E84", 346 | "x":120, 347 | "y":181 348 | }, 349 | { 350 | "res":"B32B22CE", 351 | "x":125, 352 | "y":181 353 | }, 354 | { 355 | "res":"24B7131D", 356 | "x":123, 357 | "y":178 358 | }, 359 | { 360 | "res":"C97AE9A1", 361 | "x":119, 362 | "y":181 363 | }, 364 | { 365 | "res":"699C9BBE", 366 | "x":141, 367 | "y":184 368 | }, 369 | { 370 | "res":"25BA2A47", 371 | "x":143, 372 | "y":175 373 | }, 374 | { 375 | "res":"179A9FD2", 376 | "x":147, 377 | "y":163 378 | }, 379 | { 380 | "res":"2495AC0", 381 | "x":146, 382 | "y":164 383 | }, 384 | { 385 | "res":"953D8DFF", 386 | "x":157, 387 | "y":177 388 | }, 389 | { 390 | "res":"EFFB2A46", 391 | "x":157, 392 | "y":168 393 | }, 394 | { 395 | "res":"190B26D4", 396 | "x":157, 397 | "y":158 398 | }, 399 | { 400 | "res":"C6F44C48", 401 | "x":157, 402 | "y":159 403 | }, 404 | { 405 | "res":"8B4EFD72", 406 | "x":157, 407 | "y":183 408 | }, 409 | { 410 | "res":"44164BB4", 411 | "x":131, 412 | "y":182 413 | }, 414 | { 415 | "res":"2A113325", 416 | "x":110, 417 | "y":193 418 | }, 419 | { 420 | "res":"1736D93C", 421 | "x":129, 422 | "y":185 423 | }, 424 | { 425 | "res":"EAA2026", 426 | "x":157, 427 | "y":176 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "FF0FE48":{"x":1,"y":581,"w":63,"h":95}, 433 | "68B05ED6":{"x":813,"y":563,"w":63,"h":97}, 434 | "20C0B18B":{"x":619,"y":549,"w":63,"h":97}, 435 | "C102CE80":{"x":378,"y":556,"w":63,"h":97}, 436 | "1D138349":{"x":715,"y":271,"w":95,"h":94}, 437 | "47E459E2":{"x":513,"y":180,"w":98,"h":96}, 438 | "A8CA97B0":{"x":523,"y":81,"w":109,"h":97}, 439 | "AADDF79E":{"x":664,"y":1,"w":113,"h":96}, 440 | "169FC08F":{"x":523,"y":1,"w":139,"h":78}, 441 | "5706F40A":{"x":779,"y":1,"w":137,"h":79}, 442 | "1689CE5F":{"x":380,"y":1,"w":141,"h":79}, 443 | "B2F444D5":{"x":233,"y":1,"w":145,"h":79}, 444 | "F761D819":{"x":199,"y":343,"w":104,"h":80}, 445 | "C29D335C":{"x":203,"y":254,"w":103,"h":87}, 446 | "9CCC4E37":{"x":1,"y":198,"w":99,"h":95}, 447 | "195AF5BD":{"x":613,"y":246,"w":100,"h":91}, 448 | "1C8DECD7":{"x":619,"y":648,"w":63,"h":87}, 449 | "411685C7":{"x":684,"y":624,"w":63,"h":92}, 450 | "366E9190":{"x":554,"y":479,"w":63,"h":100}, 451 | "2CB2F51D":{"x":878,"y":563,"w":63,"h":96}, 452 | "1A2C7AD6":{"x":554,"y":581,"w":63,"h":93}, 453 | "C62DD697":{"x":749,"y":662,"w":63,"h":76}, 454 | "8EC4550D":{"x":510,"y":676,"w":63,"h":71}, 455 | "93F0088E":{"x":901,"y":383,"w":63,"h":122}, 456 | "67FDCA10":{"x":444,"y":658,"w":64,"h":80}, 457 | "EE55FE1F":{"x":943,"y":658,"w":66,"h":77}, 458 | "FF096204":{"x":1,"y":678,"w":63,"h":66}, 459 | "EF3C8CA4":{"x":1,"y":295,"w":95,"h":91}, 460 | "BCF8FB56":{"x":685,"y":367,"w":109,"h":72}, 461 | "DAC69B6F":{"x":313,"y":429,"w":109,"h":63}, 462 | "AA586766":{"x":131,"y":1,"w":100,"h":116}, 463 | "DDB7CAFA":{"x":748,"y":457,"w":99,"h":66}, 464 | "9463C310":{"x":129,"y":425,"w":117,"h":61}, 465 | "EC0F55C3":{"x":66,"y":488,"w":116,"h":54}, 466 | "F191454F":{"x":106,"y":159,"w":135,"h":72}, 467 | "9DA37ABE":{"x":308,"y":306,"w":140,"h":62}, 468 | "CFE74B13":{"x":634,"y":171,"w":131,"h":73}, 469 | "4B0B56EF":{"x":1,"y":1,"w":128,"h":98}, 470 | "6F572B32":{"x":849,"y":507,"w":113,"h":54}, 471 | "3206FF7D":{"x":548,"y":422,"w":133,"h":55}, 472 | "6CA507EC":{"x":305,"y":370,"w":138,"h":57}, 473 | "CE9AA7A5":{"x":812,"y":294,"w":104,"h":84}, 474 | "88C342EC":{"x":243,"y":159,"w":104,"h":93}, 475 | "BB680B53":{"x":918,"y":1,"w":101,"h":104}, 476 | "F7172C9B":{"x":349,"y":227,"w":119,"h":77}, 477 | "909BA733":{"x":443,"y":582,"w":80,"h":74}, 478 | "6798FD96":{"x":450,"y":363,"w":96,"h":85}, 479 | "80F6F193":{"x":894,"y":107,"w":105,"h":93}, 480 | "64F1EB38":{"x":249,"y":594,"w":63,"h":92}, 481 | "F9B2042C":{"x":489,"y":479,"w":63,"h":101}, 482 | "5FAA16C3":{"x":248,"y":429,"w":63,"h":111}, 483 | "A1BE1F40":{"x":196,"y":688,"w":65,"h":68}, 484 | "DF46B664":{"x":878,"y":661,"w":63,"h":78}, 485 | "9F116AEB":{"x":943,"y":563,"w":65,"h":93}, 486 | "6926D85E":{"x":424,"y":450,"w":63,"h":104}, 487 | "7686AB59":{"x":131,"y":641,"w":63,"h":90}, 488 | "FEE0FC17":{"x":748,"y":525,"w":63,"h":97}, 489 | "2C9FC08A":{"x":314,"y":655,"w":63,"h":85}, 490 | "AE7CCC74":{"x":184,"y":542,"w":63,"h":97}, 491 | "C20EE0B6":{"x":98,"y":327,"w":99,"h":85}, 492 | "56809BAB":{"x":1,"y":101,"w":103,"h":95}, 493 | "438FDA15":{"x":470,"y":278,"w":107,"h":83}, 494 | "32B9F517":{"x":779,"y":82,"w":113,"h":88}, 495 | "18695E84":{"x":634,"y":99,"w":141,"h":70}, 496 | "B32B22CE":{"x":374,"y":154,"w":137,"h":71}, 497 | "24B7131D":{"x":233,"y":82,"w":139,"h":75}, 498 | "C97AE9A1":{"x":374,"y":82,"w":143,"h":70}, 499 | "699C9BBE":{"x":796,"y":380,"w":103,"h":75}, 500 | "25BA2A47":{"x":867,"y":202,"w":102,"h":90}, 501 | "179A9FD2":{"x":767,"y":172,"w":98,"h":97}, 502 | "2495AC0":{"x":102,"y":233,"w":99,"h":92}, 503 | "953D8DFF":{"x":379,"y":658,"w":63,"h":83}, 504 | "EFFB2A46":{"x":313,"y":494,"w":63,"h":98}, 505 | "190B26D4":{"x":1,"y":477,"w":63,"h":102}, 506 | "C6F44C48":{"x":683,"y":441,"w":63,"h":106}, 507 | "8B4EFD72":{"x":66,"y":544,"w":63,"h":97}, 508 | "44164BB4":{"x":918,"y":294,"w":100,"h":87}, 509 | "2A113325":{"x":1,"y":414,"w":126,"h":61}, 510 | "1736D93C":{"x":579,"y":339,"w":104,"h":81}, 511 | "EAA2026":{"x":66,"y":643,"w":63,"h":90} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_0.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "e215cc2e-299f-4c06-a393-99197082c11f", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_0.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_0.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "060561c2-f3de-4194-b6b0-09607396de85", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1020, 12 | "height": 757, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_0": { 16 | "ver": "1.0.6", 17 | "uuid": "ed9ea504-b4fe-4543-80a3-215619be9f92", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "060561c2-f3de-4194-b6b0-09607396de85", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1018, 28 | "height": 755, 29 | "rawWidth": 1020, 30 | "rawHeight": 757, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_1.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"FE538313", 31 | "x":157, 32 | "y":177 33 | }, 34 | { 35 | "res":"18B82B86", 36 | "x":157, 37 | "y":177 38 | }, 39 | { 40 | "res":"BCC4B93C", 41 | "x":157, 42 | "y":180 43 | }, 44 | { 45 | "res":"FFC8456", 46 | "x":157, 47 | "y":181 48 | }, 49 | { 50 | "res":"F091DB01", 51 | "x":129, 52 | "y":171 53 | }, 54 | { 55 | "res":"117222D6", 56 | "x":125, 57 | "y":171 58 | }, 59 | { 60 | "res":"AAFCAA1B", 61 | "x":127, 62 | "y":173 63 | }, 64 | { 65 | "res":"CE93E054", 66 | "x":130, 67 | "y":174 68 | }, 69 | { 70 | "res":"B1946CB4", 71 | "x":114, 72 | "y":167 73 | }, 74 | { 75 | "res":"81CEDFD3", 76 | "x":107, 77 | "y":167 78 | }, 79 | { 80 | "res":"FC2DE7AD", 81 | "x":108, 82 | "y":168 83 | }, 84 | { 85 | "res":"58248A3", 86 | "x":115, 87 | "y":170 88 | }, 89 | { 90 | "res":"36B25A27", 91 | "x":133, 92 | "y":168 93 | }, 94 | { 95 | "res":"FC677AA7", 96 | "x":131, 97 | "y":169 98 | }, 99 | { 100 | "res":"3D2A1BF6", 101 | "x":133, 102 | "y":169 103 | }, 104 | { 105 | "res":"5934DDD8", 106 | "x":136, 107 | "y":166 108 | }, 109 | { 110 | "res":"C38E56D3", 111 | "x":157, 112 | "y":163 113 | }, 114 | { 115 | "res":"BE131230", 116 | "x":157, 117 | "y":168 118 | }, 119 | { 120 | "res":"EC74C0BA", 121 | "x":157, 122 | "y":164 123 | }, 124 | { 125 | "res":"3CDEC76E", 126 | "x":157, 127 | "y":160 128 | }, 129 | { 130 | "res":"4938A645", 131 | "x":157, 132 | "y":178 133 | }, 134 | { 135 | "res":"35C4858C", 136 | "x":128, 137 | "y":176 138 | }, 139 | { 140 | "res":"424ED5C5", 141 | "x":135, 142 | "y":179 143 | }, 144 | { 145 | "res":"85D47CBC", 146 | "x":157, 147 | "y":127 148 | }, 149 | { 150 | "res":"5579507D", 151 | "x":150, 152 | "y":138 153 | }, 154 | { 155 | "res":"29E288F7", 156 | "x":142, 157 | "y":146 158 | }, 159 | { 160 | "res":"6E888117", 161 | "x":155, 162 | "y":168 163 | }, 164 | { 165 | "res":"60B511BD", 166 | "x":121, 167 | "y":172 168 | }, 169 | { 170 | "res":"9898ED6B", 171 | "x":112, 172 | "y":174 173 | }, 174 | { 175 | "res":"6CD6CB11", 176 | "x":120, 177 | "y":178 178 | }, 179 | { 180 | "res":"8E7897C7", 181 | "x":157, 182 | "y":127 183 | }, 184 | { 185 | "res":"8577D671", 186 | "x":157, 187 | "y":138 188 | }, 189 | { 190 | "res":"2B758BEC", 191 | "x":157, 192 | "y":149 193 | }, 194 | { 195 | "res":"2A77D2C8", 196 | "x":157, 197 | "y":173 198 | }, 199 | { 200 | "res":"277F5D28", 201 | "x":102, 202 | "y":167 203 | }, 204 | { 205 | "res":"17DADD7B", 206 | "x":122, 207 | "y":178 208 | }, 209 | { 210 | "res":"2647415B", 211 | "x":132, 212 | "y":184 213 | }, 214 | { 215 | "res":"3E83B90B", 216 | "x":157, 217 | "y":135 218 | }, 219 | { 220 | "res":"E5F202DC", 221 | "x":157, 222 | "y":143 223 | }, 224 | { 225 | "res":"516A8AAC", 226 | "x":157, 227 | "y":156 228 | }, 229 | { 230 | "res":"C1503174", 231 | "x":141, 232 | "y":169 233 | }, 234 | { 235 | "res":"36B86F90", 236 | "x":128, 237 | "y":166 238 | }, 239 | { 240 | "res":"A6B236FE", 241 | "x":157, 242 | "y":174 243 | }, 244 | { 245 | "res":"7DD38D81", 246 | "x":157, 247 | "y":180 248 | }, 249 | { 250 | "res":"5E4CA4A9", 251 | "x":157, 252 | "y":146 253 | }, 254 | { 255 | "res":"3CC2DE21", 256 | "x":157, 257 | "y":149 258 | }, 259 | { 260 | "res":"C39F9FDD", 261 | "x":157, 262 | "y":153 263 | }, 264 | { 265 | "res":"1188FA7B", 266 | "x":133, 267 | "y":173 268 | }, 269 | { 270 | "res":"5E6D7D2E", 271 | "x":157, 272 | "y":169 273 | }, 274 | { 275 | "res":"70D69A6D", 276 | "x":156, 277 | "y":179 278 | }, 279 | { 280 | "res":"757D1FF1", 281 | "x":156, 282 | "y":187 283 | }, 284 | { 285 | "res":"5D1F8911", 286 | "x":126, 287 | "y":153 288 | }, 289 | { 290 | "res":"EF72AB1F", 291 | "x":157, 292 | "y":152 293 | }, 294 | { 295 | "res":"73BD056A", 296 | "x":150, 297 | "y":156 298 | }, 299 | { 300 | "res":"9BB15EE", 301 | "x":148, 302 | "y":181 303 | }, 304 | { 305 | "res":"1663C6", 306 | "x":157, 307 | "y":177 308 | }, 309 | { 310 | "res":"E910CA4C", 311 | "x":157, 312 | "y":179 313 | }, 314 | { 315 | "res":"F59620D8", 316 | "x":157, 317 | "y":180 318 | }, 319 | { 320 | "res":"3598701C", 321 | "x":157, 322 | "y":181 323 | }, 324 | { 325 | "res":"1155B9F7", 326 | "x":129, 327 | "y":172 328 | }, 329 | { 330 | "res":"C0258CE0", 331 | "x":128, 332 | "y":172 333 | }, 334 | { 335 | "res":"DA31CFB", 336 | "x":131, 337 | "y":173 338 | }, 339 | { 340 | "res":"62C83B6D", 341 | "x":134, 342 | "y":175 343 | }, 344 | { 345 | "res":"26BF8847", 346 | "x":114, 347 | "y":167 348 | }, 349 | { 350 | "res":"5CB6B548", 351 | "x":110, 352 | "y":167 353 | }, 354 | { 355 | "res":"EC6E90E6", 356 | "x":114, 357 | "y":168 358 | }, 359 | { 360 | "res":"A2F16390", 361 | "x":119, 362 | "y":170 363 | }, 364 | { 365 | "res":"7D1D55FB", 366 | "x":134, 367 | "y":167 368 | }, 369 | { 370 | "res":"B3A9EBD9", 371 | "x":133, 372 | "y":168 373 | }, 374 | { 375 | "res":"BA6BDC91", 376 | "x":136, 377 | "y":166 378 | }, 379 | { 380 | "res":"83AA867D", 381 | "x":139, 382 | "y":163 383 | }, 384 | { 385 | "res":"B779CA38", 386 | "x":157, 387 | "y":162 388 | }, 389 | { 390 | "res":"18C04D99", 391 | "x":157, 392 | "y":163 393 | }, 394 | { 395 | "res":"1404127D", 396 | "x":157, 397 | "y":160 398 | }, 399 | { 400 | "res":"49D04E8E", 401 | "x":157, 402 | "y":157 403 | }, 404 | { 405 | "res":"85B253B8", 406 | "x":157, 407 | "y":190 408 | }, 409 | { 410 | "res":"2204A487", 411 | "x":115, 412 | "y":185 413 | }, 414 | { 415 | "res":"11AA4FBF", 416 | "x":97, 417 | "y":180 418 | }, 419 | { 420 | "res":"BADC15B6", 421 | "x":121, 422 | "y":177 423 | }, 424 | { 425 | "res":"55601312", 426 | "x":157, 427 | "y":171 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "FE538313":{"x":131,"y":545,"w":63,"h":78}, 433 | "18B82B86":{"x":1,"y":582,"w":63,"h":74}, 434 | "BCC4B93C":{"x":953,"y":587,"w":63,"h":67}, 435 | "FFC8456":{"x":888,"y":587,"w":63,"h":69}, 436 | "F091DB01":{"x":293,"y":258,"w":91,"h":79}, 437 | "117222D6":{"x":817,"y":275,"w":95,"h":76}, 438 | "AAFCAA1B":{"x":838,"y":378,"w":93,"h":74}, 439 | "CE93E054":{"x":728,"y":425,"w":90,"h":73}, 440 | "B1946CB4":{"x":648,"y":82,"w":116,"h":80}, 441 | "81CEDFD3":{"x":523,"y":1,"w":123,"h":80}, 442 | "FC2DE7AD":{"x":648,"y":1,"w":122,"h":79}, 443 | "58248A3":{"x":766,"y":83,"w":115,"h":77}, 444 | "36B25A27":{"x":78,"y":330,"w":87,"h":80}, 445 | "FC677AA7":{"x":184,"y":288,"w":89,"h":79}, 446 | "3D2A1BF6":{"x":275,"y":339,"w":88,"h":79}, 447 | "5934DDD8":{"x":167,"y":369,"w":84,"h":82}, 448 | "C38E56D3":{"x":693,"y":500,"w":63,"h":84}, 449 | "BE131230":{"x":661,"y":252,"w":63,"h":79}, 450 | "EC74C0BA":{"x":378,"y":505,"w":63,"h":83}, 451 | "3CDEC76E":{"x":628,"y":485,"w":63,"h":87}, 452 | "4938A645":{"x":758,"y":528,"w":63,"h":80}, 453 | "35C4858C":{"x":635,"y":164,"w":96,"h":86}, 454 | "424ED5C5":{"x":647,"y":333,"w":88,"h":79}, 455 | "85D47CBC":{"x":109,"y":1,"w":95,"h":120}, 456 | "5579507D":{"x":388,"y":218,"w":70,"h":109}, 457 | "29E288F7":{"x":422,"y":115,"w":86,"h":101}, 458 | "6E888117":{"x":365,"y":419,"w":79,"h":84}, 459 | "60B511BD":{"x":1,"y":202,"w":99,"h":80}, 460 | "9898ED6B":{"x":766,"y":162,"w":110,"h":76}, 461 | "6CD6CB11":{"x":554,"y":252,"w":105,"h":69}, 462 | "8E7897C7":{"x":1,"y":1,"w":106,"h":120}, 463 | "8577D671":{"x":114,"y":123,"w":75,"h":109}, 464 | "2B758BEC":{"x":206,"y":107,"w":89,"h":98}, 465 | "2A77D2C8":{"x":311,"y":505,"w":65,"h":81}, 466 | "277F5D28":{"x":305,"y":1,"w":125,"h":80}, 467 | "17DADD7B":{"x":628,"y":414,"w":98,"h":69}, 468 | "2647415B":{"x":908,"y":460,"w":89,"h":63}, 469 | "3E83B90B":{"x":432,"y":1,"w":89,"h":112}, 470 | "E5F202DC":{"x":206,"y":1,"w":97,"h":104}, 471 | "516A8AAC":{"x":733,"y":240,"w":82,"h":91}, 472 | "C1503174":{"x":365,"y":339,"w":89,"h":78}, 473 | "36B86F90":{"x":460,"y":233,"w":92,"h":82}, 474 | "A6B236FE":{"x":196,"y":582,"w":63,"h":74}, 475 | "7DD38D81":{"x":508,"y":576,"w":69,"h":68}, 476 | "5E4CA4A9":{"x":914,"y":275,"w":71,"h":101}, 477 | "3CC2DE21":{"x":894,"y":1,"w":98,"h":98}, 478 | "C39F9FDD":{"x":102,"y":234,"w":80,"h":94}, 479 | "1188FA7B":{"x":191,"y":207,"w":100,"h":79}, 480 | "5E6D7D2E":{"x":443,"y":551,"w":63,"h":78}, 481 | "70D69A6D":{"x":87,"y":453,"w":92,"h":68}, 482 | "757D1FF1":{"x":908,"y":525,"w":86,"h":60}, 483 | "5D1F8911":{"x":883,"y":101,"w":94,"h":94}, 484 | "EF72AB1F":{"x":1,"y":284,"w":75,"h":95}, 485 | "73BD056A":{"x":297,"y":165,"w":89,"h":91}, 486 | "9BB15EE":{"x":446,"y":477,"w":77,"h":72}, 487 | "1663C6":{"x":823,"y":528,"w":63,"h":78}, 488 | "E910CA4C":{"x":655,"y":586,"w":63,"h":70}, 489 | "F59620D8":{"x":261,"y":588,"w":63,"h":67}, 490 | "3598701C":{"x":326,"y":590,"w":63,"h":67}, 491 | "1155B9F7":{"x":460,"y":317,"w":91,"h":77}, 492 | "C0258CE0":{"x":553,"y":323,"w":92,"h":76}, 493 | "DA31CFB":{"x":253,"y":420,"w":89,"h":74}, 494 | "62C83B6D":{"x":820,"y":454,"w":86,"h":72}, 495 | "26BF8847":{"x":305,"y":83,"w":115,"h":80}, 496 | "5CB6B548":{"x":772,"y":1,"w":120,"h":80}, 497 | "EC6E90E6":{"x":523,"y":83,"w":116,"h":79}, 498 | "A2F16390":{"x":1,"y":123,"w":111,"h":77}, 499 | "7D1D55FB":{"x":933,"y":378,"w":86,"h":80}, 500 | "B3A9EBD9":{"x":456,"y":396,"w":87,"h":79}, 501 | "BA6BDC91":{"x":1,"y":412,"w":84,"h":81}, 502 | "83AA867D":{"x":545,"y":401,"w":81,"h":84}, 503 | "B779CA38":{"x":1,"y":495,"w":63,"h":85}, 504 | "18C04D99":{"x":246,"y":496,"w":63,"h":84}, 505 | "1404127D":{"x":525,"y":487,"w":63,"h":87}, 506 | "49D04E8E":{"x":181,"y":453,"w":63,"h":90}, 507 | "85B253B8":{"x":66,"y":523,"w":63,"h":82}, 508 | "2204A487":{"x":878,"y":197,"w":105,"h":76}, 509 | "11AA4FBF":{"x":510,"y":164,"w":123,"h":67}, 510 | "BADC15B6":{"x":737,"y":353,"w":99,"h":70}, 511 | "55601312":{"x":590,"y":574,"w":63,"h":76} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_1.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "f87ac750-d06d-48e7-bfff-b609faff491c", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_1.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "f44be151-16be-4db1-8f5c-707ea8467ab6", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1020, 12 | "height": 658, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_1": { 16 | "ver": "1.0.6", 17 | "uuid": "5e87acad-2ea9-4be6-b0b6-9de517ef3162", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "f44be151-16be-4db1-8f5c-707ea8467ab6", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1018, 28 | "height": 656, 29 | "rawWidth": 1020, 30 | "rawHeight": 658, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_2.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"76E9BD38", 31 | "x":157, 32 | "y":189 33 | }, 34 | { 35 | "res":"FD59E61E", 36 | "x":157, 37 | "y":190 38 | }, 39 | { 40 | "res":"1E0F6E66", 41 | "x":157, 42 | "y":191 43 | }, 44 | { 45 | "res":"F4B0B307", 46 | "x":157, 47 | "y":187 48 | }, 49 | { 50 | "res":"BB086038", 51 | "x":141, 52 | "y":188 53 | }, 54 | { 55 | "res":"CA22CEFA", 56 | "x":137, 57 | "y":188 58 | }, 59 | { 60 | "res":"967CFDF9", 61 | "x":141, 62 | "y":187 63 | }, 64 | { 65 | "res":"443C6322", 66 | "x":148, 67 | "y":183 68 | }, 69 | { 70 | "res":"39E34936", 71 | "x":128, 72 | "y":180 73 | }, 74 | { 75 | "res":"4AA92C4E", 76 | "x":124, 77 | "y":184 78 | }, 79 | { 80 | "res":"5E6AE64E", 81 | "x":129, 82 | "y":177 83 | }, 84 | { 85 | "res":"82A0B759", 86 | "x":138, 87 | "y":173 88 | }, 89 | { 90 | "res":"7BD286B", 91 | "x":145, 92 | "y":169 93 | }, 94 | { 95 | "res":"64C7C4F2", 96 | "x":141, 97 | "y":174 98 | }, 99 | { 100 | "res":"B5B7233", 101 | "x":145, 102 | "y":169 103 | }, 104 | { 105 | "res":"17C9A3B3", 106 | "x":151, 107 | "y":164 108 | }, 109 | { 110 | "res":"AF9082E9", 111 | "x":157, 112 | "y":165 113 | }, 114 | { 115 | "res":"D76D8360", 116 | "x":157, 117 | "y":170 118 | }, 119 | { 120 | "res":"997F8A36", 121 | "x":157, 122 | "y":164 123 | }, 124 | { 125 | "res":"2370E51D", 126 | "x":157, 127 | "y":161 128 | }, 129 | { 130 | "res":"BA563E34", 131 | "x":157, 132 | "y":192 133 | }, 134 | { 135 | "res":"15E91786", 136 | "x":157, 137 | "y":199 138 | }, 139 | { 140 | "res":"D241B7F9", 141 | "x":157, 142 | "y":197 143 | }, 144 | { 145 | "res":"176320B6", 146 | "x":157, 147 | "y":130 148 | }, 149 | { 150 | "res":"59362FA7", 151 | "x":157, 152 | "y":179 153 | }, 154 | { 155 | "res":"9C8842BF", 156 | "x":157, 157 | "y":179 158 | }, 159 | { 160 | "res":"7C6CEC50", 161 | "x":157, 162 | "y":164 163 | }, 164 | { 165 | "res":"92F6729C", 166 | "x":141, 167 | "y":190 168 | }, 169 | { 170 | "res":"3A4FC795", 171 | "x":129, 172 | "y":195 173 | }, 174 | { 175 | "res":"EFFA1D5B", 176 | "x":128, 177 | "y":194 178 | }, 179 | { 180 | "res":"F4274C6B", 181 | "x":154, 182 | "y":131 183 | }, 184 | { 185 | "res":"1A9BC8FD", 186 | "x":156, 187 | "y":180 188 | }, 189 | { 190 | "res":"4B4FBB4", 191 | "x":157, 192 | "y":179 193 | }, 194 | { 195 | "res":"DBE4AEFA", 196 | "x":157, 197 | "y":165 198 | }, 199 | { 200 | "res":"2D82E2F7", 201 | "x":128, 202 | "y":179 203 | }, 204 | { 205 | "res":"47804F04", 206 | "x":112, 207 | "y":193 208 | }, 209 | { 210 | "res":"5FBB2CA7", 211 | "x":111, 212 | "y":193 213 | }, 214 | { 215 | "res":"E9279869", 216 | "x":148, 217 | "y":134 218 | }, 219 | { 220 | "res":"E3F07816", 221 | "x":150, 222 | "y":184 223 | }, 224 | { 225 | "res":"A38BA799", 226 | "x":157, 227 | "y":177 228 | }, 229 | { 230 | "res":"D8C839AC", 231 | "x":157, 232 | "y":169 233 | }, 234 | { 235 | "res":"FAEA5F31", 236 | "x":145, 237 | "y":168 238 | }, 239 | { 240 | "res":"5CB56F67", 241 | "x":134, 242 | "y":183 243 | }, 244 | { 245 | "res":"398884C9", 246 | "x":133, 247 | "y":192 248 | }, 249 | { 250 | "res":"AD934760", 251 | "x":156, 252 | "y":138 253 | }, 254 | { 255 | "res":"5BA82889", 256 | "x":157, 257 | "y":180 258 | }, 259 | { 260 | "res":"66F04FC6", 261 | "x":157, 262 | "y":175 263 | }, 264 | { 265 | "res":"9E191E24", 266 | "x":157, 267 | "y":173 268 | }, 269 | { 270 | "res":"F31B77A3", 271 | "x":157, 272 | "y":163 273 | }, 274 | { 275 | "res":"48E19B3E", 276 | "x":157, 277 | "y":178 278 | }, 279 | { 280 | "res":"71330F59", 281 | "x":157, 282 | "y":189 283 | }, 284 | { 285 | "res":"DD65951B", 286 | "x":157, 287 | "y":141 288 | }, 289 | { 290 | "res":"5B6EB004", 291 | "x":157, 292 | "y":178 293 | }, 294 | { 295 | "res":"187A201F", 296 | "x":157, 297 | "y":174 298 | }, 299 | { 300 | "res":"4C5ACB42", 301 | "x":157, 302 | "y":176 303 | }, 304 | { 305 | "res":"DD95CBE5", 306 | "x":157, 307 | "y":185 308 | }, 309 | { 310 | "res":"4E4D48B0", 311 | "x":157, 312 | "y":189 313 | }, 314 | { 315 | "res":"314AEAB8", 316 | "x":157, 317 | "y":181 318 | }, 319 | { 320 | "res":"D755B73C", 321 | "x":157, 322 | "y":181 323 | }, 324 | { 325 | "res":"94104CAC", 326 | "x":147, 327 | "y":184 328 | }, 329 | { 330 | "res":"83FCEECC", 331 | "x":145, 332 | "y":187 333 | }, 334 | { 335 | "res":"A20CEF49", 336 | "x":155, 337 | "y":178 338 | }, 339 | { 340 | "res":"D45B3357", 341 | "x":156, 342 | "y":178 343 | }, 344 | { 345 | "res":"52459D9A", 346 | "x":137, 347 | "y":175 348 | }, 349 | { 350 | "res":"7CB8A7FD", 351 | "x":135, 352 | "y":179 353 | }, 354 | { 355 | "res":"63D5AF41", 356 | "x":148, 357 | "y":171 358 | }, 359 | { 360 | "res":"6D5574E2", 361 | "x":151, 362 | "y":171 363 | }, 364 | { 365 | "res":"A2F8B484", 366 | "x":152, 367 | "y":166 368 | }, 369 | { 370 | "res":"E23D8", 371 | "x":149, 372 | "y":170 373 | }, 374 | { 375 | "res":"1002B848", 376 | "x":157, 377 | "y":165 378 | }, 379 | { 380 | "res":"EA78A8EA", 381 | "x":157, 382 | "y":165 383 | }, 384 | { 385 | "res":"A132D680", 386 | "x":157, 387 | "y":162 388 | }, 389 | { 390 | "res":"874ADB61", 391 | "x":157, 392 | "y":167 393 | }, 394 | { 395 | "res":"32CFD86C", 396 | "x":157, 397 | "y":163 398 | }, 399 | { 400 | "res":"7C102F74", 401 | "x":157, 402 | "y":164 403 | }, 404 | { 405 | "res":"769A229B", 406 | "x":157, 407 | "y":188 408 | }, 409 | { 410 | "res":"91E32165", 411 | "x":127, 412 | "y":187 413 | }, 414 | { 415 | "res":"2A552101", 416 | "x":109, 417 | "y":185 418 | }, 419 | { 420 | "res":"5F23335", 421 | "x":132, 422 | "y":182 423 | }, 424 | { 425 | "res":"1178FAC9", 426 | "x":157, 427 | "y":177 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "76E9BD38":{"x":916,"y":437,"w":63,"h":58}, 433 | "FD59E61E":{"x":800,"y":438,"w":63,"h":57}, 434 | "1E0F6E66":{"x":489,"y":454,"w":63,"h":56}, 435 | "F4B0B307":{"x":735,"y":413,"w":63,"h":60}, 436 | "BB086038":{"x":589,"y":328,"w":79,"h":59}, 437 | "CA22CEFA":{"x":66,"y":282,"w":83,"h":59}, 438 | "967CFDF9":{"x":693,"y":296,"w":79,"h":60}, 439 | "443C6322":{"x":349,"y":329,"w":72,"h":64}, 440 | "39E34936":{"x":747,"y":1,"w":92,"h":67}, 441 | "4AA92C4E":{"x":478,"y":73,"w":96,"h":63}, 442 | "5E6AE64E":{"x":478,"y":1,"w":91,"h":70}, 443 | "82A0B759":{"x":300,"y":65,"w":82,"h":74}, 444 | "7BD286B":{"x":653,"y":81,"w":75,"h":78}, 445 | "64C7C4F2":{"x":111,"y":119,"w":79,"h":73}, 446 | "B5B7233":{"x":946,"y":85,"w":75,"h":78}, 447 | "17C9A3B3":{"x":274,"y":141,"w":69,"h":83}, 448 | "AF9082E9":{"x":563,"y":230,"w":63,"h":82}, 449 | "D76D8360":{"x":154,"y":281,"w":63,"h":77}, 450 | "997F8A36":{"x":874,"y":227,"w":63,"h":83}, 451 | "2370E51D":{"x":89,"y":194,"w":63,"h":86}, 452 | "BA563E34":{"x":554,"y":459,"w":63,"h":55}, 453 | "15E91786":{"x":278,"y":465,"w":63,"h":48}, 454 | "D241B7F9":{"x":359,"y":429,"w":63,"h":59}, 455 | "176320B6":{"x":235,"y":1,"w":63,"h":117}, 456 | "59362FA7":{"x":555,"y":389,"w":63,"h":68}, 457 | "9C8842BF":{"x":294,"y":395,"w":63,"h":68}, 458 | "7C6CEC50":{"x":219,"y":226,"w":63,"h":83}, 459 | "92F6729C":{"x":66,"y":343,"w":79,"h":57}, 460 | "3A4FC795":{"x":870,"y":312,"w":91,"h":52}, 461 | "EFFA1D5B":{"x":349,"y":273,"w":92,"h":54}, 462 | "F4274C6B":{"x":87,"y":1,"w":72,"h":116}, 463 | "1A9BC8FD":{"x":517,"y":314,"w":70,"h":67}, 464 | "4B4FBB4":{"x":418,"y":203,"w":78,"h":68}, 465 | "DBE4AEFA":{"x":928,"y":1,"w":74,"h":82}, 466 | "2D82E2F7":{"x":571,"y":1,"w":92,"h":68}, 467 | "47804F04":{"x":1,"y":119,"w":108,"h":54}, 468 | "5FBB2CA7":{"x":835,"y":85,"w":109,"h":54}, 469 | "E9279869":{"x":1,"y":1,"w":84,"h":113}, 470 | "E3F07816":{"x":471,"y":138,"w":91,"h":63}, 471 | "A38BA799":{"x":747,"y":70,"w":86,"h":70}, 472 | "D8C839AC":{"x":665,"y":1,"w":80,"h":78}, 473 | "FAEA5F31":{"x":576,"y":71,"w":75,"h":79}, 474 | "5CB56F67":{"x":1,"y":175,"w":86,"h":64}, 475 | "398884C9":{"x":781,"y":294,"w":87,"h":55}, 476 | "AD934760":{"x":161,"y":1,"w":72,"h":109}, 477 | "5BA82889":{"x":443,"y":289,"w":72,"h":67}, 478 | "66F04FC6":{"x":192,"y":120,"w":80,"h":72}, 479 | "9E191E24":{"x":730,"y":142,"w":77,"h":74}, 480 | "F31B77A3":{"x":809,"y":208,"w":63,"h":84}, 481 | "48E19B3E":{"x":916,"y":366,"w":63,"h":69}, 482 | "71330F59":{"x":620,"y":431,"w":63,"h":58}, 483 | "DD65951B":{"x":413,"y":1,"w":63,"h":106}, 484 | "5B6EB004":{"x":490,"y":383,"w":63,"h":69}, 485 | "187A201F":{"x":1,"y":325,"w":63,"h":73}, 486 | "4C5ACB42":{"x":670,"y":358,"w":63,"h":71}, 487 | "DD95CBE5":{"x":213,"y":405,"w":63,"h":62}, 488 | "4E4D48B0":{"x":131,"y":431,"w":63,"h":58}, 489 | "314AEAB8":{"x":1,"y":400,"w":63,"h":66}, 490 | "D755B73C":{"x":66,"y":402,"w":63,"h":66}, 491 | "94104CAC":{"x":219,"y":340,"w":73,"h":63}, 492 | "83FCEECC":{"x":774,"y":351,"w":75,"h":60}, 493 | "A20CEF49":{"x":423,"y":358,"w":65,"h":69}, 494 | "D45B3357":{"x":147,"y":360,"w":64,"h":69}, 495 | "52459D9A":{"x":841,"y":1,"w":85,"h":72}, 496 | "7CB8A7FD":{"x":384,"y":109,"w":85,"h":68}, 497 | "63D5AF41":{"x":564,"y":152,"w":74,"h":76}, 498 | "6D5574E2":{"x":710,"y":218,"w":69,"h":76}, 499 | "A2F8B484":{"x":640,"y":161,"w":68,"h":81}, 500 | "E23D8":{"x":345,"y":179,"w":71,"h":77}, 501 | "1002B848":{"x":1,"y":241,"w":63,"h":82}, 502 | "EA78A8EA":{"x":628,"y":244,"w":63,"h":82}, 503 | "A132D680":{"x":154,"y":194,"w":63,"h":85}, 504 | "874ADB61":{"x":284,"y":258,"w":63,"h":80}, 505 | "32CFD86C":{"x":498,"y":203,"w":63,"h":84}, 506 | "7C102F74":{"x":939,"y":227,"w":63,"h":83}, 507 | "769A229B":{"x":424,"y":429,"w":63,"h":59}, 508 | "91E32165":{"x":925,"y":165,"w":93,"h":60}, 509 | "2A552101":{"x":300,"y":1,"w":111,"h":62}, 510 | "5F23335":{"x":835,"y":141,"w":88,"h":65}, 511 | "1178FAC9":{"x":851,"y":366,"w":63,"h":70} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_2.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "926e1f30-e017-4e4e-8701-7921aed9e902", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_2.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_2.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "939c7783-35cd-4e59-9e92-b394eb76fa39", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1022, 12 | "height": 515, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_2": { 16 | "ver": "1.0.6", 17 | "uuid": "0b33638a-4e14-432d-97df-b957e18ef6df", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "939c7783-35cd-4e59-9e92-b394eb76fa39", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1020, 28 | "height": 513, 29 | "rawWidth": 1022, 30 | "rawHeight": 515, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_3.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"C0AF9854", 31 | "x":157, 32 | "y":173 33 | }, 34 | { 35 | "res":"BD4C0C6B", 36 | "x":157, 37 | "y":177 38 | }, 39 | { 40 | "res":"BB289DBC", 41 | "x":157, 42 | "y":173 43 | }, 44 | { 45 | "res":"76E7AE3C", 46 | "x":157, 47 | "y":170 48 | }, 49 | { 50 | "res":"2CD8F413", 51 | "x":157, 52 | "y":169 53 | }, 54 | { 55 | "res":"AE5E38FB", 56 | "x":157, 57 | "y":172 58 | }, 59 | { 60 | "res":"46189D05", 61 | "x":157, 62 | "y":169 63 | }, 64 | { 65 | "res":"8DD9A4B3", 66 | "x":157, 67 | "y":167 68 | }, 69 | { 70 | "res":"12A141E8", 71 | "x":157, 72 | "y":165 73 | }, 74 | { 75 | "res":"8B42D7D4", 76 | "x":157, 77 | "y":167 78 | }, 79 | { 80 | "res":"A76C3428", 81 | "x":157, 82 | "y":165 83 | }, 84 | { 85 | "res":"3E5E7B53", 86 | "x":157, 87 | "y":164 88 | }, 89 | { 90 | "res":"EDB2D5CF", 91 | "x":157, 92 | "y":163 93 | }, 94 | { 95 | "res":"F2474632", 96 | "x":157, 97 | "y":165 98 | }, 99 | { 100 | "res":"7DB73E5", 101 | "x":157, 102 | "y":163 103 | }, 104 | { 105 | "res":"7AF68AAA", 106 | "x":157, 107 | "y":162 108 | }, 109 | { 110 | "res":"9F07D95A", 111 | "x":157, 112 | "y":164 113 | }, 114 | { 115 | "res":"C1E21F4E", 116 | "x":157, 117 | "y":167 118 | }, 119 | { 120 | "res":"F1E9DFD6", 121 | "x":157, 122 | "y":165 123 | }, 124 | { 125 | "res":"CB619144", 126 | "x":157, 127 | "y":164 128 | }, 129 | { 130 | "res":"AD318DAB", 131 | "x":157, 132 | "y":173 133 | }, 134 | { 135 | "res":"CD0D5C5D", 136 | "x":157, 137 | "y":167 138 | }, 139 | { 140 | "res":"90339F87", 141 | "x":157, 142 | "y":168 143 | }, 144 | { 145 | "res":"1920CB2B", 146 | "x":157, 147 | "y":146 148 | }, 149 | { 150 | "res":"3DB613A9", 151 | "x":157, 152 | "y":165 153 | }, 154 | { 155 | "res":"1C8084ED", 156 | "x":157, 157 | "y":159 158 | }, 159 | { 160 | "res":"F22E125A", 161 | "x":157, 162 | "y":166 163 | }, 164 | { 165 | "res":"DFEAE770", 166 | "x":157, 167 | "y":169 168 | }, 169 | { 170 | "res":"110D6D2", 171 | "x":157, 172 | "y":165 173 | }, 174 | { 175 | "res":"88E89991", 176 | "x":157, 177 | "y":166 178 | }, 179 | { 180 | "res":"BB6BBE9D", 181 | "x":157, 182 | "y":143 183 | }, 184 | { 185 | "res":"89C0175E", 186 | "x":157, 187 | "y":164 188 | }, 189 | { 190 | "res":"91235D2E", 191 | "x":157, 192 | "y":160 193 | }, 194 | { 195 | "res":"957F4629", 196 | "x":157, 197 | "y":169 198 | }, 199 | { 200 | "res":"BCC434E7", 201 | "x":157, 202 | "y":165 203 | }, 204 | { 205 | "res":"63F296E9", 206 | "x":157, 207 | "y":167 208 | }, 209 | { 210 | "res":"5AC0740E", 211 | "x":157, 212 | "y":169 213 | }, 214 | { 215 | "res":"1063B779", 216 | "x":157, 217 | "y":141 218 | }, 219 | { 220 | "res":"54388090", 221 | "x":157, 222 | "y":167 223 | }, 224 | { 225 | "res":"6034E75E", 226 | "x":157, 227 | "y":168 228 | }, 229 | { 230 | "res":"E7B4014D", 231 | "x":157, 232 | "y":178 233 | }, 234 | { 235 | "res":"A6DBA1F1", 236 | "x":157, 237 | "y":163 238 | }, 239 | { 240 | "res":"DAACDF0A", 241 | "x":157, 242 | "y":172 243 | }, 244 | { 245 | "res":"9843C5B9", 246 | "x":157, 247 | "y":174 248 | }, 249 | { 250 | "res":"60D35D53", 251 | "x":157, 252 | "y":140 253 | }, 254 | { 255 | "res":"84AD4A7E", 256 | "x":157, 257 | "y":172 258 | }, 259 | { 260 | "res":"8F30621A", 261 | "x":157, 262 | "y":178 263 | }, 264 | { 265 | "res":"7DB994F6", 266 | "x":157, 267 | "y":189 268 | }, 269 | { 270 | "res":"E4C80FAB", 271 | "x":157, 272 | "y":164 273 | }, 274 | { 275 | "res":"E9E63ED0", 276 | "x":157, 277 | "y":170 278 | }, 279 | { 280 | "res":"690EA32D", 281 | "x":157, 282 | "y":179 283 | }, 284 | { 285 | "res":"B325D89C", 286 | "x":157, 287 | "y":142 288 | }, 289 | { 290 | "res":"95506D1A", 291 | "x":157, 292 | "y":176 293 | }, 294 | { 295 | "res":"903C1A32", 296 | "x":157, 297 | "y":185 298 | }, 299 | { 300 | "res":"84B9888F", 301 | "x":157, 302 | "y":197 303 | }, 304 | { 305 | "res":"B6D912C", 306 | "x":157, 307 | "y":166 308 | }, 309 | { 310 | "res":"8E482BA5", 311 | "x":157, 312 | "y":166 313 | }, 314 | { 315 | "res":"5577E3ED", 316 | "x":157, 317 | "y":150 318 | }, 319 | { 320 | "res":"8D41FC01", 321 | "x":157, 322 | "y":152 323 | }, 324 | { 325 | "res":"F887DD2E", 326 | "x":157, 327 | "y":161 328 | }, 329 | { 330 | "res":"90401285", 331 | "x":157, 332 | "y":163 333 | }, 334 | { 335 | "res":"83F2992D", 336 | "x":157, 337 | "y":148 338 | }, 339 | { 340 | "res":"AD4C404D", 341 | "x":157, 342 | "y":152 343 | }, 344 | { 345 | "res":"86D2A91C", 346 | "x":157, 347 | "y":156 348 | }, 349 | { 350 | "res":"4E26FA16", 351 | "x":157, 352 | "y":160 353 | }, 354 | { 355 | "res":"99E959CF", 356 | "x":157, 357 | "y":149 358 | }, 359 | { 360 | "res":"904F247C", 361 | "x":157, 362 | "y":155 363 | }, 364 | { 365 | "res":"E8BBA760", 366 | "x":157, 367 | "y":153 368 | }, 369 | { 370 | "res":"8F769C9D", 371 | "x":157, 372 | "y":160 373 | }, 374 | { 375 | "res":"A18CD54D", 376 | "x":157, 377 | "y":151 378 | }, 379 | { 380 | "res":"DE29F9DF", 381 | "x":157, 382 | "y":160 383 | }, 384 | { 385 | "res":"BCC902D5", 386 | "x":157, 387 | "y":154 388 | }, 389 | { 390 | "res":"999BBEE6", 391 | "x":157, 392 | "y":162 393 | }, 394 | { 395 | "res":"82C59FAF", 396 | "x":157, 397 | "y":155 398 | }, 399 | { 400 | "res":"26ACF3C0", 401 | "x":157, 402 | "y":162 403 | }, 404 | { 405 | "res":"50E9FACB", 406 | "x":157, 407 | "y":183 408 | }, 409 | { 410 | "res":"7B7E0A8", 411 | "x":143, 412 | "y":178 413 | }, 414 | { 415 | "res":"BCF421AB", 416 | "x":132, 417 | "y":169 418 | }, 419 | { 420 | "res":"B3A8A8EB", 421 | "x":147, 422 | "y":162 423 | }, 424 | { 425 | "res":"D0AC1461", 426 | "x":157, 427 | "y":159 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "C0AF9854":{"x":456,"y":434,"w":63,"h":74}, 433 | "BD4C0C6B":{"x":685,"y":448,"w":63,"h":70}, 434 | "BB289DBC":{"x":66,"y":434,"w":63,"h":74}, 435 | "76E7AE3C":{"x":862,"y":427,"w":63,"h":77}, 436 | "2CD8F413":{"x":391,"y":369,"w":63,"h":78}, 437 | "AE5E38FB":{"x":555,"y":431,"w":63,"h":75}, 438 | "46189D05":{"x":261,"y":369,"w":63,"h":78}, 439 | "8DD9A4B3":{"x":660,"y":352,"w":63,"h":80}, 440 | "12A141E8":{"x":1,"y":285,"w":63,"h":82}, 441 | "8B42D7D4":{"x":490,"y":352,"w":63,"h":80}, 442 | "A76C3428":{"x":425,"y":285,"w":63,"h":82}, 443 | "3E5E7B53":{"x":602,"y":264,"w":63,"h":83}, 444 | "EDB2D5CF":{"x":267,"y":200,"w":63,"h":84}, 445 | "F2474632":{"x":196,"y":274,"w":63,"h":82}, 446 | "7DB73E5":{"x":1,"y":199,"w":63,"h":84}, 447 | "7AF68AAA":{"x":912,"y":180,"w":63,"h":85}, 448 | "9F07D95A":{"x":530,"y":267,"w":63,"h":83}, 449 | "C1E21F4E":{"x":66,"y":352,"w":63,"h":80}, 450 | "F1E9DFD6":{"x":732,"y":284,"w":63,"h":82}, 451 | "CB619144":{"x":131,"y":264,"w":63,"h":83}, 452 | "AD318DAB":{"x":131,"y":432,"w":63,"h":74}, 453 | "CD0D5C5D":{"x":595,"y":349,"w":63,"h":80}, 454 | "90339F87":{"x":797,"y":367,"w":63,"h":79}, 455 | "1920CB2B":{"x":782,"y":1,"w":63,"h":101}, 456 | "3DB613A9":{"x":66,"y":268,"w":63,"h":82}, 457 | "1C8084ED":{"x":1,"y":109,"w":63,"h":88}, 458 | "F22E125A":{"x":904,"y":344,"w":63,"h":81}, 459 | "DFEAE770":{"x":1,"y":369,"w":63,"h":78}, 460 | "110D6D2":{"x":839,"y":283,"w":63,"h":82}, 461 | "88E89991":{"x":131,"y":349,"w":63,"h":81}, 462 | "BB6BBE9D":{"x":496,"y":1,"w":64,"h":104}, 463 | "89C0175E":{"x":627,"y":179,"w":66,"h":83}, 464 | "91235D2E":{"x":252,"y":1,"w":78,"h":87}, 465 | "957F4629":{"x":72,"y":1,"w":88,"h":78}, 466 | "BCC434E7":{"x":667,"y":268,"w":63,"h":82}, 467 | "63F296E9":{"x":196,"y":358,"w":63,"h":80}, 468 | "5AC0740E":{"x":725,"y":368,"w":63,"h":78}, 469 | "1063B779":{"x":1,"y":1,"w":69,"h":106}, 470 | "54388090":{"x":912,"y":1,"w":78,"h":80}, 471 | "6034E75E":{"x":562,"y":1,"w":84,"h":79}, 472 | "E7B4014D":{"x":397,"y":1,"w":97,"h":69}, 473 | "A6DBA1F1":{"x":843,"y":197,"w":63,"h":84}, 474 | "DAACDF0A":{"x":927,"y":427,"w":63,"h":75}, 475 | "9843C5B9":{"x":620,"y":434,"w":63,"h":73}, 476 | "60D35D53":{"x":332,"y":1,"w":63,"h":107}, 477 | "84AD4A7E":{"x":908,"y":267,"w":69,"h":75}, 478 | "8F30621A":{"x":627,"y":108,"w":82,"h":69}, 479 | "7DB994F6":{"x":332,"y":248,"w":91,"h":58}, 480 | "E4C80FAB":{"x":465,"y":200,"w":63,"h":83}, 481 | "E9E63ED0":{"x":326,"y":391,"w":63,"h":77}, 482 | "690EA32D":{"x":750,"y":448,"w":63,"h":68}, 483 | "B325D89C":{"x":648,"y":1,"w":63,"h":105}, 484 | "95506D1A":{"x":196,"y":440,"w":63,"h":71}, 485 | "903C1A32":{"x":261,"y":449,"w":63,"h":62}, 486 | "84B9888F":{"x":391,"y":449,"w":63,"h":50}, 487 | "B6D912C":{"x":261,"y":286,"w":63,"h":81}, 488 | "8E482BA5":{"x":326,"y":308,"w":63,"h":81}, 489 | "5577E3ED":{"x":72,"y":81,"w":63,"h":97}, 490 | "8D41FC01":{"x":205,"y":90,"w":63,"h":95}, 491 | "F887DD2E":{"x":66,"y":180,"w":63,"h":86}, 492 | "90401285":{"x":774,"y":198,"w":63,"h":84}, 493 | "83F2992D":{"x":847,"y":1,"w":63,"h":99}, 494 | "AD4C404D":{"x":912,"y":83,"w":63,"h":95}, 495 | "86D2A91C":{"x":472,"y":107,"w":63,"h":91}, 496 | "4E26FA16":{"x":137,"y":175,"w":63,"h":87}, 497 | "99E959CF":{"x":713,"y":1,"w":67,"h":98}, 498 | "904F247C":{"x":137,"y":81,"w":66,"h":92}, 499 | "E8BBA760":{"x":713,"y":101,"w":63,"h":94}, 500 | "8F769C9D":{"x":400,"y":159,"w":63,"h":87}, 501 | "A18CD54D":{"x":562,"y":82,"w":63,"h":96}, 502 | "DE29F9DF":{"x":335,"y":159,"w":63,"h":87}, 503 | "BCC902D5":{"x":847,"y":102,"w":63,"h":93}, 504 | "999BBEE6":{"x":537,"y":180,"w":63,"h":85}, 505 | "82C59FAF":{"x":778,"y":104,"w":63,"h":92}, 506 | "26ACF3C0":{"x":202,"y":187,"w":63,"h":85}, 507 | "50E9FACB":{"x":1,"y":449,"w":63,"h":64}, 508 | "7B7E0A8":{"x":695,"y":197,"w":77,"h":69}, 509 | "BCF421AB":{"x":162,"y":1,"w":88,"h":78}, 510 | "B3A8A8EB":{"x":397,"y":72,"w":73,"h":85}, 511 | "D0AC1461":{"x":270,"y":110,"w":63,"h":88} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_3.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "19a979c0-45fd-46dc-b13a-f5ab88c6a2b2", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_3.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_3.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "a0ed1916-7a5b-4c23-a486-e54c49df5bbb", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 991, 12 | "height": 519, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_3": { 16 | "ver": "1.0.6", 17 | "uuid": "745b1c9a-7e5f-4886-a181-90cc879bf62f", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "a0ed1916-7a5b-4c23-a486-e54c49df5bbb", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 989, 28 | "height": 517, 29 | "rawWidth": 991, 30 | "rawHeight": 519, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_4.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"E8DE3C8", 31 | "x":157, 32 | "y":185 33 | }, 34 | { 35 | "res":"F2990071", 36 | "x":157, 37 | "y":184 38 | }, 39 | { 40 | "res":"C747E85F", 41 | "x":157, 42 | "y":184 43 | }, 44 | { 45 | "res":"5BFA1014", 46 | "x":157, 47 | "y":184 48 | }, 49 | { 50 | "res":"DEB35007", 51 | "x":157, 52 | "y":184 53 | }, 54 | { 55 | "res":"B2BBA4AB", 56 | "x":157, 57 | "y":184 58 | }, 59 | { 60 | "res":"B17B7C2E", 61 | "x":156, 62 | "y":183 63 | }, 64 | { 65 | "res":"9C560034", 66 | "x":157, 67 | "y":184 68 | }, 69 | { 70 | "res":"D1648F89", 71 | "x":157, 72 | "y":183 73 | }, 74 | { 75 | "res":"3F7F9ABE", 76 | "x":157, 77 | "y":182 78 | }, 79 | { 80 | "res":"8BEE9C2C", 81 | "x":157, 82 | "y":182 83 | }, 84 | { 85 | "res":"F5F45486", 86 | "x":157, 87 | "y":182 88 | }, 89 | { 90 | "res":"45E9B75B", 91 | "x":157, 92 | "y":182 93 | }, 94 | { 95 | "res":"70A1FACB", 96 | "x":157, 97 | "y":181 98 | }, 99 | { 100 | "res":"25A85B15", 101 | "x":157, 102 | "y":180 103 | }, 104 | { 105 | "res":"1BB058", 106 | "x":157, 107 | "y":181 108 | }, 109 | { 110 | "res":"DBDFC15A", 111 | "x":157, 112 | "y":182 113 | }, 114 | { 115 | "res":"AE511AFD", 116 | "x":157, 117 | "y":181 118 | }, 119 | { 120 | "res":"59660A13", 121 | "x":157, 122 | "y":180 123 | }, 124 | { 125 | "res":"EA27CCD1", 126 | "x":157, 127 | "y":181 128 | }, 129 | { 130 | "res":"3D5A8EB", 131 | "x":157, 132 | "y":183 133 | }, 134 | { 135 | "res":"B2F5B566", 136 | "x":157, 137 | "y":187 138 | }, 139 | { 140 | "res":"BE97242E", 141 | "x":157, 142 | "y":191 143 | }, 144 | { 145 | "res":"1723DD31", 146 | "x":157, 147 | "y":184 148 | }, 149 | { 150 | "res":"42ED8695", 151 | "x":157, 152 | "y":184 153 | }, 154 | { 155 | "res":"DE9623CA", 156 | "x":157, 157 | "y":183 158 | }, 159 | { 160 | "res":"2BD79BE5", 161 | "x":157, 162 | "y":183 163 | }, 164 | { 165 | "res":"6E896C4D", 166 | "x":156, 167 | "y":182 168 | }, 169 | { 170 | "res":"A17FBD46", 171 | "x":152, 172 | "y":185 173 | }, 174 | { 175 | "res":"11C0D30D", 176 | "x":146, 177 | "y":189 178 | }, 179 | { 180 | "res":"A67E63C1", 181 | "x":157, 182 | "y":185 183 | }, 184 | { 185 | "res":"9A60FA36", 186 | "x":157, 187 | "y":184 188 | }, 189 | { 190 | "res":"559561B3", 191 | "x":157, 192 | "y":183 193 | }, 194 | { 195 | "res":"A9FC213", 196 | "x":157, 197 | "y":183 198 | }, 199 | { 200 | "res":"9D68B4F3", 201 | "x":157, 202 | "y":181 203 | }, 204 | { 205 | "res":"170A449", 206 | "x":157, 207 | "y":182 208 | }, 209 | { 210 | "res":"9837F9B2", 211 | "x":148, 212 | "y":184 213 | }, 214 | { 215 | "res":"9D4C063C", 216 | "x":157, 217 | "y":186 218 | }, 219 | { 220 | "res":"80389C1", 221 | "x":157, 222 | "y":186 223 | }, 224 | { 225 | "res":"9FEBE219", 226 | "x":157, 227 | "y":184 228 | }, 229 | { 230 | "res":"4A014FC8", 231 | "x":157, 232 | "y":183 233 | }, 234 | { 235 | "res":"C90DC3B4", 236 | "x":157, 237 | "y":180 238 | }, 239 | { 240 | "res":"AE36B871", 241 | "x":150, 242 | "y":179 243 | }, 244 | { 245 | "res":"D05F62B", 246 | "x":141, 247 | "y":179 248 | }, 249 | { 250 | "res":"1CF96E1E", 251 | "x":157, 252 | "y":188 253 | }, 254 | { 255 | "res":"FF4D6C24", 256 | "x":157, 257 | "y":187 258 | }, 259 | { 260 | "res":"F6E8A9D7", 261 | "x":157, 262 | "y":186 263 | }, 264 | { 265 | "res":"65AD9EF9", 266 | "x":157, 267 | "y":183 268 | }, 269 | { 270 | "res":"1F83E1BB", 271 | "x":157, 272 | "y":180 273 | }, 274 | { 275 | "res":"BF5F72F5", 276 | "x":157, 277 | "y":178 278 | }, 279 | { 280 | "res":"5D695758", 281 | "x":157, 282 | "y":177 283 | }, 284 | { 285 | "res":"A0DD9CDA", 286 | "x":157, 287 | "y":189 288 | }, 289 | { 290 | "res":"9CF2D07F", 291 | "x":157, 292 | "y":189 293 | }, 294 | { 295 | "res":"CFC45F4D", 296 | "x":157, 297 | "y":187 298 | }, 299 | { 300 | "res":"1CE07DD3", 301 | "x":157, 302 | "y":184 303 | }, 304 | { 305 | "res":"E820EBAD", 306 | "x":156, 307 | "y":181 308 | }, 309 | { 310 | "res":"EA90F87", 311 | "x":156, 312 | "y":178 313 | }, 314 | { 315 | "res":"337A977B", 316 | "x":157, 317 | "y":179 318 | }, 319 | { 320 | "res":"395291E8", 321 | "x":157, 322 | "y":178 323 | }, 324 | { 325 | "res":"66E3FC3C", 326 | "x":157, 327 | "y":180 328 | }, 329 | { 330 | "res":"7F7C4580", 331 | "x":157, 332 | "y":177 333 | }, 334 | { 335 | "res":"B0ABF64C", 336 | "x":150, 337 | "y":178 338 | }, 339 | { 340 | "res":"CF01D41B", 341 | "x":157, 342 | "y":178 343 | }, 344 | { 345 | "res":"56D83F75", 346 | "x":157, 347 | "y":179 348 | }, 349 | { 350 | "res":"47A10A28", 351 | "x":157, 352 | "y":176 353 | }, 354 | { 355 | "res":"F296273F", 356 | "x":157, 357 | "y":175 358 | }, 359 | { 360 | "res":"83AC9C84", 361 | "x":157, 362 | "y":177 363 | }, 364 | { 365 | "res":"164D570C", 366 | "x":151, 367 | "y":178 368 | }, 369 | { 370 | "res":"CBC5ECA9", 371 | "x":157, 372 | "y":175 373 | }, 374 | { 375 | "res":"94472B25", 376 | "x":157, 377 | "y":174 378 | }, 379 | { 380 | "res":"959475D2", 381 | "x":157, 382 | "y":176 383 | }, 384 | { 385 | "res":"21EB12CB", 386 | "x":157, 387 | "y":178 388 | }, 389 | { 390 | "res":"30AFF543", 391 | "x":157, 392 | "y":176 393 | }, 394 | { 395 | "res":"751141CE", 396 | "x":156, 397 | "y":174 398 | }, 399 | { 400 | "res":"96B22185", 401 | "x":156, 402 | "y":176 403 | }, 404 | { 405 | "res":"6650496", 406 | "x":157, 407 | "y":191 408 | }, 409 | { 410 | "res":"C2CAE157", 411 | "x":155, 412 | "y":190 413 | }, 414 | { 415 | "res":"84AE7869", 416 | "x":155, 417 | "y":186 418 | }, 419 | { 420 | "res":"68D3CE08", 421 | "x":156, 422 | "y":182 423 | }, 424 | { 425 | "res":"C8AC965E", 426 | "x":157, 427 | "y":182 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "E8DE3C8":{"x":135,"y":743,"w":66,"h":62}, 433 | "F2990071":{"x":407,"y":682,"w":66,"h":63}, 434 | "C747E85F":{"x":135,"y":678,"w":66,"h":63}, 435 | "5BFA1014":{"x":269,"y":678,"w":66,"h":63}, 436 | "DEB35007":{"x":203,"y":692,"w":64,"h":63}, 437 | "B2BBA4AB":{"x":404,"y":747,"w":64,"h":63}, 438 | "B17B7C2E":{"x":1,"y":625,"w":65,"h":64}, 439 | "9C560034":{"x":269,"y":743,"w":64,"h":63}, 440 | "D1648F89":{"x":68,"y":623,"w":65,"h":64}, 441 | "3F7F9ABE":{"x":1,"y":558,"w":65,"h":65}, 442 | "8BEE9C2C":{"x":406,"y":551,"w":65,"h":65}, 443 | "F5F45486":{"x":68,"y":556,"w":65,"h":65}, 444 | "45E9B75B":{"x":69,"y":489,"w":66,"h":65}, 445 | "70A1FACB":{"x":281,"y":431,"w":66,"h":66}, 446 | "25A85B15":{"x":1,"y":421,"w":66,"h":67}, 447 | "1BB058":{"x":69,"y":421,"w":66,"h":66}, 448 | "DBDFC15A":{"x":137,"y":545,"w":65,"h":65}, 449 | "AE511AFD":{"x":416,"y":483,"w":65,"h":66}, 450 | "59660A13":{"x":137,"y":476,"w":65,"h":67}, 451 | "EA27CCD1":{"x":204,"y":490,"w":65,"h":66}, 452 | "3D5A8EB":{"x":339,"y":618,"w":66,"h":64}, 453 | "B2F5B566":{"x":68,"y":754,"w":65,"h":60}, 454 | "BE97242E":{"x":135,"y":807,"w":67,"h":56}, 455 | "1723DD31":{"x":68,"y":689,"w":65,"h":63}, 456 | "42ED8695":{"x":1,"y":691,"w":65,"h":63}, 457 | "DE9623CA":{"x":135,"y":612,"w":66,"h":64}, 458 | "2BD79BE5":{"x":271,"y":612,"w":66,"h":64}, 459 | "6E896C4D":{"x":204,"y":558,"w":65,"h":65}, 460 | "A17FBD46":{"x":407,"y":618,"w":68,"h":62}, 461 | "11C0D30D":{"x":351,"y":414,"w":74,"h":60}, 462 | "A67E63C1":{"x":1,"y":135,"w":81,"h":62}, 463 | "9A60FA36":{"x":429,"y":75,"w":81,"h":63}, 464 | "559561B3":{"x":429,"y":140,"w":78,"h":64}, 465 | "A9FC213":{"x":138,"y":410,"w":70,"h":64}, 466 | "9D68B4F3":{"x":1,"y":490,"w":65,"h":66}, 467 | "170A449":{"x":448,"y":272,"w":63,"h":65}, 468 | "9837F9B2":{"x":210,"y":359,"w":72,"h":63}, 469 | "9D4C063C":{"x":1,"y":1,"w":92,"h":61}, 470 | "80389C1":{"x":95,"y":1,"w":92,"h":61}, 471 | "9FEBE219":{"x":189,"y":1,"w":87,"h":63}, 472 | "4A014FC8":{"x":383,"y":206,"w":75,"h":64}, 473 | "C90DC3B4":{"x":427,"y":414,"w":66,"h":67}, 474 | "AE36B871":{"x":309,"y":144,"w":72,"h":68}, 475 | "D05F62B":{"x":355,"y":1,"w":80,"h":68}, 476 | "1CF96E1E":{"x":157,"y":134,"w":78,"h":64}, 477 | "FF4D6C24":{"x":157,"y":66,"w":78,"h":66}, 478 | "F6E8A9D7":{"x":228,"y":222,"w":74,"h":64}, 479 | "65AD9EF9":{"x":210,"y":424,"w":69,"h":64}, 480 | "1F83E1BB":{"x":349,"y":476,"w":65,"h":67}, 481 | "BF5F72F5":{"x":284,"y":360,"w":65,"h":69}, 482 | "5D695758":{"x":1,"y":343,"w":65,"h":70}, 483 | "A0DD9CDA":{"x":372,"y":342,"w":65,"h":70}, 484 | "9CF2D07F":{"x":439,"y":342,"w":65,"h":70}, 485 | "CFC45F4D":{"x":271,"y":499,"w":65,"h":66}, 486 | "1CE07DD3":{"x":337,"y":684,"w":65,"h":63}, 487 | "E820EBAD":{"x":68,"y":353,"w":68,"h":66}, 488 | "EA90F87":{"x":141,"y":269,"w":68,"h":69}, 489 | "337A977B":{"x":141,"y":340,"w":67,"h":68}, 490 | "395291E8":{"x":71,"y":282,"w":68,"h":69}, 491 | "66E3FC3C":{"x":154,"y":200,"w":72,"h":67}, 492 | "7F7C4580":{"x":71,"y":210,"w":68,"h":70}, 493 | "B0ABF64C":{"x":80,"y":64,"w":75,"h":69}, 494 | "CF01D41B":{"x":1,"y":272,"w":68,"h":69}, 495 | "56D83F75":{"x":377,"y":272,"w":69,"h":68}, 496 | "47A10A28":{"x":1,"y":199,"w":68,"h":71}, 497 | "F296273F":{"x":237,"y":76,"w":70,"h":72}, 498 | "83AC9C84":{"x":237,"y":150,"w":69,"h":70}, 499 | "164D570C":{"x":1,"y":64,"w":77,"h":69}, 500 | "CBC5ECA9":{"x":437,"y":1,"w":72,"h":72}, 501 | "94472B25":{"x":278,"y":1,"w":75,"h":73}, 502 | "959475D2":{"x":355,"y":71,"w":72,"h":71}, 503 | "21EB12CB":{"x":211,"y":288,"w":67,"h":69}, 504 | "30AFF543":{"x":304,"y":287,"w":66,"h":71}, 505 | "751141CE":{"x":84,"y":135,"w":68,"h":73}, 506 | "96B22185":{"x":308,"y":214,"w":67,"h":71}, 507 | "6650496":{"x":204,"y":808,"w":65,"h":56}, 508 | "C2CAE157":{"x":1,"y":756,"w":65,"h":57}, 509 | "84AE7869":{"x":335,"y":749,"w":65,"h":61}, 510 | "68D3CE08":{"x":338,"y":545,"w":66,"h":65}, 511 | "C8AC965E":{"x":203,"y":625,"w":64,"h":65} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_4.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "0193e9eb-9ebc-4714-9110-dd23e4bacbc2", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_4.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_4.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "e970ec1f-d9ab-4ac3-b0b6-de030804b9d7", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 512, 12 | "height": 865, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_4": { 16 | "ver": "1.0.6", 17 | "uuid": "a64ee08e-4717-4e71-bef3-0f6e82f84c96", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "e970ec1f-d9ab-4ac3-b0b6-de030804b9d7", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 510, 28 | "height": 863, 29 | "rawWidth": 512, 30 | "rawHeight": 865, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_5.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"stand_0","frame":1,"end":4} 6 | ,{"name":"stand_1","frame":5,"end":8} 7 | ,{"name":"stand_2","frame":9,"end":12} 8 | ,{"name":"stand_3","frame":13,"end":16} 9 | ,{"name":"stand_4","frame":17,"end":20} 10 | ,{"name":"attack_0","frame":21,"end":27} 11 | ,{"name":"attack_1","frame":28,"end":34} 12 | ,{"name":"attack_2","frame":35,"end":41} 13 | ,{"name":"attack_3","frame":42,"end":48} 14 | ,{"name":"attack_4","frame":49,"end":55} 15 | ,{"name":"move_0","frame":56,"end":59} 16 | ,{"name":"move_1","frame":60,"end":63} 17 | ,{"name":"move_2","frame":64,"end":67} 18 | ,{"name":"move_3","frame":68,"end":71} 19 | ,{"name":"move_4","frame":72,"end":75} 20 | ,{"name":"attacked_0","frame":76,"end":76} 21 | ,{"name":"attacked_1","frame":77,"end":77} 22 | ,{"name":"attacked_2","frame":78,"end":78} 23 | ,{"name":"attacked_3","frame":79,"end":79} 24 | ,{"name":"attacked_4","frame":80,"end":80} 25 | 26 | ], 27 | "frames":[ 28 | 29 | { 30 | "res":"29AC216", 31 | "x":150, 32 | "y":122 33 | }, 34 | { 35 | "res":"277024C", 36 | "x":155, 37 | "y":115 38 | }, 39 | { 40 | "res":"8764CAF", 41 | "x":157, 42 | "y":115 43 | }, 44 | { 45 | "res":"F9A51FEC", 46 | "x":151, 47 | "y":122 48 | }, 49 | { 50 | "res":"A1C3971E", 51 | "x":139, 52 | "y":120 53 | }, 54 | { 55 | "res":"DD265ED4", 56 | "x":151, 57 | "y":113 58 | }, 59 | { 60 | "res":"FB4C826F", 61 | "x":157, 62 | "y":111 63 | }, 64 | { 65 | "res":"DF9528C7", 66 | "x":155, 67 | "y":119 68 | }, 69 | { 70 | "res":"93787592", 71 | "x":151, 72 | "y":120 73 | }, 74 | { 75 | "res":"7CA85265", 76 | "x":154, 77 | "y":113 78 | }, 79 | { 80 | "res":"2555231E", 81 | "x":153, 82 | "y":110 83 | }, 84 | { 85 | "res":"E762722", 86 | "x":150, 87 | "y":116 88 | }, 89 | { 90 | "res":"8185C693", 91 | "x":140, 92 | "y":121 93 | }, 94 | { 95 | "res":"555A33EE", 96 | "x":142, 97 | "y":116 98 | }, 99 | { 100 | "res":"B0031026", 101 | "x":157, 102 | "y":112 103 | }, 104 | { 105 | "res":"74BFADE8", 106 | "x":157, 107 | "y":117 108 | }, 109 | { 110 | "res":"4BCC2767", 111 | "x":154, 112 | "y":125 113 | }, 114 | { 115 | "res":"8CA43527", 116 | "x":153, 117 | "y":120 118 | }, 119 | { 120 | "res":"1C34D1DB", 121 | "x":157, 122 | "y":115 123 | }, 124 | { 125 | "res":"EEE24E4F", 126 | "x":155, 127 | "y":121 128 | }, 129 | { 130 | "res":"BAB0C2A6", 131 | "x":157, 132 | "y":118 133 | }, 134 | { 135 | "res":"C86EC1A8", 136 | "x":144, 137 | "y":118 138 | }, 139 | { 140 | "res":"E0CC9B48", 141 | "x":157, 142 | "y":114 143 | }, 144 | { 145 | "res":"FFFC27E5", 146 | "x":151, 147 | "y":117 148 | }, 149 | { 150 | "res":"54674DB9", 151 | "x":157, 152 | "y":119 153 | }, 154 | { 155 | "res":"3E5ACD74", 156 | "x":157, 157 | "y":118 158 | }, 159 | { 160 | "res":"4A433E1E", 161 | "x":148, 162 | "y":120 163 | }, 164 | { 165 | "res":"1DAD3712", 166 | "x":154, 167 | "y":115 168 | }, 169 | { 170 | "res":"9EA12057", 171 | "x":135, 172 | "y":117 173 | }, 174 | { 175 | "res":"2C9DCA69", 176 | "x":157, 177 | "y":114 178 | }, 179 | { 180 | "res":"F74F28C3", 181 | "x":133, 182 | "y":111 183 | }, 184 | { 185 | "res":"E41D1BA7", 186 | "x":157, 187 | "y":118 188 | }, 189 | { 190 | "res":"9ADEFEBA", 191 | "x":157, 192 | "y":118 193 | }, 194 | { 195 | "res":"857C68F0", 196 | "x":157, 197 | "y":119 198 | }, 199 | { 200 | "res":"AD160DB0", 201 | "x":152, 202 | "y":110 203 | }, 204 | { 205 | "res":"5B3A3A58", 206 | "x":152, 207 | "y":119 208 | }, 209 | { 210 | "res":"8468D4FB", 211 | "x":153, 212 | "y":111 213 | }, 214 | { 215 | "res":"EAABF516", 216 | "x":134, 217 | "y":103 218 | }, 219 | { 220 | "res":"97AEAF26", 221 | "x":157, 222 | "y":121 223 | }, 224 | { 225 | "res":"2337555A", 226 | "x":157, 227 | "y":121 228 | }, 229 | { 230 | "res":"B87A5237", 231 | "x":157, 232 | "y":121 233 | }, 234 | { 235 | "res":"3C13BE31", 236 | "x":155, 237 | "y":108 238 | }, 239 | { 240 | "res":"89225794", 241 | "x":133, 242 | "y":123 243 | }, 244 | { 245 | "res":"B42CD864", 246 | "x":157, 247 | "y":111 248 | }, 249 | { 250 | "res":"BF467571", 251 | "x":139, 252 | "y":97 253 | }, 254 | { 255 | "res":"38A8D3B7", 256 | "x":157, 257 | "y":127 258 | }, 259 | { 260 | "res":"FD9962F", 261 | "x":157, 262 | "y":127 263 | }, 264 | { 265 | "res":"543C8D6A", 266 | "x":157, 267 | "y":126 268 | }, 269 | { 270 | "res":"B883B04B", 271 | "x":157, 272 | "y":109 273 | }, 274 | { 275 | "res":"23585211", 276 | "x":142, 277 | "y":125 278 | }, 279 | { 280 | "res":"7ABA0E5D", 281 | "x":157, 282 | "y":112 283 | }, 284 | { 285 | "res":"8B067194", 286 | "x":154, 287 | "y":98 288 | }, 289 | { 290 | "res":"CC088757", 291 | "x":157, 292 | "y":133 293 | }, 294 | { 295 | "res":"A78BD6AA", 296 | "x":157, 297 | "y":132 298 | }, 299 | { 300 | "res":"A9F7E757", 301 | "x":147, 302 | "y":130 303 | }, 304 | { 305 | "res":"30C92568", 306 | "x":157, 307 | "y":123 308 | }, 309 | { 310 | "res":"4B2F6BF3", 311 | "x":154, 312 | "y":123 313 | }, 314 | { 315 | "res":"B24C98CB", 316 | "x":157, 317 | "y":119 318 | }, 319 | { 320 | "res":"AC4BF37B", 321 | "x":157, 322 | "y":127 323 | }, 324 | { 325 | "res":"AFDA22FA", 326 | "x":156, 327 | "y":119 328 | }, 329 | { 330 | "res":"A124F707", 331 | "x":151, 332 | "y":121 333 | }, 334 | { 335 | "res":"A33EE83E", 336 | "x":157, 337 | "y":118 338 | }, 339 | { 340 | "res":"A96F4F74", 341 | "x":157, 342 | "y":124 343 | }, 344 | { 345 | "res":"63037956", 346 | "x":152, 347 | "y":115 348 | }, 349 | { 350 | "res":"5E05985D", 351 | "x":156, 352 | "y":124 353 | }, 354 | { 355 | "res":"D19095DD", 356 | "x":157, 357 | "y":120 358 | }, 359 | { 360 | "res":"9403C79B", 361 | "x":152, 362 | "y":124 363 | }, 364 | { 365 | "res":"E037EE4F", 366 | "x":157, 367 | "y":113 368 | }, 369 | { 370 | "res":"40742DD5", 371 | "x":145, 372 | "y":130 373 | }, 374 | { 375 | "res":"CD8647A0", 376 | "x":157, 377 | "y":125 378 | }, 379 | { 380 | "res":"F459683C", 381 | "x":157, 382 | "y":128 383 | }, 384 | { 385 | "res":"EED67B29", 386 | "x":157, 387 | "y":115 388 | }, 389 | { 390 | "res":"10674DCF", 391 | "x":149, 392 | "y":135 393 | }, 394 | { 395 | "res":"E861274D", 396 | "x":157, 397 | "y":130 398 | }, 399 | { 400 | "res":"2A810361", 401 | "x":157, 402 | "y":133 403 | }, 404 | { 405 | "res":"38ECB5F9", 406 | "x":157, 407 | "y":117 408 | }, 409 | { 410 | "res":"3FBA9B9A", 411 | "x":157, 412 | "y":115 413 | }, 414 | { 415 | "res":"BFFD907C", 416 | "x":153, 417 | "y":113 418 | }, 419 | { 420 | "res":"D24CB32C", 421 | "x":157, 422 | "y":113 423 | }, 424 | { 425 | "res":"EAC70CEC", 426 | "x":157, 427 | "y":115 428 | } 429 | ] 430 | }}, 431 | "res":{ 432 | "29AC216":{"x":80,"y":251,"w":77,"h":125}, 433 | "277024C":{"x":267,"y":153,"w":73,"h":132}, 434 | "8764CAF":{"x":349,"y":627,"w":63,"h":132}, 435 | "F9A51FEC":{"x":159,"y":262,"w":74,"h":125}, 436 | "A1C3971E":{"x":805,"y":127,"w":81,"h":127}, 437 | "DD265ED4":{"x":525,"y":257,"w":69,"h":134}, 438 | "FB4C826F":{"x":959,"y":252,"w":63,"h":136}, 439 | "DF9528C7":{"x":595,"y":547,"w":65,"h":128}, 440 | "93787592":{"x":563,"y":404,"w":69,"h":127}, 441 | "7CA85265":{"x":957,"y":391,"w":66,"h":134}, 442 | "2555231E":{"x":596,"y":265,"w":67,"h":137}, 443 | "E762722":{"x":342,"y":269,"w":70,"h":131}, 444 | "8185C693":{"x":541,"y":129,"w":80,"h":126}, 445 | "555A33EE":{"x":187,"y":129,"w":78,"h":131}, 446 | "B0031026":{"x":460,"y":515,"w":63,"h":135}, 447 | "74BFADE8":{"x":414,"y":652,"w":63,"h":130}, 448 | "4BCC2767":{"x":806,"y":379,"w":74,"h":122}, 449 | "8CA43527":{"x":665,"y":278,"w":72,"h":127}, 450 | "1C34D1DB":{"x":764,"y":631,"w":63,"h":132}, 451 | "EEE24E4F":{"x":449,"y":256,"w":74,"h":126}, 452 | "BAB0C2A6":{"x":131,"y":660,"w":63,"h":129}, 453 | "C86EC1A8":{"x":89,"y":1,"w":96,"h":129}, 454 | "E0CC9B48":{"x":942,"y":527,"w":63,"h":133}, 455 | "FFFC27E5":{"x":623,"y":133,"w":77,"h":130}, 456 | "54674DB9":{"x":894,"y":662,"w":63,"h":128}, 457 | "3E5ACD74":{"x":264,"y":657,"w":63,"h":129}, 458 | "4A433E1E":{"x":894,"y":1,"w":84,"h":127}, 459 | "1DAD3712":{"x":1,"y":406,"w":66,"h":132}, 460 | "9EA12057":{"x":643,"y":1,"w":85,"h":130}, 461 | "2C9DCA69":{"x":134,"y":525,"w":63,"h":133}, 462 | "F74F28C3":{"x":369,"y":1,"w":87,"h":136}, 463 | "E41D1BA7":{"x":1,"y":275,"w":71,"h":129}, 464 | "9ADEFEBA":{"x":458,"y":125,"w":81,"h":129}, 465 | "857C68F0":{"x":369,"y":139,"w":78,"h":128}, 466 | "AD160DB0":{"x":888,"y":252,"w":69,"h":137}, 467 | "5B3A3A58":{"x":214,"y":425,"w":68,"h":128}, 468 | "8468D4FB":{"x":235,"y":287,"w":67,"h":136}, 469 | "EAABF516":{"x":1,"y":1,"w":86,"h":144}, 470 | "97AEAF26":{"x":553,"y":1,"w":88,"h":126}, 471 | "2337555A":{"x":187,"y":1,"w":97,"h":126}, 472 | "B87A5237":{"x":1,"y":147,"w":77,"h":126}, 473 | "3C13BE31":{"x":739,"y":379,"w":65,"h":139}, 474 | "89225794":{"x":805,"y":1,"w":87,"h":124}, 475 | "B42CD864":{"x":69,"y":512,"w":63,"h":136}, 476 | "BF467571":{"x":286,"y":1,"w":81,"h":150}, 477 | "38A8D3B7":{"x":487,"y":393,"w":74,"h":120}, 478 | "FD9962F":{"x":888,"y":130,"w":84,"h":120}, 479 | "543C8D6A":{"x":782,"y":256,"w":77,"h":121}, 480 | "B883B04B":{"x":634,"y":407,"w":63,"h":138}, 481 | "23585211":{"x":458,"y":1,"w":93,"h":122}, 482 | "7ABA0E5D":{"x":877,"y":516,"w":63,"h":135}, 483 | "8B067194":{"x":730,"y":1,"w":73,"h":149}, 484 | "CC088757":{"x":609,"y":786,"w":63,"h":114}, 485 | "A78BD6AA":{"x":394,"y":784,"w":63,"h":115}, 486 | "A9F7E757":{"x":89,"y":132,"w":86,"h":117}, 487 | "30C92568":{"x":1,"y":674,"w":63,"h":124}, 488 | "4B2F6BF3":{"x":702,"y":152,"w":78,"h":124}, 489 | "B24C98CB":{"x":959,"y":662,"w":63,"h":128}, 490 | "AC4BF37B":{"x":329,"y":761,"w":63,"h":120}, 491 | "AFDA22FA":{"x":662,"y":656,"w":64,"h":128}, 492 | "A124F707":{"x":806,"y":503,"w":69,"h":126}, 493 | "A33EE83E":{"x":479,"y":658,"w":63,"h":129}, 494 | "A96F4F74":{"x":544,"y":677,"w":63,"h":123}, 495 | "63037956":{"x":74,"y":378,"w":69,"h":132}, 496 | "5E05985D":{"x":525,"y":533,"w":68,"h":123}, 497 | "D19095DD":{"x":414,"y":384,"w":71,"h":127}, 498 | "9403C79B":{"x":882,"y":391,"w":73,"h":123}, 499 | "E037EE4F":{"x":699,"y":520,"w":63,"h":134}, 500 | "40742DD5":{"x":304,"y":402,"w":75,"h":117}, 501 | "CD8647A0":{"x":196,"y":689,"w":63,"h":122}, 502 | "F459683C":{"x":728,"y":765,"w":63,"h":119}, 503 | "EED67B29":{"x":1,"y":540,"w":63,"h":132}, 504 | "10674DCF":{"x":381,"y":513,"w":77,"h":112}, 505 | "E861274D":{"x":66,"y":784,"w":63,"h":117}, 506 | "2A810361":{"x":793,"y":785,"w":63,"h":114}, 507 | "38ECB5F9":{"x":829,"y":653,"w":63,"h":130}, 508 | "3FBA9B9A":{"x":199,"y":555,"w":63,"h":132}, 509 | "BFFD907C":{"x":145,"y":389,"w":67,"h":134}, 510 | "D24CB32C":{"x":284,"y":521,"w":63,"h":134}, 511 | "EAC70CEC":{"x":66,"y":650,"w":63,"h":132} 512 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_5.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "a485f5bf-03f4-420c-8967-3002e16655f4", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_5.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_5.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "117236ce-294a-4499-bacf-150e65f99dfb", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1024, 12 | "height": 902, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_5": { 16 | "ver": "1.0.6", 17 | "uuid": "8fddbc59-31b0-4a3f-9e40-64cdcf94826a", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "117236ce-294a-4499-bacf-150e65f99dfb", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1022, 28 | "height": 900, 29 | "rawWidth": 1024, 30 | "rawHeight": 902, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_6.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "a58e0ad5-7076-4bb7-a392-1ed6e6959658", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_6.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_6.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "a284f28d-58ac-45d5-905a-2e8d556560dc", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 2043, 12 | "height": 1091, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_6": { 16 | "ver": "1.0.6", 17 | "uuid": "7bb0bcdb-1f62-4e93-b03c-313c4a0454bd", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "a284f28d-58ac-45d5-905a-2e8d556560dc", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 2041, 28 | "height": 1089, 29 | "rawWidth": 2043, 30 | "rawHeight": 1091, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_7.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "19d1af2e-ef1d-40fe-be46-c609abf6bacf", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_7.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_7.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "cf383b84-e98a-4a5d-806d-9518f7b45417", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1024, 12 | "height": 857, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_7": { 16 | "ver": "1.0.6", 17 | "uuid": "5641ebb5-8f14-4d9f-a43c-5f5a95b92893", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "cf383b84-e98a-4a5d-806d-9518f7b45417", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1022, 28 | "height": 855, 29 | "rawWidth": 1024, 30 | "rawHeight": 857, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_8.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "000bd9b9-72db-479c-87cf-f272a6786ad8", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_8.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_8.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "a8de576c-4750-48a4-bb4a-c321f93cce5f", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 2048, 12 | "height": 533, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_8": { 16 | "ver": "1.0.6", 17 | "uuid": "c48da71e-e67b-467a-af92-d85ca80ec3d1", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "a8de576c-4750-48a4-bb4a-c321f93cce5f", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 2046, 28 | "height": 531, 29 | "rawWidth": 2048, 30 | "rawHeight": 533, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_9.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "9bd15b9f-bb42-48ac-89a6-b4d889696dcf", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_9.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Iterator/monster_9.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "f53e4986-e9b8-49b3-bbee-634a5f72125a", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1023, 12 | "height": 1666, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "monster_9": { 16 | "ver": "1.0.6", 17 | "uuid": "6e58140e-ee39-4dbc-901f-c4aa58a3b597", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "f53e4986-e9b8-49b3-bbee-634a5f72125a", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1021, 28 | "height": 1664, 29 | "rawWidth": 1023, 30 | "rawHeight": 1666, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/State.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "01115be9-eba8-46a6-8715-3c0ab357df30", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/State/scenePlayer_0.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "19d7852a-baa9-41d6-b532-fa08c3a43bf2", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/State/scenePlayer_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/State/scenePlayer_0.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/State/scenePlayer_0.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "f467fb7f-6665-418d-ae88-c682c166507f", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1406, 12 | "height": 1024, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "scenePlayer_0": { 16 | "ver": "1.0.6", 17 | "uuid": "75cbbb5c-56f5-4541-9be9-8978aec4d588", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "f467fb7f-6665-418d-ae88-c682c166507f", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": 0, 24 | "offsetY": 0, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1404, 28 | "height": 1022, 29 | "rawWidth": 1406, 30 | "rawHeight": 1024, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.3", 3 | "uuid": "c835b3bb-a0e3-4fec-b2bb-40192f6672a9", 4 | "importer": "folder", 5 | "isBundle": false, 6 | "bundleName": "", 7 | "priority": 1, 8 | "compressionType": {}, 9 | "optimizeHotUpdate": {}, 10 | "inlineSpriteFrames": {}, 11 | "isRemoteBundle": {}, 12 | "subMetas": {} 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_0_attack.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"attack_0","frame":1,"end":5} 6 | ,{"name":"attack_1","frame":6,"end":10} 7 | ,{"name":"attack_2","frame":11,"end":15} 8 | ,{"name":"attack_3","frame":16,"end":20} 9 | ,{"name":"attack_4","frame":21,"end":25} 10 | 11 | ], 12 | "events":[ 13 | 14 | ], 15 | "frames":[ 16 | 17 | { 18 | "res":"0_png", 19 | "x":243, 20 | "y":166 21 | }, 22 | { 23 | "res":"1_png", 24 | "x":254, 25 | "y":174 26 | }, 27 | { 28 | "res":"2_png", 29 | "x":235, 30 | "y":186 31 | }, 32 | { 33 | "res":"3_png", 34 | "x":254, 35 | "y":109 36 | }, 37 | { 38 | "res":"4_png", 39 | "x":225, 40 | "y":32 41 | }, 42 | { 43 | "res":"0_png", 44 | "x":253, 45 | "y":156 46 | }, 47 | { 48 | "res":"1_png", 49 | "x":182, 50 | "y":167 51 | }, 52 | { 53 | "res":"2_png", 54 | "x":168, 55 | "y":176 56 | }, 57 | { 58 | "res":"3_png", 59 | "x":182, 60 | "y":132 61 | }, 62 | { 63 | "res":"4_png", 64 | "x":239, 65 | "y":1 66 | }, 67 | { 68 | "res":"0_png", 69 | "x":235, 70 | "y":152 71 | }, 72 | { 73 | "res":"1_png", 74 | "x":124, 75 | "y":156 76 | }, 77 | { 78 | "res":"2_png", 79 | "x":128, 80 | "y":147 81 | }, 82 | { 83 | "res":"3_png", 84 | "x":146, 85 | "y":158 86 | }, 87 | { 88 | "res":"4_png", 89 | "x":197, 90 | "y":14 91 | }, 92 | { 93 | "res":"0_png", 94 | "x":194, 95 | "y":156 96 | }, 97 | { 98 | "res":"1_png", 99 | "x":135, 100 | "y":97 101 | }, 102 | { 103 | "res":"2_png", 104 | "x":152, 105 | "y":92 106 | }, 107 | { 108 | "res":"3_png", 109 | "x":173, 110 | "y":115 111 | }, 112 | { 113 | "res":"4_png", 114 | "x":200, 115 | "y":41 116 | }, 117 | { 118 | "res":"0_png", 119 | "x":198, 120 | "y":167 121 | }, 122 | { 123 | "res":"1_png", 124 | "x":183, 125 | "y":69 126 | }, 127 | { 128 | "res":"2_png", 129 | "x":203, 130 | "y":70 131 | }, 132 | { 133 | "res":"3_png", 134 | "x":181, 135 | "y":98 136 | }, 137 | { 138 | "res":"4_png", 139 | "x":163, 140 | "y":73 141 | } 142 | ] 143 | }}, 144 | "res":{ 145 | "3_png":{"x":189,"y":543,"w":134,"h":234}, 146 | "0_png":{"x":1,"y":840,"w":129,"h":69}, 147 | "1_png":{"x":869,"y":587,"w":134,"h":167}, 148 | "4_png":{"x":268,"y":292,"w":211,"h":249}, 149 | "2_png":{"x":513,"y":597,"w":134,"h":159} 150 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_0_attack.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "71fdb08c-ba99-4d07-914f-a61b3cf4899d", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_0_attack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_0_attack.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_0_attack.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "9089d644-f211-407d-8b60-ea39975496da", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1024, 12 | "height": 1024, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "scenePlayer_0_attack": { 16 | "ver": "1.0.6", 17 | "uuid": "e1b022c6-2c05-41a2-96c2-aaad75c5bb0c", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "9089d644-f211-407d-8b60-ea39975496da", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": -2.5, 24 | "offsetY": 57, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1017, 28 | "height": 908, 29 | "rawWidth": 1024, 30 | "rawHeight": 1024, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_1_attack.json: -------------------------------------------------------------------------------- 1 | {"mc":{ 2 | "data":{ 3 | "frameRate":24, 4 | "labels":[ 5 | {"name":"attack_0","frame":1,"end":5} 6 | ,{"name":"attack_1","frame":6,"end":10} 7 | ,{"name":"attack_2","frame":11,"end":15} 8 | ,{"name":"attack_3","frame":16,"end":20} 9 | ,{"name":"attack_4","frame":21,"end":25} 10 | 11 | ], 12 | "events":[ 13 | 14 | ], 15 | "frames":[ 16 | 17 | { 18 | "res":"0_png", 19 | "x":243, 20 | "y":166 21 | }, 22 | { 23 | "res":"1_png", 24 | "x":254, 25 | "y":174 26 | }, 27 | { 28 | "res":"2_png", 29 | "x":235, 30 | "y":186 31 | }, 32 | { 33 | "res":"3_png", 34 | "x":254, 35 | "y":109 36 | }, 37 | { 38 | "res":"4_png", 39 | "x":225, 40 | "y":32 41 | }, 42 | { 43 | "res":"0_png", 44 | "x":253, 45 | "y":156 46 | }, 47 | { 48 | "res":"1_png", 49 | "x":182, 50 | "y":167 51 | }, 52 | { 53 | "res":"2_png", 54 | "x":168, 55 | "y":176 56 | }, 57 | { 58 | "res":"3_png", 59 | "x":182, 60 | "y":132 61 | }, 62 | { 63 | "res":"4_png", 64 | "x":239, 65 | "y":1 66 | }, 67 | { 68 | "res":"0_png", 69 | "x":235, 70 | "y":152 71 | }, 72 | { 73 | "res":"1_png", 74 | "x":124, 75 | "y":156 76 | }, 77 | { 78 | "res":"2_png", 79 | "x":128, 80 | "y":147 81 | }, 82 | { 83 | "res":"3_png", 84 | "x":146, 85 | "y":158 86 | }, 87 | { 88 | "res":"4_png", 89 | "x":197, 90 | "y":14 91 | }, 92 | { 93 | "res":"0_png", 94 | "x":194, 95 | "y":156 96 | }, 97 | { 98 | "res":"1_png", 99 | "x":135, 100 | "y":97 101 | }, 102 | { 103 | "res":"2_png", 104 | "x":152, 105 | "y":92 106 | }, 107 | { 108 | "res":"3_png", 109 | "x":173, 110 | "y":115 111 | }, 112 | { 113 | "res":"4_png", 114 | "x":200, 115 | "y":41 116 | }, 117 | { 118 | "res":"0_png", 119 | "x":198, 120 | "y":167 121 | }, 122 | { 123 | "res":"1_png", 124 | "x":183, 125 | "y":69 126 | }, 127 | { 128 | "res":"2_png", 129 | "x":203, 130 | "y":70 131 | }, 132 | { 133 | "res":"3_png", 134 | "x":181, 135 | "y":98 136 | }, 137 | { 138 | "res":"4_png", 139 | "x":163, 140 | "y":73 141 | } 142 | ] 143 | }}, 144 | "res":{ 145 | "3_png":{"x":189,"y":543,"w":134,"h":234}, 146 | "0_png":{"x":1,"y":840,"w":129,"h":69}, 147 | "1_png":{"x":869,"y":587,"w":134,"h":167}, 148 | "4_png":{"x":268,"y":292,"w":211,"h":249}, 149 | "2_png":{"x":513,"y":597,"w":134,"h":159} 150 | }} -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_1_attack.json.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "9f7d75b9-fd76-4e7c-82cc-e3dd9c26db93", 4 | "importer": "json", 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_1_attack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_1_attack.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/assets/resources/Strategy/scenePlayer_1_attack.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.7", 3 | "uuid": "e43cd849-2f7a-4ba0-9c54-8471b2f576bd", 4 | "importer": "texture", 5 | "type": "sprite", 6 | "wrapMode": "clamp", 7 | "filterMode": "bilinear", 8 | "premultiplyAlpha": false, 9 | "genMipmaps": false, 10 | "packable": true, 11 | "width": 1024, 12 | "height": 1024, 13 | "platformSettings": {}, 14 | "subMetas": { 15 | "scenePlayer_1_attack": { 16 | "ver": "1.0.6", 17 | "uuid": "7ca5df6f-6e96-4e8a-85f2-e202e326589e", 18 | "importer": "sprite-frame", 19 | "rawTextureUuid": "e43cd849-2f7a-4ba0-9c54-8471b2f576bd", 20 | "trimType": "auto", 21 | "trimThreshold": 1, 22 | "rotated": false, 23 | "offsetX": -2.5, 24 | "offsetY": 57, 25 | "trimX": 1, 26 | "trimY": 1, 27 | "width": 1017, 28 | "height": 908, 29 | "rawWidth": 1024, 30 | "rawHeight": 1024, 31 | "borderTop": 0, 32 | "borderBottom": 0, 33 | "borderLeft": 0, 34 | "borderRight": 0, 35 | "subMetas": {} 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "library", 9 | "local", 10 | "settings", 11 | "temp" 12 | ] 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos2d-html5", 3 | "packages": "packages", 4 | "version": "2.4.11", 5 | "id": "c5628b4e-7068-48c3-875e-2af763444623", 6 | "isNew": false 7 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludeScenes": [], 3 | "orientation": { 4 | "landscapeLeft": true, 5 | "landscapeRight": true, 6 | "portrait": false, 7 | "upsideDown": false 8 | }, 9 | "packageName": "org.cocos2d.helloworld", 10 | "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 11 | "title": "hello_world", 12 | "webOrientation": "auto" 13 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/settings/builder.panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludeScenes": [], 3 | "packageName": "org.cocos2d.helloworld", 4 | "platform": "web-mobile", 5 | "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 6 | "title": "HelloWorld" 7 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "collision-matrix": [ 3 | [ 4 | true 5 | ] 6 | ], 7 | "excluded-modules": [ 8 | "3D Physics/cannon.js", 9 | "3D Physics/Builtin", 10 | "3D Particle", 11 | "SafeArea" 12 | ], 13 | "group-list": [ 14 | "default" 15 | ], 16 | "start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 17 | "design-resolution-width": 960, 18 | "design-resolution-height": 640, 19 | "fit-width": false, 20 | "fit-height": true, 21 | "use-project-simulator-setting": false, 22 | "simulator-orientation": false, 23 | "use-customize-simulator": false, 24 | "simulator-resolution": { 25 | "width": 960, 26 | "height": 640 27 | }, 28 | "last-module-event-record-time": 0, 29 | "assets-sort-type": "name", 30 | "facebook": { 31 | "enable": false, 32 | "appID": "", 33 | "live": { 34 | "enable": false 35 | }, 36 | "audience": { 37 | "enable": false 38 | } 39 | }, 40 | "migrate-history": [ 41 | "cloud-function" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/settings/services.json: -------------------------------------------------------------------------------- 1 | { 2 | "game": { 3 | "name": "未知游戏", 4 | "appid": "UNKNOW" 5 | } 6 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/template-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lswgit/YiyuanGameProgrammingPatterns/f983f831617048a6975db7bcc8a1aaf23904e4f9/YiyuanGameProgrammingPatterns/template-banner.png -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TEMPLATES.helloworld-ts.name", 3 | "desc": "TEMPLATES.helloworld-ts.desc", 4 | "banner": "template-banner.png" 5 | } -------------------------------------------------------------------------------- /YiyuanGameProgrammingPatterns/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "lib": [ "es2015", "es2017", "dom" ], 5 | "target": "es5", 6 | "experimentalDecorators": true, 7 | "skipLibCheck": true, 8 | "outDir": "temp/vscode-dist", 9 | "forceConsistentCasingInFileNames": true 10 | }, 11 | "exclude": [ 12 | "node_modules", 13 | "library", 14 | "local", 15 | "temp", 16 | "build", 17 | "settings" 18 | ] 19 | } --------------------------------------------------------------------------------