void OnEnable()
        {
            hideFlags = HideFlags.HideAndDontSave;

            if (_compileEngine == null)
            {
                _compileEngine = RexCompileEngine.Instance;
            }

            if (_texts == null)
            {
                _texts = RexStaticTextCollection.Instance;
            }

            if (_macros == null)
            {
                _macros = RexMacroHandler.LoadMacros();
            }

            RexISM.Repaint     = Repaint;
            RexISM.DebugLog    = Debug.Log;
            RexISM.ExecuteCode = Execute;
            RexISM.Enter_NoInput();

            updateSkins = true;
            minSize     = new Vector2(450f, 350f);
            autoRepaintOnSceneChange = true;
            titleContent.text        = "REX";
            titleContent.tooltip     = "Runtime Expressions";
        }
Exemple #2
0
        public void MacroTest()
        {
            var before = RexMacroHandler.LoadMacros();

            foreach (var item in before)
            {
                RexMacroHandler.Remove(item);
            }

            Assert.IsEmpty(RexMacroHandler.LoadMacros());
            Assert.AreEqual(new[] { "Lol" }, RexMacroHandler.Save("Lol"));
            Assert.AreEqual(new[] { "Lol" }, RexMacroHandler.LoadMacros());
            Assert.IsEmpty(RexMacroHandler.Remove("Lol"));
            Assert.IsEmpty(RexMacroHandler.LoadMacros());
            Assert.AreEqual(new[] { "Lol1" }, RexMacroHandler.Save("Lol1"));
            Assert.AreEqual(new[] { "Lol1", "Lol2" }, RexMacroHandler.Save("Lol2"));
            Assert.AreEqual(new[] { "Lol1", "Lol2", "Lol3" }, RexMacroHandler.Save("Lol3"));
            Assert.AreEqual(new[] { "Lol1", "Lol2", "Lol3" }, RexMacroHandler.LoadMacros());

            foreach (var item in before)
            {
                RexMacroHandler.Save(item);
            }
        }