Пример #1
0
 public void ReturnComponent(EmitComponent com)
 {
     if (_componentPool.Count < MAX_POOL_NUMBER)
     {
         _componentPool.Push(com);
     }
 }
Пример #2
0
    public static void Emit(EmitNumberType type, params object[] args)
    {
        if (view == null)
        {
            view = new GComponent();
            GRoot.inst.AddChild(view);
        }

        EmitComponent ec = FindEmit(type);

        if (ec == null)
        {
            switch (type)
            {
            case EmitNumberType.EmitNumberTypeServerErrorCode:
                ec = new ServerErrorCodeEmitComponent();
                break;

            case EmitNumberType.EmitNumberTypeChessName:
                ec = new EmitChessNameComponent();
                break;
            }
        }

        ec.ShowEmit(args);
    }
 public void Emit(Transform owner, int type, long hurt, bool critical)
 {
     EmitComponent ec;
     if (_componentPool.Count > 0)
         ec = _componentPool.Pop();
     else
         ec = new EmitComponent();
     ec.SetHurt(owner, type, hurt, critical);
 }
Пример #4
0
    public static void ReturnComponent(EmitNumberType type, EmitComponent com)
    {
        if (!_componentPool.ContainsKey(type))
        {
            _componentPool.Add(type, new List <EmitComponent>());
        }

        _componentPool[type].Add(com);
    }
Пример #5
0
    public void Emit(Transform owner, int type, long hurt, bool critical)
    {
        EmitComponent ec;

        if (_componentPool.Count > 0)
        {
            ec = _componentPool.Pop();
        }
        else
        {
            ec = new EmitComponent();
        }
        ec.SetHurt(owner, type, hurt, critical);
    }
Пример #6
0
    private static EmitComponent FindEmit(EmitNumberType type)
    {
        if (!_componentPool.ContainsKey(type))
        {
            return(null);
        }

        if (_componentPool[type].Count <= 0)
        {
            return(null);
        }

        EmitComponent component = _componentPool[type][0];

        _componentPool[type].Remove(component);

        return(component);
    }
 public void ReturnComponent(EmitComponent com)
 {
     _componentPool.Push(com);
 }
Пример #8
0
 public void ReturnComponent(EmitComponent com)
 {
     _componentPool.Push(com);
 }
Пример #9
0
 public static void AddChild(EmitComponent com)
 {
     view.AddChild(com);
 }
Пример #10
0
 public static void RemoveChild(EmitComponent com)
 {
     view.RemoveChild(com);
 }