少年修仙传客户端代码仓库
client_Wu Xijin
2018-11-06 52857cbf2e453cb9f208141e5f9b9decd0ecf2e5
4590 【1.2.0】主角转至功能Npc的模型,在界面上展示时显示其翅膀、副手、武器
4个文件已修改
351 ■■■■■ 已修改文件
Fight/Stage/MapEditor/GuideDialogueWin.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainInterfacePanel/DialogueDuidanceWin.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UI3DModelExhibition.cs 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UI3DShowHero.cs 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/GuideDialogueWin.cs
@@ -153,7 +153,12 @@
            npcContent.text = m_DialogConfig.content;
            var npcConfig = Config.Instance.Get<NPCConfig>(m_DialogConfig.npcId);
            UI3DModelExhibition.Instance.ShowNPC(m_DialogConfig.npcId, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, npcIcon, false, true);
            var data = new UI3DModelExhibition.UI3DNPCExhibitionData()
            {
                npcId = m_DialogConfig.npcId,
                isDialogue = true,
            };
            UI3DModelExhibition.Instance.ShowNPC(npcIcon, data);
        }
        if (m_DialogConfig.TalkID != 0)
System/MainInterfacePanel/DialogueDuidanceWin.cs
@@ -297,7 +297,12 @@
                string npcIcon = configStoryMissions.NpcIcon[IsMultistage];
                UI3DModelExhibition.Instance.ShowNPC(npcId, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_NPCIcon, false, true);
                var data = new UI3DModelExhibition.UI3DNPCExhibitionData()
                {
                    npcId = npcId,
                    isDialogue = true,
                };
                UI3DModelExhibition.Instance.ShowNPC(m_NPCIcon,data);
            }
            typesPeaker = type;
        }
