Zenject

思考并回答以下问题:

Hello World Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Zenject;
using UnityEngine;
using System.Collections;

public class TestInstaller : MonoInstaller
{
public override void InstallBindings()
{
Container.Bind<string>().FromInstance("Hello World");
Container.Bind<Greeter>().AsSingle().NonLazy();
}
}

// Greeter 迎宾
public class Greeter
{
public Greeter(string message)
{
Debug.Log(message);
}
}
0%