예제 #1
0
        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);
        }
예제 #2
0
 void RegisterComponentImpl(string id, SynchronizedComponent component)
 {
     if (componentLookup_.ContainsKey(id))
     {
         return;
     }
     componentLookup_.Add(id, component);
 }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
 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;
     }
 }
예제 #6
0
 void RegisterComponentImpl(string id, SynchronizedComponent component)
 {
     if (componentLookup_.ContainsKey(id)) return;
     componentLookup_.Add(id, component);
 }
예제 #7
0
 public static void Send(SynchronizedComponent component, string val, string type)
 {
     Instance.SendImpl(component, val, type);
 }
예제 #8
0
 public static void RegisterComponent(string id, SynchronizedComponent component)
 {
     Instance.RegisterComponentImpl(id, component);
 }
예제 #9
0
 public static void Send(SynchronizedComponent component, string val, string type)
 {
     Instance.SendImpl(component, val, type);
 }
예제 #10
0
 public static void RegisterComponent(string id, SynchronizedComponent component)
 {
     Instance.RegisterComponentImpl(id, component);
 }