UI/Common/UI3DModelExhibition.cs
@@ -66,10 +66,8 @@
        public static UI3DModelExhibition Instance { get; private set; }
        static UI3DModelExhibition m_InstanceClone1 = null;
        public static UI3DModelExhibition InstanceClone1
        {
            get
            {
        public static UI3DModelExhibition InstanceClone1 {
            get {
                if (m_InstanceClone1 == null)
                {
                    CreateCloneStage();
@@ -240,7 +238,7 @@
            ShowPlayer(_rawImage, data);
        }
        public void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
        void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
        {
            StopShow();
@@ -442,6 +440,69 @@
            }
        }
        public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data)
        {
            StopShow();
            ResetCameraColor();
            var config = Config.Instance.Get<NPCConfig>(data.npcId);
            var job = 0;
            if (config.MODE.Contains("A_Zs"))
            {
                job = 1;
            }
            else if (config.MODE.Contains("A_Fs"))
            {
                job = 2;
            }
            var offset = config.UIModeLOffset;
            var eulerAngles = config.UIModelRotation;
            var scale = Vector3.one * config.UIModeLProportion;
            var isPlayer = job != 0;
            if (isPlayer)
            {
                var instance = UI3DModelFactory.LoadUINPC(data.npcId);
                if (instance == null)
                {
                    DebugEx.LogFormat("无法获得npc模型资源,id :{0}", data.npcId);
                    return;
                }
                instance.transform.SetParentEx(data.isDialogue ? m_DialogPoint : m_NPCShowPoint, offset, eulerAngles, scale);
                npcModel = instance;
                isShowingNPC = true;
                var ids = config.Equips.Split('|');
                var weaponId = int.Parse(ids[0]);
                var secondaryId = ids.Length > 1 ? int.Parse(ids[1]) : 0;
                var wingId = ids.Length > 3 ? int.Parse(ids[3]) : 0;
                playerModel.Show(instance, job, weaponId, wingId, secondaryId, m_PlayerShowPoint);
                playerModel.UnloadClothedEffect();
                playerModel.StandUp();
                m_PlayerShowPoint.localEulerAngles = Vector3.zero;
                isShowingPlayer = true;
                interactable = true;
                m_ShowCamera.enabled = true;
                if (rawImage != null)
                {
                    var x = rawImage.rectTransform.rect.height * 4f / 3;
                    var y = rawImage.rectTransform.rect.height;
                    rawImage.rectTransform.sizeDelta = new Vector2(x, y);
                    rawImage.texture = m_ShowCamera.targetTexture;
                    rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial();
                    m_InteractProcessor.rectTransform = rawImage.rectTransform;
                }
            }
            else
            {
                ShowNPC(data.npcId, offset, eulerAngles, rawImage, data.gray, data.isDialogue);
            }
        }
        public void ShowNPC(int _npcId, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false)
        {
            ShowNPC(_npcId, Vector3.zero, _localEulerAngles, _rawImage, _gray, _isDialogue);
@@ -506,67 +567,49 @@
        {
            m_ShowCamera.enabled = false;
            if (isShowingNPC)
            playerModel.Dispose();
            isShowingPlayer = false;
            if (npcModel != null)
            {
                if (npcModel != null)
                npcModel.transform.localScale = Vector3.one;
                if (m_NpcEffect != null)
                {
                    npcModel.transform.localScale = Vector3.one;
                    if (m_NpcEffect != null)
                    {
                        SFXPlayUtility.Instance.Release(m_NpcEffect);
                        m_NpcEffect = null;
                    }
                    UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel);
                    npcModel = null;
                    SFXPlayUtility.Instance.Release(m_NpcEffect);
                    m_NpcEffect = null;
                }
                m_NPCId = 0;
                isShowingNPC = false;
                UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel);
                npcModel = null;
            }
            m_NPCId = 0;
            isShowingNPC = false;
            if (isShowingHorse)
            if (horseModel != null)
            {
                if (horseModel != null)
                {
                    horseModel.transform.localScale = Vector3.one;
                    UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel);
                    horseModel = null;
                }
                m_HorseModelId = 0;
                isShowingHorse = false;
                horseModel.transform.localScale = Vector3.one;
                UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel);
                horseModel = null;
            }
            m_HorseModelId = 0;
            isShowingHorse = false;
            if (isShowingPlayer)
            if (wingModel != null)
            {
                playerModel.Dispose();
                isShowingPlayer = false;
                wingModel.transform.localScale = Vector3.one;
                UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel);
                wingModel = null;
            }
            m_WingModelId = 0;
            isShowWing = false;
            if (isShowWing)
            if (equipmentModel != null)
            {
                if (wingModel != null)
                {
                    wingModel.transform.localScale = Vector3.one;
                    UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel);
                    wingModel = null;
                }
                m_WingModelId = 0;
                isShowWing = false;
                UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel);
                equipmentModel = null;
            }
            if (isShowinEquipment)
            {
                if (equipmentModel != null)
                {
                    UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel);
                    equipmentModel = null;
                }
                m_EquipmentModelId = 0;
                isShowinEquipment = false;
            }
            m_EquipmentModelId = 0;
            isShowinEquipment = false;
            interactable = false;
        }
