Skip to content

Commit 75f0b53

Browse files
committed
add IndexCarSystem
1 parent bd4aab3 commit 75f0b53

File tree

10 files changed

+58
-24
lines changed

10 files changed

+58
-24
lines changed

CrazyCar/Assets/Scripts/Common/IndexCar.cs

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

CrazyCar/Assets/Scripts/Framework/Command/ChangeCarCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public ChangeCarCommand(EquipInfo equipInfo) {
77
}
88

99
protected override void OnExecute() {
10-
IndexCar.manager.mPlayerStyle.ChangeEquip(EquipType.Car, mEquipInfo.eid, mEquipInfo.rid);
10+
this.GetSystem<IIndexCarSystem>().MPlayerStyle.ChangeEquip(EquipType.Car, mEquipInfo.eid, mEquipInfo.rid);
1111
this.SendEvent(new ChangeCarEvent(mEquipInfo));
1212
}
1313
}

CrazyCar/Assets/Scripts/Framework/CrazyCar.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ protected override void Init() {
99
RegisterSystem<IPlayerManagerSystem>(new PlayerManagerSystem());
1010
RegisterSystem<IWebSocketSystem>(new WebSocketSystem());
1111
RegisterSystem<IScreenEffectsSystem>(new ScreenEffectsSystem());
12+
RegisterSystem<IIndexCarSystem>(new IndexCarSystem());
1213
RegisterModel<IUserModel>(new UserModel());
1314
RegisterModel<IAvatarModel>(new AvatarModel());
1415
RegisterModel<ITimeTrialModel>(new TimeTrialModel());

CrazyCar/Assets/Scripts/Framework/Game/CarControl.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
using UnityEngine;
55
using UnityEngine.UI;
66
using UnityEngine.EventSystems;
7+
using TFramework;
78

8-
public class CarControl : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler {
9+
public class CarControl : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IController {
910
private Transform targetTransform;
1011
public bool isTouch;
1112
private void Start() {
12-
targetTransform = IndexCar.manager.carGO.transform;
13+
targetTransform = this.GetSystem<IIndexCarSystem>().CarGO.transform;
1314
}
1415

1516
// Update is called once per frame
@@ -44,4 +45,7 @@ public void OnPointerExit(PointerEventData eventData) {
4445
isTouch = false;
4546
}
4647

48+
public IArchitecture GetArchitecture() {
49+
return CrazyCar.Interface;
50+
}
4751
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
using TFramework;
6+
7+
public class IndexCar : MonoBehaviour, IController {
8+
public GameObject carGO;
9+
public MPlayerStyle mPlayerStyle;
10+
11+
private void Awake() {
12+
this.GetSystem<IIndexCarSystem>().MPlayerStyle = mPlayerStyle;
13+
this.GetSystem<IIndexCarSystem>().CarGO = carGO;
14+
}
15+
16+
public IArchitecture GetArchitecture() {
17+
return CrazyCar.Interface;
18+
}
19+
}

CrazyCar/Assets/Scripts/Framework/Game/ScreenEffectsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class ScreenEffectsManager : MonoBehaviour, IController {
77
public MotionBlurEffects motionBlurEffects;
88
public Projector wireframeProjector;
99

10-
private void Start() {
10+
private void Awake() {
1111
this.GetSystem<IScreenEffectsSystem>().MotionBlurEffects = motionBlurEffects;
1212
this.GetSystem<IScreenEffectsSystem>().WireframeProjector = wireframeProjector;
1313
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using TFramework;
5+
6+
public interface IIndexCarSystem : ISystem {
7+
GameObject CarGO { get; set; }
8+
MPlayerStyle MPlayerStyle { get; set; }
9+
}
10+
11+
public class IndexCarSystem : AbstractSystem, IIndexCarSystem {
12+
public GameObject CarGO { get; set; } = new GameObject();
13+
public MPlayerStyle MPlayerStyle { get; set; } = new MPlayerStyle();
14+
15+
protected override void OnInit() {
16+
17+
}
18+
}

CrazyCar/Assets/Scripts/Framework/System/IndexCarSystem.cs.meta

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

CrazyCar/Assets/Scripts/Framework/UI/Equipment/ChangeCarUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private void SetItemContent() {
4646

4747
curEquipInfo = this.GetModel<IEquipModel>().EquipDic[this.GetModel<IUserModel>().EquipInfo.Value.eid];
4848
OnChangeCarEvent(new ChangeCarEvent(curEquipInfo));
49-
IndexCar.manager.mPlayerStyle.ChangeEquip(EquipType.Car, curEquipInfo.eid, curEquipInfo.rid);
49+
this.GetSystem<IIndexCarSystem>().MPlayerStyle.ChangeEquip(EquipType.Car, curEquipInfo.eid, curEquipInfo.rid);
5050
}
5151

5252
private void Start() {

0 commit comments

Comments
 (0)