修复BUG
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class LoopIndexTool {
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static Data LoopIndex<Data>(this List<Data> list, int index) {
|
||||
return list[LoopIndex(index, list.Count)];
|
||||
}
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static Data LoopIndex<Data>(this Data[] array, int index) {
|
||||
return array[LoopIndex(index, array.Length)];
|
||||
}
|
||||
/// <summary> 头尾循环标准化索引 </summary>
|
||||
public static int LoopIndex(int index, int maxIndex) {
|
||||
if (maxIndex == 0) { Debug.LogError("错误索引:maxIndex = 0"); return 0; }
|
||||
if (index < 0) { return LoopIndex(index + maxIndex, maxIndex); }
|
||||
if (index >= maxIndex) { return LoopIndex(index - maxIndex, maxIndex); }
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f410a5e521f087048804a823d1c02e6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de13e4c89e97faf45b5d383070fd8e5e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 模块基类
|
||||
/// </summary>
|
||||
/// <typeparam name="ModuleCore"></typeparam>
|
||||
public class Module<ModuleCore> where ModuleCore : Module<ModuleCore>, new() {
|
||||
/// <summary> 模块单例 </summary>
|
||||
public static ModuleCore I => Instantiate();
|
||||
|
||||
private static ModuleCore core;
|
||||
private static ModuleCore Instantiate() => core == null ? core = new ModuleCore() : core;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86acb6fd9f576cc458df7bcc1581c098
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 单例模块
|
||||
/// </summary>
|
||||
public abstract class ModuleSingle<T> : MonoBehaviour where T : ModuleSingle<T> {
|
||||
/// <summary> 模块单例 </summary>
|
||||
public static T I => instance;
|
||||
/// <summary> 模块单例 </summary>
|
||||
protected static T instance;
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 初始化 </summary>
|
||||
protected virtual void Awake() {
|
||||
if (instance != null) { Destroy(instance.gameObject); }
|
||||
instance = (T)this;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 121ca341c2100df4b94d707ed24452f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user