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