Ejemplo n.º 1
0
    public void UpdateUI()
    {
        if (this.index >= this.contentId.get_Count())
        {
            this.OnClose();
            this.mNpcId = 0;
            this.index  = 0;
            if (this.TalkEndCallBack != null)
            {
                this.TalkEndCallBack.Invoke();
            }
            return;
        }
        int talkContentId;
        int body;

        if (this.mNpcId > 0)
        {
            talkContentId     = this.contentId.get_Item(this.index);
            body              = this.mNpcId;
            this.mCurrentType = TalkUI.TalkDirType.Right;
        }
        else
        {
            DuiHuaPeiZhi duiHuaPeiZhi = DataReader <DuiHuaPeiZhi> .Get(this.contentId.get_Item(this.index));

            if (duiHuaPeiZhi == null)
            {
                Debug.Log("<color=red>Error:</color>此句话在对话表里面没有被找到:" + this.contentId.get_Item(this.index));
                this.OnClose();
                if (this.TalkEndCallBack != null)
                {
                    this.TalkEndCallBack.Invoke();
                }
                return;
            }
            talkContentId     = duiHuaPeiZhi.word;
            body              = duiHuaPeiZhi.body;
            this.mCurrentType = ((duiHuaPeiZhi.picSide != 1) ? TalkUI.TalkDirType.Right : TalkUI.TalkDirType.Left);
        }
        this.TalkContent(talkContentId, body);
        if (this.lastCurrentID != body)
        {
            this.SetUI(body, this.mCurrentType);
        }
        this.lastCurrentID = body;
        this.index++;
    }
Ejemplo n.º 2
0
    private void SetUI(int npcId, TalkUI.TalkDirType MeSpeak)
    {
        string text = string.Empty;
        int    id   = 0;

        if (npcId > 0)
        {
            NPC nPC = DataReader <NPC> .Get(npcId);

            if (nPC != null)
            {
                text = GameDataUtils.GetChineseContent(nPC.name, false);
                id   = nPC.pic;
            }
        }
        else
        {
            text = EntityWorld.Instance.EntSelf.Name;
            id   = DataReader <ZhuanZhiJiChuPeiZhi> .Get(EntityWorld.Instance.EntSelf.TypeID).jobPic;
        }
        if (MeSpeak != TalkUI.TalkDirType.Right)
        {
            if (MeSpeak == TalkUI.TalkDirType.Left)
            {
                this.rightAnim.Play("mainTalkRight");
                this.leftAnim.Play("mainTalkLeftBack");
                this.leftBody.get_gameObject().SetActive(true);
                this.leftName.set_text(text);
                ResourceManager.SetSprite(this.leftBody, GameDataUtils.GetIcon(id));
            }
        }
        else
        {
            this.leftAnim.Play("mainTalkLeft");
            this.rightAnim.Play("mainTalkRightBack");
            this.rightBody.get_gameObject().SetActive(true);
            this.rightName.set_text(text);
            ResourceManager.SetSprite(this.rightBody, GameDataUtils.GetIcon(id));
        }
    }