# Conflicts:
#	AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs
This commit is contained in:
ALIENJACK\alien 2024-12-27 14:31:36 +08:00
commit 6775c1279e
2442 changed files with 289920 additions and 134162 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3072205f33d4ee84d8117484f05398b2
guid: 43be319af7abfac409964f3b557a7558
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiCanvasScaler : UnityEngine.UI.CanvasScaler {} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d39954e798484ba44a30cfbd2ebb7fc7
guid: 473ebc56afd3a42478d4384e874c37fb
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiContentSizeFitter : UnityEngine.UI.ContentSizeFitter {} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 39557e19783acee499ace6c68549e8f8
guid: 8caea8d1f9c876b4f881e5f0b786490a
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiEventSystem : UnityEngine.EventSystems.EventSystem {} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cb5a8e579d35b9a4ca7966225235265a
guid: 1a44ffc6225f2f94e96923be40838c6b
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiGraphicRaycaster : UnityEngine.UI.GraphicRaycaster {} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5e16912525198924a860e53ab4ef0c81
guid: 1945ac5245ba5af46afb0b2c1176e625
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiHorizontalLayoutGroup : UnityEngine.UI.HorizontalLayoutGroup {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 250a43c57c3dd7743b159142e0e972dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiImage : UnityEngine.UI.Image {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51fcfe4c344a349498d3e605566e449c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiInputField : UnityEngine.UI.InputField {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c06c5945ce05264419dd9baf5052c6d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiLayoutElement : UnityEngine.UI.LayoutElement {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 662c10b55acd55b41a61b98b4e6dbdae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiRawImage : UnityEngine.UI.RawImage {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e197a80ecc5234d41a58d206698ab683
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiScrollRect : UnityEngine.UI.ScrollRect {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0bacff8c6cfbc6f4ea2f41852d636203
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiShadow : UnityEngine.UI.Shadow {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5397b0dcf716afa45b892bb200561edb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiSlider : UnityEngine.UI.Slider {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd0459cd2daa17e4bbbce2a219502891
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiStandaloneInputModule : UnityEngine.EventSystems.StandaloneInputModule {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4e4880eab24b7e49b7db61357d9fbd2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiText : UnityEngine.UI.Text {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d1e4d2ce69fe5c345903d4219ba84715
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace AxibugCom { public class AxiVerticalLayoutGroup : UnityEngine.UI.VerticalLayoutGroup {} }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6cc678483f4f2849bc6bbbcc66481a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,120 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47ae96bfd5393694da28c22ab2ccfb7c, type: 3}
m_Name: AxiComToolCache
m_EditorClassIdentifier:
caches:
- SrcFullName: UnityEngine.EventSystems.EventSystem
SrcName: EventSystem
GUID: 76c392e42b5098c458856cdf6ecaaaa1
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.EventSystems.StandaloneInputModule
SrcName: StandaloneInputModule
GUID: 4f231c4fb786f3946a6b90b886c48677
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.CanvasScaler
SrcName: CanvasScaler
GUID: 0cd44c1031e13a943bb63640046fad76
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.GraphicRaycaster
SrcName: GraphicRaycaster
GUID: dc42784cf147c0c48a680349fa168899
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.Image
SrcName: Image
GUID: fe87c0e1cc204ed48ad3b37840f39efc
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.RawImage
SrcName: RawImage
GUID: 1344c3c82d62a2a41a3576d8abb8e3ea
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.HorizontalLayoutGroup
SrcName: HorizontalLayoutGroup
GUID: 30649d3a9faa99c48a7b1166b86bf2a0
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.ContentSizeFitter
SrcName: ContentSizeFitter
GUID: 3245ec927659c4140ac4f8d17403cc18
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.LayoutElement
SrcName: LayoutElement
GUID: 306cc8c2b49d7114eaa3623786fc2126
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.Text
SrcName: Text
GUID: 5f7201a12d95ffc409449d95f23cf332
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.Shadow
SrcName: Shadow
GUID: cfabb0440166ab443bba8876756fdfa9
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.ScrollRect
SrcName: ScrollRect
GUID: 1aa08ab6e0800fa44ae55d278d1423e3
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.VerticalLayoutGroup
SrcName: VerticalLayoutGroup
GUID: 59f8146938fff824cb5fd77236b75775
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.Slider
SrcName: Slider
GUID: 67db9e8f0e2ae9c40bc1e2b64352a6b4
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}
- SrcFullName: UnityEngine.UI.InputField
SrcName: InputField
GUID: d199490a83bb2b844b9695cbf13b01ef
ToName:
ToPATH:
ToGUID:
monoScript: {fileID: 0}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 42cbfafb123e63b45841ae95eb432053
guid: d8f9e9475a806e04bb9d6946f20f4d0f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8d7ded91aab4c0b42abba5042aaceb39
guid: 113d55ba3dc10674b9bc51fc07159850
folderAsset: yes
DefaultImporter:
externalObjects: {}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 99c9720ab356a0642a771bea13969a05
guid: 236513027b5ebe041b0e5b86aec0db42
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4f6742d2e5aa8bf40b765aa44eca65d2
guid: c8eba012c3ef41a4bb9f3bfa27a8ea21
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,123 @@
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using static AxibugEmuOnline.Client.HttpAPI;
public class PSVLauncher : MonoBehaviour
{
public UnityEngine.UI.Button btnInfo;
public UnityEngine.UI.Button InitAPP;
public UnityEngine.UI.Button btnHttpTest;
public UnityEngine.UI.Button btnHttpTest10;
public UnityEngine.UI.Button btnTaskTest;
public UnityEngine.UI.Button btnTaskTest2;
public UnityEngine.UI.Button btnPSVHUD;
public UnityEngine.UI.Button btnStart;
void Awake()
{
DontDestroyOnLoad(this);
btnInfo.onClick.AddListener(() =>
{
Debug.Log($"SystemInfo.deviceUniqueIdentifier ->" + SystemInfo.deviceUniqueIdentifier);
Debug.Log($"systemLanguage ->" + UnityEngine.PSVita.Utility.systemLanguage);
Debug.Log($"skuFlags ->" + UnityEngine.PSVita.Utility.skuFlags);
}
);
InitAPP.onClick.AddListener(() =>
{
App.Init(new AxibugEmuOnline.Client.Initer());
});
btnHttpTest.onClick.AddListener(() => StartCoroutine(StartNetInit()));
btnHttpTest10.onClick.AddListener(() =>
{
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
StartCoroutine(StartNetInit());
}
);
btnTaskTest.onClick.AddListener(() =>
{
PSVThread.DoTask(() => DoWork(null));
//Task task = new Task(() =>
//{
// Thread.Sleep(1000);
// Debug.Log($"{Thread.CurrentThread.ManagedThreadId}->{1000}");
// Thread.Sleep(1000);
// Debug.Log($"{Thread.CurrentThread.ManagedThreadId}->{2000}");
//});
//task.Start();
});
btnPSVHUD.onClick.AddListener(() => {
UnityEngine.PSVita.Diagnostics.enableHUD = true;
});
btnTaskTest2.onClick.AddListener(() =>
{
ThreadPool.QueueUserWorkItem(DoWork);
}
);
btnStart.onClick.AddListener(()
=>
{
SceneManager.LoadScene("AxibugEmuOnline.Client");
});
}
static void DoWork(object state)
{
// 这里是线程池中的工作代码
Debug.Log($"thread id: {Thread.CurrentThread.ManagedThreadId} start");
// 模拟一些工作
Thread.Sleep(2000);
Debug.Log($"thread id: {Thread.CurrentThread.ManagedThreadId} end");
}
static IEnumerator StartNetInit()
{
int platform = 0;
AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{"http://emu.axibug.com/api"}/CheckStandInfo?platform={platform}&version={Application.version}");
yield return request.SendWebRequest;
if (!request.downloadHandler.isDone)
yield break;
if (request.downloadHandler.Err != null)
{
Debug.LogError(request.downloadHandler.Err);
yield break;
}
AxiHttpProxy.ShowAxiHttpDebugInfo(request.downloadHandler);
Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text);
//需要更新
if (resp.needUpdateClient == 1)
{
//TODO
}
yield return null;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f98de16d25b8f5148866d0c02a514502
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,32 +4,27 @@
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Render Texture
m_PrefabInternal: {fileID: 0}
m_Name: VideoTexture
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 256
m_Height: 240
m_Width: 960
m_Height: 544
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 0
m_ColorFormat: 8
m_ColorFormat: 20
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 5d4a385f133f9074583d64ab2172a03b
guid: 3d77df0fa731c3b458e8a1d50eb1a1b3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4f704ae4b4f98ae41a0bce26658850c1
guid: e745b95dbce117b48b4bd17df06ed302
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1bb2987740587b44e90ef7dfc1832a23
guid: 292b282919a768c4fa6b8adb858daa95
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,26 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CreateAssetMenu(fileName = "CrossMapCfg", menuName = "Tools/AxiPrefabCachec", order = 0)]
public class AxiPrefabCache : ScriptableObject
{
public List<AxiPrefabCache_Com2GUID> caches = new List<AxiPrefabCache_Com2GUID>();
}
[Serializable]
public class AxiPrefabCache_Com2GUID
{
public string SrcFullName;
public string SrcName;
public string GUID;
public string ToName;
public string ToPATH;
public string ToGUID;
public MonoScript monoScript;
}
#endif

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 47ae96bfd5393694da28c22ab2ccfb7c

View File

@ -0,0 +1,416 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
public class AxiProjectTools : EditorWindow
{
static string cachecfgPath = "Assets/AxiComToolCache.asset";
static string toolSenceName = "AxiProjectTools";
static string outCsDir = Application.dataPath + "/AxiCom/";
static Dictionary<string, AxiPrefabCache_Com2GUID> ComType2GUID = new Dictionary<string, AxiPrefabCache_Com2GUID>();
static void GoTAxiProjectToolsSence()
{
string[] sceneGuids = AssetDatabase.FindAssets("t:scene");
foreach (string guid in sceneGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
if (path.Contains(toolSenceName))
{
EditorSceneManager.OpenScene(path);
return;
}
}
}
[MenuItem("Axibug移植工具/[1]UGUI组件")]
public static void Part1()
{
GoTAxiProjectToolsSence();
ComType2GUID.Clear();
string[] sceneGuids = AssetDatabase.FindAssets("t:scene");
foreach (string guid in sceneGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
if (path.Contains(toolSenceName))
continue;
EditorSceneManager.OpenScene(path);
// 创建一个列表来存储根节点
List<GameObject> rootNodes = new List<GameObject>();
// 遍历场景中的所有对象
GameObject[] allObjects = FindObjectsOfType<GameObject>();
foreach (GameObject obj in allObjects)
{
// 检查对象是否有父对象
if (obj.transform.parent == null)
{
// 如果没有父对象,则它是一个根节点
rootNodes.Add(obj);
}
}
foreach (var node in rootNodes)
LoopPrefabNode(path, node, 0);
}
string[] prefabGuids = AssetDatabase.FindAssets("t:Prefab");
foreach (string guid in prefabGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
GetPrefab(path);
}
AxiPrefabCache cache = ScriptableObject.CreateInstance<AxiPrefabCache>();
foreach (var data in ComType2GUID)
cache.caches.Add(data.Value);
AssetDatabase.CreateAsset(cache, cachecfgPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
GoTAxiProjectToolsSence();
Debug.Log("<Color=#FFF333>处理完毕 [1]采集所有预制体和场景下的UGUI组件</color>");
}
static void GetPrefab(string path)
{
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(path);
LoopPrefabNode(path, prefab.gameObject, 0);
}
static void LoopPrefabNode(string rootPath, GameObject trans, int depth)
{
string nodename = $"{rootPath}>{trans.name}";
#if UNITY_2018_4_OR_NEWER
GameObject prefabRoot = trans.gameObject;
int comCount = prefabRoot.GetComponentCount();
for (int i = 0; i < comCount; i++)
{
var com = prefabRoot.GetComponentAtIndex(i);
if (com == null)
continue;
MonoBehaviour monoCom = com as MonoBehaviour;
if (monoCom == null)
continue;
Type monoType = monoCom.GetType();
if (!monoType.Assembly.FullName.Contains("UnityEngine.UI"))
continue;
// 获取MonoScript资源
MonoScript monoScript = MonoScript.FromMonoBehaviour(monoCom);
if (monoScript != null)
{
// 获取MonoScript资源的GUID
string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(monoScript));
Debug.Log($"{nodename} | <color=#FFF333>[{monoType.Name}]</color> <color=#FF0000>{guid}</color><color=#00FF00>({monoType.FullName})</color>");
ComType2GUID[monoType.FullName] =
new AxiPrefabCache_Com2GUID()
{
SrcFullName = monoType.FullName,
SrcName = monoType.Name,
GUID = guid,
};
}
else
{
Debug.LogError("!!!! 没得");
}
}
//遍历
foreach (Transform child in trans.transform)
LoopPrefabNode(nodename, child.gameObject, depth + 1);
#else
Debug.Log("低版本不要执行本函数");
#endif
}
[MenuItem("Axibug移植工具/[2]")]
public static void Part2()
{
if (UnityEngine.Windows.Directory.Exists(outCsDir))
UnityEngine.Windows.Directory.Delete(outCsDir);
Directory.CreateDirectory(outCsDir);
AxiPrefabCache cache = AssetDatabase.LoadAssetAtPath<AxiPrefabCache>(cachecfgPath);
foreach (var data in cache.caches)
{
string toName = "Axi" + data.SrcName;
string toPath = outCsDir + toName + ".cs";
string codeStr = "namespace AxibugCom { public class " + toName + " : " + data.SrcFullName + " {} }";
try
{
System.IO.File.WriteAllText(toPath, codeStr);
data.ToName = toName;
data.ToPATH = toPath;
}
catch (Exception ex)
{
Debug.LogError("写入失败" + ex.ToString());
}
}
Debug.Log("写入完毕");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("<Color=#FFF333>处理完毕 [2]生成中间脚本代码</color>");
}
[MenuItem("Axibug移植工具/[3]")]
public static void Part3()
{
AxiPrefabCache cache = AssetDatabase.LoadAssetAtPath<AxiPrefabCache>(cachecfgPath);
List<MonoScript> allMonoScripts = FindAllAssetsOfType<MonoScript>();
foreach (var data in cache.caches)
{
MonoScript monoScript = allMonoScripts.FirstOrDefault(w => w.name == data.ToName);
if (monoScript == null)
{
Debug.LogError("没找到" + data.ToName);
continue;
}
string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(monoScript));
data.ToGUID = guid;
data.monoScript = monoScript;
}
Debug.Log("写入完毕");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("<Color=#FFF333>处理完毕 [3]收集生成的脚本</color>");
}
static List<T> FindAllAssetsOfType<T>() where T : UnityEngine.Object
{
List<T> assets = new List<T>();
string[] allGuids = AssetDatabase.FindAssets("");
foreach (string guid in allGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
if (path.EndsWith(".cs") || path.EndsWith(".js") || path.EndsWith(".boo")) // Unity支持多种脚本语言但现代Unity主要使用C#
{
T asset = AssetDatabase.LoadAssetAtPath<T>(path);
if (asset != null)
{
assets.Add(asset);
}
}
}
return assets;
}
[MenuItem("Axibug移植工具/[4]")]
public static void Part4()
{
AxiPrefabCache cache = AssetDatabase.LoadAssetAtPath<AxiPrefabCache>(cachecfgPath);
Dictionary<string, string> tempReplaceDict = new Dictionary<string, string>();
foreach (var data in cache.caches)
{
tempReplaceDict[data.GUID] = data.ToGUID;
}
ProcessAllPrefabs("*.prefab", tempReplaceDict);
ProcessAllPrefabs("*.unity", tempReplaceDict);
ProcessAllPrefabs("*.anim", tempReplaceDict);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("<Color=#FFF333>处理完毕 [4]替换所有预制体和场景中的组件</color>");
}
static void ProcessAllPrefabs(string form, Dictionary<string, string> tempReplaceDict, bool reverse = false)
{
List<GameObject> prefabs = new List<GameObject>();
var resourcesPath = Application.dataPath;
var absolutePaths = Directory.GetFiles(resourcesPath, form, SearchOption.AllDirectories);
for (int i = 0; i < absolutePaths.Length; i++)
{
Debug.Log("prefab name: " + absolutePaths[i]);
foreach (var VARIABLE in tempReplaceDict)
{
string oldValue = reverse ? VARIABLE.Value : VARIABLE.Key;
string newValue = reverse ? VARIABLE.Key : VARIABLE.Value;
ReplaceValue(absolutePaths[i], oldValue, newValue);
}
EditorUtility.DisplayProgressBar("处理预制体……", "处理预制体中……", (float)i / absolutePaths.Length);
}
EditorUtility.ClearProgressBar();
}
/// <summary>
/// 替换值
/// </summary>
/// <param name="strFilePath">文件路径</param>
static void ReplaceValue(string strFilePath, string oldLine, string newLine)
{
if (File.Exists(strFilePath))
{
string[] lines = File.ReadAllLines(strFilePath);
for (int i = 0; i < lines.Length; i++)
{
lines[i] = lines[i].Replace(oldLine, newLine);
}
File.WriteAllLines(strFilePath, lines);
}
}
[MenuItem("Axibug移植工具/[5]UnPack所有嵌套预制体和场景中的预制体")]
public static void UnpackPrefabs()
{
#if UNITY_2018_4_OR_NEWER
GoTAxiProjectToolsSence();
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
int prefabCount = 0;
foreach (string path in allAssetPaths)
{
if (Path.GetExtension(path).Equals(".prefab"))
{
Debug.Log($"Unpacking {path}");
UnpackPrefab(path);
prefabCount++;
}
}
Debug.Log($"{prefabCount}个预制体Unpack");
string[] sceneGuids = AssetDatabase.FindAssets("t:scene");
foreach (string guid in sceneGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
if (path.Contains(toolSenceName))
continue;
EditorSceneManager.OpenScene(path);
Scene currentScene = SceneManager.GetActiveScene();
GameObject[] rootObjects = currentScene.GetRootGameObjects();
foreach (GameObject rootObj in rootObjects)
{
// 遍历场景中的所有对象
TraverseHierarchy(rootObj);
}
// Save the scene // 获取当前打开的场景
currentScene = EditorSceneManager.GetActiveScene();
// 保存场景到文件(默认路径和名称)
bool success = EditorSceneManager.SaveScene(currentScene, currentScene.path);
Debug.Log($"{currentScene.name}场景中 所有物体Unpack");
}
GoTAxiProjectToolsSence();
Debug.Log("<Color=#FFF333>处理完毕 [5]UnPack所有预制体</color>");
#else
Debug.Log("低版本不要执行本函数");
#endif
}
static void UnpackPrefab(string prefabPath)
{
#if UNITY_2018_4_OR_NEWER
GameObject prefabInstance = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
if (prefabInstance == null)
{
Debug.LogError($"Failed to load prefab at path: {prefabPath}");
return;
}
var obj = GameObject.Instantiate(prefabInstance, null);
TraverseHierarchy(obj);
PrefabUtility.SaveAsPrefabAsset(obj, prefabPath);
GameObject.DestroyImmediate(obj);
#else
Debug.Log("低版本不要执行本函数");
#endif
}
static void TraverseHierarchy(GameObject obj)
{
#if UNITY_2018_4_OR_NEWER
// 检查该对象是否是预制体的实例
if (PrefabUtility.IsPartOfPrefabInstance(obj))
{
// 将预制体实例转换为普通游戏对象
PrefabUtility.UnpackPrefabInstance(obj, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
Debug.Log("Prefab instance converted to game object: " + obj.name);
}
// 递归遍历子对象
for (int i = 0; i < obj.transform.childCount; i++)
{
TraverseHierarchy(obj.transform.GetChild(i).gameObject);
}
#else
Debug.Log("低版本不要执行本函数");
#endif
}
[MenuItem("Axibug移植工具/[6]Sprite")]
public static void FixMultipleMaterialSprites()
{
string[] guids = AssetDatabase.FindAssets("t:sprite");
List<Sprite> spritesToFix = new List<Sprite>();
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
Sprite sprite = AssetDatabase.LoadAssetAtPath<Sprite>(path);
// 检查是否有多个材质
if (IsUsingMultipleMaterials(sprite))
{
spritesToFix.Add(sprite);
Debug.Log("Found sprite with multiple materials: " + path);
}
}
// 修复每个找到的Sprite
foreach (var sprite in spritesToFix)
{
FixSprite(sprite);
}
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("<Color=#FFF333>处理完毕 [6]修复Sprite</color>");
}
private static bool IsUsingMultipleMaterials(Sprite sprite)
{
if (sprite == null) return false;
// 获取精灵的材质
var textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(sprite)) as TextureImporter;
return textureImporter != null && textureImporter.spriteImportMode == SpriteImportMode.Multiple;
}
private static void FixSprite(Sprite sprite)
{
// 获取Sprite的路径
string path = AssetDatabase.GetAssetPath(sprite);
var textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
if (textureImporter != null)
{
// 保存当前切割信息
SpriteMetaData[] originalMetaData = textureImporter.spritesheet;
// 临时禁用Sprite导入
textureImporter.spriteImportMode = SpriteImportMode.None;
textureImporter.SaveAndReimport();
// 重新启用Sprite导入并保持原样切割参数
textureImporter.spriteImportMode = SpriteImportMode.Multiple;
textureImporter.spritesheet = originalMetaData; // 恢复原来的切割信息
// 重新导入以应用更改
textureImporter.SaveAndReimport();
}
}
}
#endif

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 01c95f5e03a338749b54784eb6420d04

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 97287d4650544eb4daa041e4a384a06b
guid: 11a59d59d152c214bb99a09f4d795c21
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
serializedVersion: 10
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
@ -38,13 +38,12 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
serializedVersion: 13
m_BakeOnSceneLoad: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@ -67,9 +66,6 @@ LightmapSettings:
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
@ -89,22 +85,22 @@ LightmapSettings:
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringGaussRadiusIndirect: 1
m_PVRFilteringGaussRadiusAO: 1
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
@ -117,13 +113,13 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &708549044
--- !u!1 &1760378052
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -131,8 +127,100 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 708549046}
- component: {fileID: 708549045}
- component: {fileID: 1760378055}
- component: {fileID: 1760378054}
- component: {fileID: 1760378053}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1760378053
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760378052}
m_Enabled: 1
--- !u!20 &1760378054
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760378052}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1760378055
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760378052}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1948026923
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1948026925}
- component: {fileID: 1948026924}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
@ -140,17 +228,16 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &708549045
--- !u!108 &1948026924
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708549044}
m_GameObject: {fileID: 1948026923}
m_Enabled: 1
serializedVersion: 10
serializedVersion: 11
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
@ -200,225 +287,30 @@ Light:
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ForceVisible: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &708549046
m_LightUnit: 1
m_LuxAtDistance: 1
m_EnableSpotReflector: 1
--- !u!4 &1948026925
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708549044}
m_GameObject: {fileID: 1948026923}
serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1232273651
GameObject:
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1232273654}
- component: {fileID: 1232273653}
- component: {fileID: 1232273652}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1232273652
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1232273651}
m_Enabled: 1
--- !u!20 &1232273653
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1232273651}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1232273654
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1232273651}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1359344831
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1359344834}
- component: {fileID: 1359344833}
- component: {fileID: 1359344832}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1359344832
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1359344831}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1359344833
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1359344831}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1359344834
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1359344831}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &4232056520998800727
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536013, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_Name
value: NesEmulator
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
m_Roots:
- {fileID: 1760378055}
- {fileID: 1948026925}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8cc6e346f997e294c9dcea50436c1757
guid: f578c65afd0d1c84b9b59664106fab66
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,9 +1,9 @@
{
"name": "AxibugEmuOnline.Editor",
"rootNamespace": "AxibugEmuOnline.Editors",
"references": [
"AxibugEmuOnline.Client"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
@ -12,5 +12,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -1,6 +1,8 @@
using AxibugEmuOnline.Client;
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
namespace AxibugEmuOnline.Editors
{
[CustomEditor(typeof(CommandDispatcher))]
@ -13,8 +15,8 @@ namespace AxibugEmuOnline.Editors
if (!Application.isPlaying) return;
var dispacather = target as CommandDispatcher;
dispacather.GetRegisters(out var normal, out var solo);
IReadOnlyList<CommandExecuter> normal; IReadOnlyList<CommandExecuter> solo;
dispacather.GetRegisters(out normal, out solo);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.LabelField("NORMAL");

View File

@ -0,0 +1,3 @@
{
"name": "AxiReplay"
}

View File

@ -60,7 +60,7 @@ namespace AxiReplay
if (!bNetInit)
{
data = default(ReplayStep);
frameDiff = default;
frameDiff = default(int);
inputDiff = false;
return false;
}
@ -73,7 +73,7 @@ namespace AxiReplay
if (!bNetInit)
{
data = default(ReplayStep);
frameDiff = default;
frameDiff = default(int);
inputDiff = false;
return false;
}

View File

@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace AxiReplay
{
public class ReplayWriter : IReplayWriter
{
public ReplayData.ReplayFormat mFormat { get; private set; }
public Encoding TexEncoding { get; private set; }
ReplayHandler handler;
string mTitle;
string mNote;
int mAllFrame;
int mAllTime;
long mData;
int mSingleInputLenght;
int mSingleDataLenght;
MemoryStream mStream;
BinaryWriter mBinaryWriter;
int mCurrFrame;
UInt64 mCurrInput;
ReplayStep wirteStep;
List<string> dbgList = new List<string>();
public ReplayWriter(string Title, string Note, ReplayData.ReplayFormat format, Encoding encoding)
{
mTitle = Title;
mNote = Note;
TexEncoding = encoding;
mFormat = format;
switch (mFormat)
{
case ReplayData.ReplayFormat.FM32IP64: mSingleInputLenght = sizeof(UInt64); break;
case ReplayData.ReplayFormat.FM32IP32: mSingleInputLenght = sizeof(UInt32); break;
case ReplayData.ReplayFormat.FM32IP16: mSingleInputLenght = sizeof(UInt16); break;
case ReplayData.ReplayFormat.FM32IPBYTE: mSingleInputLenght = sizeof(byte); break;
}
mSingleDataLenght = (sizeof(UInt32)) + mSingleInputLenght;
mStream = new MemoryStream();
mBinaryWriter = new BinaryWriter(mStream);
mCurrFrame = -1;
mCurrInput = int.MaxValue;
wirteStep = new ReplayStep();
dbgList.Clear();
}
int byFrameIdx = 0;
/// <summary>
/// 往前推进帧的,指定帧下标
/// </summary>
/// <param name="frameInput"></param>
public void NextFramebyFrameIdx(int FrameID, UInt64 frameInput)
{
TakeFrame(FrameID - byFrameIdx, frameInput);
byFrameIdx = FrameID;
}
/// <summary>
/// 往前推进1帧的Input
/// </summary>
/// <param name="frameInput"></param>
public void NextFrame(UInt64 frameInput)
{
TakeFrame(1, frameInput);
}
/// <summary>
/// 往前推进指定帧数量的Input
/// </summary>
/// <param name="frameInput"></param>
public void TakeFrame(int addFrame, UInt64 frameInput)
{
if (addFrame < 0)
{
}
mCurrFrame += addFrame;
if (mCurrInput == frameInput)
return;
mCurrInput = frameInput;
wirteStep.FrameStartID = mCurrFrame;
wirteStep.InPut = mCurrInput;
dbgList.Add($"{mCurrFrame} | {mCurrInput}");
switch (mFormat)
{
case ReplayData.ReplayFormat.FM32IP64:
mBinaryWriter.Write(wirteStep.FrameStartID);
mBinaryWriter.Write(wirteStep.InPut);
break;
case ReplayData.ReplayFormat.FM32IP32:
mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 4);
break;
case ReplayData.ReplayFormat.FM32IP16:
mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 2);
break;
case ReplayData.ReplayFormat.FM32IPBYTE:
mBinaryWriter.Write(BitConverter.GetBytes(wirteStep.All64Data), 0, 4 + 1);
break;
}
}
public void SaveData(string path, bool bWithDump = false, string dumppath = null)
{
byte[] titleData; int titleLenghtWithEnd;
ReplayData.GetStringByteData(mTitle, out titleData, out titleLenghtWithEnd, TexEncoding);
byte[] noteData; int noteLenghtWithEnd;
ReplayData.GetStringByteData(mNote, out noteData, out noteLenghtWithEnd, TexEncoding);
ReplayHandler handler = new ReplayHandler();
handler.Format = (int)this.mFormat;
handler.DataOffset = ReplayData.HandlerLenght;
handler.CreateTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
handler.AllFrame = wirteStep.FrameStartID;
handler.SingleLenght = mSingleDataLenght;
using (FileStream fs = new FileStream(path, FileMode.Create))
{
using (BinaryWriter bw = new BinaryWriter(fs))
{
//写入Handler
bw.Write(ReplayData.GetHandlerData(handler));
//写入Data
bw.Write(mStream.ToArray());
}
}
if (bWithDump)
{
List<string> temp = new List<string>();
temp.Add($"Format => {handler.Format}");
temp.Add($"DataOffset => {handler.DataOffset}");
temp.Add($"CreateTime => {handler.CreateTime}");
temp.Add($"AllFrame => {handler.AllFrame}");
temp.Add($"SingleLenght => {handler.SingleLenght}");
dbgList.InsertRange(0, temp);
File.WriteAllLines(dumppath, dbgList);
}
}
public void Dispose()
{
mStream.Dispose();
mBinaryWriter.Dispose();
//TODO
}
}
}

Some files were not shown because too many files have changed in this diff Show More