示例#1
0
文件: Access.cs 项目: andreyV512/rag
 public void Set(string _group)
 {
     if (!Enum.TryParse <EGroup>(_group, out group))
     {
         group = EGroup.Operator;
     }
 }
示例#2
0
文件: Image.cs 项目: kuviman/Q
        public static void SetupHandlers(Client client)
        {
            EGroup group = new EGroup(client.Peer.ESystem, e => e.Get <Components.Image>() != null);

            client.OnRenderRoom += (string room) => {
                foreach (var e in group.Entities)
                {
                    var pos = e.Get <Components.Position>();
                    if (pos.Room != room)
                    {
                        continue;
                    }
                    var          sp    = RenderState.ModelToScreen(pos.Pos);
                    const double DELTA = 0;
                    if (sp.X < -1 - DELTA || sp.X > 1 + DELTA || sp.Y < -1 - DELTA || sp.Y > 1 + DELTA)
                    {
                        continue;
                    }
                    RenderState.Push();
                    RenderState.Translate(pos.Pos);
                    RenderState.FaceCam();
                    var image = e.Get <Components.Image>();
                    var tex   = image.Texture.Texture;
                    RenderState.Scale(tex.Width * image.Height / tex.Height, image.Height);
                    RenderState.Origin(0.5, 0);
                    tex.Render();
                    RenderState.Pop();
                }
            };
        }
示例#3
0
        public IHttpActionResult Put(int id, EGroup eGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eGroup.group_id)
            {
                return(BadRequest());
            }

            db.Entry(eGroup).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#4
0
文件: Antrieb.cs 项目: StWol/Last-Man
 //Constructor
 public Antrieb( int id, EGroup group, String name, float rateOfFire, float damage, string soundId, float weight, string description, ILocationBehavior locationBehavior)
     : base(id,  group,  name,  description,  weight,  locationBehavior)
 {
     RateOfFire = rateOfFire;
     Damage = damage;
     SoundId = soundId;
 }
示例#5
0
        public static void SetupHandlers(Client client)
        {
            EGroup group = new EGroup(client.Peer.ESystem, e => e.Get <Components.Face>() != null);

            client.OnRenderRoom += (string room) => {
                foreach (var e in group.Entities)
                {
                    var pos = e.Get <Components.Position>();
                    if (pos.Room != room)
                    {
                        continue;
                    }
                    RenderState.Push();
                    RenderState.Translate(pos.Pos);
                    RenderState.FaceCam();
                    var face = e.Get <Components.Face>();
                    RenderState.Translate(0, face.Height);
                    RenderState.Set("texture", face.Texture);
                    RenderState.Set("rotation", -0.25 + (-pos.Rot + (RenderState.CameraMatrix.Inverse * new Vec4(1, 0, 0, 0)).XY.Arg) / (2 * Math.PI));
                    RenderState.Origin(0.5, 0);
                    RotatedModel.Render();
                    RenderState.Color = Color.Black;
                    Draw.Frame(0, 0, 1, 1, 0.05);
                    RenderState.Pop();
                }
            };
        }
示例#6
0
文件: Movement.cs 项目: kuviman/Q
        public static void SetupHandlers(Peer peer)
        {
            EGroup movables = new EGroup(peer.ESystem, e => e.Id.StartsWith(peer.Nick + '#') && e.Get <Components.Movement>() != null);

            peer.OnUpdate += dt => {
                foreach (var e in movables.Entities)
                {
                    var pos = e.Get <Components.Position>();
                    var mov = e.Get <Components.Movement>();
                    pos.Pos += mov.Vel * dt;
                }
            };

            predictionMap[peer]  = new Dictionary <Entity, Prediction>();
            peer.OnUpdateEntity += (e, update, updated) => {
                if (update.Get <Components.Movement>() != null)
                {
                    var predMap = predictionMap[peer];
                    if (!predMap.ContainsKey(e))
                    {
                        predMap[e] = new Prediction(e.Get <Components.Position>(), e.Get <Components.Movement>());
                    }
                    predMap[e].Update(update.Get <Components.Position>(), update.Get <Components.Movement>());
                    updated.Add(Entity.ComponentName <Components.Position>());
                    updated.Add(Entity.ComponentName <Components.Movement>());
                }
            };
            peer.OnUpdate += dt => {
                foreach (var pred in predictionMap[peer].Values)
                {
                    pred.Update(dt);
                }
            };
        }
