Example #1
0
        public override void FireEvent()
        {
            Engine.IRenderObj renderObj = this.GetRenderObj();
            if (renderObj != null)
            {
                renderObj.Play(animationName);
            }

            //if(!animationClip)
            //{
            //    Debug.Log("Attempting to play an animation on a GameObject but you haven't given the event an animation clip from USPlayAnimEvent::FireEvent");
            //    return;
            //}


            //Animation animation = AffectedObject.GetComponent<Animation>();
            //if(!animation)
            //{
            //    Debug.Log("Attempting to play an animation on a GameObject without an Animation Component from USPlayAnimEvent.FireEvent");
            //    return;
            //}

            //animation.wrapMode = wrapMode;
            //animation.Play(animationClip.name);

            //AnimationState state = animation[animationClip.name];
            //if(!state)
            //    return;

            //state.speed = playbackSpeed;
        }
Example #2
0
    public static void EndDissolveEffect(Engine.IRenderObj obj)
    {
        if (obj == null)
        {
            return;
        }

        //UnityEngine.GameObject gameObject = obj.GetNode().GetTransForm().gameObject;
        if (obj.GetNode() == null)
        {
            return;
        }

        if (obj.GetNode().GetTransForm() == null)
        {
            return;
        }

        UnityEngine.GameObject gameObject = obj.GetNode().GetTransForm().gameObject;
        if (gameObject == null)
        {
            return;
        }

        DissolveScript[] component = gameObject.GetComponentsInChildren <DissolveScript>(true);
        for (int i = 0; i < component.Length; i++)
        {
            component[i].EndDissolve();
        }
    }
Example #3
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                return;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);
            Vector3 currPos = GetPos();

            SetPos(ref currPos);
            Vector3 dir = GetRotate();

            SetRotate(dir);


            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));

            // 先做回调
            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Example #4
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            m_EntityView.SetRenderObj(obj);

            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.HomeLandViewDatabase>((uint)nID, GetProp((int)HomeProp.State));

            if (table_data == null)
            {
                Engine.Utility.Log.Error("不存在这个对象: " + nID);
                return;
            }

            table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>((uint)table_data.dwModelID);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("Homeland:找不到Homeland模型资源路径配置{0}", table_data.dwModelID);
                return;
            }

            //string strPartName = "main";
            //string strResName = resDB.strPath;
            // m_EntityView.ChangePart( ref strPartName , ref strResName );

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);
        }
Example #5
0
 void ClearPreLoadEntity()
 {
     if (m_preLoadDic != null)
     {
         var iter = m_preLoadDic.GetEnumerator();
         while (iter.MoveNext())
         {
             var objArray = iter.Current.Value;
             for (int i = 0; i < objArray.Length; i++)
             {
                 Engine.IRenderObj obj = objArray[i];
                 if (obj != null)
                 {
                     Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                     if (rs != null)
                     {
                         if (rs.CanRemovePreLoad(obj.GetID()))
                         {
                             rs.RemoveRenderObj(obj);
                         }
                     }
                 }
             }
             objArray = null;
         }
         m_preLoadDic.Clear();
     }
 }
Example #6
0
    private void OnChangeEquip(Engine.IRenderObj obj, object param)
    {
        EquipPos pos = (EquipPos)param;

        if (pos == EquipPos.EquipPos_Body)
        {
            m_RenderObj = m_PuppetObj.renderObj;
            if (m_RenderObj != null)
            {
                // 默认播放站立动作
                m_RenderObj.Play(Client.EntityAction.Stand);
                m_RenderObj.SetLayer((int)Engine.RenderLayer.ShowModel); // showModel
                if (ufxid != 0)
                {
                    //换了时装特效就不在新的RenderObj上了  重新挂一下
                    AddLinkEffectWithoutEntity(ufxid);
                }
            }

            if (m_Root != null && m_Camera != null)
            {
                m_Camera.transform.parent = m_Root.transform;
                m_RenderObj.GetNode().GetTransForm().parent = m_Root.transform;

                m_RenderObj.GetNode().SetLocalPosition(Vector3.zero);
                SetModelRotateY(m_fYAngle);
                m_RenderObj.GetNode().SetScale(Vector3.one);
            }
        }
    }
