Ejemplo n.º 1
0
    protected override void OnInstanceDeinit()
    {
        signalTreasureOpened.callback -= OnSignalTreasureOpened;
        signalShowNext.callback       -= OnSignalShowNext;

        if (mIsDragGuideShown && mDragGuide)
        {
            mDragGuide.Hide();
        }

        base.OnInstanceDeinit();
    }
Ejemplo n.º 2
0
    public void HideDrag()
    {
        if (mDragIndicatorRout != null)
        {
            StopCoroutine(mDragIndicatorRout);
            mDragIndicatorRout = null;
        }

        if (mDragGuide)
        {
            mDragGuide.Hide();
        }
    }
Ejemplo n.º 3
0
    void OnSignalHelpHide()
    {
        if (mHelpShowRout != null)
        {
            StopCoroutine(mHelpShowRout);
            mHelpShowRout = null;
        }

        dragGuideWidget.Hide();
    }
Ejemplo n.º 4
0
    void M8.IModalPop.Pop()
    {
        CancelRout();

        if (mIsDragInstruct)
        {
            if (mDragInstructRout != null)
            {
                StopCoroutine(mDragInstructRout);
                mDragInstructRout = null;
            }

            dragGuide.Hide();

            mIsDragInstructApplied = true;
        }

        DefaultActiveDisplay();

        ClearCategoryPicks();
        ClearMeasureDisplays();
        ClearCategoryPlaced();
    }
Ejemplo n.º 5
0
    void M8.IModalActive.SetActive(bool aActive)
    {
        if (aActive)
        {
            instructDragGuide.Show(false, instructDragStart.position, instructDragEnd.position);

            //start
            mRout = StartCoroutine(DoActive());
        }
        else
        {
            instructDragGuide.Hide();

            StopRouts();
        }
    }
Ejemplo n.º 6
0
 protected override void OnHide()
 {
     //hide drag guide
     dragGuideWidget.Hide();
 }
Ejemplo n.º 7
0
    IEnumerator DoDragInstruct()
    {
        while (mDragInstructEnabled)
        {
            if (!dragInstructCardDeckWidget)
            {
                break;
            }

            if (dragInstructCardDeckWidget.cards == null)
            {
                yield return(null);

                continue;
            }

            yield return(new WaitForSeconds(0.5f));

            if (!dragInstruct)
            {
                break;
            }

            dragInstruct.Hide(); //allow for reposition

            int opInd   = -1;
            int opCount = Mathf.Min(operandSlots.slots.Length, mOperation.operands.Length);
            for (int i = 0; i < opCount; i++)
            {
                var op = mOperation.operands[i];
                if (op.isEmpty)
                {
                    opInd = i;
                    break;
                }
            }

            if (opInd != -1)
            {
                CardWidget card = null;
                for (int i = 0; i < dragInstructCardDeckWidget.cards.Length; i++)
                {
                    if (dragInstructCardDeckWidget.cards[i])
                    {
                        card = dragInstructCardDeckWidget.cards[i];
                        break;
                    }
                }

                if (card)
                {
                    Vector2 dragStart = card.transform.position;
                    Vector2 dragEnd   = operandSlots.slots[opInd].anchor.position;

                    dragInstruct.Show(false, dragStart, dragEnd);
                    if (dragInstructDialogGO)
                    {
                        dragInstructDialogGO.SetActive(true);
                    }
                }
                else   //no card available
                {
                    if (dragInstructDialogGO)
                    {
                        dragInstructDialogGO.SetActive(false);
                    }
                }
            }
            else   //all operands filled
            {
                if (dragInstructDialogGO)
                {
                    dragInstructDialogGO.SetActive(false);
                }
            }

            mDragInstructSlotUpdated = false;
            while (!mDragInstructSlotUpdated)
            {
                yield return(null);
            }

            yield return(null);
        }

        mDragInstructRout = null;
        DragInstructEnd();
    }
