com.vovgou.loxodon-framework-fody v2.6.6
Loxodon Framework Fody
Developed by Clark
Requires Unity 2018.4 or higher.
This is a plugin for static weaving code that integrates "PropertyChanged.Fody" into a Unity project, it can inject code which raises the PropertyChanged event into property setters of classes which implement "INotifyPropertyChanged".
Installation
Install via OpenUPM (recommended)
OpenUPM can automatically manage dependencies, it is recommended to use it to install the framework.
Requires nodejs's npm and openupm-cli, if not installed please install them first.
# Install openupm-cli,please ignore if it is already installed.
npm install -g openupm-cli
#Go to the root directory of your project
cd F:/workspace/New Unity Project
#Install loxodon-framework-fody
openupm add com.vovgou.loxodon-framework-fody
Install via Packages/manifest.json
Modify the Packages/manifest.json file in your project, add the third-party repository "package.openupm.com"'s configuration and add "com.vovgou.loxodon-framework-fody" in the "dependencies" node.
Installing the framework in this way does not require nodejs and openm-cli.
{
"dependencies": {
...
"com.unity.modules.xr": "1.0.0",
"com.vovgou.loxodon-framework-fody": "2.4.0"
},
"scopedRegistries": [
{
"name": "package.openupm.com",
"url": "https://package.openupm.com",
"scopes": [
"com.vovgou",
"com.openupm"
]
}
]
}
Install via git URL
After Unity 2019.3.4f1 that support path query parameter of git package. You can add https://github.com/vovgou/loxodon-framework.git?path=Loxodon.Framework/Assets/LoxodonFramework to Package Manager
Loxodon.Framework.Fody depends on Loxodon.Framework, please install Loxodon.Framework first.
Loxodon.Framework: https://github.com/vovgou/loxodon-framework.git?path=Loxodon.Framework/Assets/LoxodonFramework
Loxodon.Framework.Fody: https://github.com/vovgou/loxodon-framework.git?path=Loxodon.Framework.Fody/Assets/LoxodonFramework/Fody
Install via *.unitypackage file
Download Loxodon.Framework.unitypackage and Loxodon.Framework.Fody.unitypackage, import them into your project.
English manual
Quick Start
Add the assembly filenames that need to automatically weave "Notifity" code to the configuration file.
FodyWeavers.xml
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<AssemblyNames>
<Item>Assembly-CSharp</Item>
</AssemblyNames>
<PropertyChanged defaultWeaving ="true" />
</Weavers>
Create a User class in the project and add annotation "AddINotifyPropertyChangedInterface" to the class, as follows:
[AddINotifyPropertyChangedInterface]
public class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName => $"{FirstName} {LastName}";
}
After the project is compiled, use the ILSpy tool to view the assembly.the code of the User class is as follows, "PropertyChanged.Fody" weaves the INotifyPropertyChanged interface and related code for User.cs
public class User : INotifyPropertyChanged
{
public string FirstName
{
[CompilerGenerated]
get
{
return FirstName;
}
[CompilerGenerated]
set
{
if (!string.Equals(FirstName, value, StringComparison.Ordinal))
{
FirstName = value;
<>OnPropertyChanged(<>PropertyChangedEventArgs.FullName);
<>OnPropertyChanged(<>PropertyChangedEventArgs.FirstName);
}
}
}
public string LastName
{
[CompilerGenerated]
get
{
return LastName;
}
[CompilerGenerated]
set
{
if (!string.Equals(LastName, value, StringComparison.Ordinal))
{
LastName = value;
<>OnPropertyChanged(<>PropertyChangedEventArgs.FullName);
<>OnPropertyChanged(<>PropertyChangedEventArgs.LastName);
}
}
}
public string FullName => FirstName + " " + LastName;
[field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
[GeneratedCode("PropertyChanged.Fody", "3.4.1.0")]
[DebuggerNonUserCode]
protected void <>OnPropertyChanged(PropertyChangedEventArgs eventArgs)
{
this.PropertyChanged?.Invoke(this, eventArgs);
}
}
Contact Us
Email: yangpc.china@gmail.com
Website: https://vovgou.github.io/loxodon-framework/
QQ Group: 622321589