Exemplo n.º 1
0
 /// <summary>
 /// 动态添加Element,会在这一帧结束后添加
 /// </summary>
 /// <param name="gm"></param>
 public void DynamicInsertElement(int index, GameElement gm)
 {
     ChangeList.Add(new ChangeElement()
     {
         index = index, gameElement = gm
     });
 }
Exemplo n.º 2
0
        //private void DynamicInsert()
        //{
        //    if (DymInsertList.Count != 0)
        //    {
        //        foreach (var item in DymInsertList)
        //        {
        //            if(Elements.Count==0)
        //            {
        //                AddElement(item.gm);
        //            }
        //            else
        //            {
        //                InsertElement(item.index, item.gm);
        //            }

        //        }
        //        DymInsertList.Clear();
        //    }
        //}

        public void DynamicRemoveElement(GameElement gm)
        {
            ChangeList.Add(new ChangeElement()
            {
                index = -1, gameElement = gm
            });
        }
Exemplo n.º 3
0
 public EasyKeyInput(GameElement f)
 {
     Father             = f;
     keyCodes           = new List <KeyCode>(1);
     OnceDowns          = new List <bool>(1);
     keyEvent_OnceDowns = new List <EventDel>(1);
     keyEvent_Downs     = new List <EventDel>(1);
 }
Exemplo n.º 4
0
 public virtual void InsertElement(int i, GameElement gm)
 {
     gm.Father = this;
     if (Elements.Count > i)
     {
         Elements.Insert(i, gm);
     }
     else
     {
         Elements.Add(gm);
     }
 }
Exemplo n.º 5
0
 private void GoWithMouse()
 {
     if (ElementsGoWithMouse.Count != 0)
     {
         if (ElementsGoWithMouse[0] != last)
         {
             ElementsGoWithMouse[0].LastLayer = ElementsGoWithMouse[0].Layer;
             LayerController.MoveToLayerTop(ElementsGoWithMouse[0], "Select");
             last = ElementsGoWithMouse[0];
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 动态移除元素,在Scene中,动态移除将在动态添加之前进行
 /// </summary>
 /// <param name="element"></param>
 public void DynamicRemoveElement(GameElement element)
 {
     for (int i = 0; i < Layers.Count; i++)
     {
         if (element.Layer == Layers[i])
         {
             Layers[i].Elements.Remove(element);
             element.LastLayer = element.Layer;
             element.Layer     = null;
         }
     }
     FatherScene.DynamicRemoveElement(element);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 动态添加,会在下一帧绘制加入的元素
        /// 在Scene中,动态添加会在动态移除之后进行
        /// </summary>
        /// <param name="element"></param>
        /// <param name="layerName"></param>
        public void DynamicAddElementToLayer(GameElement element, string layerName)
        {
            int trueCount = 0;

            for (int i = 0; i < Layers.Count; i++)
            {
                trueCount += Layers[i].Elements.Count;
                if (Layers[i].LayerName == layerName)
                {
                    Layers[i].Elements.Add(element);
                    element.Layer = Layers[i];
                    break;
                }
            }
            FatherScene.DynamicInsertElement(trueCount, element);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 动态移动一个元素到指定图层的最上方
 /// </summary>
 /// <param name="element"></param>
 /// <param name="layerName"></param>
 public void MoveToLayerTop(GameElement element, string layerName)
 {
     DynamicRemoveElement(element);
     DynamicAddElementToLayer(element, layerName);
 }
Exemplo n.º 9
0
 public EasyInputAction(GameElement f)
 {
     this.Father = f;
 }
Exemplo n.º 10
0
 public virtual void RemoveElement(GameElement gm)
 {
     gm.Father = null;
     Elements.Remove(gm);
 }
Exemplo n.º 11
0
 public virtual void AddElement(GameElement gm)
 {
     gm.Father = this;
     Elements.Add(gm);
 }