예제 #1
0
    /// <summary>
    /// 设置npc模型
    /// </summary>
    /// <param name="tid">模型ID</param>
    private void ShowNpcModel(int npcid)
    {
        Npc npc = m_CfgEternityProxy.GetNpcByKey((uint)npcid);

        m_NpcName.text = TableUtil.GetNpcName((uint)npcid);
        m_NpcDesc.text = TableUtil.GetNpcDesc((uint)npcid);
        m_UI3dImage.gameObject.SetActive(false);
        CfgEternityProxy cfe         = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        string           prefabName  = cfe.GetNpcModelByKey((uint)npcid);
        Model            NpcModel    = m_CfgEternityProxy.GetModel(npc.Model);
        Npc3DViewer      npc3DViewer = m_UI3dImage.GetComponent <Npc3DViewer>();

        if (npc3DViewer == null)
        {
            npc3DViewer = m_UI3dImage.gameObject.AddComponent <Npc3DViewer>();
        }
        npc3DViewer.SetModel(prefabName, GetNpcUiPos(NpcModel), GetNpcUiRotation(NpcModel), GetNpcUiScale(NpcModel));
    }