Ejemplo n.º 1
0
    public override void Attached()
    {
        var evnt = JoinedEvent.Create();

        evnt.Send();
        state.health = 100;
        state.SetTransforms(state.armTransform, arm);
        state.SetTransforms(state.playerTransform, transform);
        state.AddCallback("health", HealthCallback);
    }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JoinedEvent = await _context.JoinedEvents.FindAsync(id);

            if (JoinedEvent != null)
            {
                _context.Events.Where(e => e.EventID == JoinedEvent.EventID).First().SpotsAvailable++;
                _context.JoinedEvents.Remove(JoinedEvent);
                await _context.SaveChangesAsync();
            }
            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JoinedEvent = await _context.JoinedEvents
                          .Where(re => re.JoinedEventID == id).FirstOrDefaultAsync();

            JoinedEvent = await _context.JoinedEvents
                          .Include(j => j.Attendee)
                          .Include(j => j.Event).FirstOrDefaultAsync(m => m.JoinedEventID == id);

            if (JoinedEvent == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 4
0
        private void HandleJoinReqPacket(NetworkPacket packet)
        {
            Debug.Assert(packet.id != null && packet.port != null);
            log.Info("Join Packet - " + EndPoint + " " + packet.id);
            IPEndPoint endPoint       = (IPEndPoint)EndPoint;
            IPEndPoint listenEndPoint = new IPEndPoint(endPoint.Address, (int)packet.port);

            JoinedEvent?.Invoke(this, new JoinedEventArgs(packet.id, listenEndPoint));

            // Send response now (Note: JoinedEvent handler could changed our TreeNode).
            NetworkPacket resp = new NetworkPacket(NetworkPacket.Type.JoinResp);

            if (TreeNode.Parent != null)
            {
                resp.id   = TreeNode.Parent.Id;
                resp.ip   = TreeNode.Parent.ListenEndPoint.Address.ToString();
                resp.port = TreeNode.Parent.ListenEndPoint.Port;
            }
            else
            {
                resp.id = packet.id;
            }
            SendPacket(resp);
        }
Ejemplo n.º 5
0
 public override void OnEvent(JoinedEvent evnt)
 {
     Invoke("JoinedEventDelay", 0.25f);
 }