Ejemplo n.º 1
0
    static void Init()
    {
        if (instance)
        {
            return;
        }
        instance = new GameObject("GameManager").AddComponent <GameManager>();
        DontDestroyOnLoad(instance);

        var types = new List <Type>(Implementors.GetTypes <GameSystem>());

        types.Sort((x, y) => ((int)x.GetCustomAttribute <Priority>()).CompareTo((int)y.GetCustomAttribute <Priority>()));

        AllGroups.Add(typeof(GameSystem), new Group <GameSystem>());

        foreach (var systemType in types)
        {
            var system = Activator.CreateInstance(systemType) as GameSystem;
            Group <GameSystem> .value.Add(system);

            foreach (var Interface in systemType.GetInterfaces())
            {
                if (!AllGroups.TryGetValue(Interface, out var group))
                {
                    AllGroups[Interface] = group = Activator.CreateInstance(typeof(Group <>).MakeGenericType(Interface)) as Group;
                }
                group.Add(system);
            }
        }

        foreach (var system in SystemsWith <IOnInitialize>())
        {
            system.OnInitialize();
        }
    }
 // DXCore-generated code...
 #region InitializePlugIn
 public override void InitializePlugIn()
 {
     base.InitializePlugIn();
     _implementors = new Implementors();
     //
     // TODO: Add your initialization code here.
     //
 }
Ejemplo n.º 3
0
        public Window(Implementors implementors)
        {
            switch (implementors)
            {
            case Implementors.XWindow:
                windowImp = new XWindowImp();
                break;

            case Implementors.PMWindow:
                windowImp = new PMWindowImp();
                break;
            }
        }