private static SetActionUI _Send(GameObject recipient, IServerActionGUI iServerActionGUI, SetActionUIActions ProposedAction, bool _showAlert = false, int location = 0) { if (!(iServerActionGUI is UIActionScriptableObject)) { var netObject = (iServerActionGUI as Component).GetComponent <NetworkIdentity>(); var _ComponentType = iServerActionGUI.GetType(); var iServerActionGUIs = netObject.GetComponentsInChildren(_ComponentType); var _ComponentLocation = 0; bool Found = false; foreach (var _iServerActionGUI in iServerActionGUIs) { if ((_iServerActionGUI as IServerActionGUI) == iServerActionGUI) { Found = true; break; } _ComponentLocation++; } if (Found) { SetActionUI msg = new SetActionUI { NetObject = netObject.netId, ComponentLocation = _ComponentLocation, ComponentType = _ComponentType, showAlert = _showAlert, SpriteLocation = location, ProposedAction = ProposedAction }; msg.SendTo(recipient); return(msg); } else { Logger.LogError("Failed to find IServerActionGUI on NetworkIdentity"); } } else { var _ComponentType = iServerActionGUI.GetType(); SetActionUI msg = new SetActionUI { soID = UIActionSOSingleton.ActionsTOID[(iServerActionGUI as UIActionScriptableObject)], showAlert = _showAlert, SpriteLocation = location, ProposedAction = ProposedAction, ComponentType = _ComponentType, }; msg.SendTo(recipient); return(msg); } return(null); }
public override void Deserialize(NetworkReader reader) { base.Deserialize(reader); soID = reader.ReadUInt16(); SpriteLocation = reader.ReadInt32(); ComponentLocation = reader.ReadInt32(); NetObject = reader.ReadUInt32(); showAlert = reader.ReadBoolean(); ComponentType = RequestGameAction.componentIDToComponentType[reader.ReadUInt16()]; ProposedAction = (SetActionUIActions)reader.ReadInt32(); }