public void AddItem(String layerName, GameComponent item) { ItemLayer layer = GetLayer(layerName); // TODO [Null模式实现] 优化请求层不存在情况处理 if(layer == null) { layer = new ItemLayer(); layer.Name = layerName; CurScene.Layers.Add(layer); } layer.Add(item); }
private void btn_addGroup_Click(object sender, EventArgs e) { bool occupied = true; NameUtil.RestartNameInc(0); String groupName = ""; while (occupied) { groupName = NameUtil.GetNextName("Group"); if (GameService.Instance.QueryModule<StageModule>().GetGroupByName(groupName) != null) { occupied = false; break; } } ItemLayer layer = new ItemLayer(); layer.Name = groupName; GameService.Instance.QueryModule<StageModule>().Layers.Add(layer); updateItemCollection(); }
public void AddItem(ItemLayer layer, GameComponent item) { layer.Add(item); }