@@ -669,6 +712,14 @@
            public int secondaryId;
            public bool isDialogue;
        }
        public struct UI3DNPCExhibitionData
        {
            public int npcId;
            public bool gray;
            public bool isDialogue;
        }
    }
}
UI/Common/UI3DShowHero.cs
@@ -32,10 +32,71 @@
        {
            showPoint = _showPoint;
            job = _job;
            PutOnClothes(_job, _clothes, suitID);
            var jobConfig = Config.Instance.Get<JobSetupConfig>(_job);
            var clothesResId = 0;
            if (_clothes == 0)
            {
                clothesResId = jobConfig.BaseEquip[0];
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(_clothes);
                clothesResId = item == null ? clothesResId = jobConfig.BaseEquip[0] : item.ChangeOrd;
            }
            PutOnClothes(_job, clothesResId, suitID);
            var weaponResId = 0;
            if (_weaponId == 0)
            {
                weaponResId = jobConfig.BaseEquip[1];
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(_weaponId);
                weaponResId = item == null ? weaponResId = jobConfig.BaseEquip[1] : item.ChangeOrd;
            }
            PutOnWeapon(_job, _weaponId);
            PutOnSecondary(_job, _secondaryId);
            PutOnWing(_wingsId);
            var secondaryResId = 0;
            if (_secondaryId == 0)
            {
                if (job == 1)
                {
                    secondaryResId = clothesId + 2900;
                }
                else
                {
                    secondaryResId = jobConfig.BaseEquip[2];
                }
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(_secondaryId);
                secondaryResId = item == null ? jobConfig.BaseEquip[2] : item.ChangeOrd;
            }
            PutOnSecondary(_job, secondaryResId);
            var wingsResId = 0;
            if (_wingsId != 0)
            {
                var item = Config.Instance.Get<ItemConfig>(_wingsId);
                wingsResId = item == null ? 0 : item.ChangeOrd;
            }
            PutOnWing(wingsResId);
            return clothesModel;
        }
        public GameObject Show(GameObject clothesModel, int job, int weaponResId, int wingsResId, int secondaryResId, Transform showPoint)
        {
            this.showPoint = showPoint;
            this.job = job;
            this.clothesModel = clothesModel;
            PutOnWeapon(job, weaponResId);
            PutOnSecondary(job, secondaryResId);
            PutOnWing(wingsResId);
            return clothesModel;
        }
@@ -103,6 +164,7 @@
                }
            }
            clothesModel = null;
            clothesId = 0;
            weaponId = 0;
            wingsId = 0;
@@ -153,40 +215,27 @@
            }
        }
        public void PutOnClothes(int _job, int itemID, int suitID)
        public void PutOnClothes(int _job, int clothesResId, int suitID)
        {
            var newClothes = 0;
            var config = Config.Instance.Get<JobSetupConfig>(_job);
            if (itemID == 0)
            {
                newClothes = config.BaseEquip[0];
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(itemID);
                newClothes = item == null ? newClothes = config.BaseEquip[0] : item.ChangeOrd;
            }
            var oldClothes = clothesId;
            if (oldClothes == newClothes)
            if (clothesId == clothesResId)
            {
                return;
            }
            if (oldClothes != 0)
            if (clothesId != 0)
            {
                UnloadClothes();
            }
            var _prefab = InstanceResourcesLoader.LoadModelRes(newClothes, true);
            var _prefab = InstanceResourcesLoader.LoadModelRes(clothesResId, true);
            if (!_prefab)
            {
                newClothes = config.BaseEquip[0];
                clothesResId = config.BaseEquip[0];
            }
            LoadClothes(newClothes);
            clothesId = newClothes;
            LoadClothes(clothesResId);
            clothesId = clothesResId;
            if (clothesModel)
            {
@@ -208,7 +257,7 @@
                    wingsModel.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
                }
                LoadClothesEffect(itemID, suitID);
                LoadClothesEffect(suitID);
            }
        }
@@ -265,23 +314,12 @@
            }
        }
        public void PutOnWeapon(int _job, int itemID)
        public void PutOnWeapon(int _job, int resoureceId)
        {
            var newWeapon = 0;
            var config = Config.Instance.Get<JobSetupConfig>(_job);
            if (itemID == 0)
            {
                newWeapon = config.BaseEquip[1];
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(itemID);
                newWeapon = item == null ? config.BaseEquip[1] : item.ChangeOrd;
            }
            var oldWeapon = weaponId;
            if (oldWeapon == newWeapon)
            if (oldWeapon == resoureceId)
            {
                return;
            }
@@ -297,12 +335,12 @@
                weaponModel = null;
            }
            prefab = InstanceResourcesLoader.LoadModelRes(newWeapon, true);
            prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true);
            if (!prefab)
            {
                newWeapon = config.BaseEquip[1];
                prefab = InstanceResourcesLoader.LoadModelRes(newWeapon, true);
                resoureceId = config.BaseEquip[1];
                prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true);
            }
            if (prefab)
