Trying to make a hacking minigame...

So I am trying to make a hacking minigame where you can access files on computers in the game, but I can’t figure out the best way to make a “file structure” on the computers. I’d like to have multiple directories with different files in them that can be accessed, edited, and deleted. I’m just not sure on the best way to get the whole thing started, I don’t think using lists would work as some directories would have files and other directories in them. Any ideas?

Woot! what a happy coincidence, I happen to be doing the VERY SAME THING! - But I think I’m a little bit ahead of you :wink:

Cutting, (I didn’t need copying, but it’s just as easy) pasting, renaming, opening files/folders, text/audio/video/image files, go back, navigable addressbar, scrolling, deleting, recycle bin, multiple selection, unique naming, etc :smiley:

I’m gonna probably make this available at the store after we release our game.

But if you wanna do this in a way that is easy, and convenient like the way I did it, then first you gotta get NGUI. Learn the basics from Michael (ArenMook), then it’s smooth sailing from there :slight_smile: - And don’t forget to make an account at NGUI’s forums, you WILL need a LOT of help at the beginning.

The rest is all pure programming and organizing code and class design, I hope you’re good at OOP. If you’re only willing to make a file manager (just like like you see in the pics, not a whole OS like what I think I’m gonna be doing), then you could have classes like:

FileManager:
   RootFolder
   CurrentFolder
   RecycleBin
   FolderStack (for going back)
   Clipboard
      Cut();
      Copy();
      Paste();
   ...

FolderContent:
  background
  icon
  label
  Open();
  Delete();
  Rename();
  MoveTo();
  ...
  ^     ^
  ^     ^
  FILE  Folder
        List <FolderContent> Contents
        List <FILE> Files   // keeping a list of files and folder for convenience and easy access
        List <Folder> Folders
        GetFile(string fileName, bool recursive);
        GetFolder(string folderName, bool recursive);
        GetUniqueName(string forName);
  ...
   ^     ^
   ^     ^
   ^     RecycleBin
   ^        RestoreAll();
   ^        DeleteAll(); // Clear it out - destroys contents completely
   AudioFIle, TextFile, VideoFile, ImageFile, etc

(Arrows mean children - inheritance)

(Here’s how I implemented the Clipboard I used a queue, but you could use a list if you like)

You’re gonna need a couple more stuff. Sorry I’m not giving details. But if you so decide to go and get NGUI, let me know and I will be more than happy to help you, and even share some code :slight_smile: But that doesn’t mean that you don’t try yourself first.

Doing this in UnityGUI is really a pain in the butt! Don’t even think about it!

There are a lot of quirks and gotchas in NGUI and headaches in the beginning, but once you get it right, NGUI isn’t just a GUI system, it will offer a LOT of powerful tools, like a brand new event handling system. It will help you solve problems in much better and efficient ways than UnityGUI.

Good luck!