Ejemplo n.º 1
0
        public JsonResult AllNoteList(int start, int limit, string searchText = null)
        {
            var noteList = JsonDataList.CreateResult(notebookservice.GetAllNoteList(searchText),
                                                     GetTransformOneNote(), start, limit);

            return(Json(noteList, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public MonsterStateMachine LoadData(string resourcesID)
        {
            //
            MonsterStateMachine monsterStateMachine = new MonsterStateMachine();

            // 取得 json資料
            TextAsset text = Resources.Load <TextAsset>(
                string.Format("1.MonsterAI/1.1.Json/{0}", resourcesID));

            // json資料轉換
            JsonDataList jsonData = JsonUtility.FromJson <JsonDataList>(text.text);

            // 狀態條件
            for (int i = jsonData.dataBases.Count - 1; i > -1; i--)
            {
                if (typeof(JsonCondition).IsInstanceOfType(jsonData.dataBases[i]))
                {
                    JsonCondition json = (JsonCondition)jsonData.dataBases[i];

                    Type type = Type.GetType(json.createType);
                    var  ob   = Activator.CreateInstance(type);

                    IStateCondition condition = (IStateCondition)ob;
                    condition.SetData(json);
                    condition.SetMonsterID = monsterID;

                    monsterStateMachine.SetCondition(condition);

                    jsonData.dataBases.RemoveAt(i);
                }
            }

            // 狀態
            for (int i = 0; i < jsonData.dataBases.Count; i++)
            {
                //
                if (typeof(JsonMonsterAI).IsInstanceOfType(jsonData.dataBases[i]))
                {
                    JsonMonsterAI json = (JsonMonsterAI)jsonData.dataBases[i];

                    Type             type         = Type.GetType(json.createType);
                    MonsterStateBase monsterState = (MonsterStateBase)Activator.CreateInstance(type);

                    monsterState.SetData(json, monsterID);

                    monsterStateMachine.SetState(json, monsterState);
                }
            }

            monsterStateMachine.StartAI();

            return(monsterStateMachine);
        }
Ejemplo n.º 3
0
        public string GetUseDataToJson()
        {
            JsonDataList jsonDataList = new JsonDataList();

            foreach (var node in _nodes)
            {
                IDataBase data = node.GetDataBase();

                if (!ReferenceEquals(data, default(IDataBase)))
                {
                    jsonDataList.Set(data);
                }
            }

            return(jsonDataList.ToJson());
        }
Ejemplo n.º 4
0
        public JsonResult Query(ShareQuery query)
        {
            if (query == null)
            {
                return(Json(false));
            }

            var statement = shareService.QueryShareList(query);

            Func <ShareInfo, ShareableContent> tranform = o =>
            {
                shareService.LoadIsMyPraised(o);

                var result = new ShareableContent(o);

                return(result);
            };

            return(Json(JsonDataList.CreateTransformResult(statement, tranform, query.Offset, query.Limit > 0 ? query.Limit : 4)));
        }
Ejemplo n.º 5
0
        public JsonResult List(int start, int limit, PlanType type)
        {
            var statement = planServices.CreateQuery(type);

            return(Json(JsonDataList.CreateResult(statement, start, limit), JsonRequestBehavior.AllowGet));
        }