Example #7
0
    private void ApplyMaterial(Client.IPlayer pPlayer, uint uSuit)
    {
        table.SuitDataBase data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>(uSuit);
        if (data == null)
        {
            return;
        }

        if (data.defaultMaterial == 0)
        {
            return;
        }


        table.ResourceDataBase res = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.defaultMaterial);
        if (res == null)
        {
            return;
        }


        if (res.strPath == "")
        {
            return;
        }


        Engine.IRenderObj renderObj = pPlayer.renderObj;
        if (renderObj != null)
        {
            renderObj.ApplyMaterial(res.strPath);
        }
    }
Example #8
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                m_bChangeRestore = false;
                return;
            }

            // 设置层信息
            if (EntitySystem.m_ClientGlobal.IsMainPlayer(this))
            {
                m_EntityView.renderObj.SetLayer(LayerMask.NameToLayer("MainPlayer"));
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);
            Vector3 dir = GetRotate();

            SetRotate(dir);

            // 还原时回调
            if (m_ChangeEventHandler != null)
            {
                m_ChangeEventHandler(m_ChangeParam);
                m_ChangeEventHandler = null;
                m_ChangeParam        = null;
            }

            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            // 播放下动画
            PlayAction(m_EntityView.GetCurAniName());

            // 先做回调
            if (!m_bChangeRestore)
            {
                Client.stCreateEntity createEntity = new Client.stCreateEntity();
                createEntity.uid = GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
            }
            else
            {
                m_bChangeRestore = false;
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_RESTORE,
                                                                    new Client.stPlayerChange()
                {
                    status = 2, uid = GetID()
                });
            }
        }
Example #9
0
 //-------------------------------------------------------------------------------------------------------
 void CreateRenderObjEvent(Engine.IRenderObj obj, object param)
 {
     m_RenderObj = obj;
     if (m_RenderObj != null)
     {
         m_RenderObj.SetLayer((int)Engine.RenderLayer.ShowModel); // showModel
     }
 }
Example #10
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////
    public bool Create(string strRenderObj, int nSize, GameObject parentObj)
    {
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            Engine.Utility.Log.Error("获取RenderSystem失败!");
            return(false);
        }

        // 对象创建
        if (m_Root == null)
        {
            m_Root = new GameObject("RTObj");
            if (parentObj != null)
            {
                m_Root.transform.parent = parentObj.transform;
            }
        }

        //
        m_RenderObj = null;
        rs.CreateRenderObj(ref strRenderObj, ref m_RenderObj, CreateRenderObjEvent, null, Engine.TaskPriority.TaskPriority_Normal);
        if (m_RenderObj == null)
        {
            Engine.Utility.Log.Error("创建Renderobj失败{0}!", strRenderObj);
            return(false);
        }

        m_RenderObj.SetLayer((int)Engine.RenderLayer.ShowModel);
        // 默认播放站立动作
        m_RenderObj.Play(Client.EntityAction.Stand);

        // CreateCamera
        Camera cam = CreateCamera();

        //  m_RenderText = new RenderTexture(nSize, nSize, 24, RenderTextureFormat.ARGB32);
        m_RenderText = RenderTexture.GetTemporary(nSize, nSize, 24, RenderTextureFormat.ARGB4444);
        if (m_RenderText == null)
        {
            return(false);
        }
        cam.targetTexture = m_RenderText;

        // 对象挂在父节点上
        if (m_Root != null)
        {
            m_RenderObj.GetNode().GetTransForm().parent = m_Root.transform;
            m_Camera.transform.parent = m_Root.transform;
        }

        return(true);
    }
