Exemple #1
0
 public DynamicSetup(ClassVisualisation classVisualisation, WorldSpaceUI UI, ResultCanvas resultCanvas, InputCanvas inputCanvas)
 {
     this.classVisualisation = classVisualisation;
     this.UI = UI;
     //this.resultCanvas = resultCanvas;
     this.inputCanvas = inputCanvas;
     this.posOffset   = new Vector3(5, 5, 5);
 }
Exemple #2
0
 public Setups(ResultCanvas resultCanvas, InputCanvas inputCanvas, ConnectionsRegisterer connRegisterer,
               WorldSpaceUI UI, ResultNode resultNode, ClassVisualisation classVisualisation)
 {
     this.resultCanvas       = resultCanvas;
     this.inputCanvas        = inputCanvas;
     this.connRegisterer     = connRegisterer;
     this.UI                 = UI;
     this.classVisualisation = classVisualisation;
     this.resultNode         = resultNode;
     ///Setup the result!
     this.resultNode.Setup(typeof(int), this.UI);
 }
    // Use this for initialization
    void Start()
    {
        QuestionCanvas = QuestionCanvas.GetComponent <Canvas> ();
        ResultCanvas   = ResultCanvas.GetComponent <Canvas> ();
        nextBtnCanvas  = nextBtnCanvas.GetComponent <Canvas> ();
        reBtncanvas    = reBtncanvas.GetComponent <Canvas> ();

        righttxt      = righttxt.GetComponent <Text> ();
        wrongtxt      = wrongtxt.GetComponent <Text> ();
        bonustxt      = bonustxt.GetComponent <Text> ();
        achivementTxt = achivementTxt.GetComponent <Text> ();

        QuestionCanvas.enabled = false;
        ResultCanvas.enabled   = false;
        nextBtnCanvas.enabled  = false;
        reBtncanvas.enabled    = false;
    }
    IEnumerator ending()
    {
        inGame.SetActive(false);
        if (playerHP >= 150)
        {
            Good.SetActive(true);
            yield return(new WaitForSecondsRealtime(3f));
        }
        else if (playerHP > 0)
        {
            Bad.SetActive(true);
            yield return(new WaitForSecondsRealtime(3f));
        }

        ResultCanvas.SetActive(true);
        ThisCanvas.SetActive(false);
    }
    // Use this for initialization
    void Start()
    {
        questionCanvas = questionCanvas.GetComponent <Canvas> ();
        ResultCanvas   = ResultCanvas.GetComponent <Canvas> ();
        DieCanvas      = DieCanvas.GetComponent <Canvas> ();
        RestgCanvas    = RestgCanvas.GetComponent <Canvas> ();
        NextstgCanvas  = NextstgCanvas.GetComponent <Canvas> ();

        rightTxt    = rightTxt.GetComponent <Text> ();
        wrongTxt    = wrongTxt.GetComponent <Text> ();
        archiveText = archiveText.GetComponent <Text> ();

        questionCanvas.enabled = false;
        ResultCanvas.enabled   = false;
        DieCanvas.enabled      = false;
        RestgCanvas.enabled    = false;
        NextstgCanvas.enabled  = false;
    }
                protected override void OnDraw(Android.Graphics.Canvas canvas)
                {
                    // if our render buffers are not valid, generate them
                    if (CurrWidth != this.LayoutParameters.Width || CurrHeight != this.LayoutParameters.Height)
                    {
                        CreateTextBitmaps(this.LayoutParameters.Width, this.LayoutParameters.Height);
                        CreateResultBitmaps(this.LayoutParameters.Width, this.LayoutParameters.Height);

                        CurrWidth  = this.LayoutParameters.Width;
                        CurrHeight = this.LayoutParameters.Height;
                    }


                    // keep the spot light centered on the image
                    float xPos = (LayoutParameters.Width / 2) - ((AlphaMask.Width / 2) * MaskScale);
                    float yPos = (LayoutParameters.Height / 2) - ((AlphaMask.Height / 2) * MaskScale);

                    // update the text's transform for the mask scale.
                    // The text's transform should be the inverse of the Canvas' values
                    TextTransform.SetScale(1.0f / MaskScale, 1.0f / MaskScale);
                    TextTransform.PreTranslate(-xPos, -yPos);

                    TextPaint.Shader.SetLocalMatrix(TextTransform);

                    // clear the bitmap before re-rendering. (NOT EFFICIENT _AT_ _ALL_)
                    ResultBmp.SetPixels(new int[ResultBmp.RowBytes * ResultBmp.Height], 0, ResultBmp.RowBytes, 0, 0, ResultBmp.Width, ResultBmp.Height);

                    // save / restore the canvas settings so we don't accumulate the scale
                    ResultCanvas.Save();
                    ResultCanvas.Translate(xPos, yPos);
                    ResultCanvas.Scale(MaskScale, MaskScale);

                    // render the alpha mask'd text to our result bmp
                    ResultCanvas.DrawBitmap(AlphaMask, 0, 0, TextPaint);

                    // restore the canvas values for next time.
                    ResultCanvas.Restore();

                    // and to the actual android buffer, render our result
                    canvas.DrawBitmap(ResultBmp, 0, 0, null);
                }
