Esempio n. 1
0
    public IEnumerator TutorialFullScreenTextPanelAlpha(TutorialOption _option)
    {
        m_fTutorialFullScrreneAlpha = DeActiveObj_Image.color.a;
        while (true)
        {
            //fade in
            if (_option == TutorialOption.E_TUTORIAL_OPTION_FADEIN)
            {
                //Debug.Log ("Fade In!!");
                m_fTutorialFullScrreneAlpha += Time.deltaTime * m_fAlphaValue;
                originColor             = new Color(DeActiveObj_Image.color.r, DeActiveObj_Image.color.g, DeActiveObj_Image.color.b, m_fTutorialFullScrreneAlpha);
                DeActiveObj_Image.color = originColor;


                if (m_fTutorialFullScrreneAlpha >= 1f && eTutorialState == TutorialOrder.E_TUTORIAL_START_FULLSCREENTALK02)
                {
                    //Text go
                    StartFullScreenText();
                    yield break;
                }


                if (m_fTutorialFullScrreneAlpha >= 1f && eTutorialState == TutorialOrder.E_TUTORIAL_START_DAYS)
                {
                    SpawnManager.Instance.tutorialPanel.StartContent();
                    yield break;
                }
            }
            //fade out
            else
            {
                //Debug.Log ("Fade Out!!");
                m_fTutorialFullScrreneAlpha -= Time.deltaTime * m_fAlphaValue;
                originColor             = new Color(DeActiveObj_Image.color.r, DeActiveObj_Image.color.g, DeActiveObj_Image.color.b, m_fTutorialFullScrreneAlpha);
                DeActiveObj_Image.color = originColor;
                if (m_fTutorialFullScrreneAlpha <= 0f && eTutorialState == TutorialOrder.E_TUTORIAL_START_FULLSCREENTALK01)
                {
                    eTutorialState = TutorialOrder.E_TUTORIAL_START_PLAYERTALKBOX01;
                    playerTalk.TalkBoxOnOff(true);
                    playerTalk.StartPlayerTalk(0);
                    DeActiveObj.SetActive(false);
                    yield break;
                }



                //보스등장
                if (m_fTutorialFullScrreneAlpha <= 0f && eTutorialState == TutorialOrder.E_TUTORIAL_START_DRAGONSHOW)
                {
                    playerTalk.TalkBoxOnOff(false);
                    DeActiveObj.SetActive(false);


                    eTutorialState = TutorialOrder.E_TUTORIAL_START_DRAGONTALKBOX01;
                    yield break;
                }

                if (m_fTutorialFullScrreneAlpha <= 0f && eTutorialState == TutorialOrder.E_TUTORIAL_START_IMAGE03)
                {
                    DeActiveObj.SetActive(false);

                    SpawnManager.Instance.tutorialPanel.tutorialImage_Obj.SetActive(true);
                    SpawnManager.Instance.tutorialPanel.tutorial_Image.gameObject.SetActive(true);
                    SpawnManager.Instance.tutorialPanel.tutorial_Image.enabled = true;
                    ShowTutorialImage(2);
                    yield break;
                }
            }
            yield return(null);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Populates and returns a data package suitable for TopicUI. Returns null if a problem.
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    private TopicUIData GetTopicData(TutorialItem item)
    {
        if (item != null)
        {
            int index, limit, count;

            //data package
            TopicUIData data = new TopicUIData();
            data.topicName            = item.tag;
            data.header               = item.query.queryHeader;
            data.text                 = item.query.queryText;
            data.isBoss               = false;
            data.nodeID               = -1;
            data.uiType               = TopicDecisionType.Tutorial;
            data.spriteMain           = GameManager.i.tutorialScript.tutorial.sprite;
            data.ignoreTooltipHeader  = string.Format("<size=120%>{0}</size>", GameManager.Formatt("Disappointed", ColourType.badText));
            data.ignoreTooltipMain    = "Yes, I am. Being able to make a decision is important, what's wrong with you?";
            data.ignoreTooltipDetails = string.Format("<size=115%>{0}</size>", GameManager.Formatt("I'll have to make it for you", ColourType.neutralText));
            if (item.query.queryType != null)
            {
                //query item type
                GameManager.i.tutorialScript.queryType = item.query.queryType;
                //Topic options
                TopicOption[] arrayOfTopicOptions = GameManager.i.tutorialScript.tutorial.arrayOfOptions;
                if (arrayOfTopicOptions != null)
                {
                    //ignore option
                    TopicOption ignoreOption = GameManager.i.tutorialScript.tutorial.ignoreOption;
                    if (ignoreOption != null)
                    {
                        //check there are four options and none are null
                        if (arrayOfTopicOptions.Length == maxOptions)
                        {
                            bool isProceed = true;
                            for (int i = 0; i < arrayOfTopicOptions.Length; i++)
                            {
                                if (arrayOfTopicOptions[i] == null)
                                {
                                    Debug.LogErrorFormat("Invalid topicOption (Null) for tutorial \"{0}\" arrayOfTopicOptions[{1}]", GameManager.i.tutorialScript.tutorial.name, i);
                                    isProceed = false;
                                }
                            }
                            if (isProceed == true)
                            {
                                //Tutorial options
                                List <TutorialOption> listOfTutorialOptions       = new List <TutorialOption>();
                                List <TutorialOption> listOfTutorialIgnoreOptions = new List <TutorialOption>();
                                //special cases where an Alt set of options may be needed
                                switch (item.query.queryType.name)
                                {
                                case "Name":
                                    switch (GameManager.i.playerScript.sex)
                                    {
                                    case ActorSex.Male:
                                        listOfTutorialOptions       = item.query.listOfOptions;
                                        listOfTutorialIgnoreOptions = item.query.listOfIgnoreOptions;
                                        break;

                                    case ActorSex.Female:
                                        listOfTutorialOptions       = item.query.listOfOptionsAlt;
                                        listOfTutorialIgnoreOptions = item.query.listOfIgnoreOptionsAlt;
                                        break;

                                    default: Debug.LogWarningFormat("Unrecognised ActorSex \"{0}\"", GameManager.i.playerScript.sex); break;
                                    }
                                    break;

                                default:
                                    listOfTutorialOptions       = item.query.listOfOptions;
                                    listOfTutorialIgnoreOptions = item.query.listOfIgnoreOptions;
                                    break;
                                }
                                count = listOfTutorialOptions.Count;
                                //create temp list by Value (will be deleting
                                List <TutorialOption> listOfTempOptions = new List <TutorialOption>(listOfTutorialOptions)
                                {
                                };
                                // - - - RANDOM
                                if (item.query.isRandomOptions == true)
                                {
                                    limit = Mathf.Min(maxOptions, count);
                                    //select up to four tutorial options randomly
                                    for (int i = 0; i < limit; i++)
                                    {
                                        index = Random.Range(0, listOfTempOptions.Count);
                                        TutorialOption optionTutorial = listOfTempOptions[index];
                                        if (optionTutorial != null)
                                        {
                                            //Get Topic options
                                            TopicOption optionTopic = arrayOfTopicOptions[i];
                                            optionTopic.tag           = optionTutorial.tag;
                                            optionTopic.textToDisplay = GameManager.i.topicScript.GetOptionString(optionTutorial.text);
                                            data.listOfOptions.Add(optionTopic);
                                            listOfTempOptions.RemoveAt(index);
                                        }
                                        else
                                        {
                                            Debug.LogWarningFormat("Invalid tutorialOption (Null) for isRandom listOfTempOptions[{0}]", index);
                                        }
                                    }
                                }
                                else
                                {
                                    // - - - NOT random, take first four options
                                    limit = Mathf.Min(maxOptions, count);
                                    for (int i = 0; i < limit; i++)
                                    {
                                        TutorialOption optionTutorial = listOfTempOptions[i];
                                        if (optionTutorial != null)
                                        {
                                            TopicOption optionTopic = arrayOfTopicOptions[i];
                                            optionTopic.tag           = optionTutorial.tag;
                                            optionTopic.textToDisplay = GameManager.i.topicScript.GetOptionString(optionTutorial.text);
                                            data.listOfOptions.Add(optionTopic);
                                        }
                                        else
                                        {
                                            Debug.LogWarningFormat("Invalid topicOption (Null) for normal listOfTempOptions[{0}]", i);
                                        }
                                    }
                                }
                                //IGNORE option
                                if (listOfTutorialIgnoreOptions != null)
                                {
                                    //needs to be one option (can be more but they are ignored)
                                    if (listOfTutorialIgnoreOptions.Count >= 1)
                                    {
                                        TutorialOption optionTutorial = listOfTutorialIgnoreOptions[0];
                                        if (optionTutorial != null)
                                        {
                                            data.listOfIgnoreEffects.Add(ignoreOption.listOfGoodEffects[0]);
                                            //ignore option data
                                            GameManager.i.tutorialScript.optionIgnoreTag = optionTutorial.tag;
                                        }
                                        else
                                        {
                                            Debug.LogWarning("Invalid topicOption (Null) for IGNORE listOfTempOptions[0]");
                                        }
                                    }
                                    else
                                    {
                                        Debug.LogWarningFormat("Invalid listOfIgnoreOptions (Empty) for topicItem \"{0}\"", item.name);
                                    }
                                }
                                else
                                {
                                    Debug.LogWarningFormat("Invalid listOfIgnoreOptions (Null) for topicItem \"{0}\"", item.name);
                                }
                                //option tooltips and optionNumber (ignore option done above)
                                for (index = 0; index < data.listOfOptions.Count; index++)
                                {
                                    TopicOption option = data.listOfOptions[index];
                                    if (option != null)
                                    {
                                        option.tooltipHeader = string.Format("<size=120%>{0}</size>", GameManager.Formatt(option.tag, ColourType.neutralText));
                                        option.tooltipMain   = GameManager.i.tutorialScript.GetTutorialTooltip(item.query.queryType);
                                        //reassign option number to be the position in the listOfOptions
                                        option.optionNumber = index;
                                        //set all options as Valid
                                        option.isValid = true;
                                        //copy data across to TutorialManager.cs fields
                                        switch (index)
                                        {
                                        case 0: GameManager.i.tutorialScript.option0Tag = option.tag; break;

                                        case 1: GameManager.i.tutorialScript.option1Tag = option.tag; break;

                                        case 2: GameManager.i.tutorialScript.option2Tag = option.tag; break;

                                        case 3: GameManager.i.tutorialScript.option3Tag = option.tag; break;

                                        default: Debug.LogWarningFormat("Invalid index \"{0}\"", index); break;
                                        }
                                    }
                                    else
                                    {
                                        Debug.LogWarningFormat("Invalid topicOption (Null) for data.listOfOptions[{0}]", index);
                                    }
                                }
                            }
                            return(data);
                        }
                        else
                        {
                            Debug.LogErrorFormat("Invalid arrayOfTopicOptions (records, has {0}, needs {1}) for tutorial \"{2}\"", arrayOfTopicOptions.Length, maxOptions, GameManager.i.tutorialScript.tutorial.name);
                        }
                    }
                    else
                    {
                        Debug.LogErrorFormat("Invalid ignoreOption (Null) for tutorial \"{0}\"", GameManager.i.tutorialScript.tutorial.name);
                    }
                }
                else
                {
                    Debug.LogError("Invalid tutorial.arrayOfOptions (Null)");
                }
            }
            else
            {
                Debug.LogWarning("Invalid (Tutorial) item (Null)");
            }
        }
        else
        {
            Debug.LogErrorFormat("Invalid queryType (Null) for TutorialItem \"{0}\"", item.name);
        }
        //fault condition
        return(null);
    }
Esempio n. 3
0
    //true 0 -> 1 fade in
    //false

    public void StartTutorialFullScreenTextPanelAlpha(TutorialOption _option)
    {
        StartCoroutine(TutorialFullScreenTextPanelAlpha(_option));
    }