public void Equip(int index, ItemType type) { Item item = inventory.GetItem(index, type); if (item != null && item is Equipment) { ; inventory.DeleteItem(index, type); for (int i = 0; i < equipmentSlots.Length; ++i) { if (equipmentSlots[i] == item.type) { if (equipments.items [i] != null) { inventory.AddItem(equipments.items [i]); } equipments.AddItem(item, i); } } Equipment temp = (Equipment)item; for (int i = 0; i < temp.stats.stats.Count; ++i) { stats.GetStat(temp.stats.stats[i].type).Value += temp.stats.stats[i].Value; if (temp.stats.stats[i].useAdditionalValue) { stats.GetStat(temp.stats.stats[i].type).AdditionalValue += temp.stats.stats[i].AdditionalValue; } } } }
private void _on_ReceiptList_item_selected(int _index) { //if a receipt is selected from the list, display it info var _title = receiptList.GetItemText(_index); initialTitle = _title; //store title higher in the scope as well to be used outside for (var l = 0; l < list.Count; l++) //add each item to list { if (_title == list[l]["Title"].ToString()) { receiptIngredients.Clear(); IngredientList.Clear(); receiptTitle.Text = _title; receiptDescription.Text = list[l]["Description"].ToString(); var _ingredientList = list[l]["Ingredients"].ToList(); for (var i = 0; i < _ingredientList.Count; i++) { var _amount = _ingredientList[i]["Amount"].ToString(); var _volume = _ingredientList[i]["Volume"].ToString(); var _ingredient = _ingredientList[i]["Ingredient"].ToString(); receiptIngredients.AddItem($"{_amount} {_volume} {_ingredient}"); IngredientList.Add(new Ingredient(_amount, _volume, _ingredient)); } } } }
// Refresh Lobby's player list // This is run after we have gotten updates from the server regarding new players public void RefreshLobby() { // Get the latest list of players from NetworkManager.Instance object[][] playerList = NetworkManager.Instance.GetPlayerList(); // Add the updated player_list to the itemlist ItemList itemlist = lobbyContainer.FindNode("itemlist_players") as ItemList; itemlist.Clear(); itemlist.AddItem(NetworkManager.Instance.GetPlayerName() + " (YOU)"); // Add yourself to the top // Add every other player to the list foreach (object[] player in playerList) { if (player[0] != NetworkManager.Instance.GetPlayerName()) { itemlist.AddItem(player[0].ToString()); } } // If you are not the server, we disable the 'start game' button if (!GetTree().IsNetworkServer()) { ((Button)lobbyContainer.FindNode("start_game_button")).Disabled = false; } }
void QRCodeScanned(Result result) { scanReady = false; bool addItem = true; //do we still need to add the item to the list? //foreach (ItemRow row in itemList.GetRows()) //{ // if (row.GetScanString() == result.Text) // { //Does item already exist in list // row.SetQuantity(row.GetQuantity() + 1); //item already exists, add quantity // addItem = false; // } //} //Check if we still need to add the item to the list or if we already added quantity to an existing item if (true) { String[] resultString = new string[4]; resultString = result.Text.Split('|'); float itemPrice = float.Parse(resultString[1], NumberStyles.Currency); //Get the value of the float, ignoring the currency format ItemRow newItem = itemList.AddItem(); newItem.SetScanString(result.Text); newItem.SetItemDescription(resultString[2]); newItem.SetProductOwner(resultString[3]); newItem.SetItemPrice(itemPrice); newItem.SetItemOriginalPrice(itemPrice); } //update the transactions itemlist transaction.SetItemListData(itemList.itemListData); //Update checkout button }
private void UpdateMissions() { itemList.Clear(); foreach (MissionInstance missionInstance in MissionManager.GetInstance().CurrentMissions) { MissionListItem item = new MissionListItem(missionInstance); itemList.AddItem(item); } MissionManager.GetInstance().HasChanged = false; }
public void AddPlayer(int id, String name = "") { Players.Add(id); if (name == "") { List.AddItem("... connecting ...", null, false); } else { List.AddItem(name, null, false); } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { // Save the shadowbox panel for hiding/showing later BackgroundShadow = GetNode <Panel>("/root/main/UI/ShadowBox"); SettingsList = GetNode <ItemList>("VBoxContainer/Panel/HSplitContainer/ItemList"); SettingsList.AddItem("General"); SettingsList.AddItem("Plugins"); GetNode("../TitleBar").Connect("PreferencesPressed", this, "OnAboutToShow"); GetNode("VBoxContainer/CloseButton").Connect("pressed", this, "ClosePopup"); this.GetCloseButton().Connect("pressed", this, "OnPopupClose"); }
public override void _Ready() { GetAllNodes(); OS.CenterWindow(); Music.Play(); foreach (String banner_size in (IEnumerable)MobileAds.Get("BANNER_SIZE")) { BannerSizes.AddItem(banner_size); } if (OS.GetName() == "Android" || OS.GetName() == "iOS") { BannerPosition.Pressed = Convert.ToBoolean(((IDictionary)config["banner"])["position"]); MobileAds.Call("request_user_consent"); MobileAds.Connect("consent_info_update_failure", this, nameof(_on_MobileAds_consent_info_update_failure)); MobileAds.Connect("consent_status_changed", this, nameof(_on_MobileAds_consent_status_changed)); MobileAds.Connect("banner_loaded", this, nameof(_on_MobileAds_banner_loaded)); MobileAds.Connect("banner_destroyed", this, nameof(_on_MobileAds_banner_destroyed)); MobileAds.Connect("interstitial_loaded", this, nameof(_on_MobileAds_interstitial_loaded)); MobileAds.Connect("interstitial_closed", this, nameof(_on_MobileAds_interstitial_closed)); MobileAds.Connect("rewarded_ad_loaded", this, nameof(_on_MobileAds_rewarded_ad_loaded)); MobileAds.Connect("rewarded_ad_closed", this, nameof(_on_MobileAds_rewarded_ad_closed)); MobileAds.Connect("rewarded_interstitial_ad_loaded", this, nameof(_on_MobileAds_rewarded_interstitial_ad_loaded)); MobileAds.Connect("rewarded_interstitial_ad_closed", this, nameof(_on_MobileAds_rewarded_interstitial_ad_closed)); MobileAds.Connect("user_earned_rewarded", this, nameof(_on_MobileAds_user_earned_rewarded)); MobileAds.Connect("initialization_complete", this, nameof(_on_MobileAds_initialization_complete)); } else { _add_text_Advice_Node("AdMob only works on Android or iOS devices!"); } }
/// <summary>Assigns all controls to modifiable values.</summary> private void AssignControls() { BtnAttack = (Button)GetNode("BtnAttack"); BtnCastSpell = (Button)GetNode("BtnCastSpell"); BtnEnemyDetails = (Button)GetNode("Enemy/CC/VB/BtnEnemyDetails"); BtnFlee = (Button)GetNode("BtnFlee"); BtnLootBody = (Button)GetNode("Enemy/CC/VB/BtnLootBody"); BtnReturn = (Button)GetNode("BtnReturn"); LstSpells = (ItemList)GetNode("LstSpells"); LblHeroName = (Label)GetNode("Hero/LblName"); LblHeroHealth = (Label)GetNode("Hero/LblHealth"); LblHeroMagic = (Label)GetNode("Hero/LblMagic"); LblHeroShield = (Label)GetNode("Hero/LblShield"); LblEnemyName = (Label)GetNode("Enemy/LblName"); LblEnemyHealth = (Label)GetNode("Enemy/LblHealth"); LblEnemyMagic = (Label)GetNode("Enemy/LblMagic"); LblEnemyShield = (Label)GetNode("Enemy/LblShield"); LblSpellTypeAmount = (Label)GetNode("LblSpellTypeAmount"); LblSpellCost = (Label)GetNode("LblSpellCost"); LblWeight = (Label)GetNode("Hero/LblWeight"); TxtBattle = (RichTextLabel)GetNode("TxtBattle"); LstSpells.Clear(); foreach (Spell spl in GameState.CurrentHero.Spellbook.Spells) { LstSpells.AddItem(spl.Name); } if (GameState.CurrentHero.CurrentSpell != new Spell()) { LstSpells.Select(GameState.CurrentHero.Spellbook.Spells.IndexOf(GameState.CurrentHero.CurrentSpell)); } }
/// <summary>Loads all <see cref="Spell"/>s not currently known by the <see cref="Hero"/>.</summary> private void LoadSpells() { foreach (Spell spl in GameState.CurrentHero.Spellbook.Spells) { LstSpells.AddItem(spl.Name); } }
public void UpdateLists() { Spectators.Clear(); RedTeam.Clear(); BlueTeam.Clear(); UserManager = GetNode("/root/GameRoot/GameWorld/Users"); Godot.Collections.Array users = UserManager.GetChildren(); foreach (Node p in users) { UserProvider user = (UserProvider)p; switch (user.ThisTeam) { case UserProvider.Team.Unassigned: Spectators.AddItem(user.Alias); break; case UserProvider.Team.Red: RedTeam.AddItem(user.Alias); break; case UserProvider.Team.Blue: BlueTeam.AddItem(user.Alias); break; } } }
void _selectAlbum(ButtonBase <Button> _button) { selectAlbum = _button.Id; selectBtn = _button.VId; var cfg = ConfigManager.Instance.GetRes <AnimeConfig>(npkKeys[selectAlbum]); $"{_button.Id} {npkKeys[_button.Id]} {cfg.key}".log(); spriteList.Clear(); if (selectBtn > 0 && selectBtn != _button.VId) { buttons[selectBtn].target.Flat = false; ConfigManager.Instance.UnloadRes(ConfigManager.Instance.GetRes <AnimeConfig>(npkKeys[buttons[selectBtn].Id])); } //albumList.ScrollIndex(selectAlbum, _button.Id); buttons[_button.VId].target.Flat = true; var album = cfg.Frames; for (int i = 0; i < album.Length; i++) { spriteList.AddItem($"{album[i].Image} {album[i].ImageIdx} {album[i].Delay}"); } if (album.Length > 0) { setImage(0); } }
public void UpdateList(Label number, double numberVal, ItemList list, PowerMonitoringConsoleEntry[] listVal) { number.Text = Loc.GetString("power-monitoring-window-value", ("value", numberVal)); // This magic is important to prevent scrolling issues. while (list.Count > listVal.Length) { list.RemoveAt(list.Count - 1); } while (list.Count < listVal.Length) { list.AddItem("YOU SHOULD NEVER SEE THIS (REALLY!)", null, false); } // Now overwrite the items properly... for (var i = 0; i < listVal.Length; i++) { var ent = listVal[i]; _prototypeManager.TryIndex(ent.IconEntityPrototypeId, out EntityPrototype? entityPrototype); IRsiStateLike?iconState = null; if (entityPrototype != null) { iconState = SpriteComponent.GetPrototypeIcon(entityPrototype, StaticIoC.ResC); } var icon = iconState?.GetFrame(RSI.State.Direction.South, 0); var item = list[i]; item.Text = $"{ent.NameLocalized} {Loc.GetString("power-monitoring-window-value", ("value", ent.Size))}"; item.Icon = icon; } }
private void refreshLobby() { playersList.Clear(); // Add current player. playersList.AddItem(String.Format("{0} (You)", GameState.Instance.getPlayerName())); // Add other players foreach (String p in GameState.Instance.getPlayerList()) { playersList.AddItem(p); } // Enable/Disable start button startButton.Disabled = !GetTree().IsNetworkServer(); }
private void SetPaymentData(Cart cart, ShippingDetails shippingDetails) { if (!this.PaymentHeadersSet) { this.SetPaymentHeaders(); } //NameValueCollection data = new NameValueCollection(); PayPalPaymentObject data = new PayPalPaymentObject(); data.intent = "sale"; Uri uri = System.Web.HttpContext.Current.Request.Url; data.redirect_urls.return_url = uri.Scheme + Uri.SchemeDelimiter + uri.Host + (uri.Port != 80 ? ":" + uri.Port : "") + "/Cart/SUCCESS"; data.redirect_urls.cancel_url = uri.Scheme + Uri.SchemeDelimiter + uri.Host + (uri.Port != 80 ? ":" + uri.Port : "") + "/Cart/CANCEL"; data.payer.payment_method = "paypal"; Transaction transaction = data.AddTransaction(cart.Lines.Sum(l => l.Product.Price * l.Quantity).ToString(), "USD", "A SportsStore order"); ItemList itemList = new ItemList(); itemList.shipping_address = new ShippingAddress(shippingDetails.Name, shippingDetails.Address1, shippingDetails.Address2, shippingDetails.City, "US", shippingDetails.Zip, shippingDetails.State); foreach (var line in cart.Lines) { //string descriptionText = "(" + line.Quantity + ")" + line.Product.Name + ": " + line.Product.Description; itemList.AddItem(line.Quantity.ToString(), line.Product.Name, line.Product.Price.ToString(), "USD"); } transaction.item_list = itemList; //data.AddTransaction((line.Product.Price * line.Quantity).ToString(), "USD", descriptionText); //data.AddTransaction("7.47", "USD", "Some random description"); this.PaymentData = data; this.PaymentDataString = JsonConvert.SerializeObject(data);; this.PaymentDataSet = true; }
private void BuildTileList(string searchStr = null) { TileList.Clear(); IEnumerable <ITileDefinition> tileDefs = __tileDefinitionManager; if (!string.IsNullOrEmpty(searchStr)) { tileDefs = tileDefs.Where(s => s.DisplayName.IndexOf(searchStr, StringComparison.InvariantCultureIgnoreCase) >= 0 || s.Name.IndexOf(searchStr, StringComparison.OrdinalIgnoreCase) >= 0); } tileDefs = tileDefs.OrderBy(d => d.DisplayName); _shownItems = tileDefs.ToList(); foreach (var entry in _shownItems) { Texture texture = null; if (!string.IsNullOrEmpty(entry.SpriteName)) { texture = _resourceCache.GetResource <TextureResource>($"/Textures/Tiles/{entry.SpriteName}.png"); } TileList.AddItem(entry.DisplayName, texture); } }
public GameState(Troop troop) { day = 1; week = 1; month = 1; unlockedTown = 0; gold = DataBase.instance.gameData.startingGold; playerTroop = troop; towns = DataBase.instance.GetTowns(); currentTownIndex = 0; recruitableUnits = new Troop(); unlockedUnits = new List <int> (); recruitablePopulateMpl = new List <float> (); UnlockUnit = 0; for (int i = 0; i < unlockedUnits.Count; ++i) { recruitableUnits.units.Add(DataBase.instance.GetUnit(unlockedUnits[i])); recruitableUnits.units[i].amount = (int)recruitableUnits.units[i].basePopulateValue; } shopItems = new ItemList(); for (int i = 0; i < DataBase.instance.gameData.shopItemIds.Count; ++i) { shopItems.AddItem(DataBase.instance.GetItem(DataBase.instance.gameData.shopItemIds[i])); } barracksUnits = new Troop(); }
private void _on_AddIngredientButton_button_up() { //when add button is clicked, add ingredient to list var _amount = amountOption.GetText(); var _volume = volumeOption.GetText(); var _ingredient = ingredientOption.GetText(); bool _match = false; for (var i = 0; i < IngredientList.Count; i++) { if (IngredientList[i].Ingredients == _ingredient) { _match = true; } } if (_match != true && _amount != "0" && _amount != "" && _amount != " ") { ingredientList.AddItem($"{_amount} {_volume} {_ingredient}"); IngredientList.Add(new Ingredient(_amount, _volume, _ingredient)); } else { //show dialog, ingredient already exist. _displayMessage(ingredientAlreadyExistMsg); } }
void _selectAlbum(ButtonBase <Button> _button) { var npk = ResourceManager.Instance.allNpkData[npkKeys[_button.Id]]; var path = System.IO.Path.GetFileName(npk.filePath); $"{_button.Id} {npkKeys[_button.Id]} {path} {npk.index}".log(); npk.album.LoadImage(npk.filePath); spriteList.Clear(); if (selectBtn > 0 && selectBtn != _button.VId) { buttons[selectBtn].target.Flat = false; ResourceManager.Instance.allNpkData[npkKeys[buttons[selectBtn].Id]].album.UnloadImage(); } //albumList.ScrollIndex(selectAlbum, _button.Id); selectAlbum = _button.Id; selectBtn = _button.VId; buttons[_button.VId].target.Flat = true; var album = npk.album; for (int i = 0; i < album.List.Count; i++) { spriteList.AddItem($"{album.List[i].Index} {album.List[i].Version} {album.List[i].Type} {album.List[i].Height} {album.List[i].Width} {album.List[i].FrameSize} {album.List[i].Location}"); } if (album.Count > 0) { setImage(0); } }
public void Populate(int serverCount, string[] serverNames, int[] serverIds, int selectedServerId) { _serverCount = serverCount; _serverNames = serverNames; _serverIds = serverIds; _selectedServerId = selectedServerId; // Disable so we can select the new selected server without triggering a new sync request. _servers.OnItemSelected -= OnItemSelected; _servers.OnItemDeselected -= OnItemDeselected; _servers.Clear(); for (var i = 0; i < _serverCount; i++) { var id = _serverIds[i]; _servers.AddItem($"ID: {id} || {_serverNames[i]}"); if (id == _selectedServerId) { _servers[id].Selected = true; } } _servers.OnItemSelected += OnItemSelected; _servers.OnItemDeselected += OnItemDeselected; }
/// <summary> /// Populate all technologies in the ItemLists. /// </summary> public void PopulateItemLists() { _unlockedTechnologies.Clear(); _unlockableTechnologies.Clear(); _futureTechnologies.Clear(); _unlockedTechnologyPrototypes.Clear(); _unlockableTechnologyPrototypes.Clear(); _futureTechnologyPrototypes.Clear(); var prototypeMan = IoCManager.Resolve <IPrototypeManager>(); // For now, we retrieve all technologies. In the future, this should be changed. foreach (var tech in prototypeMan.EnumeratePrototypes <TechnologyPrototype>()) { if (Owner.IsTechnologyUnlocked(tech)) { _unlockedTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); _unlockedTechnologyPrototypes.Add(tech); } else if (Owner.CanUnlockTechnology(tech)) { _unlockableTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); _unlockableTechnologyPrototypes.Add(tech); } else { _futureTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); _futureTechnologyPrototypes.Add(tech); } } }
private void Start() { foreach (Item i in testItem) { list.AddItem(i); } }
public static ItemList LoadItemList(string nameOfList) { ItemList list = new ItemList(nameOfList); SQLiteConnection dbConn = new SQLiteConnection("Data Source=PizzaDataBase.sqlite;Version=3;"); dbConn.Open(); string sql = "select * from " + nameOfList; SQLiteCommand command = new SQLiteCommand(sql, dbConn); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { string name = reader["name"].ToString(); string desctiption = reader["description"].ToString(); double buyprice = double.Parse(reader["buyprice"].ToString()); double sellprice = double.Parse(reader["sellprice"].ToString()); int count = int.Parse(reader["count"].ToString()); Item O = new Item(name, buyprice, sellprice, count, desctiption); list.AddItem(O, false); } dbConn.Close(); return(list); }
private void CreateItem() { ItemList itemList = ItemList.GetItemList(); itemList.AddItem(itemName, itemDescription, itemIcon, itemModel, itemCost); AssetDatabase.SaveAssets(); EditorWindow.GetWindow <ItemWindow>("Create Item").Close(); }
private void UpdateGuidList() { _itemList.Clear(); foreach (var guid in DataManager.GetGuids()) { _itemList.AddItem(guid.ToString()); } }
/// <summary>Displays all classes available for selection.</summary> private void LoadClasses() { LstClasses.Items.Clear(); foreach (HeroClass cls in GameState.AllClasses) { LstClasses.AddItem(cls.Name); } }
private void InitBlocksSelector() { blocksSelector.Clear(); foreach (var type in Item.grindable) { blocksSelector.AddItem(type.ToString(), Item.textures[(int)type], false); } }
private void InitBuildingSelector() { buildingSelector.Clear(); for (int i = 0; i < Building.nbBuildings; i++) { Building.Type type = (Building.Type)i; buildingSelector.AddItem(type.ToString(), Building.textures[type]); } }
/// <summary> /// Adds shown recipes to the ItemList control. /// </summary> public void PopulateList() { _items.Clear(); foreach (var prototype in _shownRecipes) { _items.AddItem(prototype.Name, prototype.Icon.Frame0()); } PopulateDisabled(); }
private void PopulateOptions() { dialogueOptions.Clear(); foreach (DialogueOption option in chatSupplier.Dialogues) { DialogueListItem item = new DialogueListItem(option); dialogueOptions.AddItem(item); } DialogueManager.GetInstance().HasChanged = false; }