Esempio n. 1
0
        public List <dynamic> RemoveGroupType([FromBody] Group_Type groups)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            try
            {
                Group_Type group = db.Group_Type.Where(x => x.GroupTypeID == groups.GroupTypeID).FirstOrDefault();
                db.Group_Type.Remove(group);
                db.SaveChanges();
            }
            catch (Exception e)
            {
            }

            return(GetGroupTypes());
        }
Esempio n. 2
0
        public List <dynamic> UpdateFood([FromBody] Group_Type newGroupType)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            try
            {
                Group_Type updater = db.Group_Type.Where(x => x.GroupTypeID == newGroupType.GroupTypeID).FirstOrDefault();
                updater.GroupTypeName = newGroupType.GroupTypeName;

                db.Group_Type.Attach(updater);
                db.Entry(updater).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception e)
            {
            }

            return(GetGroupTypes());
        }
Esempio n. 3
0
        public dynamic GetGroupTypeByID(int GroupTypeID)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            db.Configuration.ProxyCreationEnabled = false;

            //retrieve object where id is equal to id received
            Group_Type thisGroupType = db.Group_Type.Where(x => x.GroupTypeID == GroupTypeID).FirstOrDefault();

            try
            {
                return(thisGroupType);//return object
            }
            catch (Exception e)
            {
                //else return error
                dynamic toReturn = new ExpandoObject();
                toReturn.Error = e.Message;
                return(toReturn);
            }
        }
Esempio n. 4
0
        public List <dynamic> AddGroupType([FromBody] Group_Type AddGroupType)
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            try
            {
                if (AddGroupType != null)
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    db.Group_Type.Add(AddGroupType);
                    db.SaveChanges();
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
            }
            return(GetGroupTypes());
        }
Esempio n. 5
0
        public List <dynamic> MyGroups(Person personID)
        {
            //Database connection
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3();

            //Configure proxy to eliminamte overload of memory
            db.Configuration.ProxyCreationEnabled = false;

            //Create dynamic list
            List <dynamic> Groups = new List <dynamic>();

            //Group_Type getHomecellID = db.Group_Type.Where(z => z.GroupTypeName == "Homecell").FirstOrDefault();

            if (personID == null)
            {
                return(null);
            }
            else if (personID.OrgStructID == 27)
            {
                List <Organisational_Group> orgGroups = db.Organisational_Group.ToList();

                foreach (Organisational_Group thisgroup in orgGroups)
                {
                    dynamic dynamicGroup = new ExpandoObject();
                    dynamicGroup.OrgGroupID  = thisgroup.OrgGroupID;
                    dynamicGroup.GroupTypeID = thisgroup.GroupTypeID;
                    dynamicGroup.Description = thisgroup.Description;
                    dynamicGroup.Size        = thisgroup.Size;
                    dynamicGroup.Address     = thisgroup.Address;
                    dynamicGroup.SuburbID    = thisgroup.SuburbID;

                    Groups.Add(dynamicGroup);
                }
            }
            else
            {
                //Create list of people to find the person currently loggend in with their ID
                List <Persons_Group> myGroups = db.Persons_Group.Include(z => z.Organisational_Group).Where(x => x.PersonID == personID.PersonID).ToList();

                //Loop through the list of parents found and find the children with the matching PersonID and the Kids Church of the child with the matching KidsChurchID
                foreach (Persons_Group psngroup in myGroups)
                {
                    Group_Type type   = db.Group_Type.Where(z => z.GroupTypeID == psngroup.Organisational_Group.GroupTypeID).FirstOrDefault();
                    Suburb     suburb = db.Suburbs.Where(x => x.SuburbID == psngroup.Organisational_Group.SuburbID).FirstOrDefault();
                    //Create dynamic object to find the child information to be returned
                    dynamic group = new ExpandoObject();

                    group.PersonID      = psngroup.PersonID;
                    group.OrgGroupID    = psngroup.Organisational_Group.OrgGroupID;
                    group.PersonGroupID = psngroup.PersonGroupID;
                    group.GroupTypeID   = type.GroupTypeID;
                    group.Description   = psngroup.Organisational_Group.Description;
                    group.Address       = psngroup.Organisational_Group.Address;
                    group.SuburbID      = suburb.SuburbID;
                    group.Size          = psngroup.Organisational_Group.Size;

                    //Add dynamic object created to the dynamic list
                    Groups.Add(group);
                }
            }

            if (Groups.Count != 0)
            {
                return(Groups);
            }

            else
            {
                return(null);
            }
        }
