예제 #1
0
        protected override void OnPreRender(EventArgs e)
        {
            using (new DNNContext(this))
            {
                try
                {
                    base.OnPreRender(e);

                    var menuStyle = GetStringSetting("MenuStyle");
                    if (String.IsNullOrEmpty(menuStyle))
                    {
                        menu = null;
                        return;
                    }

                    var menuSettings = new Settings
                    {
                        MenuStyle         = GetStringSetting("MenuStyle"),
                        NodeXmlPath       = GetStringSetting("NodeXmlPath"),
                        NodeSelector      = GetStringSetting("NodeSelector"),
                        IncludeContext    = GetBoolSetting("IncludeContext"),
                        IncludeHidden     = GetBoolSetting("IncludeHidden"),
                        IncludeNodes      = GetStringSetting("IncludeNodes"),
                        ExcludeNodes      = GetStringSetting("ExcludeNodes"),
                        NodeManipulator   = GetStringSetting("NodeManipulator"),
                        TemplateArguments =
                            DDRMenu.Settings.TemplateArgumentsFromSettingString(GetStringSetting("TemplateArguments")),
                        ClientOptions =
                            DDRMenu.Settings.ClientOptionsFromSettingString(GetStringSetting("ClientOptions"))
                    };

                    MenuNode rootNode = null;
                    if (String.IsNullOrEmpty(menuSettings.NodeXmlPath))
                    {
                        rootNode =
                            new MenuNode(
                                Localiser.LocaliseDNNNodeCollection(
                                    Navigation.GetNavigationNodes(
                                        ClientID,
                                        Navigation.ToolTipSource.None,
                                        -1,
                                        -1,
                                        DNNAbstract.GetNavNodeOptions(true))));
                    }

                    menu          = MenuBase.Instantiate(menuStyle);
                    menu.RootNode = rootNode;
                    menu.ApplySettings(menuSettings);

                    menu.PreRender();
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
            }
        }
예제 #2
0
        public void ExpectSettingDefaultLanguageToSucceed()
        {
            ExpectLocaliserToInitialise();

            Assert.IsTrue(Localiser.OverrideDefaultCulture("fr"));

            Assert.IsTrue(Localiser.RevertToDefaultCulture());

            Assert.AreEqual("fr", Localiser.CurrentLocale.Name);
        }
예제 #3
0
        public void ExpectSwitchingToValidLanguageToWork()
        {
            ExpectLocaliserToInitialise();

            Assert.IsTrue(Localiser.SwitchCulture("fr"));

            Assert.AreEqual("Bonjour", TestLoc.Get(TestKeys.Test.Hello));
            Assert.AreEqual("Merci", TestLoc.Get(TestKeys.Test.ThankYou));
            Assert.AreEqual("Au revoir", TestLoc.Get(TestKeys.Test.Goodbye));
        }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        paused = false;

        foreach (var item in new GameObject[] { resumetext, mainmenutext })
        {
            Localiser.LocaliseUIElement(item.GetComponent <Text>());
            item.SetActive(false);
        }
    }
        // Autogenerated code: please make changes to the template file and re-generate
        public static bool Get(int key, out string target)
        {
            if (!Localiser.GetLocalisedString(key, out target))
            {
                target = string.Empty;
                return(false);
            }

            return(true);
        }
예제 #6
0
 void Start()
 {
     foreach (var item in new GameObject[] { gameOverText, scoreText, textTryAgain, textMainMenu })
     {
         Localiser.LocaliseUIElement(item.GetComponent <Text>());
         item.SetActive(false);
     }
     formatText = scoreText.GetComponent <Text>().text;
     buttonTryAgain.SetActive(false);
     buttonMainMenu.SetActive(false);
 }
예제 #7
0
 void Start()
 {
     s  = this;
     rt = GetComponent <RectTransform>();
     t  = GetComponent <Text>();
     HighscoreRecttr = Highscore.GetComponent <RectTransform>();
     lang            = Localiser.GetString("score");
     hilang          = Localiser.GetString("hiscore");
     scoreDirty      = true;
     storedHiscore   = GetHighscore();
     initHiscore     = storedHiscore;
     Highscore.text  = $"<size=40>{hilang}</size> {ScoreString(storedHiscore)}";
 }
