コード例 #1
0
 // Use this for initialization
 void Start()
 {
     if (transform.name.EndsWith("Default") || transform.name.StartsWith("Character"))
     {
         isCharacterButton = true;
     }
     if (manager == null)
     {
         if (isCharacterButton)
         {
             manager = transform.parent.parent.GetComponentInChildren <DialogueManagerScript> ();
         }
         else
         {
             manager = transform.GetComponentInParent <DialogueManagerScript> ();
         }
     }
     scrollRectTransform = manager.transform.parent.GetComponent <RectTransform>();
     scrollScrollRect    = scrollRectTransform.transform.GetComponent <DragOverrideScript> ();
     dialogue            = transform.GetComponentInParent <DialogueEntryScript> ();
     rt    = dialogue.transform.GetComponent <RectTransform>();
     dMPos = 0;
     //entries = new List<DialogueEntryScript> ();
     entries = manager.entries;
     UpdateEntryList();
     drag = false;
 }
コード例 #2
0
    private Transform container;                    //The entry we're moving.


    /**
     * Used for objects (mostly entries/panels used by HistoryFieldManagerScript) which need to move
     * This script should be placed on the object that will be clicked on
     */

    /**
     * Initialize most variables
     */
    void Awake()
    {
        hover  = false;
        cursor = GameObject.Find("CursorContainer").GetComponent <CECursor>();
        hm     = transform.GetComponentInParent <HistoryFieldManagerScript> ();
        if (hm.isStatic == true)
        {
            container = transform.parent.parent;
        }
        else if (hm.isQuizPanel && !transform.parent.name.StartsWith("QuizQuestionOption"))
        { //Awake is run before the name change to LabEntry takes effect
            container = transform.parent;
            while (!container.parent.Equals(hm.transform))
            {
                container = container.parent;
            }
        }
        else
        {
            container = transform.parent;
        }
        entries = new List <Transform> ();
        foreach (Transform entry in container.parent.GetComponentsInChildren <Transform>())
        {
            if (entry.parent == container.parent && entry.name != container.name)
            {
                entries.Add(entry);
            }
        }

        if (hm.isQuizPanel)
        {
            if (hm.GetComponentInParent <DialogueManagerScript>() || hm.GetComponentInParent <ReaderDialogueManagerScript>())
            {
                Transform temp = transform;
                while (temp != null && !temp.name.Equals("ScrollView"))
                {
                    temp = temp.parent;
                }
                if (temp == null)
                {
                    print("Could not find ScrollView in parents!");
                    return;
                }
                scrollRectTransform = temp.GetComponent <RectTransform>();
            }
            else
            {
                scrollRectTransform = hm.parentTab.transform.Find("QuizEditorPanel/Content/ScrollView").GetComponent <RectTransform>();
            }
        }
        else
        {
            scrollRectTransform = hm.parentTab.transform.Find("Scroll View").GetComponent <RectTransform> ();
        }
        scrollScrollRect = scrollRectTransform.transform.GetComponent <DragOverrideScript> ();
        rt    = container.GetComponent <RectTransform>();
        dMPos = 0;
    }
コード例 #3
0
    /**
     * Used for objects (mostly entries/panels used by HistoryFieldManagerScript) which need to move
     * This script should be placed on the object that will be clicked on
     */

    /**
     * Initialize most variables
     */
    void Awake()
    {
        hover  = false;
        cursor = GameObject.Find("CursorContainer")?.transform.Find("Cursor").GetComponent <Image>();
        hm     = transform.GetComponentInParent <ReaderEntryManagerScript>();
        if (hm.isStatic == true)
        {
            container = transform.parent.parent;
        }
        else if (hm.isQuizPanel && !transform.parent.name.StartsWith("QuizQuestionOption"))     //Awake is run before the name change to LabEntry takes effect
        {
            container = transform.parent;
        }
        else if (transform.name.StartsWith("DiagnosisEntry"))
        {
            container = transform;
        }
        else
        {
            container = transform.parent;
        }
        entries = new List <Transform>();
        foreach (Transform entry in container.parent.GetComponentsInChildren <Transform>())
        {
            if (entry.parent == container.parent && entry.name != container.name)
            {
                entries.Add(entry);
            }
        }

        if (hm.isQuizPanel)
        {
            scrollRectTransform = hm.parentTab.transform.Find("QuizEditorPanel/Content/ScrollView").GetComponent <RectTransform>();
        } /*else if(hm.isNested){
           *            scrollRectTransform = hm.
           *    } */
        else
        {
            scrollRectTransform = hm.parentTab.transform.Find("Scroll View").GetComponent <RectTransform>();
        }
        scrollScrollRect = scrollRectTransform.transform.GetComponent <DragOverrideScript>();
        rt    = container.GetComponent <RectTransform>();
        dMPos = 0;

        correctPosition = container.GetSiblingIndex();
    }
コード例 #4
0
    protected override void Awake()
    {
        base.Awake();

        selectable            = GetComponent <Selectable>();
        selectable.navigation = new Navigation();

        if (topRect == null)
        {
            topRect = GetComponent <RectTransform>();
        }
        if (botRect == null)
        {
            botRect = GetComponent <RectTransform>();
        }

        scrollbar = GetComponentInParent <DragOverrideScript>();
    }