Exemple #7
0
    // Use this for initialization
    void Start()
    {
        GetComponent <Slider> ().value = playerValue;

        QuestionCanvas   = QuestionCanvas.GetComponent <Canvas> ();
        DieFailCanvas    = DieFailCanvas.GetComponent <Canvas> ();
        ResultCanvas     = ResultCanvas.GetComponent <Canvas> ();
        RestageBtnCanvas = RestageBtnCanvas.GetComponent <Canvas> ();
        NextBtnCanvas    = NextBtnCanvas.GetComponent <Canvas> ();

        DieText        = DieText.GetComponent <Text> ();
        rightText      = rightText.GetComponent <Text> ();
        wrongText      = wrongText.GetComponent <Text> ();
        achivementText = achivementText.GetComponent <Text> ();

        QuestionCanvas.enabled   = false;
        DieFailCanvas.enabled    = false;
        RestageBtnCanvas.enabled = false;
        NextBtnCanvas.enabled    = false;
        ResultCanvas.enabled     = false;
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        MinigameCanvas = MinigameCanvas.GetComponent <Canvas> ();
        ResultCanvas   = ResultCanvas.GetComponent <Canvas> ();
        RestgCanvas    = RestgCanvas.GetComponent <Canvas> ();
        NextstgCanvas  = NextstgCanvas.GetComponent <Canvas> ();

        btn1 = btn1.GetComponent <Button> ();
        btn2 = btn2.GetComponent <Button> ();
        btn3 = btn3.GetComponent <Button> ();

        ans1 = ans1.GetComponent <Button> ();
        ans2 = ans2.GetComponent <Button> ();
        ans3 = ans3.GetComponent <Button> ();

        rightTxt = rightTxt.GetComponent <Text> ();
        wrongTxt = wrongTxt.GetComponent <Text> ();

        ResultCanvas.enabled  = false;
        RestgCanvas.enabled   = false;
        NextstgCanvas.enabled = false;
    }
Exemple #9
0
    private void Start()
    {
        if (transperantMat == null)
        {
            this.transperantMat   = Resources.Load("Materials/transperantMat", typeof(Material)) as Material;
            this.inputPanelPrefab = Resources.Load("Prefabs/WorldSpaceCanvases/ConstantCanvasPrefab", typeof(GameObject)) as GameObject;
            this.resultAndVariablesPanelPrefab = Resources.Load("Prefabs/WorldSpaceCanvases/ResultCanvasPrefab", typeof(GameObject)) as GameObject;
            this.worldSpaceTextPrefab          = Resources.Load("Prefabs/WorldSpaceCanvases/WorldSpaceTextPrefab", typeof(GameObject)) as GameObject;
        }

        this.spellcraftParent = new GameObject("Spellcraft Parent");
        this.persistantParent = new GameObject("Persistant Parent");

        this.connTracker = new ConnectionsTracker(this);

        //Rotation of class nodes implementation that wull be replaced
        this.rotatorGO = new GameObject("Rotator");
        this.rotatorGO.transform.SetParent(this.spellcraftParent.transform);
        //...

        //Parented
        this.drawer = new LineDrawer(this);
        this.drawer.DrawBox(SpellcraftConstants.HalfSize, SpellcraftConstants.Thickness, SpellcraftConstants.BoxCenter);
        this.myCamera          = GameObject.Find("Camera").GetComponent <Camera>();
        this.camHandling       = this.myCamera.gameObject.AddComponent <SpellcraftCam>();
        this.myCamera2         = GameObject.Find("Camera2").GetComponent <Camera>();
        this.camHandling2      = this.myCamera2.gameObject.AddComponent <SpellMenuDragCam>();
        this.myCamera2.enabled = false;

        this.procUI = this.GetComponent <SpellcraftProcUI>();
        this.procUI.Setup(this.myCamera2, this.connTracker, 0.035f);

        // Procedural SpellCraftUI
        float YY = 1000;

        this.procUI.SetCanvasPosition(new Vector3(0, YY, -1000));
        this.procUIAnchor = new GameObject("ProcUIAnchor");
        this.procUIAnchor.transform.position = new Vector3(0, YY, -2000);

        GameObject center = new GameObject("Center");

        center.transform.SetParent(this.spellcraftParent.transform);
        this.camHandling.Setup(center);
        this.classVisualisation = new ClassVisualisation(this);
        this.resultCanvas       = new ResultCanvas(this.resultAndVariablesPanelPrefab, this.myCamera, this.connTracker, this.persistantParent.transform);
        this.resultCanvas.SetPosition(new Vector3(0, 0, -25));
        this.resultCanvas.SetScale(new Vector3(0.02f, 0.02f, 0.02f));
        this.resultCanvas.Hide();
        this.inputCanvas = new InputCanvas(this.myCamera, this.inputPanelPrefab, this.persistantParent.transform);

        //Extract that somewhere
        this.resultGO      = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        this.resultGO.name = "Result GO";
        this.resultGO.transform.SetParent(this.persistantParent.transform);
        this.resultGO.transform.position = new Vector3(0, -15, 0);
        this.resultNode = this.resultGO.AddComponent <ResultNode>();
        //...

        this.connRegisterer           = new ConnectionsRegisterer(this.connTracker, this.inputCanvas, this.drawer, this.resultNode);
        this.infoCanvas               = new InfoCanvas(this.worldSpaceTextPrefab, this.myCamera, this.spellcraftParent.transform);
        this.levels                   = new Setups(this.resultCanvas, this.inputCanvas, this.connRegisterer, this, this.resultNode, this.classVisualisation);
        this.resultCanvasVantigePoint = new GameObject("VantigePoint");
        this.resultCanvasVantigePoint.transform.position = new Vector3(0, 0, -30);
        this.resultCanvasVantigePoint.transform.SetParent(this.spellcraftParent.transform);

        this.dynamicSetup = new DynamicSetup(this.classVisualisation, this, this.resultCanvas, this.inputCanvas);

        //this.levels.JustTwoAddMethod(true);
        if (LoadLevel)
        {
            this.levels.LineDestroyer(false);
        }
        else
        {
            this.connTracker.RegisterBundle(null);
        }

        this.spellcraftParent.transform.position = this.position;
        this.persistantParent.transform.position = this.position;
    }