Exemplo n.º 1
0
    public void AddChatBar(string sceneName)
    {
        if (data[sceneName] == null)
        {
            print("data[" + sceneName + "]" + "is none");
            return;
        }
        if (sceneName == null || sceneName.Equals(""))
        {
            print(sceneName + "is none");
            return;
        }

        GameObject newChatBarObj = Instantiate(
            this.chatBarObj,
            this.transform.position,
            Quaternion.identity) as GameObject;

        //새로생성된 채팅바의 부모는 나 자신이다.
        newChatBarObj.transform.SetParent(this.transform);
        //스케일 초기화
        newChatBarObj.transform.localScale = new Vector3(1, 1, 1);


        Debug.Log("selected:" + sceneName);
        Debug.Log("data scene:" + data[sceneName]);

        UILabel text = newChatBarObj.GetComponentInChildren <UILabel>();

        text.text = data[sceneName]["Content"] /*+ data[currentPage]["Speaker"]*/;

        string choice = data[sceneName]["Choice"];

        if (choice == "")
        {
            sceneName = data[sceneName]["Event"];
            //StartCoroutine(waiting());
            Debug.Log("sceneName :  " + sceneName);
            ButtonInfo.currentScene = sceneName;
            //AddChatBar();
            //this.uiGrid.Reposition();
        }
        else
        {
            Debug.Log("choice != null");

            string[] events  = data[sceneName]["Event"].Split('/');
            string[] buttons = choice.Split('/');

            Debug.Log(buttons);

            panel.makeButton(buttons.Length, buttons, events);

            //panel.makeButtons();
            //ButtonPanel.makeButton(buttons.Length, buttons);
        }


        //ChatBar newBar = newChatBarObj.GetComponent<ChatBar>();

        //정렬
        this.uiGrid.Reposition();
    }