From 91f64efc70353c80ba2fe0f0fbbe8993ef6b4e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=91=E8=87=A7=E6=8A=98=E6=9F=B3=E6=9B=B2?= <843391622@qq.com> Date: Fri, 27 Sep 2024 19:27:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(format):=20=E9=87=8D=E6=9E=84=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E7=BB=84=E4=BB=B6=E5=92=8C=E6=9C=8D=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/bag-item-view/bag-item-view.component.ts | 8 +++----- .../battle-modal/battle-modal.component.spec.ts | 2 +- src/app/components/battle-modal/battle-modal.component.ts | 4 ++-- .../components/init-modal/init-modal.component.spec.ts | 2 +- src/app/components/init-modal/init-modal.component.ts | 6 +++--- .../reward-item-view/reward-item-view.component.ts | 3 +-- src/app/layouts/character/character.component.ts | 5 ++--- src/app/layouts/header/header.component.ts | 7 +++---- src/app/layouts/sider/components/log/log.component.ts | 5 ++--- src/app/layouts/sider/components/task/task.component.ts | 5 ++--- src/app/pages/challenge/challenge.component.ts | 7 +++---- .../pages/home/components/backpack/backpack.component.ts | 5 ++--- src/app/pages/home/home.component.ts | 6 +++--- src/app/pages/shop/shop.component.ts | 5 ++--- src/app/pages/statistics/statistics.component.ts | 3 +-- src/app/pages/universe/universe.component.ts | 1 - src/app/services/backpack.service.ts | 1 - src/app/services/battle.service.spec.ts | 2 +- src/app/services/character.service.ts | 2 +- src/app/services/event.service.ts | 2 +- 20 files changed, 34 insertions(+), 47 deletions(-) diff --git a/src/app/components/bag-item-view/bag-item-view.component.ts b/src/app/components/bag-item-view/bag-item-view.component.ts index e37ee2f..c3bad62 100644 --- a/src/app/components/bag-item-view/bag-item-view.component.ts +++ b/src/app/components/bag-item-view/bag-item-view.component.ts @@ -1,14 +1,12 @@ import { CommonModule } from '@angular/common'; import { Component, inject, Input } from '@angular/core'; +import { LogType, LogLevel, EventType, ItemEventOperate, EventRes, BagItem, getItemLevelClass, ItemLevelMap, ItemMap } from '@models'; +import { BackpackService, EventService, LogService } from '@services'; +import { getItemSpan } from '@utils/html'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzCardModule } from 'ng-zorro-antd/card'; import { NzMessageModule, NzMessageService } from 'ng-zorro-antd/message'; import { NzPopoverModule } from 'ng-zorro-antd/popover'; - -import { LogType, LogLevel, EventType, ItemEventOperate, EventRes } from '@models'; -import { BagItem, getItemLevelClass, ItemLevelMap, ItemMap } from '@models'; -import { BackpackService, EventService, LogService } from '@services'; -import { getItemSpan } from '@utils/html'; import { of, switchMap } from 'rxjs'; @Component({ diff --git a/src/app/components/battle-modal/battle-modal.component.spec.ts b/src/app/components/battle-modal/battle-modal.component.spec.ts index e8a27f0..21e505e 100644 --- a/src/app/components/battle-modal/battle-modal.component.spec.ts +++ b/src/app/components/battle-modal/battle-modal.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { NzModalRefMock } from '@utils/test'; import { NzModalRef } from 'ng-zorro-antd/modal'; -import { NzModalRefMock } from '@utils/test'; import { BattleModalComponent } from './battle-modal.component'; describe('BattleModalComponent', () => { diff --git a/src/app/components/battle-modal/battle-modal.component.ts b/src/app/components/battle-modal/battle-modal.component.ts index dd0a51e..e212318 100644 --- a/src/app/components/battle-modal/battle-modal.component.ts +++ b/src/app/components/battle-modal/battle-modal.component.ts @@ -1,13 +1,13 @@ import { CommonModule } from '@angular/common'; import { Component, inject, Input, OnInit } from '@angular/core'; +import { BattleCharacter, BattleStatusInfo } from '@models'; +import { EnvService } from '@services'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { NzSpaceModule } from 'ng-zorro-antd/space'; import { BehaviorSubject, from, map, mergeMap, Subscription, timer } from 'rxjs'; -import { BattleCharacter, BattleStatusInfo } from '@models'; -import { EnvService } from '@services'; import { ProgressViewComponent } from '../progress-view/progress-view.component'; @Component({ diff --git a/src/app/components/init-modal/init-modal.component.spec.ts b/src/app/components/init-modal/init-modal.component.spec.ts index ea709e8..5a0ef6a 100644 --- a/src/app/components/init-modal/init-modal.component.spec.ts +++ b/src/app/components/init-modal/init-modal.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { NzModalRefMock } from '@utils/test'; import { NzModalRef } from 'ng-zorro-antd/modal'; -import { NzModalRefMock } from '@utils/test'; import { InitModalComponent } from './init-modal.component'; describe('InitModalComponent', () => { diff --git a/src/app/components/init-modal/init-modal.component.ts b/src/app/components/init-modal/init-modal.component.ts index 5d2578b..92986d3 100644 --- a/src/app/components/init-modal/init-modal.component.ts +++ b/src/app/components/init-modal/init-modal.component.ts @@ -1,13 +1,13 @@ import { CommonModule, KeyValuePipe } from '@angular/common'; import { Component, inject, OnInit } from '@angular/core'; +import { Env, InitCharacter } from '@models'; +import { EnvService } from '@services'; +import { Generate } from '@utils/generate'; import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { NzStepsModule } from 'ng-zorro-antd/steps'; import { NzTagModule } from 'ng-zorro-antd/tag'; -import { Env, InitCharacter } from '@models'; -import { EnvService } from '@services'; -import { Generate } from '@utils/generate'; import { LevelMapViewComponent } from '../level-map-view/level-map-view.component'; @Component({ diff --git a/src/app/components/reward-item-view/reward-item-view.component.ts b/src/app/components/reward-item-view/reward-item-view.component.ts index c2889e3..3c60fda 100644 --- a/src/app/components/reward-item-view/reward-item-view.component.ts +++ b/src/app/components/reward-item-view/reward-item-view.component.ts @@ -1,8 +1,7 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; -import { NzCardModule } from 'ng-zorro-antd/card'; - import { getItemLevelClass, Item, ItemLevelMap, ItemMap, RewardPool } from '@models'; +import { NzCardModule } from 'ng-zorro-antd/card'; @Component({ selector: 'app-reward-item-view', diff --git a/src/app/layouts/character/character.component.ts b/src/app/layouts/character/character.component.ts index 7dd0081..fcad810 100644 --- a/src/app/layouts/character/character.component.ts +++ b/src/app/layouts/character/character.component.ts @@ -1,12 +1,11 @@ import { Component, inject, OnInit } from '@angular/core'; +import { ProgressViewComponent } from '@components/progress-view/progress-view.component'; +import { CharacterService, EnvService, TimeTickService } from '@services'; import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions'; import { NzProgressModule } from 'ng-zorro-antd/progress'; import { NzTagModule } from 'ng-zorro-antd/tag'; import { NzTypographyModule } from 'ng-zorro-antd/typography'; -import { ProgressViewComponent } from '@components/progress-view/progress-view.component'; -import { CharacterService, EnvService, TimeTickService } from '@services'; - @Component({ selector: 'app-character', standalone: true, diff --git a/src/app/layouts/header/header.component.ts b/src/app/layouts/header/header.component.ts index ff89bef..6bf1693 100644 --- a/src/app/layouts/header/header.component.ts +++ b/src/app/layouts/header/header.component.ts @@ -1,14 +1,13 @@ import { KeyValuePipe } from '@angular/common'; import { Component, inject } from '@angular/core'; +import { LevelMapViewComponent } from '@components/level-map-view/level-map-view.component'; +import { TimeFormatPipe } from '@pipes/time-format.pipe'; +import { EnvService, CharacterService, TimeTickService, RuntimeService } from '@services'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions'; import { NzGridModule } from 'ng-zorro-antd/grid'; import { NzTagModule } from 'ng-zorro-antd/tag'; -import { LevelMapViewComponent } from '@components/level-map-view/level-map-view.component'; -import { TimeFormatPipe } from '@pipes/time-format.pipe'; -import { EnvService, CharacterService, TimeTickService, RuntimeService } from '@services'; - @Component({ selector: 'app-header', standalone: true, diff --git a/src/app/layouts/sider/components/log/log.component.ts b/src/app/layouts/sider/components/log/log.component.ts index 46139ac..4b67c67 100644 --- a/src/app/layouts/sider/components/log/log.component.ts +++ b/src/app/layouts/sider/components/log/log.component.ts @@ -1,9 +1,8 @@ import { Component, ElementRef, inject, ViewChild, OnInit } from '@angular/core'; -import { NzTimelineModule } from 'ng-zorro-antd/timeline'; -import { NzTypographyModule } from 'ng-zorro-antd/typography'; - import { LogTypeMap } from '@models'; import { LogService } from '@services'; +import { NzTimelineModule } from 'ng-zorro-antd/timeline'; +import { NzTypographyModule } from 'ng-zorro-antd/typography'; @Component({ selector: 'app-log', diff --git a/src/app/layouts/sider/components/task/task.component.ts b/src/app/layouts/sider/components/task/task.component.ts index 4f8812f..9714e88 100644 --- a/src/app/layouts/sider/components/task/task.component.ts +++ b/src/app/layouts/sider/components/task/task.component.ts @@ -1,11 +1,10 @@ import { Component, inject, OnInit } from '@angular/core'; +import { Task, ItemMap } from '@models'; +import { BackpackService, TaskService } from '@services'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzEmptyModule } from 'ng-zorro-antd/empty'; import { NzTypographyModule } from 'ng-zorro-antd/typography'; -import { Task, ItemMap } from '@models'; -import { BackpackService, TaskService } from '@services'; - @Component({ selector: 'app-task', standalone: true, diff --git a/src/app/pages/challenge/challenge.component.ts b/src/app/pages/challenge/challenge.component.ts index a353763..6c1f5b8 100644 --- a/src/app/pages/challenge/challenge.component.ts +++ b/src/app/pages/challenge/challenge.component.ts @@ -1,12 +1,11 @@ import { Component, inject } from '@angular/core'; import { Router } from '@angular/router'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzCardModule } from 'ng-zorro-antd/card'; -import { NzTagModule } from 'ng-zorro-antd/tag'; - import { RewardItemViewComponent } from '@components/reward-item-view/reward-item-view.component'; import { Challenge, RewardPoolMap } from '@models'; import { EnvService } from '@services'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzCardModule } from 'ng-zorro-antd/card'; +import { NzTagModule } from 'ng-zorro-antd/tag'; @Component({ selector: 'app-challenge', diff --git a/src/app/pages/home/components/backpack/backpack.component.ts b/src/app/pages/home/components/backpack/backpack.component.ts index 1fc5c8b..d3828bc 100644 --- a/src/app/pages/home/components/backpack/backpack.component.ts +++ b/src/app/pages/home/components/backpack/backpack.component.ts @@ -1,10 +1,9 @@ import { Component, inject } from '@angular/core'; -import { NzTabsModule } from 'ng-zorro-antd/tabs'; -import { NzTypographyModule } from 'ng-zorro-antd/typography'; - import { BagItemViewComponent } from '@components/bag-item-view/bag-item-view.component'; import { BagItem, ItemTypeMap, ItemTypeValueMap } from '@models'; import { BackpackService } from '@services'; +import { NzTabsModule } from 'ng-zorro-antd/tabs'; +import { NzTypographyModule } from 'ng-zorro-antd/typography'; @Component({ selector: 'app-backpack', diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 9ab21e4..7655820 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -1,13 +1,13 @@ import { Component, inject, OnInit } from '@angular/core'; +import { LogType, LogLevel, BattleCharacter, CharacterEventOperate, EventType, EventRes } from '@models'; +import { CharacterService, LogService, RuntimeService, BattleService, EnvService, BackpackService, EventService } from '@services'; +import { Generate } from '@utils/generate'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzDividerModule } from 'ng-zorro-antd/divider'; import { NzModalModule } from 'ng-zorro-antd/modal'; import { NzTypographyModule } from 'ng-zorro-antd/typography'; -import { LogType, LogLevel, BattleCharacter, CharacterEventOperate, EventType, EventRes } from '@models'; -import { Generate } from '@utils/generate'; import { BackpackComponent } from './components/backpack/backpack.component'; -import { CharacterService, LogService, RuntimeService, BattleService, EnvService, BackpackService, EventService } from '@services'; @Component({ selector: 'app-home', diff --git a/src/app/pages/shop/shop.component.ts b/src/app/pages/shop/shop.component.ts index e42ec30..f4efdd7 100644 --- a/src/app/pages/shop/shop.component.ts +++ b/src/app/pages/shop/shop.component.ts @@ -1,10 +1,9 @@ import { Component, inject, OnInit } from '@angular/core'; -import { NzEmptyModule } from 'ng-zorro-antd/empty'; -import { NzTypographyModule } from 'ng-zorro-antd/typography'; - import { BagItemViewComponent } from '@components/bag-item-view/bag-item-view.component'; import { BagItem, ItemMap } from '@models'; import { TimeTickService } from '@services'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzTypographyModule } from 'ng-zorro-antd/typography'; @Component({ selector: 'app-shop', diff --git a/src/app/pages/statistics/statistics.component.ts b/src/app/pages/statistics/statistics.component.ts index c1c0f69..32ba8b5 100644 --- a/src/app/pages/statistics/statistics.component.ts +++ b/src/app/pages/statistics/statistics.component.ts @@ -1,9 +1,8 @@ import { Component, inject } from '@angular/core'; +import { StatisticsService } from '@storages/statistics.service'; import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions'; import { NzTypographyModule } from 'ng-zorro-antd/typography'; -import { StatisticsService } from '@storages/statistics.service'; - @Component({ selector: 'app-statistics', standalone: true, diff --git a/src/app/pages/universe/universe.component.ts b/src/app/pages/universe/universe.component.ts index 68214e8..9cc3382 100644 --- a/src/app/pages/universe/universe.component.ts +++ b/src/app/pages/universe/universe.component.ts @@ -1,6 +1,5 @@ import { Component, inject, OnInit } from '@angular/core'; import { Graph } from '@antv/g6'; - import { EnvService } from '@services'; @Component({ diff --git a/src/app/services/backpack.service.ts b/src/app/services/backpack.service.ts index 20cc0bd..bdce1df 100644 --- a/src/app/services/backpack.service.ts +++ b/src/app/services/backpack.service.ts @@ -1,5 +1,4 @@ import { inject, Injectable } from '@angular/core'; - import { Effect, EffectType, diff --git a/src/app/services/battle.service.spec.ts b/src/app/services/battle.service.spec.ts index 43fcbde..20690a9 100644 --- a/src/app/services/battle.service.spec.ts +++ b/src/app/services/battle.service.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; +import { NzModalService } from 'ng-zorro-antd/modal'; import { BattleService } from './battle.service'; -import { NzModalService } from 'ng-zorro-antd/modal'; describe('BattleService', () => { let service: BattleService; diff --git a/src/app/services/character.service.ts b/src/app/services/character.service.ts index ee178f0..21b067a 100644 --- a/src/app/services/character.service.ts +++ b/src/app/services/character.service.ts @@ -1,4 +1,5 @@ import { inject, Injectable } from '@angular/core'; +import { delay, Observable, of } from 'rxjs'; import { BaseInfo, Character, LogLevel, LogType, SkillInfo, StatusInfo, LevelInfo, AttrInfo } from '../models'; import { CharacterEventOperate, Event, EventRes } from '../models/event.model'; @@ -7,7 +8,6 @@ import { EnvService } from './env.service'; import { LogService } from './log.service'; import { RuntimeService } from './runtime.service'; import { TimeTickService } from './time-tick.service'; -import { delay, Observable, of } from 'rxjs'; @Injectable({ providedIn: 'root' diff --git a/src/app/services/event.service.ts b/src/app/services/event.service.ts index e259191..441e31f 100644 --- a/src/app/services/event.service.ts +++ b/src/app/services/event.service.ts @@ -2,9 +2,9 @@ import { inject, Injectable } from '@angular/core'; import { Observable, of, Subject } from 'rxjs'; import { Event, EventRes, EventType } from '../models/event.model'; +import { BackpackService } from './backpack.service'; import { CharacterService } from './character.service'; import { TaskService } from './task.service'; -import { BackpackService } from './backpack.service'; @Injectable({ providedIn: 'root'