Example #11
0
    //自己
    private void OnSceneLoadCompelete(int nEventId, object param)
    {
        Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)param;
        uint nMapID = (uint)loadScene.nMapID;

        m_nCurMapID = nMapID;
        table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(nMapID);
        if (mapDB == null)
        {
            return;
        }

        if (mapDB.dwMaterial == 0)
        {
            // 使用默认材质
            Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer;
            if (pPlayer != null)
            {
                // 时装id
                uint uSuit = 0;

                List <GameCmd.SuitData> lstSuit = null;
                pPlayer.GetSuit(out lstSuit);

                if (lstSuit.Count > 0)
                {
                    uSuit = lstSuit[0].baseid;
                    ApplyMaterial(pPlayer, uSuit);
                }
            }
        }
        else
        {
            table.ResourceDataBase res = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwMaterial);
            if (res == null)
            {
                return;
            }

            if (res.strPath == "")
            {
                return;
            }

            Engine.IRenderObj renderObj = Client.ClientGlobal.Instance().MainPlayer.renderObj;
            if (renderObj != null)
            {
                renderObj.ApplyMaterial(res.strPath);
            }
        }
    }
Example #12
0
    private void ClearSequencerTempObject()
    {
        for (int i = 0; i < m_SequencerTempObject.Count; i++)
        {
            GameObject temp = m_SequencerTempObject[i];
            if (temp != null)
            {
                GameObject.DestroyObject(temp);
            }
        }
        m_SequencerTempObject.Clear();


        for (int i = 0; i < m_SequencerTempRender.Count; i++)
        {
            Engine.IRenderObj temp = m_SequencerTempRender[i];
            if (temp != null)
            {
                m_RenderSystem.RemoveRenderObj(temp);
            }
        }
        m_SequencerTempRender.Clear();


        for (int i = 0; i < m_SequencerTempEffect.Count; i++)
        {
            Engine.IEffect temp = m_SequencerTempEffect[i];
            if (temp != null)
            {
                m_RenderSystem.RemoveEffect(temp);
            }
        }
        m_SequencerTempEffect.Clear();


        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return;
        }
        for (int i = 0; i < m_SequencerTempEntity.Count; i++)
        {
            Client.IEntity entity = m_SequencerTempEntity[i];
            if (entity != null)
            {
                es.RemoveEntity(entity);
            }
        }
        m_SequencerTempEntity.Clear();
    }
Example #13
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            m_EntityView.SetRenderObj(obj);

            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.HomeLandViewDatabase>((uint)nID, GetProp((int)HomeProp.State));

            if (table_data == null)
            {
                Engine.Utility.Log.Error("不存在这个对象: " + nID);
                return;
            }

            table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>((uint)table_data.dwModelID);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("Homeland:找不到Homeland模型资源路径配置{0}", table_data.dwModelID);
                return;
            }

            string strPartName = "main";
            string strResName  = resDB.strPath;

            m_EntityView.ChangePart(ref strPartName, ref strResName);

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            //Client.stCreateEntity createEntity = new Client.stCreateEntity();
            //createEntity.uid = GetUID();
            //Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Example #14
0
        //-------------------------------------------------------------------------------------------------------
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Example #15
0
    //-------------------------------------------------------------------------------------------------------
    public bool Create(Client.IPlayer player, int nSize, GameObject parentObj, Client.SkillSettingState eState = Client.SkillSettingState.StateOne)
    {
        if (player == null)
        {
            return(false);
        }

        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            Engine.Utility.Log.Error("获取RenderSystem失败!");
            return(false);
        }

        // 对象创建
        if (m_Root == null)
        {
            m_Root = new GameObject("RTObj");
            if (parentObj != null)
            {
                m_Root.transform.parent = parentObj.transform;
            }
        }

        //
        m_RenderObj = null;

        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return(false);
        }

        List <GameCmd.SuitData> lstSuit = null;

        player.GetSuit(out lstSuit);

        return(Create(lstSuit, player.GetProp((int)PlayerProp.Job), player.GetProp((int)PlayerProp.Sex), nSize, parentObj, eState));
    }
