Skip to content

Commit

Permalink
修改NMO加载器无法加载某些关卡文件问题
Browse files Browse the repository at this point in the history
  • Loading branch information
imengyu committed Jul 4, 2022
1 parent 8e77dce commit 316950d
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 23 deletions.
9 changes: 6 additions & 3 deletions Assets/BallancePhysics/PhysicsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,18 @@ public static void PhysicsApiDestroy()
ballance_physics_entry(sFalse, IntPtr.Zero);
}

#if UNITY_EDITOR
[UnityEditor.MenuItem("Ballance/Physics/Open Console")]
public static void OpenConsole() {
ballance_physics_entry(3, IntPtr.Zero);
}
[UnityEditor.MenuItem("Ballance/Physics/Close Console")]
public static void CloseConsole() {
ballance_physics_entry(2, IntPtr.Zero);
}

#if UNITY_EDITOR
[UnityEditor.MenuItem("Ballance/Physics/Open Console")]
public static void MOpenConsole() { OpenConsole(); }
[UnityEditor.MenuItem("Ballance/Physics/Close Console")]
public static void MCloseConsole() { CloseConsole(); }
#endif
}
}
5 changes: 5 additions & 0 deletions Assets/BallancePhysics/Wapper/PhysicsEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public void Create()
PhysicsWorlds.Add(currentScenseIndex, this);
Handle = PhysicsApi.API.create_environment(Gravity, 1.0f / SimulationRate, -2147483647, layerNames.GetGroupFilterMasks(), Marshal.GetFunctionPointerForDelegate(callback));

if(fixedUpdateTicket != null)
{
fixedUpdateTicket.Unregister();
fixedUpdateTicket = null;
}
fixedUpdateTicket = GameManager.GameTimeMachine.RegisterFixedUpdate(_FixedUpdate, 15);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Game/Materials/Game/SkyLayer.mat
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Material:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 550bc03f31e06d54e80a12103627045c, type: 3}
m_Scale: {x: 2, y: 2}
m_Offset: {x: 0.23072791, y: 0.752728}
m_Offset: {x: 0.5966339, y: 0.118640065}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Game/PackageEntry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ return {
CoreUnload()
return true
end,
PackageVersion = 55,
PackageVersion = 60,
}
18 changes: 9 additions & 9 deletions Assets/Game/Scripts/Debug/ModulDebug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,42 +115,42 @@ function ModulCustomDebug()
stateText.text = 'Modul state tools:\n'..Modul_Instace.name..' state: '..state
end

button = ui.transform:Find('ButtonActive'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonActive'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Active()
UpdateText('Active')
end);
button = ui.transform:Find('ButtonDeactive'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonDeactive'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Deactive()
UpdateText('Deactive')
end);
button = ui.transform:Find('ButtonResetLevel'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonResetLevel'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Reset('levelRestart')
UpdateText('Reset levelRestart')
end);
button = ui.transform:Find('ButtonResetSector'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonResetSector'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Reset('sectorRestart')
UpdateText('Reset sectorRestart')
end);
button = ui.transform:Find('ButtonQuit'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonQuit'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
ui.gameObject:SetActive(false)
GameManager:QuitGame()
end);
button = ui.transform:Find('ButtonBackup'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonBackup'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Backup()
Game.UIManager:GlobalToast('Modul_Class:Backup() !')
end);
button = ui.transform:Find('ButtonCustom1'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonCustom1'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Custom(1)
Game.UIManager:GlobalToast('Modul_Class:Custom1() !')
end);
button = ui.transform:Find('ButtonCustom2'):GetComponent(UnityEngine.UI.Button)
button = ui.transform:Find('ButtonCustom2'):GetComponent(UnityEngine.UI.Button) ---@type Button
button.onClick:AddListener(function ()
Modul_Class:Custom(2)
Game.UIManager:GlobalToast('Modul_Class:Custom2() !')
Expand Down Expand Up @@ -179,7 +179,7 @@ function ModulCustomDebug()

UpdateText('Active')
--开始关卡
Game.Mediator:NotifySingleEvent("CoreGamePlayManagerInitAndStart")
Game.Mediator:NotifySingleEvent("CoreGamePlayManagerInitAndStart", nil)
end)
end)
end
1 change: 0 additions & 1 deletion Assets/Game/Scripts/GamePlay/BallSoundManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ end
---添加球碰撞声音组
---@param colId number 自定义碰撞层ID,为防止重复,请使用 GetSoundCollIDByName 使用名称获取ID
---@param data BallSoundCollData 碰撞数据
---@return number BallSoundCollData 碰撞数据
function BallSoundManager:AddSoundCollData(colId, data)
if self._SoundCollData[colId] ~= nil then
Log.E(TAG, 'AddSoundCollData failed because SoundCollData id: '..colId..' already added')
Expand Down
2 changes: 1 addition & 1 deletion Assets/Game/Scripts/GamePlay/SectorManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function SectorManager:Start()

