public void CreateActItem(ActItem actItem) { actItem.CreateTime = DateTime.Now; actItem.UpDateTime = DateTime.Now; actItem.ValidStatus = (int)ValidStatus.TRUE; dbService.Add <ActItem>(actItem); }
public async Task <IActionResult> ActItemDetail(int planId, int id, ActItem model) { var identity = User; var now = DateTime.Now; var result = new Result(); if (model.Name.IsNullOrEmpty()) { result.Error("请输入名称"); return(Json(result)); } if (model.Title.IsNullOrEmpty()) { result.Error("请输入标题"); return(Json(result)); } if (id > 0) { var old = DefaultStorage.ActItemGet(id); if (old == null) { result.Message = "数据不存在"; return(Json(result)); } var status = await TryUpdateModelAsync(old); if (status) { result.Status = DefaultStorage.ActItemUpdate(old); if (!result.Status) { result.Message = "更新失败"; } } else { result.Message = "参数有误"; } return(Json(result)); } model.SellerId = identity.Id; model.SellerName = identity.Name; model.CreatedOn = now; model.ModifiedBy = identity.Name; model.ModifiedOn = now; var newId = DefaultStorage.ActItemCreate(model); if (result.Status = newId > 0) { result.Success(); } return(Json(result)); }
public ActItem UpdateActItem(ActItem actItem) { var filter = filterBuilder.Where(x => x.ID == actItem.ID); actItem.CreateTime = dbService.Query(filter).Result[0].CreateTime; actItem.UpDateTime = DateTime.Now; var result = dbService.Update <ActItem>(filter, actItem).Result; if (result.IsModifiedCountAvailable && result.ModifiedCount == 1) { return(dbService.Query <ActItem>(filter).Result[0]); } else { return(new ActItem()); } }
//调用后直接在指定位置生成指定id的Animal public static GameObject CreateActObject(int i, Vector3 p) { //Debug.Log (i); ActItem tmp = AllActItems[i]; //Debug.Log (tmp.obj); GameObject g = (GameObject)Instantiate(tmp.obj, tmp.obj.transform.localPosition + p, tmp.obj.transform.localRotation); g.name = tmp.name; ActObject actO = g.GetComponent <ActObject>(); actO.life = tmp.life; actO.isnomaldie = tmp.isnomaldie; actO.isdiedrop = tmp.isdiedrop; actO.carryItem = tmp.carryItem; actO.carryIll = tmp.carryIll; actO.attedtype = tmp.attedtype; return(g); }
/// <summary>Checks if an action with the same link is already on the Action List.</summary> private static bool CheckAction(SimulationRule rule, Action action, List <ActItem> actionList) { for (int i = 0; i < actionList.Count; i++) { if (actionList[i].action._link != action._link) { continue; } // Action with same link if (rule._priority > actionList[i].rule._priority) { // Replace Actitem action with higher priority rule actionList[i] = new ActItem(rule, action); } return(true); } return(false); }
public QuestAct() { Items = new ActItem[0]; Skills = new ActSkill[0]; }