Ejemplo n.º 1
0
        /*
         * public void PrepareGameObject(string prefabFullPath, enResourceType resourceType, int amount, Action OnFinish)
         * {
         *      string prefabFullPathInRes = CFileManager.EraseExtension(prefabFullPath);
         *      Queue<CPooledGameObjectScript> queue = null;
         *      if (!this._pooledGameObjectMap.TryGetValue(prefabFullPathInRes.JavaHashCodeIgnoreCase(), out queue))
         *      {
         *              queue = new Queue<CPooledGameObjectScript>();
         *              this._pooledGameObjectMap.Add(prefabFullPathInRes.JavaHashCodeIgnoreCase(), queue);
         *      }
         *      if (queue.Count >= amount)
         *      {
         *              OnFinish();
         *              return;
         *      }
         *      amount -= queue.Count;
         *      _mono.StartCoroutine(Precache(amount, prefabFullPath, resourceType, prefabFullPathInRes, queue, OnFinish));
         *      return;
         * }*/
        /*
         * public System.Collections.IEnumerator Precache(int amount, string prefabFullPath, CustomAsyncOperation customAsyncOperation)
         * {
         *      if (customAsyncOperation != null)
         *              customAsyncOperation.AddMission();
         *
         *      Queue<CPooledGameObjectScript> queue = null;
         *
         *      if (!this._pooledGameObjectMap.TryGetValue(prefabFullPath, out queue))
         *      {
         *              queue = new Queue<CPooledGameObjectScript>();
         *              this._pooledGameObjectMap.Add(prefabFullPath, queue);
         *      }
         *
         *      var co = ResourceManager.Instance.GetResourceAsync(prefabFullPath, typeof(GameObject), resourceType);
         *      while (co.MoveNext())
         *      {
         *              yield return co.Current;
         *      }
         *
         *      for (int i = 0; i < amount; i++)
         *      {
         *              CPooledGameObjectScript cPooledGameObjectScript = this.CreateGameObject(prefabFullPath, Vector3.zero, Quaternion.identity);
         *
         *              SuperDebug.Assert(cPooledGameObjectScript != null, "Failed Create Game object from \"{0}\"", new object[]
         *              {
         *              prefabFullPath
         *              });
         *
         *              if (cPooledGameObjectScript != null)
         *              {
         *                      queue.Enqueue(cPooledGameObjectScript);
         *                      cPooledGameObjectScript.gameObject.transform.SetParent(this.m_poolRoot.transform, true);
         *                      cPooledGameObjectScript.OnPrepare();
         *              }
         *      }
         *      if (customAsyncOperation != null)
         *              customAsyncOperation.FinishMission();
         * }*/

        private CPooledGameObjectScript CreateGameObject(string prefabFullPath, Vector3 pos, Quaternion rot, bool useRotation)
        {
            GameObject prefabObj = Resources.Load <GameObject>(prefabFullPath);

            if (prefabObj == null)
            {
                SuperDebug.Error("prefabObj Can Not Be Null " + prefabFullPath);
                return(null);
            }
            GameObject instObj;

            if (useRotation)
            {
                instObj = (GameObject.Instantiate(prefabObj, pos, rot) as GameObject);
            }
            else
            {
                instObj = (GameObject.Instantiate(prefabObj) as GameObject);
                instObj.transform.position = pos;
            }
            SuperDebug.Assert(instObj != null);
            CPooledGameObjectScript cPooledGameObjectScript = instObj.GetComponent <CPooledGameObjectScript>();

            if (cPooledGameObjectScript == null)
            {
                cPooledGameObjectScript = instObj.AddComponent <CPooledGameObjectScript>();
            }
            cPooledGameObjectScript.Initialize(prefabFullPath);
            cPooledGameObjectScript.OnCreate();
            return(cPooledGameObjectScript);
        }
Ejemplo n.º 2
0
 public static void AssertThrow(bool InCondition, string InFormat)
 {
     SuperDebug.Assert(InCondition, InFormat, null);
 }
Ejemplo n.º 3
0
 public static void AssertThrow(bool InCondition)
 {
     SuperDebug.Assert(InCondition, null, null);
 }