self:ResetCurrentSector(n)
elseif type == 'reset-all' then
self:ResetAllSector()
self:ResetAllSector(true)
else
Log.W(TAG, 'Unknow option '..type)
return false
Expand Down
4 changes: 2 additions & 2 deletions Assets/Game/Scripts/Moduls/P_Extra_Point.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ P_Extra_Point = ModulBase:extend()
function P_Extra_Point:new()
P_Extra_Point.super.new(self)
self._Actived = false
self._RotDegree = 6
self._RotDegree = 3
self._Rotate = false
self._FlyUpTime = 0.4
self._FlyFollowTime = 0.3
Expand Down Expand Up @@ -178,7 +178,7 @@ function P_Extra_Point:StartFly()
end
end)
end
function P_Extra_Point:Update()
function P_Extra_Point:FixedUpdate()
--旋转小球
if self._Rotate then
self.P_Extra_Point_Ball1.transform:RotateAround(self._RotCenter, self._RotAxis1, self._RotDegree)
Expand Down
1 change: 1 addition & 0 deletions Assets/Game/Scripts/UI/KeypadUIManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function KeypadUIManager.AddKeypad(name, prefrab, image)
prefrab = prefrab,
image = image
}
return true
end
---获取已注册键盘,如果没有找到则返回nil
---@param name string 名称
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/MainScense.unity
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ MonoBehaviour:
DebugSetFrameRate: 1
DebugEnableLuaDebugger: 0
DebugLuaDebugger: 1
DebugType: 0
DebugType: 2
DebugInitPackages:
- Enable: 1
PackageName: core.sounds
Expand Down
6 changes: 3 additions & 3 deletions Assets/System/Scripts/Config/GameConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public static class GameConst
/// 游戏版本
/// </summary>
[LuaApiDescription("游戏版本")]
public const string GameVersion = "0.9.8";
public const string GameVersion = "0.9.9";
/// <summary>
/// 游戏编译版本
/// </summary>
[LuaApiDescription("游戏编译版本")]
public const int GameBulidVersion = 55;
public const int GameBulidVersion = 60;
/// <summary>
/// 游戏编译版本
/// </summary>
[LuaApiDescription("游戏编译版本")]
public const string GameBulidDate = "2022.06.22";
public const string GameBulidDate = "2022.07.05";

#region Unity 环境静态常量

Expand Down
3 changes: 3 additions & 0 deletions Assets/System/Scripts/Services/Init/GameSystemInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ private static void SysHandler(int act)
//初始化物理引擎
PhysicsApi.SecretKey = "666dccad4ae697b45aac145f18f49c5b";
PhysicsSystemInit.DoInit();

#endif
//if (GameEntry.Instance.DebugMode)
// PhysicsApi.OpenConsole();
}
else if (act == GameSystem.ACTION_DESTROY)
{
Expand Down
Binary file not shown.
Binary file modified VirtoolsNMOLoader/VirtoolsNMOLoader/Release/VirtoolsNMOLoader.iobj
Binary file not shown.
Binary file modified VirtoolsNMOLoader/VirtoolsNMOLoader/Release/VirtoolsNMOLoader.ipdb
Binary file not shown.
5 changes: 4 additions & 1 deletion VirtoolsNMOLoader/VirtoolsNMOLoader/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ BOOL _InitPlugins(CKPluginManager& iPluginManager, char* currentPath)
char PluginPath[_MAX_PATH];
char RenderPath[_MAX_PATH];
char ManagerPath[_MAX_PATH];
char BuildingBlocksPath[_MAX_PATH];

sprintf(BuildingBlocksPath, "%s%s", currentPath, "BuildingBlocks");
sprintf(PluginPath, "%s%s", currentPath, "Plugins");
sprintf(RenderPath, "%s%s", currentPath, "RenderEngines");
sprintf(ManagerPath, "%s%s", currentPath, "Managers");
Expand All @@ -48,6 +50,7 @@ BOOL _InitPlugins(CKPluginManager& iPluginManager, char* currentPath)
iPluginManager.ParsePlugins(RenderPath);
iPluginManager.ParsePlugins(ManagerPath);
iPluginManager.ParsePlugins(PluginPath);
iPluginManager.ParsePlugins(BuildingBlocksPath);
return TRUE;
}

Expand Down Expand Up @@ -176,7 +179,7 @@ EXTERN_C API_EXPORT void* Loader_SolveNmoFileRead(wchar_t* filePath, int *outErr
CKFile* f = VirtoolsContext->CreateCKFile();
DWORD res = CKERR_INVALIDFILE;
char* filePathAnsi = UnicodeToAnsi(filePath);
res = f->OpenFile(filePathAnsi, (CK_LOAD_FLAGS)(CK_LOAD_DEFAULT | CK_LOAD_CHECKDEPENDENCIES));
res = f->OpenFile(filePathAnsi, (CK_LOAD_FLAGS)(CK_LOAD_GEOMETRY | CK_LOAD_CHECKDEPENDENCIES));
delete filePathAnsi;
if (res != CK_OK) {
VirtoolsContext->DeleteCKFile(f);
Expand Down

0 comments on commit 316950d

Please sign in to comment.