@@ -318,34 +356,13 @@
                }
            }
            weaponId = newWeapon;
            weaponId = resoureceId;
        }
        public void PutOnSecondary(int _job, int itemID)
        public void PutOnSecondary(int _job, int secondaryResId)
        {
            var newSecondary = 0;
            var config = Config.Instance.Get<JobSetupConfig>(_job);
            if (itemID == 0)
            {
                if (job == 1)
                {
                    // 这里不再读取默认的副手装备,而是根据套装读取默认的手臂装备
                    newSecondary = clothesId + 2900;
                }
                else
                {
                    newSecondary = config.BaseEquip[2];
                }
            }
            else
            {
                var item = Config.Instance.Get<ItemConfig>(itemID);
                newSecondary = item == null ? config.BaseEquip[2] : item.ChangeOrd;
            }
            var oldSecondary = secondaryId;
            if (oldSecondary == newSecondary)
            if (oldSecondary == secondaryResId)
            {
                return;
            }
@@ -361,13 +378,14 @@
                secondaryModel = null;
            }
            if (newSecondary != 0)
            if (secondaryResId != 0)
            {
                prefab = InstanceResourcesLoader.LoadModelRes(newSecondary, true);
                prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true);
                if (!prefab)
                {
                    newSecondary = config.BaseEquip[2];
                    prefab = InstanceResourcesLoader.LoadModelRes(newSecondary, true);
                    var config = Config.Instance.Get<JobSetupConfig>(_job);
                    secondaryResId = config.BaseEquip[2];
                    prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true);
                }
                if (prefab)
@@ -380,22 +398,14 @@
                }
            }
            secondaryId = newSecondary;
            secondaryId = secondaryResId;
        }
        public void PutOnWing(int itemID)
        public void PutOnWing(int resourceId)
        {
            var newWings = 0;
            if (itemID != 0)
            {
                var item = Config.Instance.Get<ItemConfig>(itemID);
                newWings = item == null ? 0 : item.ChangeOrd;
            }
            var config = Config.Instance.Get<JobSetupConfig>(job);
            var oldWings = wingsId;
            if (newWings == oldWings)
            if (resourceId == oldWings)
            {
                return;
            }
@@ -411,14 +421,14 @@
                wingsModel = null;
            }
            if (newWings != 0)
            if (resourceId != 0)
            {
                prefab = InstanceResourcesLoader.LoadModelRes(newWings, true);
                prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true);
                if (!prefab)
                {
                    newWings = config.BaseEquip[3];
                    prefab = InstanceResourcesLoader.LoadModelRes(newWings, true);
                    resourceId = config.BaseEquip[3];
                    prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true);
                }
                if (prefab)
@@ -439,20 +449,20 @@
                    wingsAnimator = wingsModel.GetComponent<Animator>();
                    if (wingsAnimator == null)
                    {
                        DebugEx.LogErrorFormat("翅膀资源{0}没有动画控制器", itemID);
                        DebugEx.LogErrorFormat("翅膀资源{0}没有动画控制器", resourceId);
                    }
                    wingsAnimator.enabled = true;
                    wingsAnimator.Play("UI_Idle", 0);
                }
            }
            wingsId = newWings;
            wingsId = resourceId;
        }
        private PlayerSuitModel SuitModel { get { return ModelCenter.Instance.GetModel<PlayerSuitModel>(); } }
        private PlayerPackModel PlayerBackModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
        public void LoadClothesEffect(int clothedID, int suitLevel)
        public void LoadClothesEffect(int suitLevel)
        {
            UnloadClothedEffect();