public void Despawn(Transform instance) { bool despawned = false; for (int i = 0; i < this._prefabPools.Count; i++) { if (this._prefabPools[i]._spawned.Contains(instance)) { despawned = this._prefabPools[i].DespawnInstance(instance); break; } else if (this._prefabPools[i]._despawned.Contains(instance)) { LitLogger.WarningFormat("SpawnPool {0}: {1} has already been despawned. " + "You cannot despawn something more than once!", this.poolName, instance.name); return; } } if (!despawned) { Debug.LogError(string.Format("SpawnPool {0}: {1} not found in SpawnPool", this.poolName, instance.name)); return; } this._spawned.Remove(instance); }
private void TrrigerCreateEvent(string poolName) { if (!this.onCreatedDelegates.ContainsKey(poolName)) { LitLogger.WarningFormat("No OnCreatedDelegates found for pool name: <{0}>", poolName); return; } this.onCreatedDelegates[poolName](this[poolName]); }
public void RemoveOnCreatedDelegate(string poolName, OnCreatedDelegate createdDelegate) { if (!this.onCreatedDelegates.ContainsKey(poolName)) { LitLogger.WarningFormat("No OnCreatedDelegates found for pool name: <{0}>", poolName); return; } this.onCreatedDelegates[poolName] -= createdDelegate; }
public JsonData Get(string name) { if (data == null || !data.Contains(name)) { LitLogger.WarningFormat("Not Found {0} in JsonData {1}", name, data.ToJson()); return(new JsonData()); } return(data[name]); }
internal bool Remove(SpawnPool spawnPool) { if (!this.ContainsKey(spawnPool.poolName)) { LitLogger.WarningFormat(string.Format("Pool not in PoolManager: {0}", spawnPool.poolName)); return(false); } this._pools.Remove(spawnPool.poolName); return(true); }
internal void Add(SpawnPool spawnPool) { if (this.ContainsKey(spawnPool.poolName)) { LitLogger.WarningFormat(string.Format("A pool with the name '{0}' already exists. ", spawnPool.poolName)); return; } this._pools.Add(spawnPool.poolName, spawnPool); TrrigerCreateEvent(spawnPool.name); }
private void InitComps(GameObject go, List <SerializeEntity> comps) { if (comps == null || comps.Count <= 0) { LitLogger.WarningFormat("{0} has no Components to Add", go.name); return; } for (int i = 0; i < comps.Count; i++) { InitComp(go, comps[i]); } }
public static void UID_Register(string uid, LitLua obj) { if (uid.isEmpty() || obj == null) { LitLogger.ErrorFormat("Register Invalid UID : <{0}> , <{1}>", uid, obj); } else if (UID_Contains(uid)) { LitLogger.WarningFormat("UID <{0}> repeated !! => {1} will replace by {2}", uid, UID_Get(uid), obj); UIDMap[uid] = obj; } else { UIDMap.Add(uid, obj); } }
public SpawnPool this[string key] { get { SpawnPool pool; try { pool = this._pools[key]; } catch (KeyNotFoundException) { LitLogger.WarningFormat("A Pool with the name '{0}' not found. " + "\nPools={1}", key, this.ToString()); return(null); } return(pool); } }
//public static void SetEnum<T>(ref T value, SerializeEntity data, string name) where T : System.IConvertible //{ // if (data == null || !data.Contains(name)) // return; // int _v = data[name]; // value = T.C; //} #endregion #region "资源处理" public static string GetResPath(Object obj) { if (obj == null) { return(""); } #if UNITY_EDITOR string fullPath = UnityEditor.AssetDatabase.GetAssetPath(obj); int startIndex = fullPath.IndexAtTimes('/', 2) + 1; int endIndex = fullPath.IndexOf("."); if (startIndex < 0 || endIndex < 0 || startIndex >= endIndex) { LitLogger.WarningFormat("Not Found Res {0}", obj); return(""); } return(fullPath.Substring(startIndex, endIndex - startIndex)); #endif return(""); }
public JsonData this[string name] { get { return(Get(name)); } set { EnsureJsonData(); if (string.IsNullOrEmpty(name)) { LitLogger.LogFormat("Add Proterty Error => key : {0} , value : {1}", name, value); return; } else if (data.Contains(name)) { LitLogger.WarningFormat("The Proterty Exist : {0} ,it will be repalce ", name); } else { data[name] = value; } } }