예제 #8
0
        protected override void OnPreRender(EventArgs e)
        {
            using (new DNNContext(this))
            {
                try
                {
                    base.OnPreRender(e);

                    menu = MenuBase.Instantiate(MenuStyle);
                    menu.ApplySettings(
                        new Settings
                    {
                        MenuStyle         = MenuStyle,
                        NodeXmlPath       = NodeXmlPath,
                        NodeSelector      = NodeSelector,
                        IncludeContext    = IncludeContext,
                        IncludeHidden     = IncludeHidden,
                        IncludeNodes      = IncludeNodes,
                        ExcludeNodes      = ExcludeNodes,
                        NodeManipulator   = NodeManipulator,
                        ClientOptions     = ClientOptions,
                        TemplateArguments = TemplateArguments
                    });

                    if (String.IsNullOrEmpty(NodeXmlPath))
                    {
                        menu.RootNode =
                            new MenuNode(
                                Localiser.LocaliseDNNNodeCollection(
                                    Navigation.GetNavigationNodes(
                                        ClientID,
                                        Navigation.ToolTipSource.None,
                                        -1,
                                        -1,
                                        DNNAbstract.GetNavNodeOptions(true))));
                    }

                    menu.PreRender();
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
            }
        }
    void Awake()
    {
        Application.runInBackground = true;

        largestRes = Screen.resolutions[0];
        foreach (Resolution res in Screen.resolutions)
        {
            if (res.width > largestRes.width)
            {
                largestRes = res;
            }
        }
        autosaveLocation = Application.persistentDataPath + "/autosave.chart";

        viewMode = ViewMode.Chart;
        editor   = ChartEditor.Instance;

#if !UNITY_EDITOR
        workingDirectory = DirectoryHelper.GetMainDirectory();
#else
        workingDirectory = Application.dataPath;
#endif
        // Bass init
        string audioInitErr = string.Empty;
        if (!AudioManager.Init(out audioInitErr))
        {
            editor.errorManager.QueueErrorMessage(audioInitErr);
        }

        LoadGameSettings();
        Localiser.LocaliseScene();

        localEvents  = LoadCommonEvents("local_events.txt");
        globalEvents = LoadCommonEvents("global_events.txt");

        InputField[] allInputFields = Resources.FindObjectsOfTypeAll <InputField>();
        foreach (InputField inputField in allInputFields)
        {
            inputField.gameObject.AddComponent <InputFieldDoubleClick>();
        }

        HintMouseOver.style = hintMouseOverStyle;
    }
예제 #10
0
    void Close(bool rebindSuccess)
    {
        this.device = null;
        if (!rebindSuccess && rebinder != null)
        {
            rebinder.RevertMapBeingRebound();
        }

        rebinder = null;
        gameObject.SetActive(false);
        rebindCompleteEvent.Fire();

        if (ChartEditor.Instance)
        {
            ChartEditor.Instance.uiServices.SetPopupBlockingEnabled(false);
        }

        Localiser.LocaliseScene();
    }
        public void Bind(DNNNodeCollection objNodes, bool localise)
        {
            var clientOptions = new List <ClientOption>();

            var ignoreProperties = new List <string>
            {
                "CustomAttributes",
                "NavigationControl",
                "SupportsPopulateOnDemand",
                "NodeXmlPath",
                "NodeSelector",
                "IncludeContext",
                "IncludeHidden",
                "IncludeNodes",
                "ExcludeNodes",
                "NodeManipulator"
            };

            foreach (var prop in
                     typeof(NavigationProvider).GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance))
            {
                if (!string.IsNullOrEmpty(prop.Name) && !ignoreProperties.Contains(prop.Name))
                {
                    var propValue = prop.GetValue(this, null);
                    if (propValue != null)
                    {
                        if (propValue is bool)
                        {
                            clientOptions.Add(new ClientBoolean(prop.Name, propValue.ToString()));
                        }
                        else if (propValue is int || propValue is decimal || propValue is double)
                        {
                            clientOptions.Add(new ClientNumber(prop.Name, propValue.ToString()));
                        }
                        else
                        {
                            clientOptions.Add(new ClientString(prop.Name, propValue.ToString()));
                        }
                    }
                }
            }

            if (CustomAttributes != null)
            {
                foreach (var attr in CustomAttributes)
                {
                    if (!string.IsNullOrEmpty(attr.Name))
                    {
                        clientOptions.Add(new ClientString(attr.Name, attr.Value));
                    }
                }
            }

            if (localise)
            {
                objNodes = Localiser.LocaliseDNNNodeCollection(objNodes);
            }

            menuControl.RootNode         = new MenuNode(objNodes);
            menuControl.SkipLocalisation = !localise;
            menuControl.MenuSettings     = new Settings
            {
                MenuStyle         = GetCustomAttribute("MenuStyle") ?? MenuStyle ?? "DNNMenu",
                NodeXmlPath       = GetCustomAttribute("NodeXmlPath"),
                NodeSelector      = GetCustomAttribute("NodeSelector"),
                IncludeContext    = Convert.ToBoolean(GetCustomAttribute("IncludeContext") ?? "false"),
                IncludeHidden     = Convert.ToBoolean(GetCustomAttribute("IncludeHidden") ?? "false"),
                IncludeNodes      = GetCustomAttribute("IncludeNodes"),
                ExcludeNodes      = GetCustomAttribute("ExcludeNodes"),
                NodeManipulator   = GetCustomAttribute("NodeManipulator"),
                ClientOptions     = clientOptions,
                TemplateArguments = TemplateArguments,
            };
        }
예제 #12
0
 private Program(GameData gameData, Localiser localiser)
 {
     this.gameData  = gameData;
     this.localiser = localiser;
 }
예제 #13
0
 /// <summary>
 /// Initialises the static object.
 /// </summary>
 static PluginLocalise()
 {
     _Localiser = new Localiser(typeof(VirtualRadar.Localisation.Strings));
     _Localiser.AddResourceStrings(typeof(FeedFilterStrings));
 }
예제 #14
0
 static Menu()
 {
     Localiser.ConfigureResourceType(typeof(Menu));
 }
예제 #15
0
 static Status()
 {
     Localiser.ConfigureResourceType(typeof(Status));
 }
예제 #16
0
 static Message()
 {
     Localiser.ConfigureResourceType(typeof(Message));
 }
예제 #17
0
 private Program(GameData gameData, Localiser localiser)
 {
     this.gameData = gameData;
     this.localiser = localiser;
 }
예제 #18
0
 /// <summary>
 /// Initialises the static object.
 /// </summary>
 static PluginLocalise()
 {
     _Localiser = new Localiser(typeof(VirtualRadar.Localisation.Strings));
     _Localiser.AddResourceStrings(typeof(DatabaseEditorStrings));
 }
예제 #19
0
 static UI()
 {
     Localiser.ConfigureResourceType(typeof(UI));
 }