Beispiel #1
0
        public static void GatherMenus(MenuManager instance)
        {
            Debug.Log("Adding RA3-Tweaks Menu...");
            MenuMain mainMenu = instance.menus.Where(m => m.name == "MenuMain").Select(m => m.GetComponentInChildren <MenuMain>()).First();

            if (mainMenu != null)
            {
                // Create the new tweaks menu from the asset bundle
                var tweakMenu = AssetsHandler.CreateAsset <GameObject>("MenuTweaks");
                tweakMenu.name = "MenuTweaks";
                tweakMenu.transform.GetChild(0).gameObject.AddComponent <MenuTweaks>();
                instance.AddNewMenu(tweakMenu);

                Debug.Log(mainMenu.mHeaderText.font);

                // Add a button on the main menu to open the tweak options
                var button = AssetsHandler.CreateAsset <Button>("MenuButton");
                button.onClick.AddListener(() =>
                {
                    Debug.Log("Opening Tweaks Menu...");
                    var menuBase       = tweakMenu.GetComponentInChildren <MenuBase>();
                    var gameLogic      = UnityEngine.Object.FindObjectOfType(typeof(GameLogic)) as GameLogic;
                    gameLogic.MainMode = global::GameLogic.MAINMODE.SETTINGS;
                    instance.Pop();
                    bool result = instance.Push("MenuTweaks");
                    Debug.Log(result);
                });

                button.transform.SetParent(mainMenu.transform, false);
            }
        }
Beispiel #2
0
        public void ProcessRequest_WhiteSpaceParamKey_ThrowsException()
        {
            var context = CreateContext(key: "   ");
            var cache   = CreateCache();

            var handler = new AssetsHandler(cache);

            handler.ProcessRequest(context);
        }
Beispiel #3
0
        public void ProcessRequest_IncorrectParamType_ThrowsException()
        {
            var context = CreateContext(type: "zzzz");
            var cache   = CreateCache();

            var handler = new AssetsHandler(cache);

            handler.ProcessRequest(context);
        }
Beispiel #4
0
        public void ProcessRequest_NoCachedKey_ThrowsException()
        {
            var context    = CreateContext();
            var emptyCache = CreateCache(key: null, content: null);

            var handler = new AssetsHandler(emptyCache);

            handler.ProcessRequest(context);
        }
Beispiel #5
0
        public void ProcessRequest_ValidSetup_WritesContent()
        {
            var context = CreateContext();
            var cache   = CreateCache();

            var handler = new AssetsHandler(cache);

            handler.ProcessRequest(context);

            Assert.That(_lastResponseWritten, Is.EqualTo("test-content"));
        }
Beispiel #6
0
        public void ProcessRequest_ValidSetup_SetsJavascriptContentType()
        {
            var context = CreateContext(type: "Javascript");
            var cache   = CreateCache();

            var handler = new AssetsHandler(cache);

            handler.ProcessRequest(context);

            Assert.That(_lastContentTypeSet, Is.EqualTo("application/javascript"));
        }
Beispiel #7
0
        public void ProcessRequest_ValidSetup_SetsCssContentType()
        {
            var context = CreateContext();
            var cache   = CreateCache();

            var handler = new AssetsHandler(cache);

            handler.ProcessRequest(context);

            Assert.That(_lastContentTypeSet, Is.EqualTo("text/css"));
        }