Ejemplo n.º 8
0
    protected override IEnumerator Start()
    {
        if (!string.IsNullOrEmpty(musicPath))
        {
            LoLManager.instance.PlaySound(musicPath, true, true);
        }

        yield return(base.Start());

        //spawn player
        mPlayerGO.SetActive(true);
        yield return(new WaitForSeconds(1.5f));

        //

        //first time detail

        //activate force selection
        mForceGroupUIGO.SetActive(true);

        //first time - show drags
        if (isForceDragInstructions)
        {
            yield return(new WaitForSeconds(0.4f));

            dragGuideGO.SetActive(true);

            var item = entitySpawnerGroup.widgets[0];

            Vector2 guideStart = item.transform.position;
            Vector2 guideDest  = Camera.main.WorldToScreenPoint(dragGuideGO.transform.position);

            mDragGuide.Show(false, guideStart, guideDest);

            //wait for item to be spawned
            while (item.activeUnitCount == 0)
            {
                yield return(null);
            }

            //hide guide, show adjust entity guide
            dragGuideGO.SetActive(false);
            mDragGuide.Hide();

            dragEntityGuideGO.SetActive(true);

            yield return(new WaitForSeconds(playGuideGOShowDelay));

            playGuideGO.SetActive(true);
            mPlayGroupUIGO.SetActive(true);

            while (!mPlayerBody.simulated)
            {
                yield return(null);
            }

            //hide guides
            dragEntityGuideGO.SetActive(false);
            playGuideGO.SetActive(false);
        }
        else
        {
            //activate play
            mPlayGroupUIGO.SetActive(true);
        }

        //player watcher
        StartCoroutine(DoPlayer());
    }
