}                                                          ///@property(readwrite,assign) bool usingStrings;

//public void SetActionDone(bool inThing) {actionDone = inThing;}///@property(readwrite,assign) bool actionDone;

        public FrontEndQuery()
        {
            //if (!base.init()) return null;

            unityText   = null;
            textTexture = null;

            for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++)
            {
                button[i] = new FrontEndButton(i);
            }

            for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++)
            {
                funnyWord[i] = null;
            }

            for (int i = 0; i < (int)Enum.kMaxCentralButtonsInQuery; i++)
            {
                buttonText[i] = null;
            }

            dimZob       = new Zobject();
            backdrop     = new Zobject();
            text         = new Zobject();
            chosenButton = (QueryButton)(-1);
            noDimZob     = false;
            wordScale    = 0.42f;
            wordGap      = 32.0f;
            wordOffset   = 0.0f;
            myColour     = Constants.kColourLightGreen;
            usingStrings = false;
            //return this;
        }
        public void ShowForUIAlert()
        {
            if (unityText != null)
            {
                unityText.Show();
            }

            if (queryButtonStyle == QueryButtonStyle.kQButtonsCentral)
            {
                for (int i = 0; i < numButtons; i++)
                {
                    (buttonText[i]).FitToWidth(170.0f);
                    (buttonText[i]).Show();
                }
            }

            state        = QueryState.e_Active;
            chosenButton = (QueryButton)(-1);
            dimZob.Show();
            backdrop.Show();
            if (useActualText)
            {
                this.ShowFunnyWords();
            }
            else
            {
                text.Show();
            }

            float timeTweenButtons = 0.04f;
            float maxWaitToShow    = (float)numButtons * timeTweenButtons;

            for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++)
            {
                (button[i]).Show();
                if (queryButtonStyle == QueryButtonStyle.kQButtonsEdges)
                {
                    ((button[i]).zobject).QueueAction(ZobjectAction.nThrobLooping);
                    ((button[i]).zobject).SetThrobSize(0.06f);
                    ((button[i]).zobject).SetThrobTime(0.5f);
                }
                else if (queryButtonStyle == QueryButtonStyle.kQButtonsCentral)
                {
                    button[i].zobject.SetWaitToShow(maxWaitToShow - ((float)i * timeTweenButtons));
                }
            }

            for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++)
            {
                if (funnyWord[i] != null)
                {
                    (funnyWord[i]).Show();
                }
            }
        }
        public void HandleTap(CGPoint inPosition)
        {
            if (backdrop.state != ZobjectState.kZobjectShown)
            {
                return;
            }

            for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++)
            {
                if ((button[i]).IsTouched_NoCanClick(inPosition))
                {
                    (button[i]).Click();
                    chosenButton = (QueryButton)i;
                    {
                    }
                    break;
                }
            }
        }
        public void InitialiseNew(QueryInfoNew info)
        {
            waitToHide = 0.0f;

            if (unityText == null)
            {
                unityText = new FunnyWord();
            }

            if (info.numButtons > 0)
            {
                myColour = Constants.kColourRed;
            }

            if (Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High)
            {
                info.inTextScale *= 2.0f;
            }

            if (Globals.g_world.DoesCurrentLanguageUseNSString() || info.useNSStringForAnyLanguage)
            {
                useNSString = true;
            }
            else
            {
                useNSString = false;
            }

            FunnyWord.WordInfo wInfo;
            wInfo.position    = info.position;
            wInfo.isCentrePos = true;
            wInfo.scale       = info.inTextScale * 0.32f;      // * 0.25f;

            if (useNSString)
            {
                unityText.InitWithWordNewP1(wInfo, info.queryText);
            }
            else
            {
                position = info.position;
                this.DivideStringIntoFunnyWords(info.queryText);

                wInfo.scale = info.inTextScale * 0.012f;                // * 0.1f;// * 0.25f;
                //unityText.SetFont(Globals.g_world.font);
                //unityText.SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours));
                //unityText.InitWithWordP1(wInfo,info.queryText);
            }

            unityText.SetColour(myColour);

            if (useNSString)
            {
                unityText.myTextWrapper.SetBoundThing();
                unityText.SetUseTextureInstead(true);
                unityText.myTextWrapper.SetFontSize(info.inTextScale * 0.32f);
            }

            newStyleWithAtlas = info.newStyleWithAtlas;
            newStyleQuery     = true;
            useActualText     = false;
            FrontEndQuery.QueryInfo qInfo = new FrontEndQuery.QueryInfo();
            qInfo.noButton  = info.noButton;
            qInfo.yesButton = info.yesButton;
            position        = info.position;
            state           = QueryState.e_Inactive;
            chosenButton    = (QueryButton)(-1);
            queryText       = (info.queryText);
            boxDimensions   = Utilities.CGPointMake(info.boxDimensions.Width, info.boxDimensions.Height);
            scale.x         = info.scale;
            scale.y         = info.scale;
            atlas           = info.inAtlas;
            if (newStyleWithAtlas)
            {
                this.SetupButtonsNew(info);
            }

            Zobject.ZobjectInfo zInfo = new Zobject.ZobjectInfo();
            if (newStyleWithAtlas)
            {
                zInfo.texture = null;
            }
            else
            {
                zInfo.texture = info.backdropTexture;
            }

            zInfo.startState  = ZobjectState.kZobjectHidden;
            zInfo.position    = position;
            zInfo.isMapObject = false;
            backdrop.Initialise(zInfo);
            backdrop.SetShowScale(scale.x * 1.2f);
            if (newStyleWithAtlas)
            {
                backdrop.SetAtlasAndSubtextureP1(atlas, info.backdropId);
            }
            else
            {
//                backdrop.SetShowScale(1.2f);
            }

            if (backdrop.myAtlasBillboard != null)
            {
                backdrop.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff");
            }

            numButtons     = info.numButtons;
            zInfo.position = Utilities.CGPointMake(160.0f, 240.0f);
            zInfo.texture  = info.dimOverlayTexture;
            dimZob.Initialise(zInfo);
            dimZob.SetStretchToScreen(true);
            dimZob.SetShowStyle((int)ZobjectShowStyle.kZobjectShow_FadeIn);
            dimZob.SetHideStyle((int)ZobjectHideStyle.kZobjectHide_FadeOut);
            dimZob.SetShowAlpha(0.7f);
            if (newStyleWithAtlas)
            {
                dimZob.SetAtlasAndSubtextureP1(atlas, info.dimId);
            }

            if (dimZob.myAtlasBillboard != null)
            {
                dimZob.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff");
            }


            if (textTexture != null)
            {
            }

            CGSize dimensionsForText = info.boxDimensions;
            float  textScale         = info.inTextScale;

            if (Globals.deviceIPad)
            {
                dimensionsForText.Height *= 2.0f;
                dimensionsForText.Width  *= 2.0f;
                textScale *= 2.0f;
            }

            textTexture    = null;         //new Texture2D_Ross(info.queryText, dimensionsForText, UITextAlignment.UITextAlignmentCenter, "Arial", textScale);
            zInfo.texture  = textTexture;
            zInfo.position = position;
            if (Globals.g_currentLanguage == World.Enum11.kLanguage_Japanese)
            {
                if ((!Globals.deviceIPhone4) && (!Globals.deviceIPad))
                {
                    zInfo.position.y += 3.0f;
                }
                else
                {
                    zInfo.position.y += 15.0f;
                }
            }

            text.Initialise(zInfo);
            text.SetShowScale(scale.x);

            if (text.myAtlasBillboard != null)
            {
                text.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff");
            }


            if (!newStyleWithAtlas)
            {
                boxDimensions.x = 200.0f;
                boxDimensions.y = 180.0f;
                if (info.numButtons == 0)
                {
                    this.SetupButtons(qInfo);
                }
            }


            if (info.numButtons > 0)
            {
                queryButtonStyle = QueryButtonStyle.kQButtonsCentral;
                this.SetupCentralButtons(info);

                //This means we want the new style central hanging buttons
            }
            else
            {
                queryButtonStyle = QueryButtonStyle.kQButtonsEdges;
            }

            backdrop.SetShowStyle(ZobjectShowStyle.kZobjectShow_SlideInLeft);
            backdrop.SetHideStyle(ZobjectHideStyle.kZobjectHide_SlideToRight);
            backdrop.SetHideAcc(0.02f);

            unityText.SetPositionZob(backdrop);
        }
        public void Initialise(QueryInfo info)
        {
            waitToHide    = 0.0f;
            newStyleQuery = false;
            for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++)
            {
                if (funnyWord[i] == null)
                {
                    funnyWord[i] = new FunnyWord();
                }

                (funnyWord[i]).Disappear();
            }

            state         = QueryState.e_Inactive;
            chosenButton  = (QueryButton)(-1);
            useActualText = info.useActualText;
            theInfo1      = info.theInfo1;
            theInfo2      = info.theInfo2;
            theInfo3      = info.theInfo3;
            theInfo4      = info.theInfo4;
            theInfo5      = info.theInfo5;
            theInfo6      = info.theInfo6;
            theInfo7      = info.theInfo7;
            position      = info.position;
            boxDimensions = info.boxDimensions;
            if (info.backdropTexture == null)
            {
                scale.x = boxDimensions.x / 128;
                scale.y = boxDimensions.y / 128;
            }
            else
            {
                scale.x = 1.0f;
                scale.y = 1.0f;
            }

            this.SetupButtons(info);
            Zobject.ZobjectInfo zInfo = new Zobject.ZobjectInfo();
            zInfo.texture     = info.backdropTexture;
            zInfo.startState  = ZobjectState.kZobjectHidden;
            zInfo.position    = position;
            zInfo.isMapObject = false;
            backdrop.Initialise(zInfo);
            backdrop.SetShowScale(scale.x);
            if (zInfo.texture != null)
            {
                backdrop.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff");
            }


            zInfo.texture  = info.dimTexture;
            zInfo.position = Utilities.CGPointMake(160.0f, 240.0f);
            dimZob.Initialise(zInfo);
            dimZob.SetStretchToScreen(true);
            dimZob.SetShowStyle((int)ZobjectShowStyle.kZobjectShow_FadeIn);
            dimZob.SetHideStyle((int)ZobjectHideStyle.kZobjectHide_FadeOut);
            dimZob.SetShowAlpha(0.9f);
            zInfo.texture  = info.textTexture;
            zInfo.position = Utilities.CGPointMake(position.x, position.y - 40);
            text.Initialise(zInfo);
            text.SetShowScale(scale.x);
        }
 public void SetChosenButton(QueryButton inThing)
 {
     chosenButton = inThing;
 }                                                                                 ///@property(readwrite,assign) QueryButton chosenButton;