Example #1
0
 void btn_OnPress(object sender, EventArgs e)
 {
     if (selectIndex >= 0 && selectIndex <= rulesList.Items.Count)
     {
         GameManager.ComponentReset();
         GameManager.AddGameScreen(RuleLoader.CreateRuleInstance(selectIndex));
     }
 }
Example #2
0
        public async Task LoadAndNextTest_LangtonsLoops()
        {
            Rule rule = await RuleLoader.LoadAsync("Langtons-Loops.table.txt");

            Assert.AreEqual(5, rule.Next(7, 0, 2, 5, 2));
            Assert.AreEqual(5, rule.Next(7, 2, 0, 2, 5));
            Assert.AreEqual(5, rule.Next(7, 5, 2, 0, 2));
            Assert.AreEqual(5, rule.Next(7, 2, 5, 2, 0));
        }
Example #3
0
 public void TestLoadInvalidRessource()
 {
     try
     {
         RuleLoader.LoadFromRessource("invalidName");
         Assert.Fail("ArgumentException expected");
     }
     catch (ArgumentException)
     {
     }
 }
Example #4
0
        public void TestSimpleGerman2()
        {
            Phonetizer p = new Phonetizer();

            p.Rules = RuleLoader.LoadFromRessource("phonet4n.Core.german_2.csv");
            Assert.AreEqual(919 * 3, p.Rules.Length);

            Assert.AreEqual("NEIA", p.Phonetize("Meier"));
            Assert.AreEqual("NEIA", p.Phonetize("Mayer"));
            Assert.AreEqual("FEIFA", p.Phonetize("Pfeiffer"));
            Assert.AreEqual("FEIFA", p.Phonetize("Pfeifer"));
        }
Example #5
0
        public void TestRecurringDigits_Strip()
        {
            Phonetizer p = new Phonetizer(false);

            p.Rules = RuleLoader.LoadFromRessource("phonet4n.Core.german_1.csv");
            Assert.AreEqual(919 * 3, p.Rules.Length);

            Assert.AreEqual("TEST01", p.Phonetize("Teest01"));
            Assert.AreEqual("TEST01", p.Phonetize("Teest001"));
            Assert.AreEqual("0123456789", p.Phonetize("00112233445566778899"));
            Assert.AreEqual("0", p.Phonetize("0000"));
        }
Example #6
0
    // Use this for initialization
    void Start()
    {
        instance = GameManager.instance;
        Assert.IsNotNull(instance, "Can not find Game Manger.");
        loader = FindObjectOfType <RuleLoader>();
        Assert.IsNotNull(loader, "Can not find Rule Loader.");
        setter = FindObjectOfType <RuleSetter>();
        Assert.IsNotNull(setter, "Can not find Rule Setter.");
        ui = FindObjectOfType <RuleUI>();
        Assert.IsNotNull(ui, "Can not find Rule UI.");

        GetComponent <Button>().onClick.AddListener(LoadRule);
    }
Example #7
0
        public void TestLoadRessources()
        {
            string[] res1 = RuleLoader.LoadFromRessource("phonet4n.Core.german_1.csv");
            Assert.AreEqual(RuleLoader.DefaultRules, res1);

            string[] csv1 = RuleLoader.LoadFromCSV("../../rules/german_1.csv");
            Assert.AreEqual(res1, csv1);

            string[] res2 = RuleLoader.LoadFromRessource("phonet4n.Core.german_2.csv");
            string[] csv2 = RuleLoader.LoadFromCSV("../../rules/german_2.csv");
            Assert.AreEqual(res2, csv2);

            Assert.AreNotEqual(res1, res2);
        }
Example #8
0
 public RuleSelectScreen()
 {
     BaseGame.ShowMouse = true;
     RuleLoader.Initial();
     string[] ruleLists = RuleLoader.GetRulesList();
     rulesList = new Listbox("rulelist", new Vector2(200, 150), new Point(400, 300), Color.WhiteSmoke, Color.Green);
     foreach (string rulename in ruleLists)
     {
         rulesList.AddItem(rulename);
     }
     rulesList.OnChangeSelection += new EventHandler(rulesList_OnChangeSelection);
     btn          = new TextButton("OkBtn", new Vector2(700, 500), "Begin", 0, Color.Blue);
     btn.OnClick += new EventHandler(btn_OnPress);
 }
