protected override void Init_Model() { //AssetbundleLoader.AssetLoad( AssetbundleLoader.CreateSuffixForPlatform( resInfo.modelFile ), OnLoadedModelGO ); //추후 어셋번들에서 읽어오게 수정 //MobTableLowData.MobInfo mosterInfo = _LowDataMgr.instance.GetMonsterInfo(npcInfo.Id); GameObject _unit = UnitModelHelper.NPCModelLoad(npcInfo.Id, QualityManager.instance.GetModelQuality()); CharInfo.animDatas = _LowDataMgr.instance.AniInfoSetting(npcInfo.prefab, _unit, npcInfo.AniId); //_LowDataMgr.instance.GetUnitAniInfo(mosterInfo.AniId); if (CharInfo.animDatas != null) { CharInfo.MaxAnimCombo = UnitDataFactory.CountingMaxAnimCombo(CharInfo.animDatas); } else { Debug.LogError(string.Format("NotFound AniData MonsterID:{0}", npcInfo.Id)); } OnLoadedModelGO(_unit); NGUITools.SetLayer(gameObject, 14); SetShaderEnvironment(); }
protected IEnumerator UnitModelLoadAsync() { //추후 다시한번 수정 요망 GameObject _myUnit = null; yield return(StartCoroutine(UnitModelHelper.ModelLoadAsync(npcData.NPCPref, (retVal) => { _myUnit = retVal; }))); ////무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 ads = _LowDataMgr.instance.TownAniInfoSetting(npcData.NPCPref, _myUnit, npcData.AniID, false); ////inven.GetEquipCostume().GetLowData().AniId); _myUnit.transform.parent = transform; _myModel = _myUnit; Animator.Init(_myUnit, _myUnit.animation, ads); Animator.Animation.playAutomatically = false; Model.Init(gameObject, _myUnit); AniEvent aniEvent = _myUnit.AddComponent <AniEvent>(); aniEvent.MyUnit = this; Animator.PlayAnim(eAnimName.Anim_idle); }
protected void UnitModelLoad() { //추후 다시한번 수정 요망 GameObject _myUnit = UnitModelHelper.ModelLoadtoString(npcData.NPCPref); ////무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 ads = _LowDataMgr.instance.TownAniInfoSetting(npcData.NPCPref, _myUnit, npcData.AniID, false); ////inven.GetEquipCostume().GetLowData().AniId); _myUnit.transform.parent = transform; _myModel = _myUnit; Animator.Init(_myUnit, _myUnit.animation, ads); Animator.Animation.playAutomatically = false; Model.Init(gameObject, _myUnit); AniEvent aniEvent = _myUnit.AddComponent <AniEvent>(); aniEvent.MyUnit = this; Animator.PlayAnim(eAnimName.Anim_idle); }
protected void UnitModelLoad() { //추후 다시한번 수정 요망 GameObject _myUnit = UnitModelHelper.PCModelLoad(townunitData.character_id, townunitData.EquipHeadItemIdx, townunitData.costume_id, townunitData.EquipClothItemIdx, townunitData.EquipWeaponItemIdx, townunitData.isHideCostume, ref WeaponEffects, QualityManager.instance.GetModelQuality()); //Item.CostumeInfo cosinfo = _LowDataMgr.instance.GetLowDataCostumeInfo(townunitData.costume_id); uint skillSetId = townunitData.SkillSetID;//애니메이션을 코스튬이 아닌 스킬셋트에서 가져온다. if (skillSetId <= 0) { switch (townunitData.character_id) { case 11000: skillSetId = 100; break; case 12000: skillSetId = 200; break; case 13000: skillSetId = 300; break; } } SkillTables.SkillSetInfo skillSetInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId); //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 ads = _LowDataMgr.instance.TownAniInfoSetting(skillSetInfo.AniPath, _myUnit, skillSetInfo.AniId, false); //inven.GetEquipCostume().GetLowData().AniId); _myUnit.transform.parent = transform; _myModel = _myUnit; Animator.Init(_myUnit, _myUnit.animation, ads); Animator.Animation.playAutomatically = false; Model.Init(gameObject, _myUnit); AniEvent aniEvent = _myUnit.AddComponent <AniEvent>(); aniEvent.MyUnit = this; Animator.PlayAnim(eAnimName.Anim_idle); SetShaderEnvironment(); }
////////////////////////여기부터 황비홍 프로젝트 신규 함수 /// <summary> /// 플레이어 생성 /// </summary> /// <param name="parent"></param> /// <param name="charIdx"></param> /// <param name="HeadItemIdx"></param> /// <param name="CostumeItemIdx"></param> /// <param name="ClothItemIdx"></param> /// <param name="WeaponItemIdx"></param> /// <param name="HideCostume"></param> /// <returns></returns> /// bool isLighting, bool isShadow, bool isRim=true, bool isEff=true public static GameObject CreatePcUIModel(string panelName, Transform parent, uint charIdx, uint HeadItemIdx, uint CostumeItemIdx, uint ClothItemIdx, uint WeaponItemIdx, uint skillSetId, byte aniState, bool HideCostume, bool isShadow, bool isWeapon = true) { if (0 < parent.childCount) { int count = parent.childCount; while (0 < count) { --count; if (parent.GetChild(count).name.Contains("pc"))//혹시모를 예외처리 { GameObject.Destroy(parent.GetChild(count).gameObject); } } } GameObject[] effect = isWeapon ? new GameObject[2] : null; UnitAnimator unitAnim = new UnitAnimator(); //뻑날때를 대비해 예외처리 GameObject _unit = UnitModelHelper.PCModelLoadRimSpec(charIdx, HeadItemIdx, CostumeItemIdx, ClothItemIdx, WeaponItemIdx, HideCostume, ref effect, isWeapon); //Item.CostumeInfo lowData = _LowDataMgr.instance.GetLowDataCostumeInfo(CostumeItemIdx); Resource.AniInfo[] ads = null; SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId); if (setInfo != null) { ads = _LowDataMgr.instance.UIAniInfoSetting(setInfo.AniPath, _unit, setInfo.AniId, aniState); } if (effect != null)//이펙트의 사이즈를 조정해야 하는데 미리 켜져있을 경우 활활 거리는게 있어서 추가함. { int loopCount = effect.Length; for (int i = 0; i < loopCount; i++) { if (effect[i] != null) { effect[i].SetActive(false); } } } unitAnim.Init(_unit, _unit.animation, ads); unitAnim.Animation.playAutomatically = false; unitAnim.PlayAnim(eAnimName.Anim_idle); UIModel model = _unit.AddComponent <UIModel>(); model.Init(parent, unitAnim, effect, charIdx == 13000, isShadow, panelName); return(_unit); }
protected override void Init_Model() { //AssetbundleLoader.AssetLoad( AssetbundleLoader.CreateSuffixForPlatform( resInfo.modelFile ), OnLoadedModelGO ); //추후 다 어셋번들에서 읽어오게 해야함 GameObject _unit = null; if (syncData._isPartner) { Partner.PartnerDataInfo partner = _LowDataMgr.instance.GetPartnerInfo(syncData._partnerID); _unit = UnitModelHelper.PartnerModelLoad(syncData._partnerID, ref WeaponEffects, true, partner.RightWeaDummy, partner.LeftWeaDummy, QualityManager.instance.GetModelQuality()); CharInfo.animDatas = _LowDataMgr.instance.AniInfoSetting(partner.prefab, _unit, partner.AniId); } else { _unit = UnitModelHelper.PCModelLoad(syncData._charIdx, syncData._HeadItem, syncData._CostumeItem, syncData._ClothItem, syncData._WeaponItem, syncData._HideCostume, ref WeaponEffects, QualityManager.instance.GetModelQuality()); //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 CharInfo.animDatas = _LowDataMgr.instance.AniInfoSetting(_LowDataMgr.instance.GetLowDataSkillSet(syncData._SkillSetId).AniPath,//_LowDataMgr.instance.GetLowDataCostumeInfo(syncData._CostumeItem).Bodyprefab, _unit, _LowDataMgr.instance.GetLowDataSkillSet(syncData._SkillSetId).AniId); //_LowDataMgr.instance.GetLowDataCostumeInfo(syncData._CostumeItem).AniId); } CharInfo.MaxAnimCombo = UnitDataFactory.CountingMaxAnimCombo(CharInfo.animDatas); OnLoadedModelGO(_unit); NGUITools.SetLayer(gameObject, 14); SetShaderEnvironment(); }
protected void UnitModelLoad() { NetData._UserInfo inven = NetData.instance.GetUserInfo(); uint HELMETID = 0; uint CLOTHID = 0; uint WEAPONID = 0; uint CostumeID = 0; getModelInfo(inven, ref HELMETID, ref CLOTHID, ref WEAPONID, ref CostumeID); //예외처리는 어케하냐 GameObject _myUnit = UnitModelHelper.PCModelLoad(inven.GetCharIdx(), HELMETID, CostumeID, CLOTHID, WEAPONID, inven.isHideCostum, ref WeaponEffects, QualityManager.instance.GetModelQuality()); UnitModelLoadPart2(_myUnit, CostumeID); }
protected IEnumerator UnitModelLoadAsync() { NetData._UserInfo inven = NetData.instance.GetUserInfo(); uint HELMETID = 0; uint CLOTHID = 0; uint WEAPONID = 0; uint CostumeID = 0; getModelInfo(inven, ref HELMETID, ref CLOTHID, ref WEAPONID, ref CostumeID); GameObject _myUnit = null; yield return(StartCoroutine(UnitModelHelper.PCModelLoadAsync(inven.GetCharIdx(), HELMETID, CostumeID, CLOTHID, WEAPONID, inven.isHideCostum, (retVal1, retVal2) => { _myUnit = retVal1; WeaponEffects = retVal2; }, QualityManager.instance.GetModelQuality()))); uint skillSetId = inven.GetEquipSKillSet().SkillSetId; if (skillSetId <= 0) { switch (inven._userCharIndex) { case 11000: skillSetId = 100; break; case 12000: skillSetId = 200; break; case 13000: skillSetId = 300; break; } } UnitModelLoadPart2(_myUnit, skillSetId); }
protected void UnitModelLoad() { //추후 다시한번 수정 요망 GameObject _myUnit = UnitModelHelper.ModelLoadtoString(_npcData.NPCPref); //GameObject _myUnit = UnitModelHelper.PCModelLoad(townunitData.character_id, // townunitData.EquipHeadItemIdx, // townunitData.costume_id, // townunitData.EquipClothItemIdx, // townunitData.EquipWeaponItemIdx, // townunitData.isHideCostume, ref WeaponEffects); //Item.CostumeInfo cosinfo = _LowDataMgr.instance.GetLowDataCostumeInfo(townunitData.costume_id); ////무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 _ads = _LowDataMgr.instance.TownAniInfoSetting(_npcData.NPCPref, _myUnit, _npcData.AniID, false); ////inven.GetEquipCostume().GetLowData().AniId); _myUnit.transform.parent = transform; _myModel = _myUnit; Animator.Init(_myUnit, _myUnit.animation, _ads); Animator.Animation.playAutomatically = false; Model.Init(gameObject, _myUnit); AniEvent aniEvent = _myUnit.AddComponent <AniEvent>(); aniEvent.MyUnit = this; Animator.PlayAnim(eAnimName.Anim_idle); }
public static GameObject CreateTalkNPC(string PanelName, Transform parent, string NPCPrefName, bool isRim, bool UseUICamera = true) { if (0 < parent.childCount) { GameObject.DestroyImmediate(parent.GetChild(0).gameObject); } //GameObject[] effect = isCreateEffect ? new GameObject[2] : null; //UnitAnimator unitAnim = new UnitAnimator(); bool isLight = false; string lightModelName = NPCPrefName; if (ResourceMgr.Load(string.Format("Character/Prefab/{0}_s", lightModelName)) != null) { lightModelName = string.Format("{0}_s", NPCPrefName); isLight = true; } GameObject _unit = UnitModelHelper.ModelLoadtoString(lightModelName); if (isLight) { int childCount = _unit.transform.childCount; for (int i = 0; i < childCount; i++) { if (_unit.transform.GetChild(i).renderer == null) { continue; } Material[] m = _unit.transform.GetChild(i).renderer.materials; if (m == null) { continue; } int mCount = m.Length; for (int j = 0; j < mCount; j++) { m[j].SetFloat("_IsRim", isRim ? 1 : 0); } } } //PartnerTableLowData.PartnerInfo lowData = _LowDataMgr.instance.GetPartnerInfo(partnerIdx); //_ResourceLowData.AniTableInfo[] ads = _LowDataMgr.instance.TownAniInfoSetting(lowData.prefab, _unit, lowData.AniId); /* * if (effect != null)//이펙트의 사이즈를 조정해야 하는데 미리 켜져있을 경우 활활 거리는게 있어서 추가함. * { * int loopCount = effect.Length; * for (int i = 0; i < loopCount; i++) * { * if (effect[i] != null) * effect[i].SetActive(false); * } * } * * unitAnim.Init(_unit, _unit.animation, ads); * unitAnim.Animation.playAutomatically = false; * unitAnim.PlayAnim(isBattleIdle ? eAnimName.Anim_battle_idle : eAnimName.Anim_idle); */ UIModel model = _unit.AddComponent <UIModel>(); model.Init(PanelName, parent, NPCPrefName.Contains("pc_d_"), UseUICamera); return(_unit); }
////////////////////////여기부터 황비홍 프로젝트 신규 함수 /// <summary> 파트너 생성 </summary> public static GameObject CreatePartnerUIModel(Transform parent, uint partnerIdx, byte aniState, bool isLight, bool isShadow, string panelName) { if (0 < parent.childCount) { int count = parent.childCount; while (0 < count) { --count; if (parent.GetChild(count).name.Contains("par"))//혹시모를 예외처리 { GameObject.Destroy(parent.GetChild(count).gameObject); } } } GameObject[] effect = isLight ? new GameObject[2] : null;//강제로 isLight가 false라면 이펙트 생성 하지않는다. UnitAnimator unitAnim = new UnitAnimator(); Partner.PartnerDataInfo lowData = _LowDataMgr.instance.GetPartnerInfo(partnerIdx); string leftWeaDummy = lowData.LeftWeaDummy; if (!string.IsNullOrEmpty(leftWeaDummy) && leftWeaDummy.Contains("Fx_par_jaejee_weapon")) { leftWeaDummy = ""; //string.Format("{0}_UI", leftWeaDummy);//재지의 경우 UI용으로 별도 가지고있다. } //GameObject _unit = UnitModelHelper.PartnerModelLoad(partnerIdx, ref effect, isLight, lowData.RightWeaDummy, leftWeaDummy, QualityManager.instance.GetModelQuality()); // UI용 파트너는 퀄리티 설정에 상관없이 항상 _s 프리팹 사용 // kyh. GameObject _unit = UnitModelHelper.PartnerModelLoad(partnerIdx, ref effect, isLight, lowData.RightWeaDummy, leftWeaDummy, ModelQuality.UI); int childCount = _unit.transform.childCount; for (int i = 0; i < childCount; i++) { if (_unit.transform.GetChild(i).renderer == null) { continue; } Material[] m = _unit.transform.GetChild(i).renderer.materials; if (m == null) { continue; } int mCount = m.Length; for (int j = 0; j < mCount; j++) { m[j].SetFloat("_IsRim", 0); } } //졌을경우 Resource.AniInfo[] ads = _LowDataMgr.instance.UIAniInfoSetting( lowData.prefab, _unit, lowData.AniId, aniState); if (effect != null)//이펙트의 사이즈를 조정해야 하는데 미리 켜져있을 경우 활활 거리는게 있어서 추가함. { int loopCount = effect.Length; for (int i = 0; i < loopCount; i++) { if (effect[i] != null) { effect[i].SetActive(false); } } } unitAnim.Init(_unit, _unit.animation, ads); unitAnim.Animation.playAutomatically = false; unitAnim.PlayAnim(eAnimName.Anim_idle); UIModel model = _unit.AddComponent <UIModel>(); model.Init(parent, unitAnim, effect, true, isShadow, panelName); return(_unit); }
protected IEnumerator UnitModelLoadAsync() { //추후 다시한번 수정 요망 GameObject _myUnit = null; yield return(StartCoroutine(UnitModelHelper.PCModelLoadAsync(townunitData.character_id, townunitData.EquipHeadItemIdx, townunitData.costume_id, townunitData.EquipClothItemIdx, townunitData.EquipWeaponItemIdx, townunitData.isHideCostume, (retval, retval2) => { _myUnit = retval; WeaponEffects = retval2; }, QualityManager.instance.GetModelQuality()))); //Item.CostumeInfo cosinfo = _LowDataMgr.instance.GetLowDataCostumeInfo(townunitData.costume_id); if (_myUnit == null) { Debug.LogError(string.Format("charId={0}, headIdx={1}, costumeId={2}, clothIdx={3}, weaponIdx={4}, isHide={5}, roleId={6}, nickName={7}", townunitData.character_id, townunitData.EquipHeadItemIdx, townunitData.costume_id, townunitData.EquipClothItemIdx, townunitData.EquipWeaponItemIdx, townunitData.isHideCostume, townunitData.c_usn, townunitData.nickname )); yield return(null); } uint skillSetId = townunitData.SkillSetID;//애니메이션을 코스튬이 아닌 스킬셋트에서 가져온다. if (skillSetId <= 0) { switch (townunitData.character_id) { case 11000: skillSetId = 100; break; case 12000: skillSetId = 200; break; case 13000: skillSetId = 300; break; } } SkillTables.SkillSetInfo skillSetInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId); //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다 ads = _LowDataMgr.instance.TownAniInfoSetting(skillSetInfo.AniPath, _myUnit, skillSetInfo.AniId, false); //inven.GetEquipCostume().GetLowData().AniId); _myUnit.transform.parent = transform; _myModel = _myUnit; Animator.Init(_myUnit, _myUnit.animation, ads); Animator.Animation.playAutomatically = false; Model.Init(gameObject, _myUnit); AniEvent aniEvent = _myUnit.AddComponent <AniEvent>(); aniEvent.MyUnit = this; Animator.PlayAnim(eAnimName.Anim_idle); SetShaderEnvironment(); }