Esempio n. 6
0
    //控制怪物出现
    public void oniAppearControl()
    {
        //玩家每前进一定距离后,生成的怪物分组

        if (this.can_dispatch)
        {
        }
        else
        {
            if (this.Is_one_group_only())//检测是否是特别模式
            {
                //特别模式下,等待怪物从画面中消失
                if (GameObject.FindGameObjectsWithTag("OniGroup").Length == 0)
                {
                    this.can_dispatch = true;
                }
            }
            else
            {
                //普通模式下,马上生成
                this.can_dispatch = true;
            }

            if (this.can_dispatch)
            {
                //准备好出现后,通过玩家的位置计算怪物应该出现位置
                if (this.group_type_next == Group_Type.Normal)
                {
                    this.oni_generate_line = this.player.transform.position.x + this.next_line;
                }
                else if (this.group_type_next == Group_Type.Slow)
                {
                    this.oni_generate_line = this.player.transform.position.x + 50.0f;
                }
                else
                {
                    this.oni_generate_line = this.player.transform.position.x + 10.0f;
                }
            }
        }

        //玩家前进一定距离后,生成下一个分组
        do
        {
            if (this.scene_control.oni_group_num >= this.scene_control.oni_group_appear_max)
            {
                break;
            }
            if (!this.can_dispatch)
            {
                break;
            }
            if (this.player.transform.position.x <= this.oni_generate_line)
            {
                break;
            }

            this.group_type = this.group_type_next;

            switch (this.group_type)
            {
            case Group_Type.Slow:
            {
                this.Dispatch_slow();
            }
            break;

            case Group_Type.Decelerate:
            {
                this.Dispatch_decelerate();
            }
            break;

            case Group_Type.Passing:
            {
                this.dispatch_passing();
            }
            break;

            case Group_Type.Rapid:
            {
                this.dispatch_rapid();
            }
            break;

            case Group_Type.Normal:
            {
                this.Dispatch_normal(this.next_speed);
            }
            break;
            }


            //更新下次出现分组的怪物数量
            this.oni_appear_num++;

            this.oni_appear_num = Mathf.Min(this.oni_appear_num, SceneControl.ONI_APPEAR_NUM_MAX);

            this.can_dispatch = false;

            this.no_miss_count++;

            this.scene_control.oni_group_num++;

            if (this.is_random)
            {
                //选择下次出现的分组
                this.Select_next_group_type();
            }
        } while (false);
    }
Esempio n. 7
0
    //随机下次生成的类型
    public void Select_next_group_type()
    {
        if (this.event_type != Group_Type.None)
        {
            this.event_count--;
            if (this.event_count <= 0)
            {
                this.event_type   = Group_Type.None;
                this.normal_count = Random.Range(3, 6);
            }
        }
        else
        {
            this.normal_count--;

            if (this.normal_count <= 0)
            {
                //产生随机事件
                this.event_type = (Group_Type)Random.Range(0, 4);

                switch (this.event_type)
                {
                default:
                case Group_Type.Decelerate:
                case Group_Type.Passing:
                case Group_Type.Slow:
                {
                    this.event_count = 1;
                }
                break;

                case Group_Type.Rapid:
                {
                    this.event_count = Random.Range(2, 4);
                }
                break;
                }
            }
        }


        //生成普通分组和事件分组

        if (this.event_type == Group_Type.None)
        {
            //普通类型分组
            float rate;

            rate = (float)this.no_miss_count / 10.0f;

            rate = Mathf.Clamp01(rate);

            this.next_speed = Mathf.Lerp(OniGroupControl.Speed_Max, OniGroupControl.Speed_Min, rate);

            this.next_line = Mathf.Lerp(LevelControl.INTERVAL_MAX, LevelControl.INTERVAL_MIN, rate);

            this.group_type_next = Group_Type.Normal;
        }
        else
        {
            //事件类型的分组
            this.group_type_next = this.event_type;
        }
    }