Project unity version: 2020.3.18f1
XIL version: commissions on Oct 26, 2021
GameFramework version: commitments on Sep 28, 2021
UnityGameFramework version: commissions on Oct 28, 2021
StarForce version: commissions on Aug 9, 2021
HFS version: 2.3
Project cloning:
StarForce clone Repository: https://github.com/EllanJiang/StarForce
UnityGameFramework clone Repository: https://github.com/EllanJiang/UnityGameFramework
GameFramework clone Repository: https://github.com/EllanJiang/GameFramework
GameFramework user manual to see the source code
StartForce source code configuration
1. Put the UnityGameFramework in StarForce\Assets\GameFramework
2. In StarForce\Assets\GameFramework\UnityGameFramework\Libraries, replace the dll with the GameFramework content. An error will be reported and the namespace reference is missing. Right click the Libraries directory Assembly Definition to generate an assembly named GameFramework, find UnityGameFramework.Editor and UnityGameFramework.Runtime, add a reference to the GameFramework assembly, and the error will disappear.
3. Check whether the unsafe code is ticked.
Simulate remote AB hot configuration
HFS virtual file server
HFS download address: HFS
AB configuration
The packaged directory structure is like this
Create a file named version.txt in the AB directory and check the AB configuration with json protocol. It is best to open the VersiongInfo.cs script to configure this file. After all, I don't know the code change. If I just copy my field, I have to fill in this hole.
namespace StarForce { public class VersionInfo { // Do you need to force the update of the game app public bool ForceUpdateGame { get; set; } // Latest game version number public string LatestGameVersion { get; set; } // Latest game build number public int InternalGameVersion { get; set; } // Latest resource build number public int InternalResourceVersion { get; set; } // Resource update download address public string UpdatePrefixUri { get; set; } // Resource version list length public int VersionListLength { get; set; } // Resource version list hash value public int VersionListHashCode { get; set; } // Compressed length of resource version list public int VersionListCompressedLength { get; set; } // Compressed hash value of resource version list public int VersionListCompressedHashCode { get; set; } } }
The VersionList data here is based on StarForce\AB\BuildReport StarForce \ ab \ buildreport \ 0_ 1_ 0_ XX \ buildlog.txt _1_0_XX\BuildLog.txt found
{ "ForceGameUpdate":false,//Force update "LatestGameVersion":"0.1.0",//Latest game version number "InternalGameVersion":1,//Latest game build number "InternalResourceVersion":3,//Latest resource build number "UpdatePrefixUri":"http://10.23.48.21/Windows64 ", / / server resource update address "VersionListLength":7104,//Specifically refers to the size of the GameFrameworkVersion.xxxxx.dat file "VersionListHashCode":2063015162,//GameFrameworkVersion.xxxxx.dat file hash "VersionListCompressedLength":2559,//Specifically refers to the compressed size of the GameFrameworkVersion.xxxxx.dat file "VersionListCompressedHashCode":-131527863,//Compressed hash of GameFrameworkVersion.xxxxx.dat file "END_OF_JSON":""//Terminator }
Open the file StarForce\Assets\GameMain\Configs\BuildInfo.txt
{ "GameVersion": "0.1.0",//Latest game version number "InternalGameVersion": 0,//Latest game build number "CheckVersionUrl": "http://10.23.48.21/Version.txt ", / / server file version.txt address "WindowsAppUrl": "http://10.23.48.21/Windows64",//win resource server "MacOSAppUrl": "https://starforce.gameframework.cn",//macOS resource server "IOSAppUrl": "https://starforce.gameframework.cn",//ios resource server "AndroidAppUrl": "https://starforce.gameframework.cn",//android resource server "END_OF_JSON": "" }
Open HFS.exe and store Window64 and version.txt files in the full directory
Check whether all procedures are ticked
Remove the Editor Resource Mode check box
Package run.
Code hotter
XIL warehouse address: XIL
XIL user manual, see the official documents and source code
Configure XIL for StartForce
1. Put the three directories of Demo, hotScripts and XIL into the StartForce/Assets directory
2. Create a new HotProject in the StartForce directory ~ put the Hot directory, DyncDll.csproj file and Hot.sln solution in the XIL directory
Fix compilation errors
1.Hot.sln solution. Look at the dll reference in the solution. If the yellow warning is reported, it needs to be repaired,
2. Open DyncDLL.csproj file and modify the dependent path.
3. How to repair it? How to know what needs to be done and what doesn't need to be done. I adhere to the consistent principle and add it when necessary, such as Analytics (player data embedding point interface), Newtonsoft.Json (json tool), Purchasing.Common, UntiyEngine.Purchasing (IAP internal purchase payment interface), etc. I can directly delete them. I can modify the corresponding path of the machine if necessary.
4. The editor runs the demo to fix strange errors
5. Make preparations before the test.
1. In which GF process should the dll be loaded?
Procedure preload.preloadresource to load resources.
private void PreloadResources() { // Preload configs LoadConfig("DefaultConfig"); // Preload data tables foreach (string dataTableName in DataTableNames) { LoadDataTable(dataTableName); } // Preload dictionaries LoadDictionary("Default"); // Preload fonts LoadFont("MainFont"); LoadDLL("DyncDll"); //GameEntry.Procedure.gameObject.AddComponent<HelloWorld>(); } private void LoadDLL(string dllName) { string dllAssetName = AssetUtility.GetDLLAsset(dllName, false); //Debug.Log(dllAssetName); GameFrameworkLog.Debug("dll:{0}",dllAssetName); m_LoadedFlag.Add(dllAssetName, false); GameEntry.Resource.LoadBinary(dllAssetName, new LoadBinaryCallbacks( (assetName, asset, duration, userData) => { m_LoadedFlag[dllAssetName] = true; GameFrameworkLog.Debug(asset); GameFrameworkLog.Debug(userData); GameFrameworkLog.Debug(duration); GameFrameworkLog.Debug(assetName); #if USE_HOT wxb.hotMgr.DLL = asset; wxb.hotMgr.isGF = true; #endif HelloWorld hellowrod = GameEntry.WebRequest.gameObject.AddComponent<HelloWorld>(); Debug.Log(asset); }, (assetName, status, errorMessage, userData) => { Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", dllAssetName, assetName, errorMessage); })); }
2. In what form does DLL type AB package?
Change DyncDll.dll to DyncDll.dll.bytes
Package and load in the form of Load From Binary.
3. What form of domain can Xil support now?
The demo example supports file loading. The GF loading framework of client packaged exe needs to be added to load the adapter with byte [].
byte[] dll { get; set; } public EditorResLoadRuntime(byte[] dll) { this.dll = dll; } public Stream GetStream() { return new MemoryStream(dll); }
The complete code will be uploaded to the github repository
Warehouse address: GF-XIL
1. Install hfs and put the packaged resources and version.txt on it.
2. Change the UpdatePrefixUri of version.txt to your own ip address
3. Change the ip in BuildInfo file to your own ip address
4. Put the StarForce Launcher, Main and Menu scenarios into BuildSettings and package an exe that can run
5. If you want to run the demo in the editor, click Hotfix inject in Editor.
Starfrom + Xil integration summary
It took a day to get out and run. In the middle, because of the lack of documents, I have to gnaw the source code, and the progress is really slow.
Fortunately, we added a group, and everyone answered very warmly. Because there was a time difference between Q & A and made low-level mistakes, he delusionally gave dll AB package directly,
For this reason, the configuration and source code are also changed (unity can't package unrecognized assets (maybe the underlying packaging source code can be changed)). I don't deserve MD, hahaha.
In general, the online documents are detailed, and some details may be outdated. You still need to interrupt more and run the source code.