public static TabUpdateMessage Send(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction, GameObject changedBy = null, ElementValue[] values = null) { // if ( changedBy ) { // //body = human_33, hands, uniform, suit // } var msg = new TabUpdateMessage { Provider = provider.NetId(), Type = type, Action = tabAction, ElementValues = values, Touched = changedBy != null }; switch (tabAction) { case TabAction.Open: NetworkTabManager.Instance.Add(provider, type, recipient); //!! resetting ElementValues msg.ElementValues = NetworkTabManager.Instance.Get(provider, type).ElementValues; //!! break; case TabAction.Close: NetworkTabManager.Instance.Remove(provider, type, recipient); break; case TabAction.Update: var playerScript = recipient.Player()?.Script; //fixme: duplication of NetTab.ValidatePeepers //Not sending updates and closing tab for players that don't pass the validation anymore bool validate = playerScript && !playerScript.canNotInteract() && playerScript.IsInReach(provider, true); if (!validate) { Send(recipient, provider, type, TabAction.Close); return(msg); } break; } msg.SendTo(recipient); Logger.LogTrace(msg.ToString(), Category.NetUI); return(msg); }