Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Latest commit

 

History

History
49 lines (38 loc) · 1.45 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.45 KB

NoesisGUIBindingsGenerator

A simple piece of code that helps generate .g.cs files for Unity3d

How to use

In NoesisPostprocessor.cs find a method called ScanDependencies(), in the bottom of the method body paste this code:

NoesisCsBindingsGenerator.GenerateCsFile(filename);

and you're good to go.

it will pump out code that looks like this:

/* This file has been generated automatically. All user changes will be overwritten if the XAML is changed. */
using Noesis;

namespace Assets.UI.Views.DesignerUI
{
    [UnityEngine.HideInInspector]
    public partial class DesignerMain : UserControl
    {
        internal Grid JustNormalGrid;
        internal UniformGrid MyUniformGrid;
        
        private void InitializeComponent()
        {
            GUI.LoadComponent(this, "Assets/UI/Views/DesignerUI/DesignerMain.xaml");
            
            this.JustNormalGrid = (Grid)FindName("JustNormalGrid");
            this.MyUniformGrid = (UniformGrid)FindName("MyUniformGrid");
        }
        
        protected override bool ConnectEvent(object source, string eventName, string handlerName)
        {
            if (source is UserControl && eventName == "Loaded" && handlerName == "DesignerMain_OnLoaded") {
                ((UserControl)source).Loaded += DesignerMain_OnLoaded;
                return true;
            }

            return false;
        }
    }
}

Forum Thread

https://www.noesisengine.com/forums/viewtopic.php?t=1670