From bf30962e5d6655219d995e418b54e89fce56284f Mon Sep 17 00:00:00 2001 From: js Date: Thu, 11 May 2023 06:27:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../element/shoot/AbstractShootStrategyFactory.kt | 5 ----- .../element/shoot/ShootStrategyFactories.kt | 7 +++++++ .../element/shoot/enemy/EnemyShootStrategies.kt | 9 +++++++++ .../element/shoot/enemy/EnemyShootStrategy.kt | 15 --------------- .../element/shoot/hero/HeroShootStrategies.kt | 9 +++++++++ .../element/shoot/hero/HeroShootStrategy.kt | 9 --------- 6 files changed, 25 insertions(+), 29 deletions(-) delete mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/AbstractShootStrategyFactory.kt create mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/ShootStrategyFactories.kt create mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategies.kt delete mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategy.kt create mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategies.kt delete mode 100644 app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategy.kt diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/AbstractShootStrategyFactory.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/AbstractShootStrategyFactory.kt deleted file mode 100644 index b93b332..0000000 --- a/app/src/main/java/net/imshit/aircraftwar/element/shoot/AbstractShootStrategyFactory.kt +++ /dev/null @@ -1,5 +0,0 @@ -package net.imshit.aircraftwar.element.shoot - -abstract class AbstractShootStrategyFactory { - abstract fun getStrategy(shootNum: Int): ShootStrategy -} diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/ShootStrategyFactories.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/ShootStrategyFactories.kt new file mode 100644 index 0000000..25134d6 --- /dev/null +++ b/app/src/main/java/net/imshit/aircraftwar/element/shoot/ShootStrategyFactories.kt @@ -0,0 +1,7 @@ +package net.imshit.aircraftwar.element.shoot + +import net.imshit.aircraftwar.logic.Games + +abstract class ShootStrategyFactories(val game: Games) { + abstract fun getStrategy(shootNum: Int): ShootStrategies +} diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategies.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategies.kt new file mode 100644 index 0000000..8cf6776 --- /dev/null +++ b/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategies.kt @@ -0,0 +1,9 @@ +package net.imshit.aircraftwar.element.shoot.enemy + +import net.imshit.aircraftwar.element.bullet.EnemyBullet +import net.imshit.aircraftwar.element.shoot.ShootStrategies +import net.imshit.aircraftwar.logic.Games + +sealed class EnemyShootStrategies(game: Games) : ShootStrategies(game = game) { + abstract override fun shoot(x: Float, y: Float, speedY: Float, power: Int): List +} \ No newline at end of file diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategy.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategy.kt deleted file mode 100644 index ec7692f..0000000 --- a/app/src/main/java/net/imshit/aircraftwar/element/shoot/enemy/EnemyShootStrategy.kt +++ /dev/null @@ -1,15 +0,0 @@ -package net.imshit.aircraftwar.element.shoot.enemy - -import net.imshit.aircraftwar.element.bullet.EnemyBullet -import net.imshit.aircraftwar.element.shoot.ShootStrategy -import net.imshit.aircraftwar.logic.Games - -interface EnemyShootStrategy : ShootStrategy { - override fun shoot( - game: Games, - x: Float, - y: Float, - speedY: Float, - power: Int - ): List -} \ No newline at end of file diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategies.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategies.kt new file mode 100644 index 0000000..d9729ac --- /dev/null +++ b/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategies.kt @@ -0,0 +1,9 @@ +package net.imshit.aircraftwar.element.shoot.hero + +import net.imshit.aircraftwar.element.bullet.HeroBullet +import net.imshit.aircraftwar.element.shoot.ShootStrategies +import net.imshit.aircraftwar.logic.Games + +sealed class HeroShootStrategies(game: Games) : ShootStrategies(game = game) { + abstract override fun shoot(x: Float, y: Float, speedY: Float, power: Int): List +} \ No newline at end of file diff --git a/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategy.kt b/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategy.kt deleted file mode 100644 index bb03a9f..0000000 --- a/app/src/main/java/net/imshit/aircraftwar/element/shoot/hero/HeroShootStrategy.kt +++ /dev/null @@ -1,9 +0,0 @@ -package net.imshit.aircraftwar.element.shoot.hero - -import net.imshit.aircraftwar.element.bullet.HeroBullet -import net.imshit.aircraftwar.element.shoot.ShootStrategy -import net.imshit.aircraftwar.logic.Games - -interface HeroShootStrategy : ShootStrategy { - override fun shoot(game: Games, x: Float, y: Float, speedY: Float, power: Int): List -} \ No newline at end of file