コード例 #1
0
ファイル: ChooseRolePanel.cs プロジェクト: zuojiashun/src
    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);
    }
コード例 #2
0
    protected override void OnHide()
    {
        ResetCameraAnimator();
        ResetCharacterCreate();
        if (m_scene_obj)
        {
            //m_scene_obj.gameObject.SetActive(false);
            // Destroy(m_scene_obj);
            if (m_Avater != null)
            {
                m_Avater.Destroy();
                m_Avater = null;
            }

            Resources.UnloadUnusedAssets();
        }
    }
コード例 #3
0
ファイル: ChooseRolePanel.cs プロジェクト: zuojiashun/src
    protected override void OnHide()
    {
        ResetSelectRole();

        if (m_scene_obj)
        {
            if (m_Avater != null)
            {
                m_Avater.Destroy();
                m_Avater = null;
            }
        }
        Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
        if (audio != null)
        {
            audio.StopMusic();
        }
    }
コード例 #4
0
    void OnSelChanged(enumProfession prof, enmCharSex sex, bool force = false)
    {
        if (m_curPro == prof && m_sel_sex == sex && force == false)
        {
            //没有改变
            return;
        }
        m_bLockRotate = true;
        bool havePre = m_curPro != enumProfession.Profession_None;

        GetGridByPro(prof).SetSelect(true, havePre);
        GetPropDesContent(prof).SetActive(true);
        if (havePre)
        {
            if (null != m_rightDesTA)
            {
                m_rightDesTA.ResetToBeginning();
                m_rightDesTA.Play(true);
            }
            GetGridByPro(m_curPro).SetSelect(false);
            GetPropDesContent(m_curPro).SetActive(false);
        }
        else
        {
            if (m_rightDesTA != null)
            {
                m_rightDesTA.GetComponent <UIWidget>().alpha = m_rightDesTA.to;
            }
        }
        m_prePro = m_curPro;
        m_curPro = prof;
        if (m_curPro == enumProfession.Profession_Soldier || m_curPro == enumProfession.Profession_Freeman)
        {
            sex = enmCharSex.MALE;
        }
        else
        {
            sex = enmCharSex.FEMALE;
        }
        m_sel_sex = sex;
        //for (int i = 0; i < m_lstCreateRoleBtn.Count; i++)
        //{
        //    m_lstCreateRoleBtn[i].ToggleSelectMask(m_lstCreateRoleBtn[i].m_enumProfession == m_sel_profession);
        //}

        if (m_char_obj != null)
        {
            GameObject.Destroy(m_char_obj);
        }

        //if(m_sel_sex == enmCharSex.MALE)
        //{
        //    m_sprite_male_bg.spriteName = "nan_liang";
        //    m_sprite_female_bg.spriteName = "nv_an";
        //}
        //else
        //{
        //    m_sprite_male_bg.spriteName = "nan_an";
        //    m_sprite_female_bg.spriteName = "nv_liang";
        //}


        //随机一个名字
        onClick_Random_name_Btn(null);

        //if(m_sel_sex == enmCharSex.MALE)
        //    StartCoroutine(LoadModel("ZS_Male_Show"));
        //else
        //    StartCoroutine(LoadModel("ZS_Female_Show"));

        var t = Table.Query <table.SelectRoleDataBase>();

        table.SelectRoleDataBase item = null;
        for (int i = 0; i < t.Count; i++)
        {
            if (t[i].professionID == (uint)m_curPro && t[i].Sex == m_sel_sex)
            {
                item = t[i];
                break;
            }
        }
        // var item = table.SelectRoleDataBase.Where(m_sel_profession, m_sel_sex);

        if (item == null || (item != null && string.IsNullOrEmpty(item.bodyPathRoleShowcase)))
        {
            Log.Error("角色展示模型未配置,请检查选人界面表!");
            return;
        }


        if (m_Avater != null)
        {
            RenderObjHelper.EndDissolveEffect(m_Avater.RenderObj);
        }
        if (m_Avater != null)
        {
            m_Avater.Destroy();
            m_Avater = null;
        }

        if (m_model_node == null)
        {
            Engine.Utility.Log.Error("m_model_node 为 null !!!");
            return;
        }

        m_model_node.transform.DestroyChildren();
        rotateY = m_model_node.localRotation.y;

        //var table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)item.createRoleResID);


        //创建角色,模型自带武器
        var ritem = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>((uint)item.createRoleResID);

        if (ritem == null)
        {
            Engine.Utility.Log.Error("ritem 为 null !!!");
            return;
        }

        Client.AvatarUtil.CreateAvater(ref m_Avater, ritem.strPath, m_model_node, m_model_node.gameObject.layer, OnCreateAvater, (int)prof);

        Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem();
        if (renderSys == null)
        {
            return;
        }

        for (int i = m_CurShowEffect.Count - 1; i >= 0; i--)
        {
            Engine.IEffect effect = m_CurShowEffect[i];
            renderSys.RemoveEffect(effect);
        }
        m_CurShowEffect.Clear();
    }