暂存修改 尝试添加热重载插件

This commit is contained in:
2024-09-23 22:56:51 +08:00
parent 5b79a2d4bb
commit 8f824e0671
373 changed files with 3835 additions and 5709 deletions

View File

@ -15,6 +15,7 @@ using Object = UnityEngine.Object;
using UnityEditor;
#endif
/// <summary>
/// Author: Blastom
/// 通用工具类型代码
@ -37,7 +38,7 @@ public static class CommonUtility
private const float _jumpAnimTime = 1f;
private static float _lastGetUnityTime;
private static int _lastGetTime;
private static int _lastGetTime;
/// <summary>
/// 数组Find方法
@ -104,7 +105,7 @@ public static class CommonUtility
public static void ToCopyClip(string text)
{
var textEditor = new TextEditor {text = text};
var textEditor = new TextEditor { text = text };
textEditor.SelectAll();
textEditor.Copy();
}
@ -171,10 +172,10 @@ public static class CommonUtility
public static void TrimCloneInName(this GameObject gameObject)
{
const string clone = "(Clone)";
var name = gameObject.name;
var name = gameObject.name;
if (name.EndsWith(clone))
{
name = name.Remove(name.Length - clone.Length);
name = name.Remove(name.Length - clone.Length);
gameObject.name = name;
}
}
@ -224,11 +225,11 @@ public static class CommonUtility
/// </summary>
public static void CopyTo(this RectTransform source, RectTransform target)
{
target.pivot = source.pivot;
target.anchorMin = source.anchorMin;
target.anchorMax = source.anchorMax;
target.pivot = source.pivot;
target.anchorMin = source.anchorMin;
target.anchorMax = source.anchorMax;
target.anchoredPosition = source.anchoredPosition;
target.sizeDelta = source.sizeDelta;
target.sizeDelta = source.sizeDelta;
target.SetParent(source.parent, false);
}
@ -279,8 +280,8 @@ public static class CommonUtility
result.AddKey(keyFrame);
}
result.preWrapMode = (WrapMode) keyFrameList[0].PreWrapMode;
result.postWrapMode = (WrapMode) keyFrameList[0].PostWrapMode;
result.preWrapMode = (WrapMode)keyFrameList[0].PreWrapMode;
result.postWrapMode = (WrapMode)keyFrameList[0].PostWrapMode;
}
}
#if UNITY_EDITOR
@ -295,7 +296,7 @@ public static class CommonUtility
/// </summary>
public static float LoopFloat(float source, float minValue, float maxValue)
{
var cycle = maxValue - minValue;
var cycle = maxValue - minValue;
var multiplier = Mathf.Floor((source - minValue) / cycle);
return source - multiplier * cycle;
}
@ -345,7 +346,7 @@ public static class CommonUtility
var target = source as TTarget;
if (target == null)
LogModule.ErrorLog(string.Format("无法将组件{0}转换为{1}, 所在路径{2}", source.GetType(), typeof(TTarget),
source.transform.GetHierarchyName()));
source.transform.GetHierarchyName()));
return target;
}
@ -399,8 +400,8 @@ public static class CommonUtility
/// </summary>
public static Tab_Impact GetMoveSkillImpact(this Tab_SkillEx skillEx)
{
Tab_Impact result = null;
var impactCount = skillEx.getImpactIdCount();
Tab_Impact result = null;
var impactCount = skillEx.getImpactIdCount();
for (var i = 0; i < impactCount; i++)
{
var impactId = skillEx.GetImpactIdbyIndex(i);
@ -432,7 +433,8 @@ public static class CommonUtility
//}
//return hasNext;
return skillEx.NextStageSkillId >= 0 && GameManager.gameManager.PlayerDataPool.GetOwnSkillInfo(skillEx.NextStageSkillId) != null;
return skillEx.NextStageSkillId >= 0 &&
GameManager.gameManager.PlayerDataPool.GetOwnSkillInfo(skillEx.NextStageSkillId) != null;
}
/// <summary>
@ -440,8 +442,8 @@ public static class CommonUtility
/// </summary>
public static Tab_SkillTargetSelector GetSkillSelector(this Tab_SkillEx skillEx)
{
Tab_SkillTargetSelector result = null;
var selectorId = skillEx.GetSelectorIdbyIndex(0);
Tab_SkillTargetSelector result = null;
var selectorId = skillEx.GetSelectorIdbyIndex(0);
if (selectorId > -1)
result = TryGetTable(selectorId, a => TableManager.GetSkillTargetSelectorByID(a));
return result;
@ -494,7 +496,7 @@ public static class CommonUtility
/// </summary>
public static string GetCurrentTimeString(bool showInterval = true)
{
var time = GetCurrentTimeInMilliseconds();
var time = GetCurrentTimeInMilliseconds();
var result = time.ToString();
if (showInterval)
result = string.Format("({0} - {1})", result, time - _lastGetTime);
@ -516,12 +518,12 @@ public static class CommonUtility
/// </summary>
private static int GetCurrentTimeInMilliseconds()
{
return (int) (DateTime.Now - DateTime.Today).TotalMilliseconds;
return (int)(DateTime.Now - DateTime.Today).TotalMilliseconds;
}
public static Vector3 ParseVector3(string source)
{
var result = Vector3.zero;
var result = Vector3.zero;
var segments = source.Split(';');
result.x = float.Parse(segments[0]);
result.y = float.Parse(segments[1]);
@ -597,7 +599,7 @@ public static class CommonUtility
public static int FubenAutoType()
{
var fubenId = GlobeVar.INVALID_ID;
var cache = GameManager.gameManager.PlayerDataPool.EnterSceneCache;
var cache = GameManager.gameManager.PlayerDataPool.EnterSceneCache;
if (cache != null)
fubenId = cache.EnterCopySceneID;
if (fubenId <= GlobeVar.INVALID_ID)
@ -618,8 +620,8 @@ public static class CommonUtility
public static bool IsCopyScene(this Tab_SceneClass sceneClassData)
{
return sceneClassData.SceneID != (int) GameDefine_Globe.SCENE_DEFINE.SCENE_GUILD &&
sceneClassData.Type == (int) GameDefine_Globe.SCENE_TYPE.SCENETYPE_COPYSCENE;
return sceneClassData.SceneID != (int)GameDefine_Globe.SCENE_DEFINE.SCENE_GUILD &&
sceneClassData.Type == (int)GameDefine_Globe.SCENE_TYPE.SCENETYPE_COPYSCENE;
}
public static Tab_Jump GetFinialJumpData(this Tab_Jump jumpData)
@ -681,15 +683,15 @@ public static class CommonUtility
public static Tab_SkillEx GetSkillMaxLevelByBaseId(int baseId)
{
Tab_SkillEx result = null;
var maxLevel = int.MinValue;
var skillExDict = TableManager.GetSkillEx();
Tab_SkillEx result = null;
var maxLevel = int.MinValue;
var skillExDict = TableManager.GetSkillEx();
foreach (var value in skillExDict.Values)
{
var skillEx = value;
if (skillEx.BaseId == baseId && skillEx.Level > maxLevel)
{
result = skillEx;
result = skillEx;
maxLevel = skillEx.Level;
}
}
@ -700,7 +702,7 @@ public static class CommonUtility
// 注C#不支持对泛型限制为枚举
public static T GetMaxEnum<T>() where T : struct, IComparable
{
var values = (T[]) Enum.GetValues(typeof(T));
var values = (T[])Enum.GetValues(typeof(T));
return GetMaxValue(values);
}
@ -735,7 +737,7 @@ public static class CommonUtility
break;
}
startPos = corners[i];
startPos = corners[i];
distance -= length;
}
@ -762,7 +764,7 @@ public static class CommonUtility
/// </summary>
public static float GetTotalDistance(this NavMeshPath path)
{
var length = 0f;
var length = 0f;
var corners = path.corners;
if (corners.Length > 1)
for (var i = 1; i < corners.Length; i++)
@ -799,7 +801,7 @@ public static class CommonUtility
if (mode == ListGetMode.create && result == null)
{
result = new TV {id = id};
result = new TV { id = id };
list.Add(result);
}
@ -863,6 +865,12 @@ public static class CommonUtility
}
#endif
var bundleName = LoadAssetBundle.FixBundleName(LoadAssetBundle.BUNDLE_PATH_GAMERES);
if (AssetManager.instance == null)
{
throw new Exception("AssetManager.instance is null");
}
return AssetManager.instance.LoadAssetSync<T>(bundleName, name);
}
@ -890,8 +898,8 @@ public static class CommonUtility
// LoadAssetBundle.Instance.LoadGameObject(bundleName, assetName, callBack, null, archive);
// }
public static void LoadAssetInstance(string bundleName, string assetName,
LoadBundleAssetCallback<GameObject> callBack, bool archive)
public static void LoadAssetInstance(string bundleName, string assetName,
LoadBundleAssetCallback<GameObject> callBack, bool archive)
{
#if UNITY_EDITOR
if (AssetUpdateManager.useResources)
@ -922,7 +930,7 @@ public class MyTuple<T1, T2>
public MyTuple(T1 first, T2 second)
{
this.first = first;
this.first = first;
this.second = second;
}
}