Example #16
0
    public void Release()
    {
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            Engine.Utility.Log.Error("获取RenderSystem失败!");
            return;
        }


        if (m_PuppetObj != null)
        {
            ClientGlobal.Instance().GetEntitySystem().RemoveEntity(m_PuppetObj);
            m_PuppetObj = null;
            m_RenderObj = null;
        }
        if (m_RenderObj != null)
        {
            rs.RemoveRenderObj(m_RenderObj);
        }

        if (m_Camera != null)
        {
            GameObject.DestroyImmediate(m_Camera);
        }
        if (m_RenderText != null)
        {
            m_RenderText.Release();
            GameObject.DestroyImmediate(m_RenderText);
            m_RenderText = null;
        }


        if (m_Root != null)
        {
            GameObject.DestroyImmediate(m_Root);
            m_Root = null;
        }
    }
Example #17
0
    public GameObject GetGameObject(string strName)
    {
        GameObject result = null;

        for (int i = 0; i < m_SequencerTempRender.Count; i++)
        {
            Engine.IRenderObj renderObj = m_SequencerTempRender[i];
            if (renderObj != null)
            {
                if (renderObj.GetNode().GetTransForm().gameObject.name == strName)
                {
                    result = renderObj.GetNode().GetTransForm().gameObject;
                    return(result);
                }
            }
        }

        for (int i = 0; i < m_SequencerTempEntity.Count; i++)
        {
            Client.IEntity entity = m_SequencerTempEntity[i];
            if (entity != null)
            {
                Engine.IRenderObj renderObj = entity.renderObj;
                if (renderObj != null)
                {
                    if (renderObj.GetNode().GetTransForm().gameObject.name == strName)
                    {
                        result = renderObj.GetNode().GetTransForm().gameObject;
                        return(result);
                    }
                }
            }
        }


        return(null);
    }
Example #18
0
    public bool Create(List <GameCmd.SuitData> lstSuit, int nJob, int nSex, int nSize, GameObject parentObj, SkillSettingState eState = SkillSettingState.StateOne)
    {
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            Engine.Utility.Log.Error("获取RenderSystem失败!");
            return(false);
        }

        // 对象创建
        if (m_Root == null)
        {
            m_Root = new GameObject("RTObj");
            if (parentObj != null)
            {
                m_Root.transform.parent = parentObj.transform;
            }
        }

        //
        m_RenderObj = null;

        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            return(false);
        }

        Client.EntityCreateData data = new Client.EntityCreateData();
        data.ID      = ++s_uPuppetID;
        data.strName = "";

        //int speed = player.GetProp((int)WorldObjProp.MoveSpeed);
        data.PropList = new EntityAttr[(int)PuppetProp.End - (int)EntityProp.Begin];
        int index = 0;

        data.PropList[index++] = new EntityAttr((int)PuppetProp.Job, nJob);
        data.PropList[index++] = new EntityAttr((int)PuppetProp.Sex, nSex);
        //data.PropList[index++] = new EntityAttr((int)EntityProp.BaseID, 0);
        //data.PropList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, speed);
        data.eSkillState = eState;
        data.bViewModel  = true;
        // 处理时装外观数据
        EntityViewProp[] propList = new EntityViewProp[(int)Client.EquipPos.EquipPos_Max];
        index             = 0;
        propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Body, 0);
        propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Weapon, 0);

        if (lstSuit.Count > 0)
        {
            for (int i = 0; i < lstSuit.Count; ++i)
            {
                if (lstSuit[i] == null)
                {
                    continue;
                }

                int pos = GetPropPos((Client.EquipPos)lstSuit[i].suit_type, propList);
                if (pos >= 0)
                {
                    propList[pos] = new EntityViewProp((int)lstSuit[i].suit_type, (int)lstSuit[i].baseid);
                }
                else
                {
                    Client.EquipPos equipPos = (Client.EquipPos)lstSuit[i].suit_type;
                    propList[index++] = new EntityViewProp((int)equipPos, (int)lstSuit[i].baseid);
                }
            }
        }

        data.ViewList = propList;
        data.nLayer   = LayerMask.NameToLayer("ShowModel");

        m_PuppetObj = es.CreateEntity(Client.EntityType.EntityType_Puppet, data, true) as Client.IPuppet;
        if (m_PuppetObj == null)
        {
            Engine.Utility.Log.Error("创建Renderobj失败{0}!", "");
            return(false);
        }

        m_RenderObj = m_PuppetObj.renderObj;
        if (m_RenderObj == null)
        {
            return(false);
        }

        // 默认播放站立动作
        m_RenderObj.Play(Client.EntityAction.Stand);
        m_RenderObj.SetLayer((int)Engine.RenderLayer.ShowModel); // showModel

        // CreateCamera
        Camera cam = CreateCamera();

        m_RenderText = new RenderTexture(nSize, nSize, 24, RenderTextureFormat.ARGB32);
        if (m_RenderText == null)
        {
            return(false);
        }
        cam.targetTexture = m_RenderText;

        // 对象挂在父节点上
        if (m_Root != null)
        {
            m_RenderObj.GetNode().GetTransForm().parent = m_Root.transform;
            m_Camera.transform.parent = m_Root.transform;
        }

        return(true);
    }
