Ejemplo n.º 1
0
        public void SetEntryAsRootTest()
        {
            // - Arrange
            var screenClass = Class <Screen> .Get();

            var screenResolver = new Mock <IScreenResolver>().Object;
            var screenEntry    = new ScreenEntry(screenClass, screenResolver);

            // - Act
            ((IScreenRegistrationConfig)screenEntry).AsRoot();

            // - Assert
            Assert.IsTrue(screenEntry.IsRoot);
        }
Ejemplo n.º 2
0
        public void DefaultScreenEntryTest()
        {
            var screenClass = Class <Screen> .Get();

            var screenResolver = new Mock <IScreenResolver>().Object;

            // - Act
            var screenEntry = new ScreenEntry(screenClass, screenResolver);

            // - Assert
            Assert.AreEqual(screenClass, screenEntry.ScreenClass);
            Assert.AreEqual(screenResolver, screenEntry.Resolver);
            Assert.IsFalse(screenEntry.IsRoot);
        }
Ejemplo n.º 3
0
    void Init()
    {
        mStartMem = new byte[1024 * 1024 * 20 * 8];
        mStartMem = null;
#if RUNTIME_DEBUG
        Reporter.Init();
#endif
        GameObject ui_parent = GameObject.Find("UI");
        MenuMrg.instance.SetTransform(ui_parent.transform);

        ScreenEntry screen = MenuMrg.instance.CreateMenu <ScreenEntry>();
        if (screen != null)
        {
            screen.ShowScreen();
        }
    }
Ejemplo n.º 4
0
        private void ProcessScreenRegister <T>(T screenPrefab, BaseLayer <T> layer) where T : IScreenController
        {
            Type        screenType = screenPrefab.GetType();
            ScreenEntry screenEntry;

            if (registeredScreens.TryGetValue(screenType, out screenEntry) == false)
            {
                Component prefabAsComponent = screenPrefab as Component;
                Component screenInstance    = Instantiate(prefabAsComponent, mainCanvas.transform);
                screenInstance.gameObject.SetActive(false);
                IScreenController screenController = (IScreenController)screenInstance;
                screenEntry = new ScreenEntry(screenPrefab, screenController);
                layer.RegisterScreen((T)screenEntry.ScreenInstance);
                layer.ReparentScreen(screenController, screenInstance.transform);
                registeredScreens.Add(screenType, screenEntry);
            }

            screenEntry.ReferenceCount++;
        }