public bool TestAPIKey(string apiKey) { try { WebRequest request = WebRequest.Create("https://api.wanikani.com/v2/user"); request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + apiKey); WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string data = reader.ReadToEnd(); reader.Close(); response.Close(); this.user = new ItemUser(new JavaScriptSerializer().Deserialize <UserData>(data)); } catch (System.Exception exception) { return(false); } this.apiKey = apiKey; return(true); }
public ActionResult SaveItemSession(ItemUserViewModel model) { if (!ModelState.IsValid) { return(RedirectToAction("ItemSession", "UsersItems")); } ItemUser item = ItemUserModelMap.ViewModelToItemUser(model); List <ItemUser> sessionModel = Session["ItemsList"] as List <ItemUser>; if (sessionModel == null) { item.Id = 1; Session["ItemsList"] = new List <ItemUser>(); Session.Timeout = 30; } else if (item.Id != 0) { int index = sessionModel.FindIndex(i => i.Id == item.Id); sessionModel[index] = item; return(RedirectToAction("New", "Filters")); } else { item.Id = sessionModel.Count > 0 ? sessionModel.Max(i => i.Id) + 1 : 1; } List <ItemUser> viewModel = Session["ItemsList"] as List <ItemUser>; viewModel.Add(item); return(RedirectToAction("New", "Filters")); }
///<summary> ///向数据库中添加一条记录 ///</summary> ///<param name="model">要添加的实体</param> public bool Insert(ItemUser model) { const string sql = @"INSERT INTO [dbo].[ItemUser] (objectId,itemId,_UserId,love,dislove,fav,updatedAt,createdAt) VALUES (@objectId,@itemId,@_UserId,@love,@dislove,@fav,@updatedAt,@createdAt)"; int res = SqlHelper.ExecuteNonQuery(sql, new SqlParameter("@objectId", model.objectId.ToDBValue()), new SqlParameter("@itemId", model.item.objectId.ToDBValue()), new SqlParameter("@_UserId", model._User.objectId.ToDBValue()), new SqlParameter("@love", model.love.ToDBValue()), new SqlParameter("@dislove", model.dislove.ToDBValue()), new SqlParameter("@fav", model.fav.ToDBValue()), new SqlParameter("@updatedAt", model.updatedAt.ToDBValue()), new SqlParameter("@createdAt", model.createdAt.ToDBValue())); return(res > 0); }
public List <ItemUser> GetNoItemsPerUser() { MySql.Data.MySqlClient.MySqlConnection conn; List <ItemUser> itemList = new List <ItemUser>(); try { conn = new MySql.Data.MySqlClient.MySqlConnection(); conn.ConnectionString = ConnectionString; conn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = "select users.user_id, users.username, (select count(items.item_id) from items where items.user_id = users.user_id) as item_count, (select sum(items.value) from items where items.user_id = users.user_id) as total_value from users"; MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ItemUser itemUser = new ItemUser(); itemUser.User_id = reader.GetInt32("user_id"); itemUser.Username = reader.GetString("username"); itemUser.Item_count = reader.GetInt32("item_count"); itemUser.Total_value = reader.GetInt32("total_value"); itemList.Add(itemUser); } reader.Close(); } catch (MySql.Data.MySqlClient.MySqlException ex) { Console.Write(ex.Message); } return(itemList); }
public ActionResult SaveItemDb(ItemUserViewModel model) { bool isAuthorized = User.Identity.GetUserId() == _context.Filters.SingleOrDefault(i => i.Id == model.FilterId).UserId; if (!isAuthorized) { return(HttpNotFound()); } if (!ModelState.IsValid) { return(RedirectToAction("MyFilters", "UsersItems")); } ItemUser item = ItemUserModelMap.ViewModelToItemUser(model); if (model.ItemId == null) { int lastRowId = _context.Filters .SelectMany(i => i.Items) .Where(i => i.FilterId == item.FilterId) .Max(i => i.RowId); item.RowId = lastRowId + 1; _context.UsersItems.Add(item); } else { ItemUser itemInDb = new ItemUser(); itemInDb = _context.UsersItems.SingleOrDefault(i => i.Id == item.Id); itemInDb.BaseType = item.BaseType; itemInDb.Attribute1 = item.Attribute1; itemInDb.Attribute2 = item.Attribute2; itemInDb.Class = item.Class; itemInDb.Corrupted = item.Corrupted; itemInDb.DropLevel = item.DropLevel; itemInDb.Height = item.Height; itemInDb.Identified = item.Identified; itemInDb.ItemLevel = item.ItemLevel; itemInDb.LinkedSockets = item.LinkedSockets; itemInDb.MainCategory = item.MainCategory; itemInDb.PlayAlertSound = item.PlayAlertSound; itemInDb.Quality = item.Quality; itemInDb.Rarity = item.Rarity; itemInDb.SetBackgroundColor = item.SetBackgroundColor; itemInDb.SetBorderColor = item.SetBorderColor; itemInDb.SetFontSize = item.SetFontSize; itemInDb.SetTextColor = item.SetTextColor; itemInDb.Show = item.Show; itemInDb.Sockets = item.Sockets; itemInDb.SocketsGroup = item.SocketsGroup; itemInDb.Width = item.Width; itemInDb.UserBaseType = item.UserBaseType; } _context.SaveChanges(); return(RedirectToAction("Edit", "Filters", new { id = item.FilterId })); }
//static bool outsideInventory = false; // change later add to a main script // Use this for initialization void Start() { itemAmount = gameObject.transform.GetChild(1).GetComponent <Text> (); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory> (); user = GameObject.FindGameObjectWithTag("Item User").GetComponent <ItemUser> (); itemImage = gameObject.transform.GetChild(0).GetComponent <Image> (); _slotManger = FindObjectOfType <SlotManger>(); itemImage.enabled = false; itemAmount.text = ""; }
public async Task <IActionResult> Create(long id, string type, string screenshot) { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var currentUser = await _userManager.FindByIdAsync(userId); Item newItem = new Item(); if (type == "game") { RawgIdRoot itemDetails = Rawg.GetGameById(id); newItem.GetRawgValues(itemDetails); newItem.Poster = screenshot; newItem.Priority = currentUser.PriorityValue; _db.Items.Add(newItem); ItemUser newItemUser = new ItemUser { Item = newItem, User = currentUser, ItemId = newItem.ItemId, UserId = userId }; _db.ItemUser.Add(newItemUser); currentUser.PriorityValue++; var result = await _userManager.UpdateAsync(currentUser); _db.SaveChanges(); } else if (type == "movie") { TmdbMovieRoot itemDetails = Tmdb.GetMovieById(id); newItem.GetTmdbMovieValues(itemDetails); newItem.Priority = currentUser.PriorityValue; _db.Items.Add(newItem); ItemUser newItemUser = new ItemUser { Item = newItem, User = currentUser, ItemId = newItem.ItemId, UserId = userId }; _db.ItemUser.Add(newItemUser); currentUser.PriorityValue++; var result = await _userManager.UpdateAsync(currentUser); _db.SaveChanges(); } else if (type == "tv") { TmdbTvRoot itemDetails = Tmdb.GetTvById(id); newItem.GetTmdbTvValues(itemDetails); newItem.Priority = currentUser.PriorityValue; _db.Items.Add(newItem); ItemUser newItemUser = new ItemUser { Item = newItem, User = currentUser, ItemId = newItem.ItemId, UserId = userId }; _db.ItemUser.Add(newItemUser); currentUser.PriorityValue++; var result = await _userManager.UpdateAsync(currentUser); _db.SaveChanges(); } return(RedirectToAction("Index", new { typeFilter = type })); }
public override void ItemEffect(ItemUser user) { Debug.Log("Radar Use"); var bc = owner.GetComponentInChildren <SelfViewController>(); if (bc != null) { var gameObject = Instantiate(radarEffectPrefab); gameObject.GetComponent <RadarEffect>().Setup(owner.gameObject); } }
public IActionResult Delete(int id, string typeFilter) { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; Item itemToDelete = _db.Items.FirstOrDefault(item => item.ItemId == id); ItemUser joinToDelete = _db.ItemUser.FirstOrDefault(join => join.UserId == userId && join.ItemId == id); _db.Items.Remove(itemToDelete); _db.ItemUser.Remove(joinToDelete); _db.SaveChanges(); return(RedirectToAction("Index", new { typeFilter = typeFilter })); }
protected void RowExpand(ItemUser iu) { var parameters = new ModalParameters(); parameters.Add("ItemUser", iu); var opts = new ModalOptions() { HideHeader = true }; ModalService.Show <ItemHistoryComponent>("History", parameters, opts); }
public IHttpActionResult PostItemUser(string v1, [FromBody] ItemUser model) { try { //查询是否存在 var IsHas = bll.QuerySingleByWheres(new List <Wheres> { new Wheres("itemId", "=", model.item.objectId), new Wheres("_UserId", "=", model._User.objectId, "and") }); if (IsHas != null) { model.updatedAt = DateTime.Now; //表单验证 bool result = bll.UpdateByWheres(new List <Wheres> { new Wheres("itemId", "=", model.item.objectId), new Wheres("_UserId", "=", model._User.objectId, "and") }, new Dictionary <string, object>() { { "love", model.love }, { "dislove", model.dislove }, { "fav", model.fav } }); if (result) { return(ok(model.updatedAt.ToString("yyyy-mm-dd HH:mm:ss"))); } notFound("修改失败"); } //主键 Guid guid = Guid.NewGuid(); model.objectId = guid.ToString(); //时间 model.createdAt = DateTime.Now; model.updatedAt = DateTime.Now; ////外键 //_User modelUser = new _User(); //model._User = modelUser; //item modelitem = new item(); //model.item = modelitem; ////属性 //model.love = love; //model.dislove = dislove; //model.fav = fav; //保存 if (!bll.Insert(model)) { return(notFound("添加失败")); } return(create(model.updatedAt.ToString("yyyy-mm-dd HH:mm:ss"))); } catch (Exception e) { return(execept(e.Message)); } }
/// <summary> /// 查询单个模型实体 /// </summary> /// <param name="id">objectId</param>); /// <returns>实体</returns>); public ItemUser QuerySingleById(string objectId) { const string sql = "SELECT TOP 1 objectId,itemId,_UserId,love,dislove,fav,updatedAt,createdAt from ItemUser WHERE [objectId] = @objectId"; using (var reader = SqlHelper.ExecuteReader(sql, new SqlParameter("@objectId", objectId))) { if (reader.HasRows) { reader.Read(); ItemUser model = SqlHelper.MapEntity <ItemUser>(reader); itemDAO itemDAO = new itemDAO(); model.item = itemDAO.QuerySingleById((string)reader["itemId"]); _UserDAO _UserDAO = new _UserDAO(); model._User = _UserDAO.QuerySingleById((string)reader["_UserId"]); return(model); } else { return(null); } } }
/// <summary> /// Make the given user eat this item if possible. /// </summary> /// <param name="_User">The user of this item.</param> /// <returns>Returns true if this item can be eaten successfully, otherwise false;</returns> public virtual bool Eat(ItemUser _User) { if (!m_Eatable) { return(false); } // If one of the item effects can't be applied, cancel operation foreach (SO_ItemEffect effect in m_EffectsWhenEaten) { if (!effect.CanBeApplied(this, _User)) { return(false); } } // Apply all the effects of this item when eaten foreach (SO_ItemEffect effect in m_EffectsWhenEaten) { effect.Apply(this, _User); } return(true); }
///<summary> ///分页查询一个集合 ///</summary> ///<param name="index">页码</param> ///<param name="size">页大小</param> ///<param name="wheres">条件匿名类</param> ///<param name="orderField">排序字段</param> ///<param name="isDesc">是否降序排序</param> ///<returns>实体集合</returns> public IEnumerable <ItemUser> QueryList(int index, int size, object wheres = null, string orderField = "objectId", bool isDesc = true) { List <SqlParameter> list = null; string where = wheres.parseWheres(out list); orderField = string.IsNullOrEmpty(orderField) ? "objectId" : orderField; var sql = SqlHelper.GenerateQuerySql("ItemUser", new string[] { "objectId", "itemId", "_UserId", "love", "dislove", "fav", "updatedAt", "createdAt" }, index, size, where, orderField, isDesc); using (var reader = SqlHelper.ExecuteReader(sql, list.ToArray())) { if (reader.HasRows) { while (reader.Read()) { ItemUser model = SqlHelper.MapEntity <ItemUser>(reader); itemDAO itemDAO = new itemDAO(); model.item = itemDAO.QuerySingleById((string)reader["itemId"]); _UserDAO _UserDAO = new _UserDAO(); model._User = _UserDAO.QuerySingleById((string)reader["_UserId"]); yield return(model); } } } }
/// <summary> /// Checks if this effect can be applied. /// If false, it means that the item can't be used at all. /// </summary> /// <param name="_Item">The used item that triggers this effect.</param> /// <param name="_User">The entity that used the item.</param> /// <returns>Returns true if the effect can be applied, otherwise false.</returns> public virtual bool CanBeApplied(SO_Item _Item, ItemUser _User) { return(true); }
/// <summary> /// Called when this effect should be applied. Note that if this method is used by the system, it means that CanBeApplied() had /// been called before and returned true. /// </summary> /// <param name="_Item">The used item that triggers this effect.</param> /// <param name="_User">The entity that used the item.</param> /// <returns>Returns true if the effect has been applied successfully, otherwise false.</returns> public abstract bool Apply(SO_Item _Item, ItemUser _User);
public static ItemUserViewModel ItemUserToViewModel(ItemUser model) { ApplicationDbContext _context = new ApplicationDbContext(); ItemUserViewModel viewModel = new ItemUserViewModel(); viewModel.FilterId = model.FilterId; viewModel.ItemId = model.Id; viewModel.BaseTypes = model.MainCategory != null? _context.BaseTypes.SingleOrDefault(i => i.Name == model.MainCategory).Id: (byte?)null; if (viewModel.BaseTypes != null) { var typesInDb = _context.Types.Where(i => i.BaseTypeId == viewModel.BaseTypes).Select(i => i).ToList(); List <string> types = new List <string>(); if (model.Class.Contains("\"")) { types = model.Class.Split('\"').ToList(); } else { types = model.Class.Split(' ').ToList(); } List <string> checkList = new List <string>(); types.RemoveAll(c => c == "" || c == " "); foreach (var itemType in types) { if (itemType.StartsWith(" ") || itemType.EndsWith(" ")) { checkList.AddRange(itemType.Split(' ')); } else { checkList.Add(itemType); } } checkList.RemoveAll(c => c == "" || c == " "); int matchCount = 0; foreach (var itemType in checkList) { bool isMultipleClass = typesInDb.Any(i => i.Name == itemType); matchCount = isMultipleClass ? matchCount + 1 : matchCount; } if (matchCount == typesInDb.Count) { viewModel.Types = null; } else if (matchCount < typesInDb.Count) { model.Class = model.Class.Replace("\"", ""); viewModel.Types = model.Class != null? _context.Types.SingleOrDefault(i => i.Name == model.Class).Id: (int?)null; } else { viewModel.Types = null; } } else { if (model.Class != null) { model.Class = model.Class.Replace("\"", ""); viewModel.Types = _context.Types.SingleOrDefault(i => i.Name == model.Class).Id; } } if (model.BaseType != null) { model.BaseType = model.BaseType.Replace("\"", ""); viewModel.Items = _context.ItemsDB.SingleOrDefault(i => i.Name == model.BaseType).Id; } viewModel.UserItem = model.UserBaseType != null && model.BaseType == null ? model.UserBaseType : null; if (model.ItemLevel != null) { int indexOfSpace = model.ItemLevel.IndexOf(" "); if (model.ItemLevel.Contains("\n")) { int indexOfLastSpace = model.ItemLevel.LastIndexOf(" "); viewModel.ItemLvlRangeSelect1 = model.ItemLevel.Substring(indexOfSpace + 1, 2).Replace("\\", ""); viewModel.ItemLvlRangeSelect2 = model.ItemLevel.Substring(indexOfLastSpace + 1); } viewModel.ItemLvlSelectSign = InequalitySign.SelectInt(model.ItemLevel.Substring(0, indexOfSpace)); viewModel.ItemLvlSelect = model.ItemLevel.Substring(indexOfSpace + 1); } if (model.DropLevel != null) { int indexOfSpace = model.DropLevel.IndexOf(" "); viewModel.DropLevelSelectSign = InequalitySign.SelectInt(model.DropLevel.Substring(0, indexOfSpace)); viewModel.DropLevelSelect = model.DropLevel.Substring(indexOfSpace + 1); } if (model.Quality != null) { int indexOfSpace = model.Quality.IndexOf(" "); viewModel.ItemQualitySelectSign = InequalitySign.SelectInt(model.Quality.Substring(0, indexOfSpace)); viewModel.ItemQualitySelect = model.Quality.Substring(indexOfSpace + 1); } if (model.Rarity != null) { int indexOfSpace = model.Rarity.IndexOf(" "); viewModel.ItemRaritySelectSign = InequalitySign.SelectInt(model.Rarity.Substring(0, indexOfSpace)); viewModel.ItemRaritySelect = (int)Enum.Parse(typeof(Rarity), model.Rarity.Substring(indexOfSpace + 1)); } if (model.Sockets != null) { int indexOfSpace = model.Sockets.IndexOf(" "); viewModel.SocketsNumberSelectSign = InequalitySign.SelectInt(model.Sockets.Substring(0, indexOfSpace)); viewModel.SocketsNumberSelect = model.Sockets.Substring(indexOfSpace + 1); } if (model.LinkedSockets != null) { int indexOfSpace = model.LinkedSockets.IndexOf(" "); viewModel.LinkedSocketsNumberSelectSign = InequalitySign.SelectInt(model.LinkedSockets.Substring(0, indexOfSpace)); viewModel.LinkedSocketsNumberSelect = model.LinkedSockets.Substring(indexOfSpace + 1); } if (model.SocketsGroup != null) { viewModel.RedSocketsSelect = model.SocketsGroup.Count(c => c == 'R'); viewModel.GreenSocketsSelect = model.SocketsGroup.Count(c => c == 'G'); viewModel.BlueSocketsSelect = model.SocketsGroup.Count(c => c == 'B'); viewModel.WhiteSocketsSelect = model.SocketsGroup.Count(c => c == 'W'); } if (model.Height != null) { int indexOfSpace = model.Height.IndexOf(" "); viewModel.HeightSelectSign = InequalitySign.SelectInt(model.Height.Substring(0, indexOfSpace)); viewModel.HeightSelect = model.Height.Substring(indexOfSpace + 1); } if (model.Width != null) { int indexOfSpace = model.Width.IndexOf(" "); viewModel.WidthSelectSign = InequalitySign.SelectInt(model.Width.Substring(0, indexOfSpace)); viewModel.WidthSelect = model.Width.Substring(indexOfSpace + 1); } if (model.SetBorderColor != null) { viewModel.BorderColor = model.SetBorderColor.Substring(0, model.SetBorderColor.LastIndexOf(' ')); viewModel.BorderAlphaSelect = model.SetBorderColor.Substring(model.SetBorderColor.LastIndexOf(' ') + 1); } if (model.SetTextColor != null) { viewModel.TextColor = model.SetTextColor.Substring(0, model.SetTextColor.LastIndexOf(' ')); viewModel.TextAlphaSelect = model.SetTextColor.Substring(model.SetTextColor.LastIndexOf(' ') + 1); } if (model.SetBackgroundColor != null) { viewModel.BackgroundColor = model.SetBackgroundColor.Substring(0, model.SetBackgroundColor.LastIndexOf(' ')); viewModel.BackAlphaSelect = model.SetBackgroundColor.Substring(model.SetBackgroundColor.LastIndexOf(' ') + 1); } if (model.PlayAlertSound != null) { int indexOfSpace = model.PlayAlertSound.IndexOf(" "); viewModel.PlayAlertSoundTypeSelect = model.PlayAlertSound.Substring(0, indexOfSpace); viewModel.PlayAlertSoundVolumeSelect = model.PlayAlertSound.Substring(indexOfSpace + 1); } viewModel.FontSizeSelect = model.SetFontSize; viewModel.IdentifiedSelect = Convert.ToInt32(model.Identified); viewModel.CorruptedSelect = Convert.ToInt32(model.Corrupted); viewModel.Show = Convert.ToInt32(model.Show); return(viewModel); }
public override void ItemEffect(ItemUser user) { CmdItemEffect(); }
protected void RowExpand(ItemUser iu) { }
/// <summary> /// 向数据库中添加一条记录 /// </summary> /// <param name="model">要添加的实体</param> /// <returns>是否成功</returns> public bool Insert(ItemUser model) { return(_dao.Insert(model)); }
/// <summary> /// 根据主键更新一条记录 /// </summary> /// <param name="model">更新后的实体</param> /// <returns>是否成功</returns> public bool Update(ItemUser model) { const string sql = @"UPDATE [dbo].[ItemUser] SET itemId=@itemId,_UserId=@_UserId,love=@love,dislove=@dislove,fav=@fav,updatedAt=@updatedAt,createdAt=@createdAt WHERE [objectId] = @objectId"; return(SqlHelper.ExecuteNonQuery(sql, new SqlParameter("@objectId", model.objectId.ToDBValue()), new SqlParameter("@itemId", model.item.objectId.ToDBValue()), new SqlParameter("@_UserId", model._User.objectId.ToDBValue()), new SqlParameter("@love", model.love.ToDBValue()), new SqlParameter("@dislove", model.dislove.ToDBValue()), new SqlParameter("@fav", model.fav.ToDBValue()), new SqlParameter("@updatedAt", model.updatedAt.ToDBValue()), new SqlParameter("@createdAt", model.createdAt.ToDBValue())) > 0); }
/// return true to destroy the item after use /// return false to prevent destroying public virtual bool ShouldItemDestroyAfterUse(ItemUser user) { return(true); }
public virtual void ItemEffect(ItemUser user) { Debug.Log("Item Use"); }
public virtual bool ItemWillUse(ItemUser user) { return(true); }
public sealed override void ItemEffect(ItemUser user) { CmdThrowItem(Util.MousePositionInWorld); }
// Use this for initialization void Start() { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory> (); user = GameObject.FindGameObjectWithTag("Item User").GetComponent <ItemUser> (); }
public static ItemUser ViewModelToItemUser(ItemUserViewModel viewModel) { ApplicationDbContext _context = new ApplicationDbContext(); ItemUser model = new ItemUser(); model.Id = viewModel.ItemId != null ? viewModel.ItemId.Value : 0; model.FilterId = viewModel.FilterId != null ? viewModel.FilterId.Value : 0; if (viewModel.Items != null) { string baseType = _context.ItemsDB.SingleOrDefault(i => i.Id == viewModel.Items).Name; model.BaseType = baseType.Contains(" ") ? "\"" + baseType + "\"" : baseType; } else { model.BaseType = null; } model.UserBaseType = viewModel.UserItem != null && model.BaseType == null? viewModel.UserItem.Contains(" ") ? "\"" + viewModel.UserItem + "\"" : viewModel.UserItem: null; model.MainCategory = viewModel.BaseTypes != null? _context.BaseTypes.SingleOrDefault(i => i.Id == viewModel.BaseTypes).Name: null; if (viewModel.Types != null) { string type = _context.Types.SingleOrDefault(i => i.Id == viewModel.Types).Name; model.Class = type.Contains(" ") ? "\"" + type + "\"" : type; } else { model.Class = null; } if (model.MainCategory != null && model.Class == null) { var classesList = _context.Types.Where(i => i.BaseTypeId == viewModel.BaseTypes).Select(i => i.Name).ToList(); foreach (var className in classesList) { if (className.Contains(" ")) { model.Class += "\"" + className + "\""; } else { model.Class += className; } model.Class += " "; } model.Class = model.Class.Trim(); } model.Corrupted = Convert.ToBoolean(viewModel.CorruptedSelect); model.DropLevel = viewModel.DropLevelSelectSign != null && viewModel.DropLevelSelect != null? InequalitySign.SelectSign(viewModel.DropLevelSelectSign.Value) + " " + viewModel.DropLevelSelect: null; model.Height = viewModel.HeightSelectSign != null && viewModel.HeightSelect != null? InequalitySign.SelectSign(viewModel.HeightSelectSign.Value) + " " + viewModel.HeightSelect: null; model.Identified = Convert.ToBoolean(viewModel.IdentifiedSelect); model.ItemLevel = viewModel.ItemLvlSelectSign != null && viewModel.ItemLvlSelect != null? InequalitySign.SelectSign(viewModel.ItemLvlSelectSign.Value) + " " + viewModel.ItemLvlSelect: null; if (model.ItemLevel == null) { model.ItemLevel = viewModel.ItemLvlRangeSelect1 != null && viewModel.ItemLvlRangeSelect2 != null ? ">= " + viewModel.ItemLvlRangeSelect1 + "\n" + "<= " + viewModel.ItemLvlRangeSelect2 : null; } model.LinkedSockets = viewModel.LinkedSocketsNumberSelectSign != null && viewModel.LinkedSocketsNumberSelect != null? InequalitySign.SelectSign(viewModel.LinkedSocketsNumberSelectSign.Value) + " " + viewModel.LinkedSocketsNumberSelect: null; model.PlayAlertSound = viewModel.PlayAlertSoundTypeSelect != null && viewModel.PlayAlertSoundVolumeSelect != null ? viewModel.PlayAlertSoundTypeSelect + " " + viewModel.PlayAlertSoundVolumeSelect : null; model.Quality = viewModel.ItemQualitySelectSign != null && viewModel.ItemQualitySelect != null? InequalitySign.SelectSign(viewModel.ItemQualitySelectSign.Value) + " " + viewModel.ItemQualitySelect: null; model.Rarity = viewModel.ItemRaritySelectSign != null && viewModel.ItemRaritySelect != 300 ? InequalitySign.SelectSign(viewModel.ItemRaritySelectSign.Value) + " " + (Rarity)viewModel.ItemRaritySelect : null; model.SetBackgroundColor = viewModel.BackgroundColor != null ? viewModel.BackgroundColor + " " + viewModel.BackAlphaSelect : null; model.SetBorderColor = viewModel.BorderColor != null ? viewModel.BorderColor + " " + viewModel.BorderAlphaSelect : null; model.SetTextColor = viewModel.TextColor != null ? viewModel.TextColor + " " + viewModel.TextAlphaSelect : null; model.SetFontSize = viewModel.FontSizeSelect != null ? viewModel.FontSizeSelect : model.SetFontSize; model.Show = Convert.ToBoolean(viewModel.Show); model.Sockets = viewModel.SocketsNumberSelectSign != null && viewModel.SocketsNumberSelect != null? InequalitySign.SelectSign(viewModel.SocketsNumberSelectSign.Value) + " " + viewModel.SocketsNumberSelect: null; model.SocketsGroup = viewModel.RedSocketsSelect != null? string.Concat(Enumerable.Repeat("R", viewModel.RedSocketsSelect.Value)) : model.SocketsGroup; model.SocketsGroup = viewModel.GreenSocketsSelect != null ? model.SocketsGroup + string.Concat(Enumerable.Repeat("G", viewModel.GreenSocketsSelect.Value)) : model.SocketsGroup; model.SocketsGroup = viewModel.BlueSocketsSelect != null ? model.SocketsGroup + string.Concat(Enumerable.Repeat("B", viewModel.BlueSocketsSelect.Value)) : model.SocketsGroup; model.SocketsGroup = viewModel.WhiteSocketsSelect != null ? model.SocketsGroup + string.Concat(Enumerable.Repeat("W", viewModel.WhiteSocketsSelect.Value)) : model.SocketsGroup; model.Width = viewModel.WidthSelectSign != null && viewModel.WidthSelect != null? InequalitySign.SelectSign(viewModel.WidthSelectSign.Value) + " " + viewModel.WidthSelect: null; return(model); }
/// return true to allow pick Up /// return false to prevent pick up public virtual bool ItemWillPickUp(ItemUser user) { return(true); }
public virtual void ItemDidPickedUp(ItemUser user) { }
// Use this for initialization void Start() { inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory> (); user = GameObject.FindGameObjectWithTag ("Item User").GetComponent<ItemUser> (); }
/// <summary> /// 根据主键更新一条记录 /// </summary> /// <param name="model">更新后的实体</param> /// <returns>执行结果受影响行数</returns> public bool Update(ItemUser model) { return(_dao.Update(model)); }
//static bool outsideInventory = false; // change later add to a main script // Use this for initialization void Start() { itemAmount = gameObject.transform.GetChild (1).GetComponent<Text> (); inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory> (); user = GameObject.FindGameObjectWithTag ("Item User").GetComponent<ItemUser> (); itemImage = gameObject.transform.GetChild (0).GetComponent<Image> (); _slotManger = FindObjectOfType<SlotManger>(); itemImage.enabled = false; itemAmount.text = ""; }
public void SetItemUser(ItemUser iu) { user = iu; }