Beispiel #1
0
 private Vector3 GetNpcUiRotation(Model NpcTemplateVO)
 {
     if (NpcTemplateVO.UiPositionLength == 3)
     {
         return(new Vector3(NpcTemplateVO.UiRotation(0), NpcTemplateVO.UiRotation(1), NpcTemplateVO.UiRotation(2)));
     }
     return(Vector3.zero);
 }
Beispiel #2
0
 private Vector3 GetNpcUiScale(Model NpcTemplateVO)
 {
     if (NpcTemplateVO.UiScale > 0)
     {
         return(NpcTemplateVO.UiScale * Vector3.one);
     }
     return(Vector3.one);
 }
Beispiel #3
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));
    }