MobileUO icon indicating copy to clipboard operation
MobileUO copied to clipboard

Upgrade MobileUO to CUO version 0.1.8.0

Open mandlar opened this issue 10 months ago • 1 comments

#24

This PR is bringing CUO up to version 0.1.8.0. I fixed a number of issues and bugs that came up from migrating CUO. This build seems to be fairly stable in both Unity Player and on my Android phone. There could potentially be issues I haven't discovered yet.

  • I flagged all changes from CUO with the // MobileUO: comment to make it easier to spot changes when upgrading from version to version
  • The assistant is still working, I kept the old Packet.cs class ONLY for the assistant so it wouldn't be broken. In the future, it should probably be re-written to use the new PacketHandler (or whatever it is in later CUO versions).
  • ScrollArea UI control was re-written, I split out the old version into AssistScrollArea and put it inside of the assistant so it wouldn't break anything. In the future, someone should re-write the assistant to not use the old ScrollArea control anymore
  • I added the CUO version number that MobileUO is based off of inside of CUOEnvironment.Version
  • Rendering code changed quite a bit in CUO. I had to make a few changes to get things working, mostly by keeping some of the old rendering code and mixing it in with the new camera code. Someone else can probably make it work correctly, but I'm not experienced enough in Unity/XNA/graphics to do it myself so I hacked the old and new bits together
    • had to set _use_render_target to true, otherwise the rendering was a bit broken with the new rendering system
    • the game window was deattached from the view port (it was rendering everything at 0,0 origin), so I adjusted that
    • Fixed a bunch of other boundary conditions/offsets, especially for mouse input and the viewport
    • Used old logic of WorldToScreen() and MouseToWorldPosition() for camera
    • Used older version of GetViewPort() for world rendering
    • SetDataPointerEXT() isn't implemented in our version of XNA, so I kept old versions of using the SetData() implementation
  • I reverted the recent PR for music as it was incorrectly playing the same song everywhere in Unity Player and Android. Will revisit in later CUO versions when we catch up to the original patch
  • The resource files (.resx for strings) cannot be included in the main Unity project as Unity won't load them. I had to create a separate csproj to build a dll JUST for the .resx files in order to get Unity to read them. This solution might change slightly later in 1.x when CUO's folder structure changes.

I think that sums up the highlights. At this point, I'll continue migrating CUO version by CUO version and fixing issues as they come up. Once we hit 1.x a lot of the project structure changes due to conversion to .NET Core from .NET Framework

mandlar avatar Jan 08 '25 05:01 mandlar

Wow, great work. I will run a smoke test of sorts on the branch and go over the changes to hopefully merge it in the next few days.

VoxelBoy avatar Jan 08 '25 12:01 VoxelBoy