Skip to content

Commit 77f46d8

Browse files
committed
格式化代码
1 parent 62e1f2b commit 77f46d8

File tree

186 files changed

+1790
-1914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+1790
-1914
lines changed

CrazyCarClient/Assets/Scripts/Anim/CountDownAnim.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ public void PlayAnim(int time, Action succ = null) {
2121
sequence.Append(countDownText.transform.DOScale(1, 0.5f));
2222
sequence.Append(countDownText.transform.DOScale(0, 0.5f));
2323
}
24+
2425
sequence.OnComplete(() => {
25-
succ?.Invoke();
26+
succ?.Invoke();
2627
gameObject.SetActiveFast(false);
27-
});
28+
});
2829
}
2930

3031
private IEnumerator CountDown(int time) {
31-
while(time > 0) {
32+
while (time > 0) {
3233
if (countDownText != null) {
3334
countDownText.text = time.ToString();
3435
}
36+
3537
yield return new WaitForSecondsRealtime(1.0f);
3638
time--;
3739
}
@@ -40,4 +42,4 @@ private IEnumerator CountDown(int time) {
4042
public IArchitecture GetArchitecture() {
4143
return CrazyCar.Interface;
4244
}
43-
}
45+
}

CrazyCarClient/Assets/Scripts/Anim/MeltEffect.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ private void Start() {
1313
material = mr.material;
1414
}
1515

16-
private void Update() {
16+
private void Update() {
1717
amount = Mathf.Repeat(Time.time * speed, 1.0f);
1818
material.SetFloat("_DissolveThreshold", amount);
1919
material.SetFloat("_OffsetThreshold", amount);
2020
}
21-
}
21+
}

CrazyCarClient/Assets/Scripts/Anim/MotionBlurEffects.cs

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,51 @@
22
using System.Collections;
33

