Exemple #1
0
    //其余元素的初始化,有些初始化只应该在剧本树建立完成之后做
    //在这个方法里面初始化各种控制单元
    void makeValueStart()
    {
        theTextController   = this.GetComponent <textController> ();  //文本控制单元
        theChoiceController = this.GetComponent <choiceController>(); //分支选择控制单元
        theUIController     = this.GetComponent <UIController>();     //非文本显示的UI控制单元

        //theMusicController =  this.transform .GetComponentInChildren<MusicController> ();//音频比较特殊,需要父子关系,因为需要同时播放多个音效,音乐
        theMusicController       = this.GetComponent <AudioGetter>().GetMusicController();
        theSoundController       = this.transform.GetComponentsInChildren <soundController>()[0];   //两个sound,一个是真的音效,一个是语音音效
        thePeopleSoundController = this.transform.GetComponentsInChildren <soundController>()[1];   //两个sound,一个是真的音效,一个是语音音效
        theDataController        = this.GetComponent <saveLoadController>();
    }
Exemple #2
0
    public void updateChat(C_BasePacket chat)
    {
        if (chat.m_basicType != BasePacketType.basePacketTypeSocial)
        {
            return;
        }
        C_BaseSocialPacket data = (C_BaseSocialPacket)chat;

        if (((data.m_socialType == SocialPacketType.packetTypeSocialChatFriendResponse) ||
             (data.m_socialType == SocialPacketType.packetTypeSocialChatGuildResponse) ||
             (data.m_socialType == SocialPacketType.packetTypeSocialChatNormalResponse)) == false)
        {
            return;
        }


        RectTransform curParent   = null;
        string        curChatText = string.Empty;
        Color         color       = Color.white;
        ScrollRect    curRect     = null;

        switch (data.m_socialType)
        {
        case SocialPacketType.packetTypeSocialChatNormalResponse:
            C_SocialPacketChatNormalResponse curData = (C_SocialPacketChatNormalResponse)data;
            curParent   = m_chatBoxParentRectTransform_All;
            curChatText = curData.m_nickname + " : " + curData.m_message;
            curRect     = m_scrollRect_All;
            if (m_curChatType != CHAT_TYPE.ALL_CHAT)
            {
                m_NewIcon_AllTab.SetActive(true);
            }
            break;

        case SocialPacketType.packetTypeSocialChatFriendResponse:
            //C_SocialPacketChatRornalResponse curData = (C_SocialPacketChatRornalResponse)data;
            //curParent = m_chatBoxParentRectTransform_Whisper;
            //curChatText = chat.m_source + "->" + chat.m_target + " : " + chat.m_message;
            //curRect = m_scrollRect_Whisper;
            //color = Color.red;
            //// 채팅 탭이 현재 같은 타입 아니라면 new icon
            //if (m_curChatType != CHAT_TYPE.WHISPER_CHAT)
            //{
            //    // 유저가 쓴 귓속말이 아니면 new icon
            //    if (GameManager.m_Instance.getUserID().CompareTo(chat.m_source) != 0)
            //        m_NewIcon_WhisperTab.SetActive(true);
            //}
            break;

        case SocialPacketType.packetTypeSocialChatGuildResponse:
            //curParent = m_chatBoxParentRectTransform_Guild;
            //curChatText = chat.m_source + " : " + chat.m_message;
            //curRect = m_scrollRect_Guild;
            //if (m_curChatType != CHAT_TYPE.GUILD_CHAT)
            //    m_NewIcon_GuildTab.SetActive(true);
            break;
        }
        textController curTextController = Instantiate(m_TextPrefab, curParent).GetComponent <textController>();

        curTextController.setText(curChatText, color);
        m_TextList.Add(curTextController.gameObject);
        curParent.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 10 + m_TextList.Count * m_offset_Y);
        curRect.normalizedPosition = Vector2.zero;
    }