Ejemplo n.º 9
0
    protected override IEnumerator Start()
    {
        if (!string.IsNullOrEmpty(musicPath))
        {
            LoLManager.instance.PlaySound(musicPath, true, true);
        }

        yield return(base.Start());

        titleAnim.gameObject.SetActive(true);
        yield return(titleAnim.PlayEnterWait());

        yield return(new WaitForSeconds(startDelay));

        motionIllustrationAnim.gameObject.SetActive(true);
        yield return(motionIllustrationAnim.PlayEnterWait());

        introDialog.Play();
        while (introDialog.isPlaying)
        {
            yield return(null);
        }

        yield return(titleAnim.PlayExitWait());

        titleAnim.gameObject.SetActive(false);

        yield return(motionIllustrationAnim.PlayExitWait());

        motionIllustrationAnim.gameObject.SetActive(false);

        //princess
        yield return(DoPrincessDistress());

        //help
        kidnapDialog.Play();
        while (kidnapDialog.isPlaying)
        {
            yield return(null);
        }

        //get block 1 ready
        block1.gameObject.SetActive(true);
        block1.body.simulated = true;

        block1ForceGravityGO.SetActive(true);

        mBlockForceRout = StartCoroutine(DoForceBalance(block1, block1ForceNetGO, block1ForceBalancedGO, block1ForceUnbalancedGO, block1NetForceDirRoot, block1NetForceNoneGO));

        //wait a bit, then pause and describe the gravity
        yield return(new WaitForSeconds(gravityDialogWaitDelay));

        M8.SceneManager.instance.Pause();

        gravityDialog.Play();
        while (gravityDialog.isPlaying)
        {
            yield return(null);
        }

        M8.SceneManager.instance.Resume();

        //wait for block 1 to hit ground
        while (!block1.isGrounded)
        {
            yield return(null);
        }

        //fancy camera shake
        cameraShaker.Shake();

        if (!string.IsNullOrEmpty(blockLandSfxPath))
        {
            LoLManager.instance.PlaySound(blockLandSfxPath, false, false);
        }

        yield return(new WaitForSeconds(1f));

        for (int i = 0; i < block1Wheels.Length; i++)
        {
            var suspension = block1Wheels[i].suspension;
            suspension.frequency       = block1WheelsGroundFreq;
            block1Wheels[i].suspension = suspension;
        }
        //

        yield return(new WaitForSeconds(1f));

        block1ForceGravityGO.SetActive(false);

        //some more dialog
        landDialog.Play();
        while (landDialog.isPlaying)
        {
            yield return(null);
        }

        //show interaction
        interfaceRootGO.SetActive(true);

        //set to only one knight
        var knightSpawner   = (EntitySpawnerWidget)unitSpawnerWidget;
        var lastKnightCount = knightSpawner.entityCount;

        knightSpawner.SetEntityCount(1);

        //game ready
        unitSpawnerWidget.active = true;

        //drag instruction
        yield return(new WaitForSeconds(0.35f));

        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);

        while (knightSpawner.activeUnitCount == 0)
        {
            yield return(null);
        }

        mDragGuide.Hide();
        //

        //wait for block1 to start moving

        //send 1 goblin
        StartCoroutine(DoGoblins());

        //wait for block contact
        while ((block1.collisionFlags & CollisionFlags.CollidedSides) == CollisionFlags.None)
        {
            yield return(null);
        }

        //show knight force
        block1ForceKnightGO.SetActive(true);

        //wait for goblin force display
        while (!block1ForceGoblinGO.activeSelf)
        {
            yield return(null);
        }

        //dialog
        goblinPushDialog.Play();
        while (goblinPushDialog.isPlaying)
        {
            yield return(null);
        }

        //add the rest of knights counter
        knightSpawner.SetEntityCount(lastKnightCount);

        //show drag again
        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);
        mIsDragGuideShown = true;

        //wait for block1 to contact goal
        bool isBlockFinish = false;

        while (!isBlockFinish)
        {
            var blockContacts = block1.collisionData;
            for (int i = 0; i < blockContacts.Count; i++)
            {
                var coll = blockContacts[i].collider;
                if (coll && coll.CompareTag(block1GoalTag))
                {
                    isBlockFinish = true;
                    break;
                }
            }

            yield return(null);
        }

        unitSpawnerWidget.active = false;

        //animation

        //clear out units
        signalUnitsClear.Invoke();

        block1ForceKnightGO.SetActive(false);
        block1ForceGoblinGO.SetActive(false);

        //more dialog
        yield return(new WaitForSeconds(2f));

        //clear out block1 info
        StopCoroutine(mBlockForceRout);
        block1ForceNetGO.SetActive(false);
        block1ForceBalancedGO.SetActive(false);
        block1ForceUnbalancedGO.SetActive(false);
        block1NetForceDirRoot.gameObject.SetActive(false);
        block1NetForceNoneGO.SetActive(false);
        //

        block1FinishDialog.Play();
        while (block1FinishDialog.isPlaying)
        {
            yield return(null);
        }
        //

        //block 2 ready
        block2.gameObject.SetActive(true);
        block2.body.simulated = true;

        block2ForceGravityGO.SetActive(true);

        mBlockForceRout = StartCoroutine(DoForceBalance(block2, block2ForceNetGO, block2ForceBalancedGO, block2ForceUnbalancedGO, block2NetForceDirRoot, block2NetForceNoneGO));

        //wait for block 2 to hit ground
        while (!block2.isGrounded)
        {
            yield return(null);
        }

        //fancy camera shake
        cameraShaker.Shake();

        if (!string.IsNullOrEmpty(blockLandSfxPath))
        {
            LoLManager.instance.PlaySound(blockLandSfxPath, false, false);
        }

        block2ForceGravityGO.SetActive(false);

        block2Dialog.Play();
        while (block2Dialog.isPlaying)
        {
            yield return(null);
        }

        //game ready
        unitSpawnerWidget.active = true;

        //show drag again
        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);
        mIsDragGuideShown = true;

        //wait for knight contact, then show forces
        while ((block2.collisionFlags & CollisionFlags.CollidedSides) == CollisionFlags.None)
        {
            yield return(null);
        }

        block2ForcesGO.SetActive(true);
        //

        //wait for block2 to contact block 1
        isBlockFinish = false;

        while (!isBlockFinish)
        {
            var blockContacts = block2.collisionData;
            for (int i = 0; i < blockContacts.Count; i++)
            {
                var coll = blockContacts[i].collider;
                if (coll == block1.coll)
                {
                    isBlockFinish = true;
                    break;
                }
            }

            yield return(null);
        }

        unitSpawnerWidget.active = false;

        //clear out units
        signalUnitsClear.Invoke();

        StopCoroutine(mBlockForceRout);
        block2ForcesGO.SetActive(false);
        block2ForceNetGO.SetActive(false);
        block2ForceBalancedGO.SetActive(false);
        block2ForceUnbalancedGO.SetActive(false);
        block2NetForceDirRoot.gameObject.SetActive(false);
        block2NetForceNoneGO.SetActive(false);

        //victory
        yield return(new WaitForSeconds(victoryStartDelay));

        victoryGO.SetActive(true);

        yield return(new WaitForSeconds(victoryDelay));

        //next level
        //GameData.instance.Progress();
        M8.UIModal.Manager.instance.ModalCloseAll();
        M8.UIModal.Manager.instance.ModalOpen(victoryModal);
    }
Ejemplo n.º 10
0
    protected override void OnHide()
    {
        dragGuideWidget.Hide();

        confirmExpandGO.SetActive(false);
    }