void ChooseRole(SelectUserInfo role_info) { if (role_info == null) { return; } if (role_info.id == m_nSelectUID) { return; } if (m_Avater != null) { m_Avater.Destroy(); m_Avater = null; } m_nSelectUID = role_info.id; //m_model_node.transform.DestroyChildren(); rotateY = m_model_node.transform.localRotation.y; int nLayer = LayerMask.NameToLayer("ShowModel"); Client.AvatarUtil.CreateAvater(ref m_Avater, role_info, m_model_node, nLayer, null); m_Avater.PlayAni(Client.EntityAction.Stand, null); }
void OnCreateAvater(object param) { if (null == m_Avater || null == m_Avater.RenderObj) { Engine.Utility.Log.Error("CreateRolePanel->OnCreateAvater failed,m_Avater or m_Avater.RnederObj null!"); return; } m_Avater.RenderObj.ClearFrameEvent(); int nProfession = (int)param; PlayCreateAudio(nProfession); switch (nProfession) { case (int)enumProfession.Profession_Soldier: { for (int i = 0; i < m_ShowEffect.Count; i++) { table.ShowEffect data = m_ShowEffect[i]; if (data.Profession == (uint)enumProfession.Profession_Soldier) { switch (data.IsWeaponEffect) { case (uint)IS_WEAPON_EFFECT.SCENE: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_scene", data.StartTime, uint.Parse(data.EffectID)); break; case (uint)IS_WEAPON_EFFECT.BODY: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_body", data.StartTime, uint.Parse(data.EffectID)); break; } } } AnimationState ani = m_Avater.RenderObj.GetAnimationState(Client.EntityAction.ShowLog); m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "standAni", ani.length * 0.9f); //wbw 测试 } break; case (int)enumProfession.Profession_Spy: { for (int i = 0; i < m_ShowEffect.Count; i++) { table.ShowEffect data = m_ShowEffect[i]; if (data.Profession == (uint)enumProfession.Profession_Spy) { switch (data.IsWeaponEffect) { case (uint)IS_WEAPON_EFFECT.SCENE: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_scene", data.StartTime, uint.Parse(data.EffectID)); break; case (uint)IS_WEAPON_EFFECT.BODY: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_body", data.StartTime, uint.Parse(data.EffectID)); break; } } } AnimationState ani = m_Avater.RenderObj.GetAnimationState(Client.EntityAction.ShowLog); m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "standAni", ani.length * 0.9f); } break; case (int)enumProfession.Profession_Freeman: { for (int i = 0; i < m_ShowEffect.Count; i++) { table.ShowEffect data = m_ShowEffect[i]; if (data.Profession == (uint)enumProfession.Profession_Freeman) { switch (data.IsWeaponEffect) { case (uint)IS_WEAPON_EFFECT.SCENE: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_scene", data.StartTime, uint.Parse(data.EffectID)); break; case (uint)IS_WEAPON_EFFECT.BODY: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_body", data.StartTime, uint.Parse(data.EffectID)); break; } } } AnimationState ani = m_Avater.RenderObj.GetAnimationState(Client.EntityAction.ShowLog); m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "standAni", ani.length * 0.9f); //溶解 m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "Dissolve", 0); } break; case (int)enumProfession.Profession_Doctor: { for (int i = 0; i < m_ShowEffect.Count; i++) { table.ShowEffect data = m_ShowEffect[i]; if (data.Profession == (uint)enumProfession.Profession_Doctor) { switch (data.IsWeaponEffect) { case (uint)IS_WEAPON_EFFECT.SCENE: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_scene", data.StartTime, uint.Parse(data.EffectID)); break; case (uint)IS_WEAPON_EFFECT.BODY: m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "addEffect_body", data.StartTime, uint.Parse(data.EffectID)); break; } } } AnimationState ani = m_Avater.RenderObj.GetAnimationState(Client.EntityAction.ShowLog); m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "standAni", ani.length * 0.9f); //溶解 m_Avater.RenderObj.AddFrameEvent(Client.EntityAction.ShowLog, "Dissolve", 0); } break; } if (m_cam_animator != null) { int nJob = (int)param; m_cam_animator.SetTrigger(m_iTriggerStartHash); m_cam_animator.SetInteger(m_istateChangeParamHash, nJob); } m_Avater.PlayAni(Client.EntityAction.ShowLog, OnActionEvent, 0.3f, -1); }