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 static void ReturnComponent(EmitNumberType type, EmitComponent com) { if (!_componentPool.ContainsKey(type)) { _componentPool.Add(type, new List <EmitComponent>()); } _componentPool[type].Add(com); }
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); }