美文网首页
2d对象池

2d对象池

作者: 沉麟 | 来源:发表于2020-07-09 16:36 被阅读0次
getCoinPool() {
        if (this.coinPools.length <= 0) {
            let coin = new Laya.Image();
            coin.skin = "res/game/icon_jinbi.png";
            return coin;
        } else {
            return this.coinPools.pop();
        }
    }

    pushCoinPool(coin: Laya.Image) {
        this.coinPools.push(coin);
    }

    getLinePool() {
        if (this.linePools.length <= 0) {
            let coinAni = this.coinLineAni.clone();
            return coinAni;
        } else {
            return this.linePools.pop();
        }
    }

    pushLinePool(coinAni: Laya.Animation) {
        this.linePools.push(coinAni);
    }

相关文章

  • 2d对象池

  • Unity 类对象池资源池对象池

    类对象池 包含创建对象池,取对象池中的内容,回收。 对象管理类 因为使用加载AB包的时候可能会频繁创建类,但是ne...

  • Laya_2D示例项目使用对象池预制体的创建、位置设置和添加到父

    //使用对象池创建盒子 1.对象池的使用 对象池创建箱子 let box = Laya.Pool.getI...

  • Unity--简单的对象池

    简单的对象池分三步走: 建立对象池 拿到对象 回收对象 Test为对象池,Obj为自动回收的物体 Test.cs ...

  • 对象池

    一、对象池概述: 对于那些实例化开销比较大,并且生命周期比较短的对象,我们可以通过池就行管理。所谓池,就相当于一个...

  • 对象池

  • 对象池

    概要 看到现在,Netty之设计精妙,令人感叹。优化至极,令人发指。在高并发场景下,对象的分配的损耗是很大的,特别...

  • 对象池

    讲在前面 为什么要有对象池?我们需要一种类型的实例时候往往回去new一个这样会造成gc问题对象池根本奥义就在于一个...

  • 对象池

    UGUI 中使用的对象池 在 C:\Files\Unity\Projects\UGUITest\PackageSo...

  • 对象池

    java对象池化技术https://blog.csdn.net/tiane5hao/article/details...

网友评论

      本文标题:2d对象池

      本文链接:https://www.haomeiwen.com/subject/tcescktx.html