Example #9
0
 // Start is called before the first frame update
 void Start()
 {
     instance = GameManager.instance;
     Assert.IsNotNull(instance, "Could not find Game Manager.");
     loader = GetComponent <RuleLoader>();
     Assert.IsNotNull(loader, "Could not find Rule Loader.");
     messenger = FindObjectOfType <RuleMessenger>();
     if (messenger == null)
     {
         Debug.Log("Could not find RuleMessenger.");
     }
     setter = GetComponent <RuleSetter>();
     Assert.IsNotNull(setter, "Could not find Rule Setter.");
     ui = GetComponent <RuleUI>();
     Assert.IsNotNull(ui, "Could not find Rule UI.");
 }
Example #10
0
 public DatabaseLint()
 {
     //Load all executables
     this.AllExecutables = RuleLoader.LoadRules();
     //Save standard config if none exist
     if (DBLint.Settings.IsNormalContext)
     {
         /*
          * if (!File.Exists(Settings.CONFIG_FILE))
          *  PropertyUtils.SaveProperties(this.AllExecutables.GetExecutables(), Settings.CONFIG_FILE);
          * PropertyUtils.LoadProperties(this.AllExecutables.GetExecutables(), Settings.CONFIG_FILE);
          */
     }
     this.RuleController = new RuleController();
     this.IssueCollector = new IssueCollector();
     this.Config         = new Configuration();
     this.ConfigFile     = new XMLConfigFile(Settings.XMLCONFIG);
 }
Example #11
0
        //Constructor, create run from config file
        public Run(IConfigFile config)
        {
            this.ConfigFile = config;

            //Load all executables
            this.Executables = RuleLoader.LoadRules();

            if (this.ConfigFile.IsValid())
            {
                //Configure executables
                this.configureRulesFromConfig();

                //Extract connection from config
                this.Connection = config.GetConnection();

                //Set RulesToRun from the config file and configure
                this.setRulesToRunFromConfig();
            }
        }
Example #12
0
    // Use this for initialization
    void Start()
    {
        instance = GameManager.instance;
        Assert.IsNotNull(instance, "Could not find Game Manager.");
        setter = GetComponent <RuleSetter>();
        Assert.IsNotNull(setter, "Could not find Rule Setter.");
        loader = panelLoad.GetComponent <RuleLoader>();
        Assert.IsNotNull(loader, "Could not find Rule Loader.");

        defaultColor = textRange.color;
        panelColor1  = panelRuleUse.GetComponent <Image>().color;
        panelColor2  = panelActivation.GetComponent <Image>().color;

        messenger = ruleMessenger.GetComponent <RuleMessenger>();

        if (instance.Rules.Count > 0)
        {
            buttonLoad.interactable = true;
        }
    }
Example #13
0
        public async Task LoadPlugin(Plugin plugin)
        {
            if (plugin.PluginType == PluginType.Driver)
            {
                var factories = PluginLoader.LoadSingle(_logger, plugin, _config);

                foreach (var factory in await factories)
                {
                    await _driverLoader.Load(factory, ServerInfo.BoardType);
                }
            }
            else if (plugin.PluginType == PluginType.Logic)
            {
                var factories = RuleLoader.LoadSingle(_logger, plugin, _config);

                foreach (var factory in await factories)
                {
                    await _logicLoader.Load(factory, ServerInfo.BoardType);
                }
            }

            _nodeTemplateCache.Clear();
        }
Example #14
0
 public Run()
 {
     this.Executables = RuleLoader.LoadRules();
     this.RulesToRun  = this.Executables.GetSchemaRules().Cast <IRule>().ToList();
     this.Connection  = new Connection();
 }
Example #15
0
        public void GivenNonXmlFile_RuleLoader_Throws()
        {
            var sut = new RuleLoader();

            sut.Invoking(x => x.GetEnabledRules(@"Common/Resources/input.txt")).Should().Throw <XmlException>();
        }
Example #16
0
        public async Task LoadTest_LangtonsLoops()
        {
            Rule rule = await RuleLoader.LoadAsync("Langtons-Loops.table.txt");

            Assert.AreEqual(857, rule.Count); //回転しても同じルールのものがあるので、219x4より少なくなる
        }
Example #17
0
 public static void Load()
 {
     RuleLoader.Load();
     PieceManager.Load();
     GameSaveManager.Load();
 }