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