示例#1
0
    public HintInfo Hint()
    {
        for (int i = 0; i < (int)Dir.Max; ++i)
        {
            Point nearPoint = Get_Point().Get_NearPoint((Dir)i);
            if (null == nearPoint)
            {
                continue;
            }

            // 이전 블럭 임시 저장
            Block      before     = nearPoint.Get_Block();
            Block_Type beforeType = before._type;

            before._type = _type;

            List <Block> explosive = Helper.Get_Explosive(before); // 타입이 바뀐 그 블럭은 터질 수 있나?

            before._type = beforeType;

            if (explosive.Count != 0 && !explosive.Contains(this)) // 힌트 성공!
            {
                HintInfo hint = new HintInfo();
                hint.explosive = explosive;
                hint.moveDir   = (Dir)i;
                hint.moveBlock = this;

                //explosive.Add(this);

                return(hint);
            }
        }

        return(null);
    }
示例#2
0
    HintInfo GetHint(BaseGem gem, BaseGem otherGem)
    {
        if (!(gem && otherGem))
        {
            return(null);
        }

        HintInfo hintInfo = null;

        HintInfo hintA = hints.Find(h => h.gem == gem);
        HintInfo hintB = hints.Find(h => h.gem == otherGem);

        BoardController.SwapGems(gem, otherGem);

        MatchInfo matchA = gem.GetMatch();
        MatchInfo matchB = otherGem.GetMatch();

        if (matchA.isValid)
        {
            hintInfo = hintA != null ? hintA : new HintInfo(gem);
            hintInfo.swaps.Add(otherGem);
        }
        else if (matchB.isValid)
        {
            hintInfo = hintB != null ? hintB : new HintInfo(otherGem);
            hintInfo.swaps.Add(gem);
        }

        BoardController.SwapGems(gem, otherGem);

        return(hintInfo);
    }
示例#3
0
    public static void ShowHint()
    {
        if (hasHints && !isShowing)
        {
            HintInfo hintInfo = instance.hints[
                Random.Range(0, instance.hints.Count)
                                ];
            hintInfo.gem.Hint();

            hintInfo.currentSwap = hintInfo.swaps[
                Random.Range(0, hintInfo.swaps.Count)
                                   ];
            hintInfo.currentSwap.Hint();
            instance.currentHint = hintInfo;
        }
    }
示例#4
0
    public static void FindHints()
    {
        instance.hints.Clear();

        for (int j = 0; j < BoardController.height; ++j)
        {
            for (int i = 0; i < BoardController.width; ++i)
            {
                BaseGem gem = BoardController.GetGem(i, j);

                // Swap Right
                BaseGem otherGem = BoardController.GetGem(i + 1, j);
                if (otherGem && otherGem.type != gem.type)
                {
                    HintInfo hintInfo = instance.GetHint(gem, otherGem);

                    if (hintInfo != null && !instance.hints.Contains(hintInfo))
                    {
                        instance.hints.Add(hintInfo);
                    }
                }

                // Swap Up
                otherGem = BoardController.GetGem(i, j + 1);
                if (otherGem && otherGem.type != gem.type)
                {
                    HintInfo hintInfo = instance.GetHint(gem, otherGem);

                    if (hintInfo != null && !instance.hints.Contains(hintInfo))
                    {
                        instance.hints.Add(hintInfo);
                    }
                }
            }
        }
    }
示例#5
0
    void SetHintVisibility(E_Hint hintId, bool state)
    {
        if (state == true)
        {
            if (GuiOptions.showHints == false)
            {
                return;
            }
            if (BuildInfo.Version.Stage == BuildInfo.Stage.Beta)
            {
                return;
            }
        }

        HintInfo info = GetHintInfo(hintId);

        if (info == null)
        {
            return;
        }
        if (info.HintButton == null)
        {
            return;
        }

        info.HintButton.Widget.Show(state, true);

        if (state == true)
        {
            if (m_HintSound != null)
            {
                MFGuiManager.Instance.PlayOneShot(m_HintSound);
            }

            m_CurrentHint = hintId;

            GUIBase_Widget widget = info.HintButton.Widget;
            Transform      trans  = widget.transform;
            Vector3        origin = widget.GetOrigPos();

            origin.y -= info.Offset.y;

            // animate transparency
            Tweener.TweenFromTo(widget,
                                "m_FadeAlpha",
                                0.0f,
                                1.0f,
                                0.2f,
                                Tween.Easing.Quad.EaseIn,
                                (tween, finished) =>
            {
                GUIBase_Widget[] children = widget.GetComponentsInChildren <GUIBase_Widget>();
                foreach (var child in children)
                {
                    child.FadeAlpha = widget.FadeAlpha;
                }
            });

            // animate position
            Tweener.TweenFromTo(this,
                                "m_HintTweenY",
                                origin.y + 25.0f,
                                origin.y,
                                0.15f,
                                Tween.Easing.Sine.EaseInOut,
                                (tween, finished) =>
            {
                trans.position = new Vector3(trans.position.x, m_HintTweenY, trans.position.z);

                if (finished == true)
                {
                    Tweener.TweenFromTo(this,
                                        "m_HintTweenY",
                                        origin.y + 5.0f,
                                        origin.y,
                                        0.15f,
                                        Tween.Easing.Sine.EaseInOut,
                                        (tween1, finished1) => { trans.position = new Vector3(trans.position.x, m_HintTweenY, trans.position.z); });
                }
            });
        }
        else if (m_CurrentHint == hintId)
        {
            m_PreviousHint = m_CurrentHint;
            m_CurrentHint  = E_Hint.Max;

            Tweener.StopTweens(true);
        }
    }