public void DoAction(RequestRPC req) { UnityEngine.Debug.Log("Call Req : " + req); var actions = GetActions(req.RequestsCase); foreach (var action in actions) { action.Invoke(req); } }
private void UpdateUsers(RequestRPC obj) { var reqUsersUpdates = obj.ReqUsersUpdate; if (reqUsersUpdates == null) { return; } Users = reqUsersUpdates.Users.ToList(); }
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()); }); }
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()); } }
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); }