SynchronizedComponent AddSynchronizedComponent( string id, string componentName, string syncObjectId, string prefabPath) { var gameObj = GetGameObject(syncObjectId, prefabPath); if (gameObj == null) { return(null); } SynchronizedComponent targetComponent = null; foreach (var component in gameObj.GetComponentsInChildren <SynchronizedComponent>()) { if (component.componentName == componentName) { targetComponent = component; break; } } if (targetComponent == null) { Debug.LogError(componentName + " is not attached to " + syncObjectId); return(null); } targetComponent.id = id; componentLookup_.Add(id, targetComponent); return(targetComponent); }
void RegisterComponentImpl(string id, SynchronizedComponent component) { if (componentLookup_.ContainsKey(id)) { return; } componentLookup_.Add(id, component); }
void SendImpl(SynchronizedComponent component, string value, string type) { var id = component.id; var args = component.syncObjectId + CommandDelimiterChar + component.prefabPath + CommandDelimiterChar + component.componentName + CommandDelimiterChar + value + CommandDelimiterChar + type; if (component.syncObject.isSavedToServer) { savedComponents_[id] = args; } else { updatedComponents_[id] = args; } }
void SendImpl(SynchronizedComponent component, string value, string type) { if (string.IsNullOrEmpty(type)) { Debug.LogWarningFormat( "type is not specified:\n {0}: \"{1}\"", component.componentName, value); return; } var id = component.id; var args = component.syncObjectId + CommandDelimiterChar + component.prefabPath + CommandDelimiterChar + component.componentName + CommandDelimiterChar + value + CommandDelimiterChar + type; if (component.syncObject.isSavedToServer) { savedComponents_[id] = args; } else { updatedComponents_[id] = args; } }
void RegisterComponentImpl(string id, SynchronizedComponent component) { if (componentLookup_.ContainsKey(id)) return; componentLookup_.Add(id, component); }
public static void Send(SynchronizedComponent component, string val, string type) { Instance.SendImpl(component, val, type); }
public static void RegisterComponent(string id, SynchronizedComponent component) { Instance.RegisterComponentImpl(id, component); }