Esempio n. 1
0
    public void DoAction(RequestRPC req)
    {
        UnityEngine.Debug.Log("Call Req : " + req);
        var actions = GetActions(req.RequestsCase);

        foreach (var action in actions)
        {
            action.Invoke(req);
        }
    }
Esempio n. 2
0
    private void UpdateUsers(RequestRPC obj)
    {
        var reqUsersUpdates = obj.ReqUsersUpdate;

        if (reqUsersUpdates == null)
        {
            return;
        }

        Users = reqUsersUpdates.Users.ToList();
    }
Esempio n. 3
0
    public override void SetUp()
    {
        engine.UpdateLogic.Subscribe(_ => {
            if (dictUsers.Count == 0)
            {
                return;
            }

            //req users updates
            RequestRPC rsp             = new RequestRPC();
            ReqUsersUpdate usersUpdate = new ReqUsersUpdate();
            usersUpdate.Users.AddRange(dictUsers.Values);
            rsp.ReqUsersUpdate = usersUpdate;
            engine.server.Multicast(rsp.ToByteArray());
        });
    }
Esempio n. 4
0
    void RequestUserUpdate()
    {
        if (isPlayer)
        {
            RequestRPC reqRPC = new RequestRPC();

            ReqUserUpdate req  = new ReqUserUpdate();
            var           user = new User();
            user.IsDead = isDead;
            user.X      = birdX.transform.position.x;
            user.Y      = transform.position.y;
            user.UserId = LSRequests.Instance.UserName.Value;
            req.User    = user;

            reqRPC.ReqUserUpdate = req;
            ChatSever.client.SendAsync(reqRPC.ToByteArray());
        }
    }
Esempio n. 5
0
    public void DoAction(RequestRPC req)
    {
        var actions = this.GetActions(req.RequestsCase);

        toRemove.Clear();
        foreach (var action in actions)
        {
            if (action == null)
            {
                toRemove.Add(action);
            }
            action.Invoke(req);
        }

        foreach (var rm in actions)
        {
            actions.Remove(rm);
        }
    }
 //when packet recieved,
 //
 internal void OnPacketRecieved(RequestRPC req)
 {
     rpcManager.DoAction(req);
 }