示例#1
0
    void Start()
    {
        instance = this;

        contentRect = GetComponent <RectTransform>();

        panelArray    = new GameObject[panelCount];
        panelPosition = new Vector2[panelCount];

        panelScale = new Vector2[panelCount];

        int       i         = 0;
        Transform lastChild = null;

        foreach (Transform child in transform)
        {
            if (i == 0)
            {
                lastChild     = child;
                panelArray[i] = child.gameObject;
                i++;
                continue;
            }

            child.transform.localPosition = new Vector2(lastChild.transform.localPosition.x + child.GetComponent <RectTransform>().sizeDelta.x + (panelOffset), child.transform.localPosition.y);

            Debug.Log("LOOK AT ME AAAAAHHHHH: " + child.GetComponent <RectTransform>().sizeDelta.y);

            panelArray[i]    = child.gameObject;
            panelPosition[i] = -panelArray[i].transform.localPosition;

            i++;
            lastChild = child;
        }
    }
示例#2
0
    private void Start()
    {
        ChangeThemeSound = communicationThemeSound.GetComponent <ThemeSound>();


        // mus = bool.Parse(PlayerPrefs.GetString("Music"));
        snap = communication.GetComponent <SnapScrolling>();
    }
 public override void OnInspectorGUI()
 {
     DrawDefaultInspector();
     if (GUILayout.Button("UpdateScroll"))
     {
         SnapScrolling t = (SnapScrolling)target;
         t.UpdateScroll();
     }
 }
示例#4
0
    void Start()
    {
        jsonP     = Camera.main.GetComponent <JsonParsing>();
        path      = Path.Combine(Application.streamingAssetsPath, folder);
        snap      = GetComponentInParent <SnapScrolling>();
        answerInt = question.answer;
        answer[0].SetActive(false);
        answer[1].SetActive(false);
        answer[2].SetActive(false);
        answer[3].SetActive(false);
        offsetText       *= snap.kh;
        offsetBetweenText = snap.kh;
        if (question.url != "001")
        {
            StartCoroutine(LoadSprite(question.url));
            Question.GetComponent <RectTransform>().offsetMin = new Vector2(0, (3 - question.text.Length / numToTransfer) * offsetText);
        }
        else
        {
            Destroy(QuestionImage.gameObject);
            Question.GetComponent <RectTransform>().offsetMax = new Vector2(0, 180 * snap.kh);
            Question.GetComponent <RectTransform>().offsetMin = new Vector2(0, (3 - question.text.Length / numToTransfer) * offsetText + (180 * snap.kh));
        }
        Question.text     = question.text;
        Question.fontSize = Mathf.RoundToInt((float)Question.fontSize * snap.kw);

        for (int i = 0; i < question.opt.Length; i++)
        {
            answer[i].SetActive(true);
            if (i == 0)
            {
                answer[i].GetComponent <RectTransform>().offsetMax = new Vector2(0, Question.GetComponent <RectTransform>().offsetMin.y);
                answer[i].GetComponent <RectTransform>().offsetMin = new Vector2(0, (3 - question.opt[i].Length / numToTransfer) * offsetText + Question.GetComponent <RectTransform>().offsetMin.y);
            }
            if (i != 0)
            {
                answer[i].GetComponent <RectTransform>().offsetMax = new Vector2(0, (answer[i - 1].GetComponent <RectTransform>().offsetMin.y) - offsetBetweenText);
                answer[i].GetComponent <RectTransform>().offsetMin = new Vector2(0, (3 - question.opt[i].Length / numToTransfer) * offsetText + (answer[i - 1].GetComponent <RectTransform>().offsetMin.y) - offsetBetweenText);
            }
            answer[i].GetComponentInChildren <Text>().text     = question.opt[i];
            answer[i].GetComponentInChildren <Text>().fontSize = Mathf.RoundToInt((float)answer[i].GetComponentInChildren <Text>().fontSize *snap.kw);
            int t = i + 1;
            answer[i].GetComponent <Button>().onClick.AddListener(() => OnClick(t));
        }
    }
示例#5
0
 private void Awake()
 {
     _snapScrolling = FindObjectOfType <SnapScrolling>();
     _targetAnim    = ToolboxManager.instance.targetAnim;
     _targetAnim.GetComponent <ThirdPersonCharacter>().onMovementStarted += StopAllAnimationItems;
 }
示例#6
0
 void Start()
 {
     win = GetComponent <SnapScrolling>();
 }