예제 #1
0
    IEnumerator TutorialWait(float waitTime, TutorialProcess process)
    {
        Debug.Log("Wait");
        yield return(new WaitForSeconds(waitTime));

        StepEnd(process);
    }
예제 #2
0
 private void SetWaitProcess(TutorialProcess process, TutorialProcess nProcess)
 {
     Debug.Log("Set Wait");
     SetMaskAndBtnHiglight(process, nProcess);
     //SetMaskAndBtnHiglight (btn, nBtn, gos, ngos);
     Debug.Log((nProcess.focusGameObject == null).ToString() + " , " + (nProcess.gameObjectAry.Length == 0).ToString());
     if (nProcess.focusGameObject == null && nProcess.gameObjectAry.Length == 0)
     {
         mask.color = (Color)Vector4.zero;
     }
     Wait(nProcess);
 }
예제 #3
0
    private void SetLastProcess(TutorialProcess process, GameObject[] listArray = null)
    {
        GameObject focus = process.focusGameObject;

        GameObject[] array = process.gameObjectAry;
        if (listArray != null)
        {
            focus = listArray [listArray.Length - 1];
            array = listArray;
        }

        if (process._tutorialType != TutorialType.Talk)
        {
            if (listArray != null)
            {
                if (array.Length > 0)
                {
                    for (int i = orgParant.Length - 1; i >= 0; i--)
                    {
                        array [i].GetComponent <RectTransform> ().SetParent(orgParant [i].transform);
                        array [i].transform.SetSiblingIndex(orgSibling [i]);
                    }
                    recListArray = null;
                }
            }
            else
            {
                if (array == null)
                {
                    return;
                }
                else
                {
                    if (array.Length > 0)
                    {
                        for (int i = array.Length - 1; i >= 0; i--)
                        {
                            array [i].GetComponent <RectTransform> ().SetParent(orgParant [i]);
                            array [i].transform.SetSiblingIndex(orgSibling [i]);
                        }
                    }
                }
            }
        }

        if (focus)
        {
            Destroy(focus.GetComponent <GraphicRaycaster> ());
            Destroy(focus.GetComponent <Canvas> ());
        }
    }
예제 #4
0
    private void Wait(TutorialProcess process)
    {
        float waitTime;

        if (float.TryParse(process.data [0], out waitTime))
        {
            StartCoroutine(TutorialWait(waitTime, process));
        }
        else
        {
            SetTutorialProcess(tutorialSteps.First.Value);
            return;
        }
    }
예제 #5
0
 private void StepEnd(TutorialProcess process)
 {
     mask.color = (Color)maskAlpha;
     SetMaskAndBtnHiglight(process, new TutorialProcess(), recListArray);
     if (tutorialSteps.Count > 0)
     {
         if (process._tutorialType == TutorialType.ButtonForWnd)
         {
             SetTutorialProcess(null);
         }
         else
         {
             SetTutorialProcess(tutorialSteps.First.Value);
         }
         return;
     }
     TutorialEnd(process.saveKey);
 }
예제 #6
0
    private void SetTutorialProcess(TutorialProcess process, TutorialProcess nProcess)
    {
        switch (process._tutorialType)
        {
        case TutorialType.Button:
        case TutorialType.ButtonForWnd:
            SetButtonProcess(process, nProcess);
            break;

        case TutorialType.Talk:
            SetTalkProcess(process, nProcess);
            break;

        case TutorialType.List:
            SetListProcess(process, nProcess);
            break;
        }
    }
예제 #7
0
    public GameObject[] GetListArray(TutorialProcess process)
    {
        if (process._tutorialType == TutorialType.List)
        {
            GameObject[] listArray = process.gameObjectAry;
            Array.Resize(ref listArray, process.gameObjectAry.Length + 1);

            GameObject focus;
            if (process.focusGameObject.GetComponent <WndEditor.ItemListContainer> ())
            {
                int childIdx;
                if (Int32.TryParse(process.data [0], out childIdx))
                {
                    if (process.focusGameObject.transform.childCount > childIdx)
                    {
                        focus = process.focusGameObject.transform.GetChild(childIdx).gameObject;
                    }
                    else
                    {
                        Debug.Log("Have Not Child");
                        return(null);
                    }
                }
                else
                {
                    Debug.Log("Have Not Child");
                    return(null);
                }
            }
            else
            {
                Debug.Log("Set Error");
                return(null);
            }
            listArray [listArray.Length - 1] = focus;
            Array.Reverse(listArray);

            return(listArray);
        }
        else
        {
            return(null);
        }
    }
