Author Topic: photo gallery - how to do?  (Read 2255 times)

VamppiV

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 1
  • Posts: 15
    • View Profile
photo gallery - how to do?
« on: October 06, 2014, 12:37:14 PM »
Hi :) I'm new on forum (I hope I put this post at good place) and new in NGUI. I have problem, I was trying to do it, but I wasted a lot of time earlier (when I was learning basics) so I decided to ask you for help.

I have to do Photo Gallery. At Android/iOS (if easier, we can focus on Android). Layout similar to this: http://www.techcredo.com/wp-content/uploads/2011/02/quickpic-top-android-image-app-review.jpg

And it's my idea. I hope you tell me is it okey or something I'm thinking wrong.

1. I'm making empty game object. There I have ALBUM CONTROLLER.
2. In ALBUM CONTROLLER I have function that's reading all photos from device and put it into table (first question: how do that?).
3. Next - I'm doing so much GUITextures how I need (count of photos). HOW?
4. And atribute every photo from table to next textures.

It sound in my opinion quite good, but I don't know how to script it.
And, I see, it has one big defect: if I put it in function "Start" it doesn't include new photos (app: camera+photo album). If I put it on Update() it will working all time... So: what function? Maybe when I'm coming into "panel album". But it won't be to slow?

I hope you help me solve my problem. Every idea/tricks will be very helpful. I want to do it good.

(And sorry for my grammar :))

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: photo gallery - how to do?
« Reply #1 on: October 07, 2014, 10:03:10 AM »
GUITexture is not NGUI. NGUI's equivalent is UITexture.

2. NGUITools.AddChild(tableGameObject, prefab), or NGUITools.AddWidget<UITexture>(tableGameObject).

Have a look at DownloadTexture script that comes with NGUI. http://www.tasharen.com/ngui/docs/class_download_texture.html

VamppiV

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 1
  • Posts: 15
    • View Profile
Re: photo gallery - how to do?
« Reply #2 on: October 07, 2014, 10:27:05 AM »
Thank you very much :) I've done that, now I have just one problem, this:
"And, I see, it has one big defect: if I put it in function "Start" it doesn't include new photos (app: camera+photo album). If I put it on Update() it will working all time... So: what function? Maybe when I'm coming into "panel album". But how to do that? Or maybe other option?"

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: photo gallery - how to do?
« Reply #3 on: October 07, 2014, 10:47:49 AM »
Doesn't include new photos? Eh?

If you're loading something in another script's Start(), then you either need to make sure that it executes first by changing the script execution order, or have your texture-setting script wait until it finishes loading whatever it is -- by using Coroutines, for example. This is a Unity usability question at this point.