示例#1
0
        public new object Clone()
        {
            IActor actor = new UIButtonObject("clone - " + ID,                     //deep
                                              this.ActorType,                      //deep
                                              this.StatusType,                     //deep - enum type
                                              (Transform2D)this.Transform.Clone(), //deep - calls the clone for Transform3D explicitly
                                              this.Color,                          //deep
                                              this.SpriteEffects,                  //deep - enum type
                                              this.LayerDepth,                     //deep
                                              this.Texture,                        //shallow
                                              this.text,                           //deep
                                              this.spriteFont,                     //shallow
                                              this.textColor,                      //deep
                                              this.textOffset);                    //deep

            //clone each of the (behavioural) controllers, if we have any controllers attached
            if (this.ControllerList != null)
            {
                foreach (IController controller in this.ControllerList)
                {
                    actor.AttachController((IController)controller.Clone());
                }
            }
            return(actor);
        }
示例#2
0
        public override bool Equals(object obj)
        {
            UIButtonObject other = obj as UIButtonObject;

            if (other == null)
            {
                return(false);
            }
            else if (this == other)
            {
                return(true);
            }

            return(this.text.Equals(other.Text) &&
                   this.spriteFont.Equals(other.SpriteFont) &&
                   this.textColor.Equals(other.TextColor) &&
                   base.Equals(obj));
        }