예제 #8
0
    private void NextProcess(TutorialProcess process, TutorialProcess nProcess, GameObject[] listArray = null)
    {
        GameObject btn = process.focusGameObject;

        GameObject[] gos = process.gameObjectAry;
        GameObject   nBtn;

        GameObject[] ngos;

        btn.gameObject.SetActive(true);

        nBtn = nProcess.focusGameObject;
        ngos = nProcess.gameObjectAry;
        if (nProcess._tutorialType != TutorialType.Wait)
        {
            nBtn.gameObject.SetActive(true);
        }

        if (process._tutorialType == TutorialType.Talk && nProcess._tutorialType != TutorialType.Talk)
        {
            Time.timeScale = 1;
        }

        if (nProcess._tutorialType == TutorialType.Talk)
        {
            SetMaskAndBtnHiglight(process, nProcess);
            TalkManager.Instance.TalkStart();
        }
        else if (nProcess._tutorialType == TutorialType.Wait)
        {
            SetWaitProcess(process, nProcess);
        }
        else if (nProcess._tutorialType == TutorialType.List)
        {
            SetMaskAndBtnHiglight(process, nProcess, recListArray, GetListArray(nProcess));
        }
        else
        {
            SetMaskAndBtnHiglight(process, nProcess);
        }
    }
예제 #9
0
    private void SetTalkProcess(TutorialProcess process, TutorialProcess nProcess)
    {
        GameObject btn = process.focusGameObject;

        TalkManager.Instance.SetTalkData(process.data);

        TutorialTriggerListener.GetListener(btn.gameObject).onClick += go => {
            if (TalkManager.Instance.isTalking == false)
            {
                if (nProcess._tutorialType == TutorialType.End)
                {
                    StepEnd(process);
                }
                else
                {
                    NextProcess(process, nProcess);
                }
            }
        };
        TalkManager.Instance.SetTalkData(process.data);
    }
예제 #10
0
    private void SetNextProcess(TutorialProcess process, GameObject[] listArray = null)
    {
        GameObject focus = process.focusGameObject;

        GameObject[] array = process.gameObjectAry;
        if (listArray != null)
        {
            focus = listArray [listArray.Length - 1];
            array = listArray;
        }

        if (focus)
        {
            Canvas nextCanvas = focus.GetComponent <Canvas> ();
            if (nextCanvas)
            {
                nextCanvas.overrideSorting = true;
            }
            else
            {
                focus.AddComponent <Canvas> ().overrideSorting = true;
            }

            focus.GetComponent <Canvas> ().sortingOrder = 1;
            focusGameObject = null;

            if (process._tutorialType == TutorialType.Button && process.listnerType == EventListnerType.onClick)
            {
                focusGameObject = focus;
            }

            focus.AddComponent <GraphicRaycaster> ();
        }

        if (process._tutorialType != TutorialType.Talk)
        {
            if (listArray != null)
            {
                if (array.Length > 0)
                {
                    orgParant  = new Transform[array.Length - 1];
                    orgSibling = new int[array.Length - 1];

                    for (int i = 0; i < array.Length - 1; i++)
                    {
                        orgParant [i]  = array [i].transform.parent;
                        orgSibling [i] = array [i].transform.GetSiblingIndex();
                        array [i].GetComponent <RectTransform> ().SetParent(focus.transform);
                    }
                    recListArray = array;
                }
            }
            else
            {
                if (array == null)
                {
                    return;
                }
                else
                {
                    if (array.Length > 0)
                    {
                        orgParant  = new Transform[array.Length];
                        orgSibling = new int[array.Length];

                        for (int i = 0; i < array.Length; i++)
                        {
                            orgParant [i]  = array [i].transform.parent;
                            orgSibling [i] = array [i].transform.GetSiblingIndex();
                            array [i].GetComponent <RectTransform> ().SetParent(focus.transform);
                        }
                    }
                }
            }
        }
    }
예제 #11
0
 private void SetMaskAndBtnHiglight(TutorialProcess lastProcess, TutorialProcess nextProcess, GameObject[] lastListArray = null, GameObject[] nextListArray = null)
 {
     SetLastProcess(lastProcess, lastListArray);
     SetNextProcess(nextProcess, nextListArray);
 }
