void OnPuzzleAutostepAvailable(object sender, InstantMessageArgs args)
        {
            bool available = (bool)args.arg;

            GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleBusy, this, true);
            if (available)
            {
                //Debug.Log("Autostep available, running DialogOkCancel");
                dialogMode = DialogOKCancelMode.Autostep;
                GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzlePrepareAutostep, this);
                GlobalManager.MInstantMessage.DeliverMessage(
                    InstantMessageType.GUIStartDialogOKCancel,
                    this,
                    GlobalManager.MLanguage.Entry(magicQuestionId)
                    );
            }
            else
            {
                dialogMode = DialogOKCancelMode.Shopping;
                GlobalManager.MInstantMessage.DeliverMessage(
                    InstantMessageType.GUIStartDialogOKCancel,
                    this,
                    GlobalManager.MLanguage.Entry(shopQuestionId)
                    );
            }
        }
        void OnGUIOKButtonPressed(object sender, InstantMessageArgs args)
        {
            DialogOKCancelMode mode = dialogMode;

            dialogMode = DialogOKCancelMode.None;
            switch (mode)
            {
            case DialogOKCancelMode.Back:
                GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.GUIFadeWhiteCurtain, this);
                break;

            case DialogOKCancelMode.Reset:
                GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleReset, this);
                break;

            case DialogOKCancelMode.Autostep:
                GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleAutostep, this);
                break;

            case DialogOKCancelMode.Shopping:
                GlobalManager.MScreenshot.TakeShot();
                GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleReadyToShop, this);
                break;
            }
        }
 protected override void AwakeInit()
 {
     dialogMode = DialogOKCancelMode.None;
     exitMode   = Exitmode.World;
     registrator.Add(
         new MessageRegistrationTuple {
         type = InstantMessageType.PuzzleBusy, handler = OnPuzzleBusy
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.PuzzleCompleteProcessed, handler = OnPuzzleCompleteProcessed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.PuzzleWinImageStopped, handler = OnPuzzleWinImageStopped
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.PuzzleSourceImageClosed, handler = OnPuzzleSourceImageClosed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIBackButtonPressed, handler = OnGUIBackButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIWhiteCurtainFaded, handler = OnGUIWhiteCurtainFaded
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIViewButtonPressed, handler = OnGUIViewButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIRestartButtonPressed, handler = OnGUIRestartButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIMagicButtonPressed, handler = OnGUIMagicButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIOKButtonPressed, handler = OnGUIOKButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUICancelButtonPressed, handler = OnGUICancelButtonPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.MusicTrackPlayed, handler = OnMusicTrackPlayed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIRotoCoinsPressed, handler = OnGUIRotoCoinsPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.GUIRotoChipsPressed, handler = OnGUIRotoChipsPressed
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.PuzzleAutostepAvailable, handler = OnPuzzleAutostepAvailable
     },
         new MessageRegistrationTuple {
         type = InstantMessageType.ShopBlurryScreenshotTaken, handler = OnShopBlurryScreenshotTaken
     }
         );
 }
 void OnGUIRestartButtonPressed(object sender, InstantMessageArgs args)
 {
     if (!puzzleBusy)
     {
         if (!GlobalManager.MHint.ShowNewHint(HintType.AskForRestartButton))
         {
             GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleBusy, this, true);
             dialogMode = DialogOKCancelMode.Reset;
             GlobalManager.MInstantMessage.DeliverMessage(
                 InstantMessageType.GUIStartDialogOKCancel,
                 this,
                 GlobalManager.MLanguage.Entry(restartlevelQuestionId)
                 );
         }
     }
 }
 void OnGUICancelButtonPressed(object sender, InstantMessageArgs args)
 {
     dialogMode = DialogOKCancelMode.None;
     GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleBusy, this, false);
 }