示例#1
0
    void OnCategoryDragEnd(ShapeAnalyzeCategoryWidget widget, PointerEventData eventData)
    {
        categoryHighlightGO.SetActive(false);

        bool isInCategoryPanel = IsInCategoryPanel(widget.dragRoot);

        if (isInCategoryPanel)
        {
            //add to placed
            if (!mShapeCategoryWidgetActivePlaced.Exists(widget))
            {
                mShapeCategoryWidgetActivePicks.Remove(widget);

                widget.transform.SetParent(categoryContainer, false);

                mShapeCategoryWidgetActivePlaced.Add(widget);

                //show next if first time
                if (mShapeCategoryWidgetActivePlaced.Count == 1)
                {
                    if (!nextBase.gameObject.activeSelf || !nextBase.isEntering)
                    {
                        CancelRout();
                        nextBase.gameObject.SetActive(true);
                        nextBase.PlayEnter();
                    }
                }
            }
        }
        else
        {
            //add to picks
            if (!mShapeCategoryWidgetActivePicks.Exists(widget))
            {
                mShapeCategoryWidgetActivePlaced.Remove(widget);

                widget.transform.SetParent(categoryPickContainer, false);

                mShapeCategoryWidgetActivePicks.Add(widget);

                //hide next if no categories picked
                if (mShapeCategoryWidgetActivePlaced.Count == 0)
                {
                    if (nextBase.gameObject.activeSelf && !nextBase.isExiting)
                    {
                        CancelRout();
                        mRout = StartCoroutine(DoNextHide());
                    }
                }
            }
        }

        ApplyDragInstruct();
    }
示例#2
0
            public void Enter()
            {
                slot.Begin();

                if (!transition.gameObject.activeSelf)
                {
                    transition.gameObject.SetActive(true);
                    transition.PlayEnter();
                }
            }
示例#3
0
        IEnumerator DoQuestionSequence(int startIndex, int count)
        {
            var lolMgr  = LoLManager.instance;
            var gameDat = GameData.instance;

            for (int i = startIndex; i < count; i++)
            {
                if (lolMgr.curProgress >= lolMgr.progressMax) //completed
                {
                    break;
                }

                mQuestion = gameDat.GetCurrentQuestion();
                if (mQuestion == null)
                {
                    break;
                }

                mSlotCount = mQuestion.answers.Length;

                if (gameDat.signalQuestion)
                {
                    gameDat.signalQuestion.Invoke();
                }

                //question dialog
                StartCoroutine(DoDialogEnter(questionDialog, questionDialogTransition, mQuestion.questionTextRef));

                //deck
                gameDat.GetCards(mQuestion, mAnswers);

                deckWidget.Setup(mAnswers, cardDragArea);

                deckTransition.gameObject.SetActive(true);
                deckTransition.PlayEnter();

                //show/reset slots
                for (int j = 0; j < mSlotCount; j++)
                {
                    slots[j].Enter();
                }

                //fail-safe: fewer slots than before
                for (int j = mSlotCount; j < slots.Length; j++)
                {
                    slots[j].Hide();
                }

                //wait for slots to be filled
                mCurScore   = 0;
                mErrorCount = 0;

                while (!IsSlotsFilled())
                {
                    yield return(null);
                }

                //update score and progress
                lolMgr.ApplyProgress(lolMgr.curProgress + 1, lolMgr.curScore + mCurScore);

                //hide deck and question
                deckTransition.PlayExit();
                questionDialogTransition.PlayExit();

                while (deckTransition.isPlaying || questionDialogTransition.isPlaying)
                {
                    yield return(null);
                }

                deckTransition.gameObject.SetActive(false);

                questionDialog.gameObject.SetActive(false);
                questionDialogEndGO.SetActive(false);
                questionDialogTransition.gameObject.SetActive(false);

                if (!string.IsNullOrEmpty(mQuestion.resultTextRef))
                {
                    if (gameDat.signalResult)
                    {
                        gameDat.signalResult.Invoke();
                    }

                    //result
                    yield return(DoDialogEnter(resultDialog, resultDialogTransition, mQuestion.resultTextRef));

                    //wait for result click
                    mIsResultDone = false;

                    resultInteractGO.SetActive(true);

                    while (!mIsResultDone)
                    {
                        yield return(null);
                    }

                    resultInteractGO.SetActive(false);

                    //hide result dialog
                    yield return(resultDialogTransition.PlayExitWait());

                    resultDialog.gameObject.SetActive(false);
                    resultDialogEndGO.SetActive(false);
                    resultDialogTransition.gameObject.SetActive(false);
                }
                else
                {
                    yield return(new WaitForSeconds(1.0f));
                }
            }

            //hide slots
            for (int i = 0; i < mSlotCount; i++)
            {
                slots[i].Exit();
            }

            while (IsSlotsTransitioning())
            {
                yield return(null);
            }

            for (int i = 0; i < mSlotCount; i++)
            {
                slots[i].Hide();
            }

            Close();
        }
