コード例 #1
0
ファイル: GameData.cs プロジェクト: kayorga/3DSP
 public GameData(ContentManager Content, GraphicsDevice device, AudioManager audio, World world)
 {
     player = new Player(world, Content, audio, device);
     mods = new ModCollection();
     npcs = new NPCCollection(world, Content, player, device, audio);
     bullets = new BulletCollection(Content, device);
     missions = new MissionCollection(world, npcs);
     this.world = world;
     this.audio = audio;
 }
コード例 #2
0
        public override MissionCollection GetNewMissions(int userID, int?categoryID, int pageNumber, int pageSize, out int totalCount)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.IsDesc     = false;
                query.Pager.SortField  = "[SortOrder]";
                query.Pager.PrimaryKey = "[ID]";
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize   = pageSize;
                //query.Pager.TotalRecords = totalCount;
                query.Pager.SelectCount = true;
                query.Pager.TableName   = "[bx_Missions]";
                if (categoryID != null)
                {
                    query.Pager.Condition = "CategoryID = @CategoryID AND ";
                    query.CreateParameter <int>("@CategoryID", categoryID.Value, SqlDbType.Int);
                }
                query.Pager.Condition += @"
ParentID IS NULL AND
    ( getdate() > [BeginDate] AND getdate() < [EndDate] AND [IsEnable] = 1 AND [ID] NOT IN (SELECT [MissionID] FROM [bx_UserMissions] WHERE [UserID] = @UserID)
OR
    ([CycleTime] > 0 AND [IsEnable] = 1 AND [ID] IN(
        SELECT [MissionID] FROM [bx_UserMissions] WHERE [UserID] = @UserID AND [FinishPercent]=1 AND [Status]<>3 AND [CreateDate]<DATEADD(second,0-[CycleTime],getdate()) AND getdate() > [BeginDate] AND getdate() < [EndDate]
        )
    ))
";

                query.CreateParameter <int>("@UserID", userID, SqlDbType.Int);


                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    MissionCollection missions = new MissionCollection(reader);

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            totalCount = reader.Get <int>(0);
                        }
                        else
                        {
                            totalCount = 0;
                        }
                    }
                    else
                    {
                        totalCount = 0;
                    }

                    return(missions);
                }
            }
        }
コード例 #3
0
    public void ReadMissionInfo()
    {
        MissionCollection mc = JsonUtility.FromJson <MissionCollection>(jsonFile.text);

        Mission[] tempMissions = mc.missions;
        Debug.Log(mc.missions.Length);
        foreach (Mission mission in tempMissions)
        {
            Missions.Add(mission);
            Debug.Log(mission.missionText + "!?");
        }
        Debug.Log(tempMissions.Length);
    }
コード例 #4
0
        public void MissionList(string page, int pageSize, Mission2Template template)
        {
            int pageNumber;

            if (page == null)
            {
                pageNumber = 1;
            }
            else if (!int.TryParse(page, out pageNumber))
            {
                pageNumber = 1;
            }

            int total;
            MissionCollection missions = MissionBO.Instance.GetMissions(null, pageNumber, pageSize, false, out total);

            int i = 0;

            foreach (Mission mission in missions)
            {
                template(i++, mission);
            }
        }
コード例 #5
0
        public void MissionList(int page, int pageSize
                                , MissionListHeadFootTemplate head
                                , MissionListHeadFootTemplate foot
                                , MissionListItemTemplate item)
        {
            if (page == 0)
            {
                page = 1;
            }

            int total;
            MissionCollection missions = MissionBO.Instance.GetMissions(null, page, pageSize, true, out total);

            head(total > 0, total);

            int i = 0;

            foreach (Mission mission in missions)
            {
                item(i++, mission);
            }
            foot(total > 0, total);
        }
コード例 #6
0
        public override MissionCollection GetAllMissions()
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_GetAllMissions";
                query.CommandType = CommandType.StoredProcedure;
                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    MissionCollection missions = new MissionCollection(reader);

                    MissionCollection result = new MissionCollection();

                    foreach (Mission mission in missions)
                    {
                        if (mission.ParentID == null)
                        {
                            result.Add(mission);

                            MissionCollection childMissions = new MissionCollection();

                            foreach (Mission childMission in missions)
                            {
                                if (childMission.ParentID != null && childMission.ParentID == mission.ID)
                                {
                                    childMissions.Add(childMission);
                                }
                            }

                            mission.ChildMissions = childMissions;
                        }
                    }

                    return(result);
                }
            }
        }
コード例 #7
0
ファイル: MissionDao.cs プロジェクト: huchao007/bbsmax
        public override MissionCollection GetNewMissions(int userID, int? categoryID, int pageNumber, int pageSize, out int totalCount)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.IsDesc = false;
                query.Pager.SortField = "[SortOrder]";
                query.Pager.PrimaryKey = "[ID]";
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize = pageSize;
                //query.Pager.TotalRecords = totalCount;
                query.Pager.SelectCount = true;
                query.Pager.TableName = "[bx_Missions]";
                if (categoryID != null)
                {
                    query.Pager.Condition = "CategoryID = @CategoryID AND ";
                    query.CreateParameter<int>("@CategoryID", categoryID.Value, SqlDbType.Int);
                }
                query.Pager.Condition += @"
ParentID IS NULL AND
    ( getdate() > [BeginDate] AND getdate() < [EndDate] AND [IsEnable] = 1 AND [ID] NOT IN (SELECT [MissionID] FROM [bx_UserMissions] WHERE [UserID] = @UserID)
OR
    ([CycleTime] > 0 AND [IsEnable] = 1 AND [ID] IN(
        SELECT [MissionID] FROM [bx_UserMissions] WHERE [UserID] = @UserID AND [FinishPercent]=1 AND [Status]<>3 AND [CreateDate]<DATEADD(second,0-[CycleTime],getdate()) AND getdate() > [BeginDate] AND getdate() < [EndDate]
        )
    ))
";

                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);


                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    MissionCollection missions = new MissionCollection(reader);

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            totalCount = reader.Get<int>(0);
                        }
                        else
                            totalCount = 0;
                    }
                    else
                        totalCount = 0;

                    return missions;
                }
            }
        }
コード例 #8
0
ファイル: MissionDao.cs プロジェクト: huchao007/bbsmax
        public override MissionCollection GetAllMissions()
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_GetAllMissions";
                query.CommandType = CommandType.StoredProcedure;
                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    MissionCollection missions = new MissionCollection(reader);

                    MissionCollection result = new MissionCollection();

                    foreach (Mission mission in missions)
                    {
                        if (mission.ParentID == null)
                        {
                            result.Add(mission);

                            MissionCollection childMissions = new MissionCollection();

                            foreach (Mission childMission in missions)
                            {
                                if (childMission.ParentID != null && childMission.ParentID == mission.ID)
                                {
                                    childMissions.Add(childMission);
                                }
                            }

                            mission.ChildMissions = childMissions;
                        }
                    }

                    return result;
                }
            }
        }