Refresh a Layer

I have a layer in my game and I have a "options" layer that will show the options controls. When I select the option I want, how can I refresh the initial layer I am in to have the changes take place?

Answers

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    Reynaldo

    You will have to have an instance of your other layer somewhere that you can call into. Create a method called Refresh or something similar and call it when you are ready for a refresh.

    Another alternative could be to use Custom Events (CCEventListenerCustom) as demonstrated in the CustomEventTest. Don't forget to clean up your Custom Event listeners when you are done with them as demonstrated in the test code.

        public override void OnExit ()
        {
            // Don't forget to remove the fixed priority Event listeners yourself.
                       RemoveEventListener(listener);
                       RemoveEventListener(listener2);
            base.OnExit ();
        }
    

    The above shows the removal in the OnExit but you are the only one to decide when they should be cleaned up.

Sign In or Register to comment.