44
[ExecuteInEditMode]
5-
6-
public class MotionBlurEffects : MonoBehaviour
7-
{
8-
5+
public class MotionBlurEffects : MonoBehaviour {
96
//-------------------变量声明部分-------------------
7+
108
#region Variables
11-
public Shader CurShader;//着色器实例
12-
private Vector4 ScreenResolution;//屏幕分辨率
13-
private Material CurMaterial;//当前的材质
149

15-
[Range(5, 50)]
16-
public float IterationNumber = 15;
17-
[Range(-0.5f, 0.5f)]
18-
public float Intensity = 0.125f;
19-
[Range(-2f, 2f)]
20-
public float OffsetX = 0.5f;
21-
[Range(-2f, 2f)]
22-
public float OffsetY = 0.5f;
10+
public Shader CurShader; //着色器实例
11+
private Vector4 ScreenResolution; //屏幕分辨率
12+
private Material CurMaterial; //当前的材质
13+
14+
[Range(5, 50)] public float IterationNumber = 15;
15+
[Range(-0.5f, 0.5f)] public float Intensity = 0.125f;
16+
[Range(-2f, 2f)] public float OffsetX = 0.5f;
17+
[Range(-2f, 2f)] public float OffsetY = 0.5f;
2318

2419

2520
public static float ChangeValue;
2621
public static float ChangeValue2;
2722
public static float ChangeValue3;
2823
public static float ChangeValue4;
24+
2925
#endregion
3026

3127

3228
//-------------------------材质的get&set----------------------------
29+
3330
#region MaterialGetAndSet
34-
Material material
35-
{
36-
get
37-
{
38-
if (CurMaterial == null)
39-
{
31+
32+
Material material {
33+
get {
34+
if (CurMaterial == null) {
4035
CurMaterial = new Material(CurShader);
4136
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
4237
}
38+
4339
return CurMaterial;
4440
}
4541
}
42+
4643
#endregion
4744

4845
//-----------------------------------------【Start()函数】---------------------------------------------
4946
// 说明:此函数仅在Update函数第一次被调用前被调用
5047
//--------------------------------------------------------------------------------------------------------
5148
[System.Obsolete]
52-
void Start()
53-
{
49+
void Start() {
5450
//依此赋值
5551
ChangeValue = Intensity;
5652
ChangeValue2 = OffsetX;
@@ -61,8 +57,7 @@ void Start()
6157
CurShader = Shader.Find("Self/MotionBlurEffects");
6258

6359
//判断是否支持屏幕特效
64-
if (!SystemInfo.supportsImageEffects)
65-
{
60+
if (!SystemInfo.supportsImageEffects) {
6661
enabled = false;
6762
return;
6863
}
@@ -71,11 +66,9 @@ void Start()
7166
//-------------------------------------【OnRenderImage()函数】------------------------------------
7267
// 说明:此函数在当完成所有渲染图片后被调用,用来渲染图片后期效果
7368
//--------------------------------------------------------------------------------------------------------
74-
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
75-
{
69+
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture) {
7670
//着色器实例不为空,就进行参数设置
77-
if (CurShader != null)
78-
{
71+
if (CurShader != null) {
7972
//设置Shader中的外部变量
8073
material.SetFloat("_IterationNumber", IterationNumber);
8174
material.SetFloat("_Value", Intensity);
@@ -87,49 +80,40 @@ void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
8780
Graphics.Blit(sourceTexture, destTexture, material);
8881
}
8982
//着色器实例为空,直接拷贝屏幕上的效果。此情况下是没有实现屏幕特效的
90-
else
91-
{
83+
else {
9284
//直接拷贝源纹理到目标渲染纹理
9385
Graphics.Blit(sourceTexture, destTexture);
9486
}
95-
9687
}
9788

9889

9990
//-----------------------------------------【OnValidate()函数】--------------------------------------
10091
// 说明:此函数在编辑器中该脚本的某个值发生了改变后被调用
10192
//--------------------------------------------------------------------------------------------------------
102-
void OnValidate()
103-
{
93+
void OnValidate() {
10494
//将编辑器中的值赋值回来,确保在编辑器中值的改变立刻让结果生效
10595
ChangeValue4 = IterationNumber;
10696
ChangeValue = Intensity;
10797
ChangeValue2 = OffsetX;
10898
ChangeValue3 = OffsetY;
109-
11099
}
111100

112101
//-----------------------------------------【Update()函数】------------------------------------------
113102
// 说明:此函数在每一帧中都会被调用
114103
//--------------------------------------------------------------------------------------------------------
115-
void Update()
116-
{
117-
if (Application.isPlaying)
118-
{
104+
void Update() {
105+
if (Application.isPlaying) {
119106
//赋值
120107
IterationNumber = ChangeValue4;
121108
Intensity = ChangeValue;
122109
OffsetX = ChangeValue2;
123110
OffsetY = ChangeValue3;
124-
125111
}
126112

127113
//找到对应的Shader文件
128114
#if UNITY_EDITOR
129-
if (Application.isPlaying != true)
130-
{
115+
if (Application.isPlaying != true) {
131116
CurShader = Shader.Find("Self/MotionBlurEffects");
132-
133117
}
134118
#endif
135119
}
@@ -138,11 +122,9 @@ void Update()
138122
//-----------------------------------------【OnDisable()函数】---------------------------------------
139123
// 说明:当对象变为不可用或非激活状态时此函数便被调用
140124
//--------------------------------------------------------------------------------------------------------
141-
void OnDisable()
142-
{
143-
if (CurMaterial)
144-
{
125+
void OnDisable() {
126+
if (CurMaterial) {
145127
DestroyImmediate(CurMaterial);
146128
}
147129
}
148-
}
130+
}

CrazyCarClient/Assets/Scripts/Anim/MoveAnim.cs

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,21 @@
55
using System;
66
using DG.Tweening;
77

8-
public class MoveAnim : MonoBehaviour
9-
{
10-
public enum MoveAnimType
11-
{
8+
public class MoveAnim : MonoBehaviour {
9+
public enum MoveAnimType {
1210
MoveOut = 0,
1311
MoveIn
1412
}
1513

16-
public enum MoveDirction
17-
{
14+
public enum MoveDirction {
1815
Left,
1916
Right,
2017
Up,
2118
Down
2219
}
2320

2421
[Serializable]
25-
public class MoveAnimInfo
26-
{
22+
public class MoveAnimInfo {
2723
public MoveDirction direction;
2824
public float moveDistance;
2925
public Transform target;
@@ -33,33 +29,26 @@ public class MoveAnimInfo
3329
public MoveAnimInfo[] moveAnimInfos;
3430
public float duration = 1.4f;
3531

36-
private void OnEnable()
37-
{
38-
if (moveAnimType == MoveAnimType.MoveIn)
39-
{
40-
foreach (var moveAnimInfo in moveAnimInfos)
41-
{
42-
if (moveAnimInfo.target != null)
43-
{
44-
if (moveAnimInfo.direction == MoveDirction.Left)
45-
{
46-
moveAnimInfo.target.localPosition = new Vector3(moveAnimInfo.target.localPosition.x + moveAnimInfo.moveDistance,
32+
private void OnEnable() {
33+
if (moveAnimType == MoveAnimType.MoveIn) {
34+
foreach (var moveAnimInfo in moveAnimInfos) {
35+
if (moveAnimInfo.target != null) {
36+
if (moveAnimInfo.direction == MoveDirction.Left) {
37+
moveAnimInfo.target.localPosition = new Vector3(
38+
moveAnimInfo.target.localPosition.x + moveAnimInfo.moveDistance,
4739
moveAnimInfo.target.localPosition.y, moveAnimInfo.target.localPosition.z);
48-
}
49-
else if (moveAnimInfo.direction == MoveDirction.Right)
50-
{
51-
moveAnimInfo.target.localPosition = new Vector3(moveAnimInfo.target.localPosition.x - moveAnimInfo.moveDistance,
40+
} else if (moveAnimInfo.direction == MoveDirction.Right) {
41+
moveAnimInfo.target.localPosition = new Vector3(
42+
moveAnimInfo.target.localPosition.x - moveAnimInfo.moveDistance,
5243
moveAnimInfo.target.localPosition.y, moveAnimInfo.target.localPosition.z);
53-
}
54-
else if (moveAnimInfo.direction == MoveDirction.Up)
55-
{
44+
} else if (moveAnimInfo.direction == MoveDirction.Up) {
5645
moveAnimInfo.target.localPosition = new Vector3(moveAnimInfo.target.localPosition.x,
57-
moveAnimInfo.target.localPosition.y - moveAnimInfo.moveDistance, moveAnimInfo.target.localPosition.z);
58-
}
59-
else if (moveAnimInfo.direction == MoveDirction.Down)
60-
{
46+
moveAnimInfo.target.localPosition.y - moveAnimInfo.moveDistance,
47+
moveAnimInfo.target.localPosition.z);
48+
} else if (moveAnimInfo.direction == MoveDirction.Down) {
6149
moveAnimInfo.target.localPosition = new Vector3(moveAnimInfo.target.localPosition.x,
62-
moveAnimInfo.target.localPosition.y + moveAnimInfo.moveDistance, moveAnimInfo.target.localPosition.z);
50+
moveAnimInfo.target.localPosition.y + moveAnimInfo.moveDistance,
51+
moveAnimInfo.target.localPosition.z);
6352
}
6453
}
6554
}
@@ -68,39 +57,36 @@ private void OnEnable()
6857
}
6958
}
7059

71-
private void Update()
72-
{
73-
if (Input.GetKeyDown(KeyCode.A))
74-
{
60+
private void Update() {
61+
if (Input.GetKeyDown(KeyCode.A)) {
7562
PlayAnim();
7663
}
7764
}
7865

79-
public void PlayAnim()
80-
{
66+
public void PlayAnim() {
8167
Sequence sequence = DOTween.Sequence();
82-
foreach (var moveAnimInfo in moveAnimInfos)
83-
{
84-
if (moveAnimInfo.target == null)
85-
{
68+
foreach (var moveAnimInfo in moveAnimInfos) {
69+
if (moveAnimInfo.target == null) {
8670
continue;
8771
}
88-
if (moveAnimInfo.direction == MoveDirction.Left)
89-
{
90-
sequence.Join(moveAnimInfo.target.DOLocalMoveX(moveAnimInfo.target.localPosition.x - moveAnimInfo.moveDistance, duration));
91-
}
92-
else if (moveAnimInfo.direction == MoveDirction.Right)
93-
{
94-
sequence.Join(moveAnimInfo.target.DOLocalMoveX(moveAnimInfo.target.localPosition.x + moveAnimInfo.moveDistance, duration));
95-
}
96-
else if (moveAnimInfo.direction == MoveDirction.Up)
97-
{
98-
sequence.Join(moveAnimInfo.target.DOLocalMoveY(moveAnimInfo.target.localPosition.y + moveAnimInfo.moveDistance, duration));
72+
73+
if (moveAnimInfo.direction == MoveDirction.Left) {
74+
sequence.Join(
75+
moveAnimInfo.target.DOLocalMoveX(moveAnimInfo.target.localPosition.x - moveAnimInfo.moveDistance,
76+
duration));
77+
} else if (moveAnimInfo.direction == MoveDirction.Right) {
78+
sequence.Join(
79+
moveAnimInfo.target.DOLocalMoveX(moveAnimInfo.target.localPosition.x + moveAnimInfo.moveDistance,
80+
duration));
81+
} else if (moveAnimInfo.direction == MoveDirction.Up) {
82+
sequence.Join(
83+
moveAnimInfo.target.DOLocalMoveY(moveAnimInfo.target.localPosition.y + moveAnimInfo.moveDistance,
84+
duration));
85+
} else if (moveAnimInfo.direction == MoveDirction.Down) {
86+
sequence.Join(
87+
moveAnimInfo.target.DOLocalMoveY(moveAnimInfo.target.localPosition.y - moveAnimInfo.moveDistance,
88+
duration));
9989
}
100-
else if (moveAnimInfo.direction == MoveDirction.Down)
101-
{
102-
sequence.Join(moveAnimInfo.target.DOLocalMoveY(moveAnimInfo.target.localPosition.y - moveAnimInfo.moveDistance, duration));
103-
}
10490
}
10591
}
106-
}
92+
}

CrazyCarClient/Assets/Scripts/Command/ApplyAvatarCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ protected override async void OnExecute() {
2020
Debug.Log("++++++ " + sb.ToString());
2121
byte[] bytes = Encoding.UTF8.GetBytes(sb.ToString());
2222
var result = await this.GetSystem<INetworkSystem>().Post(
23-
url: this.GetSystem<INetworkSystem>().HttpBaseUrl + RequestUrl.changeAvatarUrl, this.GetModel<IGameModel>().Token.Value, bytes);
23+
url: this.GetSystem<INetworkSystem>().HttpBaseUrl + RequestUrl.changeAvatarUrl,
24+
this.GetModel<IGameModel>().Token.Value, bytes);
2425
if (result.serverCode == 200) {
2526
this.GetModel<IUserModel>().Aid.Value = (int)result.serverData["aid"];
2627
this.SendEvent(new UpdataAvatarUIEvent(this.GetModel<IUserModel>().Aid));
@@ -29,6 +30,6 @@ protected override async void OnExecute() {
2930
} else if (result.serverCode == 423) {
3031
WarningAlertInfo alertInfo = new WarningAlertInfo("Did not have");
3132
UIController.Instance.ShowPage(new ShowPageInfo(UIPageType.WarningAlert, UILevelType.Alart, alertInfo));
32-
}
33+
}
3334
}
3435
}

CrazyCarClient/Assets/Scripts/Command/ApplyEquipCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ protected override async void OnExecute() {
2121
Debug.Log("++++++ " + sb.ToString());
2222
byte[] bytes = Encoding.UTF8.GetBytes(sb.ToString());
2323
var result = await this.GetSystem<INetworkSystem>().Post(url: this.GetSystem<INetworkSystem>().HttpBaseUrl +
24-
RequestUrl.changeEquipUrl,token: this.GetModel<IGameModel>().Token.Value, bytes);
24+
RequestUrl.changeEquipUrl,
25+
token: this.GetModel<IGameModel>().Token.Value, bytes);
2526
if (result.serverCode == 200) {
26-
this.GetModel<IUserModel>().EquipInfo.Value = this.GetModel<IEquipModel>().EquipDic[(int)result.serverData["eid"]];
27+
this.GetModel<IUserModel>().EquipInfo.Value =
28+
this.GetModel<IEquipModel>().EquipDic[(int)result.serverData["eid"]];
2729
WarningAlertInfo alertInfo = new WarningAlertInfo("Successfully Set");
2830
UIController.Instance.ShowPage(new ShowPageInfo(UIPageType.WarningAlert, UILevelType.Alart, alertInfo));
2931
this.SendEvent<ApplyEquipEvent>();

0 commit comments

Comments
 (0)