Skip to content

Commit 105ed25

Browse files
committed
删除无用log; 优化数据初始化;
1 parent abd85e3 commit 105ed25

File tree

8 files changed

+103
-35
lines changed

8 files changed

+103
-35
lines changed

.gitignore

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
# MemoryCaptures can get excessive in size.
14+
# They also could contain extremely sensitive data
15+
/[Mm]emoryCaptures/
16+
17+
# Recordings can get excessive in size
18+
/[Rr]ecordings/
19+
20+
# Uncomment this line if you wish to ignore the asset store tools plugin
21+
# /[Aa]ssets/AssetStoreTools*
22+
23+
# Autogenerated Jetbrains Rider plugin
24+
/[Aa]ssets/Plugins/Editor/JetBrains*
25+
26+
# Visual Studio cache directory
27+
.vs/
28+
29+
# idea
30+
.idea/
31+
32+
# Gradle cache directory
33+
.gradle/
34+
35+
# Autogenerated VS/MD/Consulo solution and project files
36+
ExportedObj/
37+
.consulo/
38+
*.csproj
39+
*.unityproj
40+
*.sln
41+
*.suo
42+
*.tmp
43+
*.user
44+
*.userprefs
45+
*.pidb
46+
*.booproj
47+
*.svd
48+
*.pdb
49+
*.mdb
50+
*.opendb
51+
*.VC.db
52+
53+
# Unity3D generated meta files
54+
*.pidb.meta
55+
*.pdb.meta
56+
*.mdb.meta
57+
58+
# Unity3D generated file on crash reports
59+
sysinfo.txt
60+
61+
# Builds
62+
*.apk
63+
*.aab
64+
*.unitypackage
65+
*.app
66+
67+
# Crashlytics generated file
68+
crashlytics-build.properties
69+
70+
# Packed Addressables
71+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
72+
73+
# Temporary auto-generated Android Assets
74+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
75+
/[Aa]ssets/[Ss]treamingAssets/aa/*

.vsconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/BuffBase/Buff.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public virtual void OnBuffAwake()
7171
Layer = 0;
7272
ModifyLayer(1);
7373
firstFrame = true;
74-
Debug.Log(Layer);
7574
}
7675
public abstract void OnBuffRemove();
7776

@@ -80,7 +79,6 @@ public virtual void OnBuffDestroy()
8079
if (mutilAddType == BuffMutilAddType.multipleLayer || mutilAddType == BuffMutilAddType.multipleLayerAndResetTime)
8180
{
8281
ModifyLayer(-Layer);
83-
isEffective = false;
8482
}
8583
RealModifyLayer();
8684
}
@@ -145,6 +143,7 @@ public void OnBuffUpdate()
145143
timer = duration;
146144
ModifyLayer(-1);
147145
}
146+
else isEffective = false;
148147
}
149148
RealModifyLayer();
150149
if (!runTickTimer) return;

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/BuffHandler/BuffHandler.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,6 @@ private void AddBuff(IBuff buff, GameObject caster)
3434
bf.Initialize(this, caster);
3535
bf.OnBuffAwake();
3636

37-
//Tag处理:
38-
//只在有BuffTagManager注册时处理互斥
39-
//特殊的None:如果tag为none则认为不会有任何Tag处理
40-
//if (buffTagManager != null && bf.BuffTag != BuffTag.none)
41-
//{
42-
// for (int i = buffs.Count - 1; i >= 0; i--)
43-
// {
44-
// //首先:如果有已有buff能抵消新buff,则直接抵消
45-
// if (buffs.Any(b => buffTagManager.IsTagRemovedBy(bf.BuffTag, b.BuffTag)))
46-
// {
47-
// bf.OnBuffDestroy();
48-
// return;
49-
// }
50-
// //之后:如果新buff没有被抵消,则新buff抵消已有的buff
51-
// if (buffTagManager.IsTagConflictWith(bf.BuffTag, buffs[i].BuffTag))
52-
// {
53-
// InteruptBuff(buffs[i]);
54-
// }
55-
// }
56-
//}
57-
5837
//确定能添加Buff时
5938
onAddBuff?.Invoke();
6039
//检查是否已有同样的Buff

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/Editor/BitType/CustomBitBuffTagManager.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ private void OnEnable()
1414
}
1515
public override void OnInspectorGUI()
1616
{
17-
serializedObject.UpdateIfRequiredOrScript();
17+
//serializedObject.UpdateIfRequiredOrScript();
1818

19-
EditorGUILayout.BeginHorizontal();
20-
EditorGUILayout.PropertyField(data);
21-
if (GUILayout.Button(new GUIContent("New")))
22-
{
19+
//EditorGUILayout.BeginHorizontal();
20+
//EditorGUILayout.PropertyField(data);
21+
//if (GUILayout.Button(new GUIContent("New")))
22+
//{
2323

24-
AssetDatabase.CreateAsset(CreateInstance<BitBuffTagData>(), EditorUtility.SaveFilePanelInProject("保存新BitBuffTag数据", "NewBitBuffData", "asset", "输入文件名"));
25-
}
26-
EditorGUILayout.EndHorizontal();
24+
// AssetDatabase.CreateAsset(CreateInstance<BitBuffTagData>(), EditorUtility.SaveFilePanelInProject("保存新BitBuffTag数据", "NewBitBuffData", "asset", "输入文件名"));
25+
//}
26+
//EditorGUILayout.EndHorizontal();
2727

28-
serializedObject.ApplyModifiedProperties();
28+
//serializedObject.ApplyModifiedProperties();
2929
}
3030
}
3131
}

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/Editor/BuffEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ private void CreateBuffTagAsset()
155155
string dir = Path.Combine(SO_PATH, defaultTagSOName);
156156
if (File.Exists(dir)) return;
157157
BitBuffTagData b = CreateInstance<BitBuffTagData>();
158+
b.Initialize();
158159
AssetDatabase.CreateAsset(b, dir);
159160
}
160161
/// <summary>

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/Tag/BitType/BitBuffTagData.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using System;
12
using System.Collections;
23
using System.Collections.Generic;
4+
using System.Linq;
35
using UnityEngine;
46
namespace NoSLoofah.BuffSystem
57
{
@@ -8,8 +10,8 @@ namespace NoSLoofah.BuffSystem
810
/// </summary>
911
public class BitBuffTagData : BuffTagData
1012
{
11-
[Tooltip("这些tag的旧Buff会被挤掉")][SerializeField] private List<int> removedTags = new List<int>(32);
12-
[Tooltip("存在这些tag的Buff时新Buff无法被添加")][SerializeField] private List<int> blockTags = new List<int>(32);
13+
[Tooltip("这些tag的旧Buff会被挤掉")][SerializeField] private List<int> removedTags;
14+
[Tooltip("存在这些tag的Buff时新Buff无法被添加")][SerializeField] private List<int> blockTags;
1315

1416
public int[] RemovedTags => removedTags.ToArray();
1517
public int[] BlockTags => blockTags.ToArray();
@@ -26,5 +28,11 @@ public static int GetIndex(BuffTag tag)
2628
while (((int)tag & (1 << i)) == 0) i++;
2729
return i + 1;
2830
}
31+
32+
public void Initialize()
33+
{
34+
removedTags = Enumerable.Repeat(0, 32).ToList();
35+
blockTags = Enumerable.Repeat(0, 32).ToList();
36+
}
2937
}
3038
}

Assets/NoSLoofah_BuffSystem/BuffSystem/Base/Tag/BitType/BitBuffTagManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override bool IsTagRemoveOther(BuffTag tag, BuffTag other)
2828
}
2929

3030
public override bool IsTagCanAddWhenHaveOther(BuffTag tag, BuffTag other)
31-
{
31+
{
3232
if (tag == 0) return false;
3333
if (tag < 0) throw new System.Exception("使用了负标签");
3434
int index = BitBuffTagData.GetIndex(tag);

0 commit comments

Comments
 (0)