Example #19
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                return;
            }

            if (m_EntityView.GetNode() == null)
            {
                Engine.Utility.Log.Error("OnCreateRenderObj  m_EntityView.GetNode() is null");
                return;
            }
            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.ItemDataBase>((uint)nID);

            if (table_data != null)
            {
                m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * table_data.scale * 0.01f);
            }

            if (nID == 60001)
            {
                UnityEngine.Vector3 pos = GetPos();
                pos.y += 0.05f;
                SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
            }
            // 根据全局配置设置阴影
            //int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);
            //m_EntityView.SetShadowLevel(nShadowLevel);


            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs == null)
            {
                return;
            }
            // 取下地表高度
            // 再计算移动速度
            Engine.IScene curScene = rs.GetActiveScene();
            if (curScene == null)
            {
                return;
            }
            Material mat = curScene.GetBoxMat();

            if (mat != null)
            {
                if (m_EntityView.GetMaterial() == null)
                {
                    return;
                }
                Texture tex = m_EntityView.GetMaterial().mainTexture;
                mat.mainTexture = tex;
                m_EntityView.ApplySharedMaterial(mat);
            }


            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
            //             if (!m_sendPickMsg && CanAutoPick())
            //             {
            //                 m_sendPickMsg = true;
            //                 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_PICKUPITEM, new Client.stPickUpItem() { itemid = GetID(), state = 0 });
            //             }
        }
Example #20
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            // 加载部件
            if (m_EntityView == null)
            {
                return;
            }
            //if (m_Data == null)
            //{
            //    Engine.Utility.Log.Error("m_data is null");
            //    return;
            //}
            //if (m_Data.ViewList == null)
            //{
            //    return;
            //}

            ////string strResName = "";
            //for (int i = 0; i < m_Data.ViewList.Length; ++i)
            //{
            //    if (m_Data.ViewList[i] == null)
            //    {
            //        continue;
            //    }

            //    if (m_Data.ViewList[i].nPos == (int)EquipPos.EquipPos_Body)
            //    {
            //        var table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //        m_EntityView.AddSuitData(EquipPos.EquipPos_Body, m_Data.ViewList[i].value, table_data == null ? 0 : (int)table_data.resid, obj);
            //    }

            //    if (m_Data.ViewList[i].nPos != (int)EquipPos.EquipPos_Body)
            //    {
            //        // 读取时装配置表,挂接装备
            //        ChangeEquip changeEquip = new ChangeEquip();
            //        changeEquip.pos = (EquipPos)m_Data.ViewList[i].nPos;

            //        // 武器
            //        table.SuitDataBase table_data = null;
            //        int nSuitID = m_Data.ViewList[i].value;
            //        if (changeEquip.pos == EquipPos.EquipPos_Weapon)
            //        {
            //            if (m_Data.ViewList[i].value == 0)
            //            {
            //                table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //                if (table_data == null)
            //                {
            //                    var role_data = table.SelectRoleDataBase.Where((GameCmd.enumProfession)GetProp((int)PuppetProp.Job), (GameCmd.enmCharSex)GetProp((int)PuppetProp.Sex));
            //                    if (role_data == null)
            //                    {
            //                        Engine.Utility.Log.Error("OnCreateRenderObj:job{0}或者sex{1}数据非法!", GetProp((int)PuppetProp.Job), GetProp((int)PuppetProp.Sex));
            //                        return;
            //                    }

            //                    table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)role_data.weaponPath);
            //                }
            //            }
            //            else
            //            {
            //                table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //            }
            //        }
            //        else
            //        {
            //            table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)m_Data.ViewList[i].value);
            //        }

            //        if (table_data != null)
            //        {
            //            nSuitID = (int)table_data.base_id;
            //        }
            //        else
            //        {
            //            Engine.Utility.Log.Error("OnCreateRenderObj:{0}位置 资源{1}找不到资源数据!", changeEquip.pos, m_Data.ViewList[i].value);
            //            return;
            //        }

            //        changeEquip.nSuitID = nSuitID;
            //        changeEquip.nLayer = m_Data.nLayer;
            //        SendMessage(EntityMessage.EntityCommand_ChangeEquip, changeEquip);
            //    }
            //}
            m_Data = null; // 释放资源

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            // 播放下动画
            PlayAction(m_EntityView.GetCurAniName());

            Client.stCreateEntity createEntity = new Client.stCreateEntity();
            createEntity.uid = GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);
        }