예제 #12
0
    private void SetListProcess(TutorialProcess process, TutorialProcess nProcess)
    {
        GameObject focus;

        if (process.focusGameObject.GetComponent <WndEditor.ItemListContainer> ())
        {
            int childIdx;
            if (Int32.TryParse(process.data [0], out childIdx))
            {
                if (process.focusGameObject.transform.childCount > childIdx)
                {
                    focus = process.focusGameObject.transform.GetChild(childIdx).gameObject;
                }
                else
                {
                    Debug.Log("Have Not Child");
                    return;
                }
            }
            else
            {
                Debug.Log("Have Not Child");
                return;
            }
        }
        else
        {
            Debug.Log("Set Error");
            return;
        }

        if (process.listnerType == EventListnerType.onClick)
        {
            TutorialTriggerListener.GetListener(focus).onClick += go => {
                if (TalkManager.Instance.isTalking == false)
                {
                    if (nProcess._tutorialType == TutorialType.End)
                    {
                        StepEnd(process);
                    }
                    else
                    {
                        NextProcess(process, nProcess, recListArray);
                    }
                }
            };
        }
        else
        {
            if (process.gameObjectAry.Length > 1)
            {
                GameObject from = process.gameObjectAry [0];
                GameObject to   = process.gameObjectAry [1];

                TutorialTriggerListener.GetListener(focus).onBeginDrag += go => {
                    CanvasManager.Instance.SetRaycastCanvas(process.gameObjectAry[0].GetComponent <Canvas> ());
                    foreach (RaycastResult result in CanvasManager.Instance.GetRaycastResult())
                    {
                    }
                };
                TutorialTriggerListener.GetListener(focus).onEndDrag += go => {
                    var results = CanvasManager.Instance.GetRaycastResult();

                    if (results.Count > 0)
                    {
                        foreach (RaycastResult result in results)
                        {
                            if (result.gameObject == to)
                            {
                                if (nProcess._tutorialType == TutorialType.End)
                                {
                                    StepEnd(process);
                                    return;
                                }
                                else
                                {
                                    NextProcess(process, nProcess, recListArray);
                                    return;
                                }
                            }
                        }
                        string[] startTwo = new string[process.data.Length - 1];
                        Array.Copy(process.data, 1, startTwo, 0, startTwo.Length);
                        SetControlError(process.gameObjectAry[0], startTwo);
                    }
                    else
                    {
                        string[] startTwo = new string[process.data.Length - 1];
                        Array.Copy(process.data, 1, startTwo, 0, startTwo.Length);
                        SetControlError(process.gameObjectAry[0], startTwo);
                        Debug.Log("End False");
                    }
                };
            }
            else
            {
                if (process.gameObjectAry.Length == 0)
                {
                    Debug.Log("Have Not Drag Begin And End");
                }
                else
                {
                    Debug.Log("Have Not Drag End");
                }
            }
        }
    }
예제 #13
0
    private void SetButtonProcess(TutorialProcess process, TutorialProcess nProcess)
    {
        if (process.listnerType == EventListnerType.onClick)
        {
            TutorialTriggerListener.GetListener(process.focusGameObject).onClick += go => {
                if (process.focusGameObject == focusGameObject)
                {
                    if (nProcess._tutorialType == TutorialType.End)
                    {
                        StepEnd(process);
                    }
                    else
                    {
                        NextProcess(process, nProcess);
                    }
                }
            };
        }
        else
        {
            if (process.gameObjectAry.Length > 1)
            {
                GameObject from = process.gameObjectAry [0];
                GameObject to   = process.gameObjectAry [process.gameObjectAry.Length - 1];



                TutorialTriggerListener.GetListener(from).onBeginDrag += go => {
                    CanvasManager.Instance.SetRaycastCanvas(process.focusGameObject.GetComponent <Canvas> ());
                    foreach (RaycastResult result in CanvasManager.Instance.GetRaycastResult())
                    {
                        Debug.Log(result.gameObject.name);
                    }
                };
                TutorialTriggerListener.GetListener(from).onEndDrag += go => {
                    var results = CanvasManager.Instance.GetRaycastResult();

                    if (results.Count > 0)
                    {
                        foreach (RaycastResult result in results)
                        {
                            if (result.gameObject == to)
                            {
                                if (nProcess._tutorialType == TutorialType.End)
                                {
                                    StepEnd(process);
                                    return;
                                }
                                else
                                {
                                    NextProcess(process, nProcess);
                                    return;
                                }
                            }
                        }
                        SetControlError(process.focusGameObject, process.data);
                    }
                    else
                    {
                        SetControlError(process.focusGameObject, process.data);
                    }
                };
            }
            else
            {
                if (process.gameObjectAry.Length == 0)
                {
                    Debug.Log("Have Not Drag Begin And End");
                }
                else
                {
                    Debug.Log("Have Not Drag End");
                }
            }
        }
    }