Пример #1
0
 public EntitySpawner Reset()
 {
     _roachPool.DespawnAll();
     _spikeBallPool.DespawnAll();
     _pizzaPool.DespawnAll();
     return(this);
 }
Пример #2
0
 public void Clear()
 {
     if (pool == null)
     {
         return;
     }
     pool.DespawnAll();
 }
Пример #3
0
        /// <summary>
        /// 释放所有资源
        /// </summary>
        /// <param name="type"></param>
        public void DespawnAll(PoolType type)
        {
            SpawnPool tempPool = GetPool(type);

            if (tempPool != null)
            {
                tempPool.DespawnAll();
            }
        }
Пример #4
0
    /// <summary>
    /// 終了処理
    /// </summary>
    void OnDisable()
    {
        // ウサギの図鑑のフラグ関連の終了処理を行う
        RabbitPictureBookFlagSwitcher.Inst.FinalizeData();

        // 積み上げられたオブジェクトを全てデスポーンする
        mochiSpawnPool.DespawnAll();
        rabbitSpawnPool.DespawnAll();
        // 積み上げられたオブジェクトのデータを管理したリストを全て削除する
        stackedObjects.Clear();
    }
Пример #5
0
    public void DeletePool(string _poolName)
    {
        SpawnPool _spawnPool = GetPool(_poolName);

        if (_spawnPool != null)
        {
            _spawnPool.DespawnAll();
            GameObject.Destroy(_spawnPool.gameObject);
            spawnPoolDic.Remove(_poolName);
        }
    }
Пример #6
0
    public void DespawnAllObject(string poolName)
    {
        if (PoolManager.Pools.ContainsKey(poolName))
        {
            SpawnPool pool = PoolManager.Pools[poolName];
            pool.DespawnAll();
        }
        else
        {
#if UNITY_EDITOR
            Debug.Log(poolName + "khong co trong pool");
#endif
        }
    }
Пример #7
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         spawnPool.Spawn("step");
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         spawnPool.DespawnAll();
     }
     if (Input.GetKeyDown(KeyCode.D))
     {
         spawnPool.Clear();
     }
 }
Пример #8
0
    void OnGUI()
    {
        if (GUILayout.Button("初始化内存池"))
        {
            if (!spawnPool._perPrefabPoolOptions.Contains(refabPool))
            {
                refabPool = new PrefabPool(Resources.Load <Transform>("momo"));
                //默认初始化两个Prefab
                refabPool.preloadAmount = 2;
                //开启限制
                refabPool.limitInstances = true;
                //关闭无限取Prefab
                refabPool.limitFIFO = false;
                //限制池子里最大的Prefab数量
                refabPool.limitAmount = 5;
                //开启自动清理池子
                refabPool.cullDespawned = true;
                //最终保留
                refabPool.cullAbove = 10;
                //多久清理一次
                refabPool.cullDelay = 5;
                //每次清理几个
                refabPool.cullMaxPerPass = 5;
                //初始化内存池
                spawnPool._perPrefabPoolOptions.Add(refabPool);
                spawnPool.CreatePrefabPool(spawnPool._perPrefabPoolOptions[spawnPool.Count]);
            }
        }

        if (GUILayout.Button("从内存池里面取对象"))
        {
            ///从内存池里面取一个GameObjcet
            Transform momo = spawnPool.Spawn("momo");

            //存入
            //spawnPool.Despawn(momo);
        }


        if (GUILayout.Button("清空内存池"))
        {
            //清空池子
            spawnPool.DespawnAll();
        }
    }
Пример #9
0
        void DoDeSpawnAll()
        {
            if (poolName.Value == "")
            {
                return;
            }

            //check and  if the pool does not exists
            if (!PoolManager.Pools.TryGetValue(poolName.Value, out _pool))
            {
                LogWarning(string.Format("Pool {0} doesn't exists", poolName.Value));
                if (failureEvent != null)
                {
                    Fsm.Event(failureEvent);
                }
                return;
            }

            _pool.DespawnAll();
        }
Пример #10
0
    void OnGUI()
    {
        if (GUILayout.Button("初始化内存池"))
        {
            for (int i = 0; i < m_pPrePools.Count; i++)
            {
                r1 = m_pPrePools[i];
                CreatePrefabPool(r1);
            }

            //spawnPool.CreatePrefabPool(spawnPool._perPrefabPoolOptions[spawnPool.Count]);
        }

        if (GUILayout.Button("从内存池里面取对象"))
        {
            int nIndex = Random.Range(0, m_pPrePools.Count);
            ///从内存池里面取一个GameObjcet
            //Transform momo =  spawnPool.Spawn("momo");
            Transform momo = spawnPool.Spawn(m_pPrePools[nIndex].prefab);
            momo.localPosition = new Vector3(0, nIndex, 0);
            m_pTf.Add(momo);
        }


        if (GUILayout.Button("清空内存池"))
        {
            //清空池子
            spawnPool.DespawnAll();
            m_pTf.Clear();
        }

        if (GUILayout.Button("干掉一个"))
        {
            if (m_pTf.Count > 0)
            {
                // 通知缓存池,缓存对象实例
                spawnPool.Despawn(m_pTf[m_pTf.Count - 1]);
                m_pTf.RemoveAt(m_pTf.Count - 1);
            }
        }
    }