示例#4
0
    protected override IEnumerator Start()
    {
        yield return(base.Start());

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

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

        yield return(seqIllustrateFormula.PlayExitWait());

        seqIllustrateFormula.gameObject.SetActive(false);

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

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

        yield return(seqIllustrateAxis.PlayExitWait());

        seqIllustrateAxis.gameObject.SetActive(false);

        ApplyCurrentWheelInfoDisplay();
        cannonAnimator.Play(cannonTakeEnter);
        while (cannonAnimator.isPlaying)
        {
            yield return(null);
        }

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

        cannonInterfaceGO.SetActive(true);

        yield return(new WaitForSeconds(0.34f));

        //enable cannon launch
        mIsKnightLocked = true;

        cannonLaunch.interactable = true;

        seqPressLaunch.gameObject.SetActive(true);
        seqPressLaunch.PlayEnter();

        //wait for launch
        mIsCannonballFree = true; //free shot
        mIsLaunchWait     = true;
        while (mIsLaunchWait)
        {
            yield return(null);
        }

        //wait for tracer to finish
        do
        {
            yield return(null);
        } while(graphControl.tracer.isRecording);


        //wheel time
        mCurWheelTracerMaxInd = graphControl.tracer.points.Count - 2;

        wheelTimeSlider.minValue = 0f;
        wheelTimeSlider.maxValue = mCurWheelTracerMaxInd;

        mCurWheelDialogInd = -1;
        ApplyWheelTime(0);

        wheelTimeGhost.SetActive(true);

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

        mIsWheelTimeWaitNext = true; //wait for slider to get to end where next is show, wait for it to be pressed.
        while (mIsWheelTimeWaitNext)
        {
            yield return(null);
        }

        wheelTimeGhost.SetActive(false);

        yield return(wheelTimeAnim.PlayExitWait());

        wheelTimeAnim.gameObject.SetActive(false);

        nextGO.SetActive(false);
        //


        //graph stuff
        graphButton.interactable = true;

        seqPressGraph.gameObject.SetActive(true);
        seqPressGraph.PlayEnter();

        mIsGraphWait = true;
        while (mIsGraphWait)
        {
            yield return(null);
        }

        //dialog about graph
        yield return(new WaitForSeconds(0.34f));

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

        //wait for graph to be closed
        while (graphControl.graphGO.activeSelf)
        {
            yield return(null);
        }
        //

        seqPressGraph.gameObject.SetActive(false);

        //show targets
        ShowTargets();

        yield return(new WaitForSeconds(1.5f));

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

        //ready to play normally
        mIsKnightLocked = false;

        ApplyCurrentWheelInfoDisplay();
        cannonAnimator.Play(cannonTakeEnter);
        while (cannonAnimator.isPlaying)
        {
            yield return(null);
        }

        cannonLaunch.interactable = true;
        forceSlider.interactable  = true;

        seqForceSlider.gameObject.SetActive(true);
        seqForceSlider.PlayEnter();
    }
