Exemple #1
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);
    }
Exemple #2
0
    public static void ReturnComponent(EmitNumberType type, EmitComponent com)
    {
        if (!_componentPool.ContainsKey(type))
        {
            _componentPool.Add(type, new List <EmitComponent>());
        }

        _componentPool[type].Add(com);
    }
Exemple #3
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);
    }