public void InitData() { characterSkin = new CharacterSkin(this); characterEquip = new CharacterEquip(this); characterAnim = new CharacterAnim(this); CharacterItems = new CharacterItems(this); }
public async Task <IActionResult> Edit( int id, [Bind("ID,CharacterId,ItemId,IsEquipped,BpSlotId")] CharacterItems characterItems) { if (id != characterItems.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(characterItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CharacterItemsExists(characterItems.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(characterItems)); }
public InventoryItem(CharacterItems item)//, string baseItem) : base() { _item = item; this.BackgroundImageLayout = ImageLayout.Stretch; Position = _item.InventoryPosition; }
void Start() { rigidBody = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); characterItems = GetComponent <CharacterItems>(); gameOver.continueGame += Restart; originalPosition = transform.position; aimPositionX = originalPosition.x; }
protected override void TriggerFunction(Collider other) { CharacterItems characterItems = other.GetComponent <CharacterItems>(); if (characterItems == null) { return; } characterItems.ShieldActivate(); }
public async Task <IActionResult> Create( [Bind("ID,CharacterId,ItemId,IsEquipped,BpSlotId")] CharacterItems characterItems) { if (ModelState.IsValid) { _context.Add(characterItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(characterItems)); }
//Adds the item to the character, public void AddItem(Item item, int quantity) { using (CharacterContext db = new CharacterContext()) { CharacterItem charItem = db.CharacterItems.FirstOrDefault(ci => ci.ItemParentID == item.ItemID && ci.CharacterId == CharacterID); if (charItem != null) { charItem.QuantityOwned += quantity; db.Entry(charItem).State = EntityState.Modified; } else { CharacterItems.Add(new CharacterItem(item.ItemName, item.ItemDescription, item.ItemCost, item.ItemID, quantity)); } db.SaveChanges(); } }
public Item TakeEnemyItems() { string _item = Console.ReadLine(); Item _take = null; for (int i = 0; i < Position.GetEnemy().CharacterItems.Count; i++) { if (Position.GetEnemy().CharacterItems[i].Name == _item) { _take = Position.GetEnemy().CharacterItems[i]; CharacterItems.Remove(Position.GetEnemy().CharacterItems[i]); Insert(_take); Position.GetEnemy().CharacterItems.Remove(CharacterItems[i]); Console.WriteLine("You took " + _item + "."); } } return(_take); }
public IEnumerator GetItems() { WWWForm form = new WWWForm(); form.AddField("name", ServerData.GlobalUser); UnityWebRequest www = UnityWebRequest.Post(postURL, form); yield return(www.SendWebRequest());//ждем if (www.isNetworkError || www.isHttpError) { Debug.Log("Error: " + www.error); yield break; } else { items = JsonUtility.FromJson <CharacterItems>(www.downloadHandler.text); PotionSet.Invoke(); yield break; } }
private void CreateToolTip(InventoryItem item) { CharacterItems tmpItem = item.Item; string questString = String.Empty; if (tmpItem.IsQuestItem) { questString = "[Questitem]" + Environment.NewLine; } string toolTip = questString + tmpItem.Name + Environment.NewLine + "Item quantity: " + tmpItem.StackSize + "/" + tmpItem.MaxStackSize + Environment.NewLine + "Item quality: " + tmpItem.Quality.ToString() + Environment.NewLine + Environment.NewLine + "Upgrades: " + tmpItem.NumberOfUpgrades + "/" + tmpItem.MaxNumberOfUpgrades + Environment.NewLine + "Augments: " + tmpItem.NumberOfAugmentations + "/" + tmpItem.MaxNumberOfAugmentations + Environment.NewLine + "Affixes: " + tmpItem.NumberOfAffixes + Environment.NewLine + "Age: " + tmpItem.PlayTime / 60 + " ingame minutes"; toolTip1.SetToolTip(item, toolTip); }
private void AddOrRemoveItem2(TradeInventoryTypes type, CharacterItems item, bool removeItem) { // get corresponding inventory bool[,] inventory = _charInventory[(int)type]; int x = item.InventoryPosition.X; int y = item.InventoryPosition.Y; int width = item.InventorySize.Width; int height = item.InventorySize.Height; if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } AllocateInventorySpace(inventory, x, y, width, height, removeItem); }
private TreeNode CreateItemNode(CharacterItems item) { TreeNode node = new TreeNode(item.Name); node.Nodes.Add("Quest item: " + item.IsQuestItem); node.Nodes.Add("Consumable: " + item.IsConsumable); node.Nodes.Add("Affixes: " + item.NumberOfAffixes + "/" + item.MaxNumberOfAffixes); node.Nodes.Add("Augmentations: " + item.NumberOfAugmentations + "/" + item.MaxNumberOfAugmentations); node.Nodes.Add("Upgrades: " + item.NumberOfUpgrades + "/" + item.MaxNumberOfUpgrades); node.Nodes.Add("Quality: " + item.Quality); node.Nodes.Add("Quality Color: " + item.QualityColor.R + "," + item.QualityColor.G + "," + item.QualityColor.B); node.Nodes.Add("Stack size: " + item.StackSize + "/" + item.MaxStackSize); node.Nodes.Add("Has mods: " + item.WrappedItems.Count); TreeNode inventory = new TreeNode("Inventory"); inventory.Nodes.Add("Type: " + item.InventoryType); inventory.Nodes.Add("Position: " + item.InventoryPosition.X + "," + item.InventoryPosition.Y); inventory.Nodes.Add("Size: " + item.InventorySize.Width + "," + item.InventorySize.Height); node.Nodes.Add(inventory); return(node); }
public void AddItem2(CharacterItems item) { // get inventory type that the item uses TradeInventoryTypes type = TradeInventoryTypes.Inventory; if (item.InventoryType == InventoryTypes.Cube) { type = TradeInventoryTypes.Cube; } else if (item.InventoryType == InventoryTypes.Stash) { type = TradeInventoryTypes.Stash; } else if (item.InventoryType == InventoryTypes.Inventory) { type = TradeInventoryTypes.Inventory; } else { return; } AddOrRemoveItem2(type, item, false); }
void Awake() { if(instance) DestroyImmediate(gameObject); else { instance = this; DontDestroyOnLoad(gameObject); } }
//public UnitObject Item //{ // get { return _item; } // set { _item = value; } //} public ItemInfo(CharacterItems item) { itemWrapper = item; }