示例#7
0
文件: Weapon.cs 项目: StWol/Last-Man
 // ***************************************************************************
 // Konstruktor
 public Weapon( Visier visier, Antrieb antrieb, Stabilisator stabilisator, Hauptteil hauptteil, int id, EGroup group, String name, float weight, string description, ILocationBehavior locationBehavior )
     : base(id, group, name, description, weight, locationBehavior)
 {
     this.Visier = visier;
     this.Antrieb = antrieb;
     this.Stabilisator = stabilisator;
     this.Hauptteil = hauptteil;
 }
示例#8
0
文件: Weapon.cs 项目: StWol/Last-Man
 // ***************************************************************************
 // Konstruktor
 public Weapon( int visierId, int antriebId, int stabilisatorId, int hauptteilId, int id, EGroup group, String name, float weight, string description, ILocationBehavior locationBehavior )
     : base(id, group, name, description, weight, locationBehavior)
 {
     this.Visier = Item.DefaultVisiere[ visierId ];
     this.Antrieb = Item.DefaultAntrieb[ antriebId ];
     this.Stabilisator = Item.DefaultStabilisatoren[ stabilisatorId ];
     this.Hauptteil = Item.DefaultHauptteil[ hauptteilId ];
 }
示例#9
0
        public Product(string id, string name, decimal price, EGroup group = EGroup.GroupA)
        {
            Id    = id;
            Name  = name;
            Price = price;
            Group = group;

            Validate();
        }
示例#10
0
 //Constructor
 public Munition(int id, EGroup group, String name, List<int> buffIDs, int count, int shotId, float damage, string description, float weight, ILocationBehavior locationBehavior)
     : base(id, group, name, description, weight, locationBehavior)
 {
     this.buffIDs = buffIDs;
     Count = count;
     MagazineSize = count;
     ShotId = shotId;
     Damage = damage;
 }
示例#11
0
        public IHttpActionResult Get(int id)
        {
            EGroup eGroup = db.EGroups.Find(id);

            if (eGroup == null)
            {
                return(NotFound());
            }

            return(Ok(eGroup));
        }
示例#12
0
        public IHttpActionResult Post(EGroup eGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EGroups.Add(eGroup);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = eGroup.group_id }, eGroup));
        }
示例#13
0
        public static void SetupHandlers(Client client)
        {
            q[client.Peer] = new Dictionary <Entity, State>();
            EGroup group = new EGroup(client.Peer.ESystem, e => e.Get <Components.Legs>() != null);

            client.Peer.OnUpdate += dt => {
                foreach (var e in group.Entities)
                {
                    var pos = e.Get <Components.Position>();
                    if (!q[client.Peer].ContainsKey(e))
                    {
                        q[client.Peer][e] = new State(pos.Pos.XY);
                    }
                    var    s     = q[client.Peer][e];
                    double distD = (pos.Pos.XY - s.pos).Length;
                    s.dist += distD;
                    s.pos   = pos.Pos.XY;
                    s.h     = GMath.Clamp(s.h + 5 * distD - 10 * dt, 0, 1);
                }
            };
            client.OnRenderRoom += (string room) => {
                foreach (var e in group.Entities)
                {
                    var pos = e.Get <Components.Position>();
                    if (pos.Room != room)
                    {
                        continue;
                    }
                    if (!q[client.Peer].ContainsKey(e))
                    {
                        q[client.Peer][e] = new State(pos.Pos.XY);
                    }
                    var s = q[client.Peer][e];
                    RenderState.Push();
                    RenderState.Translate(pos.Pos);
                    RenderState.FaceCam();
                    RenderState.Scale(e.Get <Components.Legs>().Height);
                    RenderState.Color = Color.Black;
                    var sn = Math.Sin(s.dist * 3) * s.h;
                    for (int x = -1; x <= 1; x += 2)
                    {
                        RenderState.Push();
                        RenderState.Translate(x * 2, Math.Max(0, sn * x));
                        RenderState.Origin(0, 0.5);
                        Draw.Quad();
                        RenderState.Pop();
                    }
                    RenderState.Pop();
                }
            };
        }
