Exemplo n.º 1
0
        /*public void AddOrUpdate(UnityEngine.Object obj, long id)
         * {
         *      long existingId = Get(obj);
         *
         *      // If there's not an existing ID, we're adding a new object.
         *      if(existingId == -1)
         *      {
         *              // If an id wasn't specified, add the object with a new ID.
         *              if(id == -1)
         *                      Add(obj, GetNewRefID());
         *              // If an object already exists with this id, do not add the object.
         *              else if(Get(id) == null)
         *                      Add(obj, GetNewRefID);
         *      }
         *      // Else we're updating an existing object.
         *      else
         *      {
         *              var existingObj = Get(existingId);
         *
         *      }
         *
         *      // If there's an existing id and one wasn't specified as as parameter, use the existing id.
         *      if(existingId != -1 && id == -1)
         *              id = existingId;
         *      // If there's not an existing id and one wasn't specified as a parameter, generate a new id.
         *      else if(existingId == -1 && id == -1)
         *              id = GetNewRefID();
         *
         *      // Add the reference to the Dictionary.
         *      idRef[id] = obj;
         *      //refId[obj] = id;
         * }*/

        public void AddPrefab(ES3Prefab prefab)
        {
            if (!prefabs.Contains(prefab))
            {
                prefabs.Add(prefab);
            }
        }
Exemplo n.º 2
0
 public bool AddPrefab(ES3Prefab prefab)
 {
     if (!prefabs.Contains(prefab))
     {
         prefabs.Add(prefab);
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 public long GetPrefab(ES3Prefab prefab)
 {
     for (int i = 0; i < prefabs.Count; i++)
     {
         if (prefabs[i] == prefab)
         {
             return(prefabs[i].prefabId);
         }
     }
     return(-1);
 }
Exemplo n.º 4
0
 public long GetPrefab(ES3Prefab prefab, bool suppressWarnings = false)
 {
     for (int i = 0; i < prefabs.Count; i++)
     {
         if (prefabs[i] == prefab)
         {
             return(prefabs[i].prefabId);
         }
     }
     if (!suppressWarnings)
     {
         ES3Internal.ES3Debug.LogWarning("Prefab with name " + prefab.name + " could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene.", prefab);
     }
     return(-1);
 }
Exemplo n.º 5
0
        public long GetPrefab(ES3Prefab prefabToFind, bool suppressWarnings = false)
        {
            foreach (var mgr in mgrs)
            {
                if (mgr == null)
                {
                    continue;
                }

                foreach (var prefab in prefabs)
                {
                    if (prefab == prefabToFind)
                    {
                        return(prefab.prefabId);
                    }
                }
            }
            if (!suppressWarnings)
            {
                ES3Debug.LogWarning("Prefab with name " + prefabToFind.name + " could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene.", prefabToFind);
            }
            return(-1);
        }