Пример #11
0
 //重置所有牌
 public void Reset()
 {
     //玩家手牌
     hostUser.Reset();
     frontUser.Reset();
     leftUser.Reset();
     rightUser.Reset();
     //抽牌区域
     group_R.Reset();
     group_L.Reset();
     group_H.Reset();
     group_F.Reset();
     //出牌区域
     outCardPoint_F.Reset();
     outCardPoint_H.Reset();
     outCardPoint_L.Reset();
     outCardPoint_R.Reset();
     //重置对象池
     spawnPool.DespawnAll();
     //重置色子
     diceA = null;
     diceB = null;
 }
Пример #12
0
 public void DespawnAll()
 {
     pool.DespawnAll();
     //GameObject.Destroy(instance.gameObject);
 }
Пример #13
0
 public void StopGame()
 {
     _mapPool.DespawnAll();
     _bgPool.DespawnAll();
 }
Пример #14
0
    public static void DespawnAll(string poolName)
    {
        SpawnPool pool = PoolManager.Pools[poolName];

        pool.DespawnAll();
    }
Пример #15
0
 public void ClearPool()
 {
     spawnPool.DespawnAll();
 }
Пример #16
0
 public void ResetSpawnPool()
 {
     //Debug.Log ("ResetSpawnPool " + poolMahjongRes);
     //poolMahjongRes.ResetAllSpawned (false, poolMahjongRes.transform);
     poolMahjongRes.DespawnAll(poolMahjongRes.transform);
 }
Пример #17
0
 /// <summary>
 /// Despawn all spawned object
 /// </summary>
 private void DespawnAll()
 {
     orderPool.DespawnAll();
 }
Пример #18
0
 /// <summary>
 /// Despawn all spawned object
 /// </summary>
 private void DespawnAll()
 {
     truckPool.DespawnAll();
 }
Пример #19
0
 /// <summary>
 /// 清空桌面 牌墙
 /// </summary>
 public void DespawnAll()
 {
     m_WallPool.DespawnAll();
 }
Пример #20
0
 /// <summary>
 /// 清空池子
 /// </summary>
 public void DespawnAll()
 {
     _objectPool.DespawnAll();
 }
Пример #21
0
 /// <summary>
 /// 清空特效
 /// </summary>
 public void Clear()
 {
     m_EffectDic.Clear();
     m_EffectPool.DespawnAll();
     m_EffectPool = null;
 }
Пример #22
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="majiangCount">麻将总数</param>
    /// <param name="diceSeatPos2">第二个摇骰子的座位号</param>
    /// <param name="firstDice">第一次骰子</param>
    /// <param name="secondDice">第二次骰子</param>
    /// <param name="playerCount">玩家数量</param>
    /// <param name="bankerPos">庄家座位号</param>
    /// <returns></returns>
    public List <MaJiangCtrl> Rebuild(int majiangCount, int diceSeatPos2, int firstDice, int secondDice, int playerCount, int bankerPos)
    {
        m_DicHand.Clear();
        m_ListWall.Clear();
        m_ListWallInverse.Clear();
        m_DicTable.Clear();
        m_DicPeng.Clear();
        for (int i = 0; i < m_AllPoker.Count; ++i)
        {
            m_AllPoker[i].Reset();
        }
        m_AllPoker.Clear();

        m_WallPool.DespawnAll();

        m_nMaJiangCount = majiangCount;

        m_TaiLaiLuckPokerIndexList.Clear();


        int pos = bankerPos;

        for (int i = 1; i < firstDice + secondDice; ++i)
        {
            --pos;
            if (pos < 1)
            {
                pos += 4;
            }
        }
        int fromWallIndex = (secondDice < firstDice ? secondDice : firstDice) * 2 + (int)((pos - 1) * (majiangCount / (float)playerCount % 2 == 1 ? majiangCount / (float)playerCount - 1f : majiangCount / (float)playerCount));

        if (fromWallIndex % 2 == 1)
        {
            fromWallIndex += 1;
        }
        AppDebug.Log(string.Format("从第{0}张开始摸牌", fromWallIndex));

        List <MaJiangCtrl> tempWall = new List <MaJiangCtrl>();

        for (int i = 0; i < m_nMaJiangCount; ++i)
        {
            MaJiangCtrl majiang = SpawnMaJiang(1, null, "Hand");
            tempWall.Add(majiang);
        }

        for (int i = fromWallIndex; i < tempWall.Count; ++i)
        {
            m_ListWall.Add(tempWall[i]);
        }
        for (int i = 0; i < fromWallIndex; ++i)
        {
            m_ListWall.Add(tempWall[i]);
        }

        for (int i = m_ListWall.Count - 2; i >= 0; i -= 2)
        {
            m_ListWallInverse.Add(m_ListWall[i]);
            m_ListWallInverse.Add(m_ListWall[i + 1]);
        }
        return(tempWall);
    }
Пример #23
0
 public void DespawnAll()
 {
     spawnPool.DespawnAll();
 }