示例#14
0
        public IHttpActionResult Delete(int id)
        {
            EGroup eGroup = db.EGroups.Find(id);

            if (eGroup == null)
            {
                return(NotFound());
            }

            db.EGroups.Remove(eGroup);
            db.SaveChanges();

            return(Ok(eGroup));
        }
示例#15
0
文件: Shot.cs 项目: StWol/Last-Man
        //Constructor
        public Shot(int id, EGroup group, float speed, Vector2 direction, float damage, String name, float distance, string description, float weight, ILocationBehavior locationBehavior)
            : base(id, group, name, description, weight, locationBehavior)
        {
            this.Speed = speed;
            this.Damage = damage;
            this.Distance = distance;

            this.Direction = direction;
            this.Direction.Normalize();

            Lifetime = 2000;// TODO: Das irgendwie auslagern oder so

            Buffs = new Dictionary<EBuffType, Buff>();
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var result = from emp in Employee.GetAllEmployees()
                         group emp by emp.Department into EGroup
                         orderby EGroup.Key
                         select new
            {
                Key  = EGroup.Key,
                Empl = EGroup.OrderBy(x => x.Name)
            };

            foreach (var g in result)
            {
                Response.Write(g.Key + "--" + g.Empl.Count() + "<br/>-------------<br/>");

                foreach (var Emp in g.Empl)
                {
                    Response.Write(Emp.Name + "--- " + Emp.Department + "<br/>");
                }
            }
        }
示例#17
0
        private static void LQ_QuerySyntax2()
        {
            var result = from e in Employee.GetAllEmployees()
                         join d in Department.GetAllDepartments()
                         on e.DepartmentID equals d.ID into EGroup
                         from d in EGroup.DefaultIfEmpty()
                         select new
            {
                EmployeeName   = e.Name,
                DepartmentName = d == null ? "No Department" : d.Name
            };



            foreach (var v in result)
            {
                Console.WriteLine(v.EmployeeName + "\t" +
                                  v.DepartmentName);
            }
            Console.ReadKey();
        }
示例#18
0
文件: Powerup.cs 项目: StWol/Last-Man
 //Constructor
 public Powerup(int id, EGroup group, String name, float regeneration, string description, float weight, ILocationBehavior locationBehavior)
     : base(id, group, name, description, weight, locationBehavior)
 {
 }
示例#19
0
 //Constructor
 public Stabilisator( int id, EGroup group, String name, float accuracy, float weight, string description, ILocationBehavior locationBehavior )
     : base(id, group, name, description, weight, locationBehavior)
 {
     this.Accuracy = accuracy;
 }
示例#20
0
文件: Access.cs 项目: andreyV512/rag
 public Access()
 {
     group = EGroup.Operator;
 }
示例#21
0
文件: Logger.cs 项目: dacuster/VOID
 public static void WriteMessage(EGroup _eGroup, string _sMessageFormat, params object[] _caParameters)
 {
     Write(_sMessageFormat, _caParameters);
 }
示例#22
0
文件: Access.cs 项目: andreyV512/rag
 public void Copy(Access _acc)
 {
     group = _acc.group;
 }
示例#23
0
文件: Liquid.cs 项目: StWol/Last-Man
 public Liquid(int id, ELiquid typeOfLiquid, String name, int amount, EGroup group, string description, float weight, ILocationBehavior locationBehavior)
     : base(id, group, name, description, weight, locationBehavior)
 {
     this.Amount = amount;
     this.TypeOfLiquid = typeOfLiquid;
 }
示例#24
0
文件: Logger.cs 项目: nulhax/VOID
 public static void WriteMessage(EGroup _eGroup, string _sMessageFormat, params object[] _caParameters)
 {
     Write(_sMessageFormat, _caParameters);
 }
示例#25
0
 //Constructor
 public Hauptteil(int id, EGroup group, String name, float rateOfFire, float weight, string description, ILocationBehavior locationBehavior)
     : base(id, group, name, description, weight, locationBehavior)
 {
     RateOfFire = rateOfFire;
 }