public GameObject ShowTipsEx(GameObject target, int type, string tipStr, int offsetX, int offsetY, int width, int height)
    {
        if (type < 1)
        {
            type = 1;
        }
        if (type > PrefabTips.Length)
        {
            type = PrefabTips.Length;
        }
        var         tip    = NGUITools.AddChild(TutorialPanel.gameObject, PrefabTips[type - 1]);
        TutorialTip script = tip.GetComponent <TutorialTip>();

        if (tip != null)
        {
            script.Label.text     = tipStr;
            script.Label.width    = width;
            script.Label.height   = height;
            script.TextBox.width  = width;
            script.TextBox.height = height;
            Vector3 pos = target.transform.position;
            pos.x += offsetX;
            pos.y += offsetY;
            tip.transform.localPosition = pos;
            _tips.Add(tip);
        }

        return(tip);
    }
Beispiel #2
0
    private void CloseTutorial(string id)
    {
        TutorialTip tip = CurrentTutorials[id];

        CurrentTutorials.Remove(id);
        tip.CloseTip();
    }
    // Start is called before the first frame update
    new void Start()
    {
        save_filepath = GameSettings.INSTANCE.tuto_campaign_savename;
        base.Start();

        //Assert.IsTrue(tip_add_cards_inactive_condition != null);
        Assert.IsTrue(deckManager != null);

        Assert.IsTrue(map != null);
        // if tip 4, search target for tip 5... (your army can be anywhere)
        List <Deck> player_armies = map.GetArmiesOfTeam(TeamType.Player);

        Assert.IsTrue(player_armies.Count > 0);
        player_deck = player_armies[0];
        // set army as target of tip 8
        TutorialTip tip_select_your_army = FindTipByName("Tip_select_your_army");

        Assert.IsTrue(tip_select_your_army != null);
        Assert.IsTrue(tip_select_your_army.highlighted_objects != null);
        Transform nodeTransform = player_deck.transform.parent;

        Assert.IsTrue(nodeTransform != null);
        tip_select_your_army.highlighted_objects[0] = nodeTransform;

        init_card_count      = player_deck.cards_to_play_count;
        init_card_pool_count = deckManager.card_pool_count;
        init_card_deck_count = deckManager.card_deck_count;

        string tip_name = tips[current_tip].gameObject.name;

        // check battle won after Tip_deck_editor_confirm (6)
        if (tip_name == "Tip_deck_editor_confirm" && GameSettings.INSTANCE.IsBattle())
        {
            NextTip();
        }
        else if (tip_name == "Tip_deck_editor_confirm")
        {
            if (GameSettings.INSTANCE.last_battle_won)
            {
                NextTip();
            }
        }
        if (current_tip == tips.Length - 1)
        {
            HideTip();
        }
        // check if campaign end
        lastNode     = map.GetDeadEndNode();
        lastNodeTeam = lastNode.team;
        if (lastNode != null && lastNodeTeam == TeamType.Player)
        {
            ShowTip(tips.Length - 1);
        }
    }
Beispiel #4
0
    protected void Start()
    {
        Assert.IsTrue(save_filepath.CompareTo("") != 0);    // path initialized

        // get tips
        tips = new TutorialTip[tips_holder.childCount];
        for (int i = 0; i < tips.Length; ++i)
        {
            Transform   t   = tips_holder.GetChild(i);
            TutorialTip tip = t.GetComponent <TutorialTip>();
            Assert.IsTrue(tip != null);
            tips[i] = tip;
            tip.gameObject.SetActive(false);
        }

        // set tip
        current_tip = PlayerPrefs.GetInt(save_filepath, -1);
        //current_tip = current_tip >= tips.Length ? -1 : current_tip;
        if (IsValidTip())
        {
            ShowTip(current_tip);
        }
        else if (current_tip < tips.Length)
        {
            NextTip();
        }

        // set original scales
        for (int i = 0; i < tips.Length; ++i)
        {
            tips[i].original_highlighted_scales = new List <Vector3>();
            Transform[] transforms = tips[i].highlighted_objects;
            if (transforms != null)
            {
                foreach (var t in transforms)
                {
                    if (t == null)
                    {
                        tips[i].original_highlighted_scales.Add(Vector3.one);
                        continue;
                    }
                    // hack fix when size 0
                    if (t.localScale.sqrMagnitude == 0)
                    {
                        t.localScale = Vector3.one;
                    }
                    Assert.IsTrue(t.localScale.sqrMagnitude != 0);
                    tips[i].original_highlighted_scales.Add(t.localScale);
                }
            }
        }
    }
Beispiel #5
0
    public TutorialTip FindTipByName(string name)
    {
        TutorialTip tip = null;

        foreach (TutorialTip t in tips)
        {
            if (t.name == name)
            {
                tip = t;
                break;
            }
        }

        return(tip);
    }
Beispiel #6
0
    private void ShowTutorial(TutorialData data)
    {
        GameManager.Instance.Settings.User.SetTutorialShowed(data.Id);
        //
        if (CanvasObject == null)
        {
            CanvasObject = GameObject.Find("UICanvas");
        }
        // create tip
        GameObject tipObj = GameObject.Instantiate(TutorialPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        tipObj.transform.SetParent(CanvasObject.transform, false);
        tipObj.transform.SetAsLastSibling();
        TutorialTip tip = tipObj.GetComponent <TutorialTip>();

        tip.InitTip(data);
        tip.ShowTip();

        CurrentTutorials.Add(data.Id, tip);
    }