public void TestPickAction() { ActionFactory factory = new ActionFactory(); PickAction action = factory.CreateGameAction("PICK 0") as PickAction; Assert.IsNotNull(action); Assert.IsInstanceOfType(action, typeof(PickAction)); }
static string MapActionName(PickAction act) { switch (act) { case PickAction.Wallpaper: return("(W)allpaper"); // case PickAction.Download: return "(D)ownload"; case PickAction.Info: return("(I)nfo"); } return(null); }
static string MapActionDesc(PickAction act) { switch (act) { case PickAction.Wallpaper: return("Change the wallpaper"); // case PickAction.Download: return "Download an image from a configured source"; case PickAction.Info: return("Show information related to wallpaper"); } return(null); }
private void RunPickTest(int expectedPick) { List <Card> draft = manager.GetDraft(); PickAction action = new PickAction(expectedPick, manager); bool result = action.Execute(player1, player2); Assert.IsTrue(result); Assert.AreEqual(player1.Deck.Count, 1); Assert.AreEqual(player2.Deck.Count, 0); CardManagerTest.AssertCards(draft[expectedPick], player1.Deck[0]); }
private void glControl1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Middle) { pickAction = PickAction.None; mouseCameraDown = false; mouseDown = false; isPicked = false; showSelectionBox = false; glControl1.Invalidate(); } }
/// <summary> /// Lors de la phase de picks, retourne l'action actuellement attendue de la part de ce héros. /// </summary> public PickAction Picks_NextAction() { System.IO.MemoryStream s = new System.IO.MemoryStream(); System.IO.StreamWriter output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; output.WriteLine(((int)1).ToString()); output.Close(); TCPHelper.Send(s.ToArray()); byte[] response = TCPHelper.Receive(); s = new System.IO.MemoryStream(response); System.IO.StreamReader input = new System.IO.StreamReader(s, BOMLESS_UTF8); PickAction returnValue = (PickAction)Int32.Parse(input.ReadLine()); return((PickAction)returnValue); }
private void glControl1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { if (isPicked) { pickAction = PickAction.Rotate; } } if (e.KeyCode == Keys.G) { if (isPicked) { pickAction = PickAction.Translate; } } }
private void glControl1_MouseDown(object sender, MouseEventArgs e) { if (Control.ModifierKeys == Keys.Shift && e.Button == MouseButtons.Left || e.Button == MouseButtons.Middle) { originMouse = e.Location; mouseCameraDown = true; glControl1.Invalidate(); } else if (e.Button == MouseButtons.Left) { mouseDown = true; var mouseCoords = GetMouseCoords(e.Location); var picks = SearchHit(mouseCoords.X, mouseCoords.Y); if (picks.Count > 0) { if (!SelectedObjects.Contains(picks[0])) { if (Control.ModifierKeys != Keys.Control) { UnselectAll(); } SelectedObjects.Add(picks[0]); picks[0].IsSelected = true; } pickAction = PickAction.Translate; isPicked = true; } else if (Control.ModifierKeys != Keys.Control) { UnselectAll(); } pickOriginMouse = e.Location; glControl1.Invalidate(); } }
// Génère le code pour la fonction de traitement des messages. public byte[] ProcessRequest(byte[] request, int clientId) { System.IO.MemoryStream s = new System.IO.MemoryStream(request); System.IO.StreamReader input = new System.IO.StreamReader(s, BOMLESS_UTF8); System.IO.StreamWriter output; int functionId = Int32.Parse(input.ReadLine()); switch (functionId) { case 0: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; GameStaticDataView retValue0 = GetStaticData(clientId); retValue0.Serialize(output); output.Close(); return(s.ToArray()); case 1: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickAction retValue1 = Picks_NextAction(clientId); output.WriteLine(((int)retValue1).ToString()); output.Close(); return(s.ToArray()); case 2: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue2 = Picks_GetActiveSpells(clientId); output.WriteLine(retValue2.Count.ToString()); for (int retValue2_it = 0; retValue2_it < retValue2.Count; retValue2_it++) { output.WriteLine(((int)retValue2[retValue2_it]).ToString()); } output.Close(); return(s.ToArray()); case 3: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityUniquePassives> retValue3 = Picks_GetPassiveSpells(clientId); output.WriteLine(retValue3.Count.ToString()); for (int retValue3_it = 0; retValue3_it < retValue3.Count; retValue3_it++) { output.WriteLine(((int)retValue3[retValue3_it]).ToString()); } output.Close(); return(s.ToArray()); case 4: EntityUniquePassives arg4_0 = (EntityUniquePassives)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickResult retValue4 = Picks_PickPassive(arg4_0, clientId); output.WriteLine(((int)retValue4).ToString()); output.Close(); return(s.ToArray()); case 5: int arg5_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickResult retValue5 = Picks_PickActive(arg5_0, clientId); output.WriteLine(((int)retValue5).ToString()); output.Close(); return(s.ToArray()); case 6: int arg6_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue6 = ShopPurchaseItem(arg6_0, clientId); output.WriteLine(((int)retValue6).ToString()); output.Close(); return(s.ToArray()); case 7: EquipmentType arg7_0 = (EquipmentType)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue7 = ShopSell(arg7_0, clientId); output.WriteLine(((int)retValue7).ToString()); output.Close(); return(s.ToArray()); case 8: EquipmentType arg8_0 = (EquipmentType)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue8 = ShopUpgrade(arg8_0, clientId); output.WriteLine(((int)retValue8).ToString()); output.Close(); return(s.ToArray()); case 9: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <WeaponModelView> retValue9 = ShopGetWeapons(clientId); output.WriteLine(retValue9.Count.ToString()); for (int retValue9_it = 0; retValue9_it < retValue9.Count; retValue9_it++) { retValue9[retValue9_it].Serialize(output); } output.Close(); return(s.ToArray()); case 10: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue10 = ShopGetArmors(clientId); output.WriteLine(retValue10.Count.ToString()); for (int retValue10_it = 0; retValue10_it < retValue10.Count; retValue10_it++) { output.WriteLine(((int)retValue10[retValue10_it]).ToString()); } output.Close(); return(s.ToArray()); case 11: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue11 = ShopGetBoots(clientId); output.WriteLine(retValue11.Count.ToString()); for (int retValue11_it = 0; retValue11_it < retValue11.Count; retValue11_it++) { output.WriteLine(((int)retValue11[retValue11_it]).ToString()); } output.Close(); return(s.ToArray()); case 12: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue12 = ShopGetEnchants(clientId); output.WriteLine(retValue12.Count.ToString()); for (int retValue12_it = 0; retValue12_it < retValue12.Count; retValue12_it++) { output.WriteLine(((int)retValue12[retValue12_it]).ToString()); } output.Close(); return(s.ToArray()); case 13: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; float retValue13 = GetMyPA(clientId); output.WriteLine(((float)retValue13).ToString()); output.Close(); return(s.ToArray()); case 14: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue14 = GetMyWeaponId(clientId); output.WriteLine(((int)retValue14).ToString()); output.Close(); return(s.ToArray()); case 15: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue15 = GetMyWeaponLevel(clientId); output.WriteLine(((int)retValue15).ToString()); output.Close(); return(s.ToArray()); case 16: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue16 = GetMyArmorId(clientId); output.WriteLine(((int)retValue16).ToString()); output.Close(); return(s.ToArray()); case 17: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue17 = GetMyArmorLevel(clientId); output.WriteLine(((int)retValue17).ToString()); output.Close(); return(s.ToArray()); case 18: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue18 = GetMyBootsId(clientId); output.WriteLine(((int)retValue18).ToString()); output.Close(); return(s.ToArray()); case 19: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue19 = GetMyBootsLevel(clientId); output.WriteLine(((int)retValue19).ToString()); output.Close(); return(s.ToArray()); case 20: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue20 = GetMyWeaponEnchantId(clientId); output.WriteLine(((int)retValue20).ToString()); output.Close(); return(s.ToArray()); case 21: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; EntityBaseView retValue21 = GetMyHero(clientId); retValue21.Serialize(output); output.Close(); return(s.ToArray()); case 22: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; Vector2 retValue22 = GetMyPosition(clientId); retValue22.Serialize(output); output.Close(); return(s.ToArray()); case 23: Vector2 arg23_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue23 = StartMoveTo(arg23_0, clientId); output.WriteLine(retValue23 ? 1 : 0); output.Close(); return(s.ToArray()); case 24: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue24 = IsAutoMoving(clientId); output.WriteLine(retValue24 ? 1 : 0); output.Close(); return(s.ToArray()); case 25: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue25 = EndMoveTo(clientId); output.WriteLine(retValue25 ? 1 : 0); output.Close(); return(s.ToArray()); case 26: Vector2 arg26_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue26 = HasSightAt(arg26_0, clientId); output.WriteLine(retValue26 ? 1 : 0); output.Close(); return(s.ToArray()); case 27: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityBaseView> retValue27 = GetDeadHeroes(clientId); output.WriteLine(retValue27.Count.ToString()); for (int retValue27_it = 0; retValue27_it < retValue27.Count; retValue27_it++) { retValue27[retValue27_it].Serialize(output); } output.Close(); return(s.ToArray()); case 28: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityBaseView> retValue28 = GetEntitiesInSight(clientId); output.WriteLine(retValue28.Count.ToString()); for (int retValue28_it = 0; retValue28_it < retValue28.Count; retValue28_it++) { retValue28[retValue28_it].Serialize(output); } output.Close(); return(s.ToArray()); case 29: int arg29_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; EntityBaseView retValue29 = GetEntityById(arg29_0, clientId); retValue29.Serialize(output); output.Close(); return(s.ToArray()); case 30: int arg30_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUseResult retValue30 = UseMyWeapon(arg30_0, clientId); output.WriteLine(((int)retValue30).ToString()); output.Close(); return(s.ToArray()); case 31: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; float retValue31 = GetMyAttackRange(clientId); output.WriteLine(((float)retValue31).ToString()); output.Close(); return(s.ToArray()); case 32: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <Vector2> retValue32 = GetMyTrajectory(clientId); output.WriteLine(retValue32.Count.ToString()); for (int retValue32_it = 0; retValue32_it < retValue32.Count; retValue32_it++) { retValue32[retValue32_it].Serialize(output); } output.Close(); return(s.ToArray()); case 33: Vector2 arg33_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue33 = MoveTowards(arg33_0, clientId); output.WriteLine(retValue33 ? 1 : 0); output.Close(); return(s.ToArray()); case 34: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue34 = GetMySpells(clientId); output.WriteLine(retValue34.Count.ToString()); for (int retValue34_it = 0; retValue34_it < retValue34.Count; retValue34_it++) { output.WriteLine(((int)retValue34[retValue34_it]).ToString()); } output.Close(); return(s.ToArray()); case 35: int arg35_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUpgradeResult retValue35 = UpgradeMyActiveSpell(arg35_0, clientId); output.WriteLine(((int)retValue35).ToString()); output.Close(); return(s.ToArray()); case 36: int arg36_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue36 = GetMyActiveSpellLevel(arg36_0, clientId); output.WriteLine(((int)retValue36).ToString()); output.Close(); return(s.ToArray()); case 37: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue37 = GetMyPassiveSpellLevel(clientId); output.WriteLine(((int)retValue37).ToString()); output.Close(); return(s.ToArray()); case 38: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUpgradeResult retValue38 = UpgradeMyPassiveSpell(clientId); output.WriteLine(((int)retValue38).ToString()); output.Close(); return(s.ToArray()); case 39: int arg39_0 = Int32.Parse(input.ReadLine()); SpellCastTargetInfoView arg39_1 = SpellCastTargetInfoView.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUseResult retValue39 = UseMySpell(arg39_0, arg39_1, clientId); output.WriteLine(((int)retValue39).ToString()); output.Close(); return(s.ToArray()); case 40: int arg40_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellView retValue40 = GetMySpell(arg40_0, clientId); retValue40.Serialize(output); output.Close(); return(s.ToArray()); case 41: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SceneMode retValue41 = GetMode(clientId); output.WriteLine(((int)retValue41).ToString()); output.Close(); return(s.ToArray()); case 42: int arg42_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellLevelDescriptionView retValue42 = GetMySpellCurrentLevelDescription(arg42_0, clientId); retValue42.Serialize(output); output.Close(); return(s.ToArray()); } return(new byte[0]); }