public StartMenu(Game1 game) { this.game = game; Texture2D t; t = GameOperators.Content.Load <Texture2D>(@"button1"); playerVsAI = new MenuButton(new Vector2(GameOperators.GraphicsDevice.Viewport.Width - 256, 100), t); playerVsAI.OnClick += new EventHandler(playerVsAI_OnClick); t = GameOperators.Content.Load <Texture2D>(@"button2"); AIVsAI = new MenuButton(new Vector2(GameOperators.GraphicsDevice.Viewport.Width - 256, 220), t); AIVsAI.OnClick += new EventHandler(AIVsAI_OnClick); t = GameOperators.Content.Load <Texture2D>(@"button3"); Video = new MenuButton(new Vector2(GameOperators.GraphicsDevice.Viewport.Width - 256, 340), t); Video.OnClick += new EventHandler(Video_OnClick); t = GameOperators.Content.Load <Texture2D>(@"button5"); Credits = new MenuButton(new Vector2(GameOperators.GraphicsDevice.Viewport.Width - 256, 460), t); Credits.OnClick += new EventHandler(Credits_OnClick); t = GameOperators.Content.Load <Texture2D>(@"button4"); Exit = new MenuButton(new Vector2(GameOperators.GraphicsDevice.Viewport.Width - 256, 580), t); Exit.OnClick += new EventHandler(Exit_OnClick); cd = GameOperators.Content.Load <Texture2D>(@"Credits"); buttons.Add(playerVsAI); buttons.Add(AIVsAI); buttons.Add(Video); buttons.Add(Credits); buttons.Add(Exit); }
private void LoadSports() { ItemManager sportManager = providers.SingleOrDefault(x => x is SportsProvider); if (sportManager == null) { SharedHelper.LogError("No Sport Manager"); return; } #region load sports if (sportManager != null) { sportManager.Add(new Sport("Time for some sport. You should go to the gym.")); sportManager.Add(new Sport("A healthy mind in a healthy body. Do not forget to do some sport today.")); sportManager.Add(new Sport("If you have troubles with sleep just remember that working out can help you sleep better. We eat a lot of food rich on energy and we need to spend this energy before going to sleep.")); sportManager.Add(new Sport("Doing some regular collective sport can help you make some new friends.")); sportManager.Add(new Sport("OK. Go! Do some sport! Don't worry. I will be right here when you get back.")); sportManager.Add(new Sport("It may seem counter-intuitive, but working out can drain your energy quite a bit, but then regular exercise can actually make you feel more energized throughout the day.")); sportManager.Add(new Sport("One study found that exercising in the middle of the day can leave you feeling more energetic and productive for the rest of the afternoon.")); sportManager.Add(new Sport("Studies show that regular exercise improve your sexual life. That should motivate you.")); sportManager.Add(new Sport("Try making seven pushups. <prosody pitch=\"+0%\"><break time=\"1600ms\"/></prosody>. OK maybe for you it should be not in a row. Better underestimate you than send you to hospital.")); } else { SharedHelper.LogError("No Sport Manager available."); } #endregion }
public void AddDamageText(float damage, bool critical, Vector2 gamePosition) { if (critical) { texts.Add(new FloatText(((int)damage).ToString() + "!", Color.OrangeRed, gamePosition, gamePosition + new Vector2(0, -12), 1.2f, this)); } else { texts.Add(new FloatText(((int)damage).ToString(), Color.Orange, gamePosition, gamePosition + new Vector2(0, -10), 1f, this)); } }
private void WriteEnemies(LevelDefinition definition) { WriteEnemyComments(); _writer.StartObject(ObjectType.Fast, "Enemies"); foreach (var enemyKeyValue in definition.Enemies) { var enemy = enemyKeyValue.Value; var offset = _writer.GetCurrentOffset(ObjectType.Fast); WriteBobOffset(enemy.Bob, enemyKeyValue); _writer.WriteWord(enemy.FrameDelay); _writer.WriteWord(enemy.Hp); var pointString = enemy.Points.ToString("D8"); foreach (var s in Enumerable.Range(0, 4).Select(i => byte.Parse($"{pointString.Substring(i * 2, 2)}", NumberStyles.HexNumber))) { _writer.WriteByte(s); } var soundOffset = (ushort)_items.Get(ItemTypes.Sound, enemy.ExplosionSound, enemyKeyValue.Key).Offset; _writer.WriteWord(soundOffset); WriteBobOffset(enemy.PortalBob, enemyKeyValue); _items.Add(ItemTypes.Enemy, enemyKeyValue.Key, offset); } _writer.EndObject(); }
private void addButton_Click(object sender, EventArgs e) { Item item = new Item(); item.ItemName = itemnameTextBox.Text; item.Price = Convert.ToDouble(priceTextBox.Text); //Set Name as Mandatory //if (String.IsNullOrEmpty(itemnameTextBox.Text)) //{ // MessageBox.Show("Name Can not be Empty!!!"); // return; //} //Check UNIQUE if (_itemManager.IsNameExist(item)) { MessageBox.Show(item.ItemName + " Already Exists!"); return; } bool isAdded = _itemManager.Add(item); if (isAdded) { MessageBox.Show("Saved"); showdataGridView.DataSource = _itemManager.Display(); } else { MessageBox.Show("Not Saved"); } }
private void addButton_Click(object sender, EventArgs e) { if (_ItemManager.IsNameExists(nameTextBox.Text)) { MessageBox.Show(nameTextBox.Text + " Already Exists!!!"); return; } if (String.IsNullOrEmpty(priceTextBox.Text)) { MessageBox.Show("Price Can not Be Empty!!!"); return; } bool isExecute = _ItemManager.Add(nameTextBox.Text, Convert.ToDouble(priceTextBox.Text)); if (isExecute) { MessageBox.Show("Saved!!"); } else { MessageBox.Show("Not Saved!!"); } DataTable showData = _ItemManager.ShowAll(); showDataGridView.DataSource = showData; }
public void Process(LevelDefinition definition) { if (definition.EnemyFire == null) { return; } _definition = definition.EnemyFire; WriteEnemyFireComments(); _writer.StartObject(ObjectType.Fast, "EnemyFireTypes"); foreach (var fireKeyValue in _definition.Types) { var fire = fireKeyValue.Value; var fireName = fireKeyValue.Key; var offset = _writer.GetCurrentOffset(ObjectType.Fast); _writer.WriteWord((ushort)_items.Get(ItemTypes.Sound, fire.Sound, fireName).Offset); _writer.WriteWord((ushort)fire.Movement); _writer.WriteWord((ushort)fire.Period); _writer.WriteWord((ushort)fire.Speed); var bob = _items.Get(ItemTypes.Bob, fire.Bob, fireName); _writer.WriteOffset(ObjectType.Chip, bob.Offset); _items.Add(ItemTypes.EnemyFire, fireName, offset); } _writer.EndObject(); WriteSupportingCode(); }
private void AddButton_Click(object sender, EventArgs e) { Item item = new Item(); if (String.IsNullOrEmpty(itemPriceTextBox.Text)) { MessageBox.Show("Price cannot be empty"); return; } if (!Regex.IsMatch(itemPriceTextBox.Text, @"-?\d+(?:\.\d+)?")) { MessageBox.Show("Enter Price properly"); return; } item.Name = itemNameTextBox.Text; item.Price = Convert.ToDouble(itemPriceTextBox.Text); if (_itemManager.IsNameExists(item)) { MessageBox.Show("This name already exist!"); return; } if (_itemManager.Add(item)) { MessageBox.Show("Item Successfully Added"); ShowItems(); return; } else { MessageBox.Show("Item not added"); } }
private void SaveButton_Click(object sender, EventArgs e) { try { if (itemTextBox.Text == "" && reOrderTextBox.Text == "") { msgLabel.Text = "Enter a Item"; msgLabel.ForeColor = Color.Red; return; } _item.CategoryId = Convert.ToInt64(categoryComboBox.SelectedValue); _item.CompanyId = Convert.ToInt64(companyComboBox.SelectedValue); _item.Name = itemTextBox.Text; _item.ReOrderLevel = Convert.ToInt32(reOrderTextBox.Text); bool isExist = _itemManager.IsDuplicateData(_item); if (isExist) { msgLabel.Text = $"Company {itemTextBox.Text} already in system"; msgLabel.ForeColor = Color.Red; return; } bool isAdded = _itemManager.Add(_item); if (isAdded) { msgLabel.Text = $"Save Item: {itemTextBox.Text} successfully"; } } catch (Exception exception) { msgLabel.Text = exception.Message; } }
public Item(string name) { ItemManager.Add(this); ObjectId = ItemManager.GetUniqueId(); Name = name; }
private void addButton_Click(object sender, EventArgs e) { //Check UNIQUE if (_itemManager.IsNameExists(nameTextBox.Text)) { MessageBox.Show(nameTextBox.Text + " Already Exists!"); return; } item.Name = nameTextBox.Text; //Set Price as Mandatory if (String.IsNullOrEmpty(priceTextBox.Text)) { MessageBox.Show("Price Can not be Empty!!!"); return; } item.Price = Convert.ToDouble(priceTextBox.Text); //Add/Insert Item bool isAdded = _itemManager.Add(item); if (isAdded) { MessageBox.Show("Saved"); } else { MessageBox.Show("Not Saved"); } showDataGridView.DataSource = _itemManager.Display(); }
private void WriteSounds(SfxDefinition sfxDefinition) { _writer.WriteCode(Code.Normal, @" ** structure for audio structure SoundStructure, 0 word SoundStartOffset_w ; Offset from the fx pack where to start sound word SoundPeriod_w ; word SoundLength_w byte SoundVolume_b ; Audio volume byte SoundUnused_b ; label SOUND_STRUCTURE_SIZE "); _writer.StartObject(ObjectType.Data, "sounds"); _writer.WriteWord(0); // So the first sound is not 0 which could mean no-sound foreach (var soundTuple in sfxDefinition.Sounds) { var sound = soundTuple.Value; _items.Add(ItemTypes.Sound, soundTuple.Key, _writer.GetCurrentOffset(ObjectType.Data)); var startOffset = (ushort)_waveOffsets[sound.Waveform]; var period = (ushort)(TicksPerSecond / sound.Frequency); var length = (ushort)(_waveLengths[sound.Waveform] / 2); _writer.WriteWord(startOffset); _writer.WriteWord(period); _writer.WriteWord(length); _writer.WriteByte((byte)sound.Volume); _writer.WriteByte(0); } _writer.EndObject(); }
private void addButton_Click(object sender, EventArgs e) { string name = nameTextBox.Text; string address = addressTextBox.Text; string contact = contactTextBox.Text; if (name == "" || address == "" || contact == "") { MessageBox.Show("Field must not be empty.."); return; } else if (_itemManager.CheckIfNumeric(name)) { MessageBox.Show("Please enter Item name, not numeric value."); nameTextBox.Clear(); return; } if (_itemManager.isNameExist(name)) { MessageBox.Show("Customer is Already exist.."); return; } if (_itemManager.Add(name, address, contact)) { MessageBox.Show("Saved Successfully"); Clear(); showDataGridView.DataSource = _itemManager.Display(); return; } else { MessageBox.Show("Not Saved Data, Check Inserting Details"); } }
private void addButton_Click(object sender, EventArgs e) { Item item = new Item(); //Mandatory if (String.IsNullOrEmpty(priceTextBox.Text)) { MessageBox.Show("Price can not be Empty!!"); return; } item.Price = Convert.ToDouble(priceTextBox.Text); item.Name = nameTextBox.Text; //Unique if (_itemManager.IsNameExist(item)) { MessageBox.Show(nameTextBox.Text + " Already Exist!!"); return; } //Add/Insert if (_itemManager.Add(item)) { MessageBox.Show("Saved"); } else { MessageBox.Show("Not Saved"); } //showDataGridView.DataSource = dataTable; showDataGridView.DataSource = _itemManager.Display(); }
private void addButton_Click(object sender, EventArgs e) { string name = nameTextBox.Text; double price = Convert.ToDouble(priceTextBox.Text); if (name == "" || nameTextBox.Text == "") { MessageBox.Show("Field must not be empty.."); return; } else if (_itemManager.CheckIfNumeric(name)) { MessageBox.Show("Please enter Item name, not numeric value."); nameTextBox.Clear(); return; } if (_itemManager.IsNameExist(name)) { MessageBox.Show("Item Name is Already exist.."); return; } if (_itemManager.Add(name, price)) { MessageBox.Show("Saved"); showDataGridView.DataSource = _itemManager.Display(); } else { MessageBox.Show("Not Save"); } }
private void addButton_Click(object sender, EventArgs e) { //Mandatory if (String.IsNullOrEmpty(priceTextBox.Text)) { MessageBox.Show("Price can not be Empty!!"); return; } //Unique if (_itemManager.IsNameExist(nameTextBox.Text)) { MessageBox.Show(nameTextBox.Text + " Already Exist!!"); return; } //Add/Insert if (_itemManager.Add(nameTextBox.Text, Convert.ToDouble(priceTextBox.Text))) { MessageBox.Show("Saved"); } else { MessageBox.Show("Not Saved"); } }
public GameSession() { IndexedKeybindingsManager.Initialize(); // Probably shouldn't be here ItemManager.Add(WeaponItem.None()); World = new Overworld(); Player = EntityManager.Create <Player>(); }
private void ConvertBobToDisk(string name, BobDefinition bob, LevelDefinition definition, Bitmap bobPalette) { var offset = _writer.GetCurrentOffset(ObjectType.Chip); _bobConverter.ConvertBob(name, bob, definition.BobPlaneCount, bobPalette.Palette, _definition.BobPaletteFlip0AndLast ? BobMode.ColorFlip : BobMode.NoColorFlip, Destination.Disk); _items.Add(ItemTypes.Bob, name, offset); }
public Game() { Player = new Player(); InventoryManager.CreateDefault(); ItemManager.Add(WeaponItem.None()); // 0 reserved for no weapon Game.Player.CurrentWeapon = (WeaponItem)ItemManager.GetItem <IItem>(0); }
public EmberItem(int glyph, Color foregroundColor, int width = 1, int height = 1) : base(width, height) { ObjectId = ItemManager.GetUniqueId(); ItemManager.Add(this); Amount = 1; Name = GetType().Name; Animation.CurrentFrame[0].Foreground = foregroundColor; Animation.CurrentFrame[0].Background = Color.Transparent; Animation.CurrentFrame[0].Glyph = glyph; }
void LoadMap(string map) { Map p = GameOperators.Content.Load <Map>(@"Maps\" + map); int i = 0; foreach (var resp in p.Resources) { resources.Add(new ResourceArea(i + 1, 196, resp, null, this)); islands.Add(new Island(this, "island" + i.ToString(), 0.3f, resp, 32f)); i++; i %= 5; } }
public ActionResult Create([Bind(Include = "Id,ItemName,ItemCode,Description,Image,CategoryId,CostPrice,SalePrice")] Item item) { if (ModelState.IsValid) { HttpPostedFileBase file = Request.Files["imageBrowes"]; _manager.Add(item, file); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(_categoryManager.GetAll(), "Id", "Name", item.CategoryId); return(View(item)); }
public async Task AddTestWithSuccessAsync() { var model = new ItemViewModel() { Name = "Cola", Quantity = 20 }; var returnjson = new Results <ItemModel>() { Exception = null, HttpStatusCode = HttpStatusCode.OK, Result = new ItemModel() { Brand = It.IsAny <string>(), Id = It.IsAny <int>(), Name = It.IsAny <string>(), Quantity = It.IsAny <int>(), Price = It.IsAny <decimal>(), TotalPrice = It.IsAny <double>() }, Success = true }; _mockRequest.Setup(e => e.GetRequest(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(JsonConvert.SerializeObject(returnjson))); _mockHandler.Setup(e => e.List).Returns(new List <ItemModel>()); _mockHandler.Setup(e => e.RemoveItem(It.IsAny <ItemModel>())).Verifiable(); _mockHandler.Setup(e => e.AddItem(It.IsAny <Results <ItemModel> >())).Verifiable(); var result = await _itemManager.Add(model, It.IsAny <string>()); result.Should().BeNull(); _mockHandler.Verify(e => e.AddItem(It.IsAny <Results <ItemModel> >()), Times.Once); _mockHandler.Verify(e => e.RemoveItem(It.IsAny <ItemModel>()), Times.Never); }
public Item(string name, int gold, int level = 1, int minDmg = 0, int maxDmg = 0, int defense = 0, bool isUnique = false) { ObjectId = ItemManager.GetUniqueId(); ItemManager.Add(this); Name = name; Level = level; Gold = gold; MinDmg = minDmg; MaxDmg = maxDmg; Defense = defense; IsUnique = isUnique; UpgradeLevel = 1; Enchantment = EnchantmentType.Default; }
public Item(string name, int gold, bool isUnique = true) { ObjectId = ItemManager.GetUniqueId(); ItemManager.Add(this); Name = name; Gold = gold; IsUnique = isUnique; Level = 1; MinDmg = 0; MaxDmg = 0; Defense = 0; UpgradeLevel = 1; Enchantment = EnchantmentType.Default; }
private void SaveButton_Click(object sender, EventArgs e) { try { Item item = new Item(); item.CategoryId = Convert.ToInt32(categoryComboBox.SelectedValue); if (item.CategoryId < 0) { errorProvider.SetError(categoryComboBox, "Please select a valid category!"); return; } item.CompanyId = Convert.ToInt32(companyComboBox.SelectedValue); if (item.CompanyId < 0) { errorProvider.SetError(companyComboBox, "Please select a valid company!"); return; } item.Name = itemNameTextBox.Text; if (item.Name == String.Empty) { errorProvider.SetError(itemNameTextBox, "Please provide a valid item name!"); return; } item.ReOrderLevel = Convert.ToInt32(reOrderLevelTextBox.Text); if (item.ReOrderLevel < 0) { errorProvider.SetError(reOrderLevelTextBox, "Please provide a valid re-order level!"); return; } bool isAdded = _itemManager.Add(item); if (isAdded) { Reset(this.Controls); MessageBox.Show("Item Saved!"); itemNameTextBox.Focus(); } else { MessageBox.Show("Error Occured While Saving!"); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void WritePaths(Dictionary <string, PathDefinition> definitionPaths) { WritePathComments(); _writer.StartObject(ObjectType.Fast, "Paths"); var initialOffset = _writer.GetCurrentOffset(ObjectType.Fast); foreach (var path in definitionPaths) { var currentOffset = _writer.GetCurrentOffset(ObjectType.Fast); _items.Add(ItemTypes.Path, path.Key, currentOffset); WritePathData(path.Value); } Console.WriteLine($"PATHS SIZE: {_writer.GetCurrentOffset(ObjectType.Fast) - initialOffset}"); _writer.EndObject(); }
private void btnItemCreate_Click(object sender, EventArgs e) { Item item = new Item { Description = txtDescription.Text }; Result result = _itemManager.Add(item); if (result.ResultState == ResultState.Erorr) { MessageBox.Show(result.Message, "Hata işlem yapılamadı"); } else { ItemDataGridFill(); txtItemId.Text = ""; txtDescription.Text = ""; } }
public Item(string name, Rarities rarity = Rarities.Common, bool isUnique = false, int level = 1, int gold = 0, int durability = 0, int minDmg = 0, int maxDmg = 0, int defense = 0) { ObjectId = ItemManager.GetUniqueId(); ItemManager.Add(this); Name = name; Rarity = rarity; IsUnique = isUnique; Level = level; Gold = gold; MinDmg = minDmg; MaxDmg = maxDmg; Defense = defense; Durability = durability; MaxDurability = durability; Enchantment = Enchantments.Default; UpgradeLevel = 1; }
public virtual void Interact() { if ((requiredItem == null || itemManager.Things.Contains(requiredItem)) && (requredAccess == null || accessSystem.Things.Contains(requredAccess))) { message.text = accessedMessage; Success?.Invoke(); if (itemReward) { itemManager.Add(itemReward); } stats.Money += MoneyReward; if (accessReward) { accessSystem.Add(accessReward); } } else { message.text = defaultMessage; } }