Ejemplo n.º 1
0
    ////////////////////////여기부터 황비홍 프로젝트 신규 함수
    /// <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);
    }
Ejemplo n.º 2
0
    /// <summary> 몬스터 생성 </summary>
    public static GameObject CreateMonsterUIModel(Transform parent, uint mobId, bool isBattleIdle, bool isRim, bool isShadow, string panelName)
    {
        bool isLight = false;

        Mob.MobInfo mobLowData = _LowDataMgr.instance.GetMonsterInfo(mobId);
        string      prefabName = mobLowData.prefab;

        if (0 < parent.childCount)
        {
            if (parent.GetChild(0).name.Contains(prefabName))
            {
                return(null);
            }

            GameObject.DestroyImmediate(parent.GetChild(0).gameObject);
        }

        if (ResourceMgr.Load(string.Format("Character/Prefab/{0}_s", prefabName)) != null)
        {
            isLight    = true;
            prefabName = string.Format("{0}_s", prefabName);
        }

        GameObject _unit = GameObject.Instantiate(Resources.Load(string.Format("Character/Prefab/{0}", prefabName))) as GameObject;

        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);
                }
            }
        }

        Resource.AniInfo[] ads = _LowDataMgr.instance.TownAniInfoSetting(mobLowData.prefab, _unit, mobLowData.AniId, true);

        UnitAnimator unitAnim = new UnitAnimator();

        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(parent, unitAnim, null, true, isShadow, panelName);

        return(_unit);
    }
Ejemplo n.º 3
0
    ////////////////////////여기부터 황비홍 프로젝트 신규 함수
    /// <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);
    }