Example #21
0
        private void OnCreateRenderObj(Engine.IRenderObj obj, object param)
        {
            if (m_EntityView == null)
            {
                m_bChange = false;
                return;
            }

            if (m_Data == null)
            {
                m_bChange = false;
                return;
            }

            int nID        = GetProp((int)EntityProp.BaseID);
            var table_data = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)nID);

            if (table_data != null)
            {
                m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * table_data.scale * 0.01f);//100为基数
            }
            int suitID = GetProp((int)NPCProp.SuitID);

            if (suitID != 0)
            {
                var suitData = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)suitID);
                if (suitData != null)
                {
                    m_EntityView.GetNode().SetScale(UnityEngine.Vector3.one * suitData.sceneModleScale);//100为基数
                }
            }
            // 时装位置
            //string strResName = "";
            if (m_Data.ViewList != null)
            {
                for (int i = 0; i < m_Data.ViewList.Length; ++i)
                {
                    if (m_Data.ViewList[i] == null)
                    {
                        continue;
                    }

                    if (m_Data.ViewList[i].nPos != (int)EquipPos.EquipPos_Body)
                    {
                        // 读取时装配置表,挂接时装
                        ChangeEquip changeEquip = new ChangeEquip();
                        changeEquip.pos     = (EquipPos)m_Data.ViewList[i].nPos;
                        changeEquip.nSuitID = m_Data.ViewList[i].value;
                        changeEquip.nLayer  = m_Data.nLayer;
                        SendMessage(EntityMessage.EntityCommand_ChangeEquip, changeEquip);
                    }
                }
            }

            if (m_ChangeEventHandler != null)
            {
                m_ChangeEventHandler(m_ChangeParam);
                m_ChangeEventHandler = null;
                m_ChangeParam        = null;
            }

            // 根据全局配置设置阴影
            int nShadowLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Render", "shadow", 1);

            m_EntityView.SetShadowLevel(nShadowLevel);

            Vector3 currPos = GetPos();

            SetPos(ref currPos);

            Vector3 dir = GetRotate();

            SetRotate(dir);

            // 根据外部设置来设置
            SendMessage(EntityMessage.EntityCommond_SetColor, new Color(1, 1, 1));
            SendMessage(EntityMessage.EntityCommand_EnableShowModel, EntityConfig.m_bShowEntity);

            PlayAction(m_EntityView.GetCurAniName());

            if (!m_bChange)
            {
                Client.stCreateEntity createEntity = new Client.stCreateEntity();
                createEntity.uid = GetUID();
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity);

                m_bChange = false;
            }
        }