Author Topic: how select UISprite Flip in code  (Read 4221 times)

sawada

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
how select UISprite Flip in code
« on: April 07, 2014, 11:40:46 AM »
As title.

change UISprite Flip use Inspector is easy.
select Flip Type Nothing,Horizontally,Vertically and Both.

but,donot select Flip ins code.


//example. change Sprite is ok
this.ui_sprite.spriteName = set_sprite_name;
//but error all
this.ui_sprite.Flip = 1; //??
this.ui_sprite.mFlip = Flip.Horizontally; //??
this.ui_sprite.FlipType= Flip.Horizontally; //??


i lock this.but I did not know
http://www.tasharen.com/ngui/docs/class_u_i_sprite.html

What should I do >:(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how select UISprite Flip in code
« Reply #1 on: April 07, 2014, 10:37:33 PM »
Good catch. Add this function to UISprite:
  1.         /// <summary>
  2.         /// Sprite flip setting.
  3.         /// </summary>
  4.  
  5.         public Flip flip
  6.         {
  7.                 get
  8.                 {
  9.                         return mFlip;
  10.                 }
  11.                 set
  12.                 {
  13.                         if (mFlip != value)
  14.                         {
  15.                                 mFlip = value;
  16.                                 MarkAsChanged();
  17.                         }
  18.                 }
  19.         }

sawada

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: how select UISprite Flip in code
« Reply #2 on: April 20, 2014, 01:03:54 AM »
I am sorry for the delay in my response.
i try it and succes it.
thanks a lot