Пример #1
0
 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);
 }
Пример #2
0
        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();
        }
Пример #3
0
 public void AddItem(ItemLayer layer, GameComponent item)
 {
     layer.Add(item);
 }