예제 #1
0
 public void CreateActItem(ActItem actItem)
 {
     actItem.CreateTime  = DateTime.Now;
     actItem.UpDateTime  = DateTime.Now;
     actItem.ValidStatus = (int)ValidStatus.TRUE;
     dbService.Add <ActItem>(actItem);
 }
예제 #2
0
        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));
        }
예제 #3
0
        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());
            }
        }
예제 #4
0
파일: GameData.cs 프로젝트: hszqf/Survive
    //调用后直接在指定位置生成指定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);
    }
예제 #5
0
        /// <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);
        }
예제 #6
0
 public QuestAct()
 {
     Items  = new ActItem[0];
     Skills = new ActSkill[0];
 }