rants

Just needed a quick way to track some tasks, so here it goes…

Found a bunch of crap surrounding the dialog implementation. Most of it was easy to cleanup, however, the animation code I just can’t find it… Looking at how the dialog isn’t deactivated nor cleaned up after being hidden also made me decide to just not cache panels....

Like, I’ve specifically had this talk with the developer, telling him:

There are two hard problems in Computer Science, the first being cache invalidation.

Yet, he insisted “it’s easy to cache”. Sigh. Yeah, you just store the crap in a variable and call it done… Completely ignoring the invalidation part, amazing.

So, let’s clean that up… OK, cache nuked… Running… Works as expected in most of the pleaganels, but the dialog stuff is interesting, since the dialog simply just stays there after the animation, and a new one is instantiated if we click again, leaking the old one… So, need to resolve the dialog flow.

Hmm… cleaned up a few scripts around panel controller, and forgot what the hell I was doing… Oh, dialogs… How are they even managed?

Well, it was pretty neat, actually. There was a script that automatically searched for any tween component in panel you push, and triggers it. Once I searched the prefab for that tween component, it was simple to alter the flow and fix stuff… Still need to figure out why the dialogs aren’t being destroyed…

I finally figured out why it was so hard to read the flow of the code.. It is basically because different things were doing the same thing… I mean, imagine you have a navigation stack. You push stuff onto the stack, then pop them out … When you push things, the existing thing is gonna be hidden. Also, when you pop from the stack, and popped thing is gonna be hidden.. Now, just because they are both gonna be hidden, doesn’t mean they should lead to the same function!! The pop flow should be completely separate from the push flow.

Well, one more stupid bug, pushing more than one panel seems to stop the push animation from working >___<

lol, indeed it was stupid… ROFL, this is just too stupid. So, while I was fixing the panel controller code, which deals with the whole navigation crap, I saw that a variable was defined like this:

private List<Panel> _panelStack;

I was like, no way! This is called a stack, it should be a stack!

private Stack<Panel> _panelStack;

Better… So, I go through the code and change Remove to Pop .. and that’s it. I leave everything else the same, including calls to the Last function. By definition, a stack puts new elements at the beginning, and I was accessing Last … Stupid. So, just changed those to Peek, and call it a day.