示例#5
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        mShapeUseSolid       = false;
        mMeasureDisplayFlags = MeasureDisplayFlag.None;
        mShapeProfile        = null;

        mIsDragInstruct = false;

        bool showHierarchy = false;

        mShapeCategories.Clear();
        mShapeAttributes.Clear();

        //clear placements
        ClearCategoryPicks();
        ClearMeasureDisplays();
        ClearCategoryPlaced();

        ShapeCategoryData[] shapes = null;

        if (parms != null)
        {
            if (parms.ContainsKey(parmUseSolid))
            {
                mShapeUseSolid = parms.GetValue <bool>(parmUseSolid);
            }

            if (parms.ContainsKey(parmMeasureDisplayFlags))
            {
                mMeasureDisplayFlags = parms.GetValue <MeasureDisplayFlag>(parmMeasureDisplayFlags);
            }

            if (!mIsDragInstructApplied)  //only show drag instruction once
            {
                if (parms.ContainsKey(parmIsDragInstruct))
                {
                    mIsDragInstruct = parms.GetValue <bool>(parmIsDragInstruct);
                }
            }

            if (parms.ContainsKey(parmShapeProfile))
            {
                mShapeProfile = parms.GetValue <ShapeProfile>(parmShapeProfile);
            }

            if (parms.ContainsKey(parmShapes))
            {
                shapes = parms.GetValue <ShapeCategoryData[]>(parmShapes);
            }

            if (parms.ContainsKey(parmShowHierarchy))
            {
                showHierarchy = parms.GetValue <bool>(parmShowHierarchy);
            }
        }

        //determine which categories fit the shape profile
        if (mShapeProfile != null && shapes != null)
        {
            for (int i = 0; i < shapes.Length; i++)
            {
                if (shapes[i].Evaluate(mShapeProfile))
                {
                    mShapeCategories.Add(shapes[i]);
                }
            }
        }

        //generate categories
        if (shapes != null)
        {
            for (int i = 0; i < shapes.Length; i++)
            {
                var category = shapes[i];

                //add category to pick area
                if (mShapeCategoryWidgetCache.Count > 0)
                {
                    var widget = mShapeCategoryWidgetCache.RemoveLast();

                    widget.Setup(category);
                    widget.isDragEnabled = true;

                    widget.transform.SetParent(categoryPickContainer, false);

                    mShapeCategoryWidgetActivePicks.Add(widget);

                    //pick a target for drag instruct
                    if (mIsDragInstruct && !mDragInstructTarget)
                    {
                        if (mShapeCategories.Exists(category))
                        {
                            mDragInstructTarget = widget;
                        }
                    }
                }
            }
        }

        //fill up attributes
        for (int i = 0; i < mShapeCategories.Count; i++)
        {
            var category = mShapeCategories[i];

            for (int j = 0; j < category.attributes.Length; j++)
            {
                var attr = category.attributes[j];

                if (!mShapeAttributes.Exists(attr))
                {
                    mShapeAttributes.Add(attr);
                }
            }
        }

        //generate description
        mDescStrBuff.Clear();

        for (int i = 0; i < mShapeAttributes.Count; i++)
        {
            var attr = mShapeAttributes[i];

            mDescStrBuff.Append("· ");
            mDescStrBuff.Append(M8.Localize.Get(attr.textRef));

            if (i < mShapeAttributes.Count - 1)
            {
                mDescStrBuff.Append('\n');
            }
        }

        descText.text = mDescStrBuff.ToString();

        DefaultActiveDisplay();

        ApplyShape();

        categoryPickBase.gameObject.SetActive(true);
        categoryPickBase.PlayEnter();

        hierarchyGO.SetActive(showHierarchy);

        mCurMode = Mode.PickCategories;

        M8.SoundPlaylist.instance.Play(sfxEnter, false);
    }