Beispiel #1
0
    //---------------------------------------------------------------------------------------------------------------//
    //尝试更加速度的刷新方式
    void makeUpdateNew2()
    {
        if (!systemValues.thePlayer)
        {
            return;
        }

        //尝试增加当前没有的effect
        //effectBasic[] theEffectbasics = systemValues.thePlayer.GetComponentsInChildren<effectBasic> ();
        //再一次强力优化,直接使用playerBasic里面保存的引用做就可以了,连获取都没有必要再次获取
        for (int i = 0; i < systemValues.thePlayer.Effects.Count; i++)
        {
            if (systemValues.thePlayer.Effects[i] == null || !systemValues.thePlayer.Effects[i].isShowing() || checkIfIsShowing(systemValues.thePlayer.Effects[i]))
            {
                continue;
            }

            bool isNew = false;
            ButtonEffectflasher theNewEffect = ButtonEffectflasher.getAFlasher(out isNew);
            if (isNew)
            {
                theNewEffect.makeStart(theEffectShowButton, this.transform, systemValues.thePlayer.Effects [i], EffectColor, NotEffectColor);
            }
            else
            {
                theNewEffect.setEffect(systemValues.thePlayer.Effects [i]);
            }

            flashItem.Add(theNewEffect);
        }

        //更新显示
        for (int i = 0; i < flashItem.Count; i++)
        {
            flashItem [i].makeUpdate();
        }

        //删除处理
        toDestroy.Clear();
        for (int i = 0; i < flashItem.Count; i++)
        {
            if (flashItem [i].theEffect == null)
            {
                toDestroy.Add(flashItem [i]);
            }
        }
        for (int i = 0; i < toDestroy.Count; i++)
        {
            //消除,同时记录到buffer里面
            toDestroy [i].makeDestroy();
            flashItem.Remove(toDestroy [i]);
        }
    }
Beispiel #2
0
    //顺带返回额外标记,是否是新的
    public static ButtonEffectflasher getAFlasher(out bool isNewOne)
    {
        if (ButtonEffectflasherBuffer.Count <= 0)
        {
            isNewOne = true;
            return(new ButtonEffectflasher());
        }

        ButtonEffectflasher A = ButtonEffectflasherBuffer [0];

        ButtonEffectflasherBuffer.Remove(A);
        isNewOne = false;
        //Debug.Log("isNew =  " + isNewOne);
        return(A);
    }
Beispiel #3
0
    //---------------------------------------------------------------------------------------------------------------//
    //这个方法保存已经存在的引用,这样可以减少获得引用的次数,,应该比老方法要高效一点
    void makeUpdateNew()
    {
        if (!systemValues.thePlayer)
        {
            return;
        }

        //尝试增加当前没有的effect
        //effectBasic[] theEffectbasics = systemValues.thePlayer.GetComponentsInChildren<effectBasic> ();
        //再一次强力优化,直接使用playerBasic里面保存的引用做就可以了,连获取都没有必要再次获取
        for (int i = 0; i < systemValues.thePlayer.Effects.Count; i++)
        {
            if (!systemValues.thePlayer.Effects[i].isShowing() || checkIfIsShowing(systemValues.thePlayer.Effects[i]))
            {
                continue;
            }

            print("check has ");
            ButtonEffectflasher theNewEffect = new ButtonEffectflasher();
            theNewEffect.makeStart(theEffectShowButton, this.transform, systemValues.thePlayer.Effects [i], EffectColor, NotEffectColor);
            flashItem.Add(theNewEffect);
        }

        //更新显示
        for (int i = 0; i < flashItem.Count; i++)
        {
            flashItem [i].makeUpdate();
        }

        //删除处理
        toDestroy.Clear();
        for (int i = 0; i < flashItem.Count; i++)
        {
            if (flashItem [i].theEffect == null)
            {
                toDestroy.Add(flashItem [i]);
            }
        }
        for (int i = 0; i < toDestroy.Count; i++)
        {
            toDestroy [i].makeDestroy();
            flashItem.Remove(toDestroy [i]);
        }
        flashItem.RemoveAll(X => X == null);
    }