public override PickTableGroup BuildPickTableGroup() { PickTableGroup pickTableGroup = new PickTableGroup(); PickTable pickTable = new PickTable("Pick Feature"); pickTable.PickItemList.Add(new PickItem { Name = "Prize_10", Value = 10 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_10", Value = 10 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_10", Value = 10 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_10", Value = 10 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_20", Value = 20 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_20", Value = 20 }); pickTable.PickItemList.Add(new PickItem { Name = "Prize_30", Value = 30 }); pickTable.PickItemList.Add(new PickItem { Name = "PickComplete", Trigger = new PaytableTrigger { Name = "Free Spins" } }); pickTableGroup.PickTable.Add(pickTable.Name, pickTable); return(pickTableGroup); }
public void TestPickTable() { var pick = new PickTable(); var result = pick.Parse(@"Table:v_cool:Schema:dbo:IsView:True:DatabaseType:MicrosoftSQLServer:Name:MyDb:Server=localhost\sqlexpress;Trusted_Connection=True;", 0); Assert.IsNotNull(result.Table); Assert.AreEqual(TableType.View, result.Table.TableType); Assert.AreEqual("dbo", result.Table.Schema); Assert.AreEqual("v_cool", result.Table.GetRuntimeName()); Assert.AreEqual("MyDb", result.Table.Database.GetRuntimeName()); Assert.AreEqual("localhost\\sqlexpress", result.Table.Database.Server.Name); Assert.AreEqual(DatabaseType.MicrosoftSQLServer, result.Table.Database.Server.DatabaseType); Assert.IsNull(result.Table.Database.Server.ExplicitPasswordIfAny); Assert.IsNull(result.Table.Database.Server.ExplicitUsernameIfAny); }
public SlotResult Evaluate(Paytable paytable, ReelWindow reelWindow, IRng rng) { if (paytable.PickTableGroup.PickTable.ContainsKey(PickFeatureId) == false) { // Can't evaluate if it doesn't exist in paytable. return(null); } PickTable pickTable = paytable.PickTableGroup.PickTable [PickFeatureId]; // Make a copy of the list since we will be removing elements from it. List <PickItem> pickItems = new List <PickItem> (pickTable.PickItemList); PickItem item; PickComponent component = new PickComponent(); do { // Continue picking items until a trigger is found. int randomNumber = rng.GetRandomNumber(pickItems.Count); item = pickItems [randomNumber]; pickItems.RemoveAt(randomNumber); component.PickResults.Add(new PickResult { Name = item.Name, Value = item.Value, Trigger = item.Trigger.Name }); } while (string.IsNullOrEmpty(item.Trigger.Name)); // Add the pick component to the slot result. SlotResult slotResult = new SlotResult(); if (component.PickResults.Count > 0) { slotResult.AddComponent <PickComponent>(component); } return(slotResult); }