Ejemplo n.º 1
0
    /// <summary>
    /// 装配角色
    /// </summary>
    /// <param name="playerKind"></param>
    /// <param name="isHero"></param>
    /// <returns></returns>
    private GameObject AssemblyPlayer(PlayerGenerateConfigData configData, byte playerKind, bool isHero, string avatarName)
    {
        string defaultAnim, defaultAvatar, defaultWeapon;

        string[] attachAnims, weaponPosition;

        defaultAnim    = configData.DefaultAnim;
        attachAnims    = configData.Animations;
        defaultAvatar  = string.IsNullOrEmpty(avatarName)? configData.DefaultAvatar:avatarName;
        defaultWeapon  = configData.DefaultWeapon;
        weaponPosition = configData.WeaponPosition;

        //如果是客户端主角,使用高模,不是则使用低模
        var player = isHero ? RoleGenerate.GenerateRole(configData.PlayerName, defaultAvatar, isHero) :
                     RoleGenerate.GenerateRole(configData.PlayerName, defaultAvatar, isHero, MESHDENSITY.LOW);

        player.name = configData.PlayerName;

        RoleGenerate.AttachAnimation(player, configData.PlayerName, defaultAnim, attachAnims);

        var weapon = Weapons.SingleOrDefault(P => P.name == defaultWeapon);

        RoleGenerate.AttachWeapon(player, weaponPosition, weapon, null);

        return(player);
    }
Ejemplo n.º 2
0
    public void PlayAnimation(string[] OnceWeaponPos, string[] OnceAnimationNames, PackToFashingEff OnceEffs, string[] LoopWeaponPos, string[] LoopAnimationNames, PackToFashingEff Loopeffs)
    {
        List <AnimationClip> OnecAnimationClips = new List <AnimationClip>();

        if (OnceAnimationNames != null)
        {
            OnceAnimationNames.ApplyAllItem(c => OnecAnimationClips.Add(m_hero.animation.GetClip(c)));
        }

        List <AnimationClip> LoopAnimationClips = new List <AnimationClip>();

        LoopAnimationNames.ApplyAllItem(c => LoopAnimationClips.Add(m_hero.animation.GetClip(c)));

        StopCoroutine("PlayAnimation");
        StopCoroutine("PlayOnceAnimation");
        StopCoroutine("PlayeOnceAni");
        if (OnecAnimationClips.Count > 0)
        {
            StartCoroutine(PlayAnimation(OnceWeaponPos, OnecAnimationClips, OnceEffs, LoopWeaponPos, LoopAnimationClips[0], Loopeffs));
        }
        else
        {
            RoleGenerate.AttachWeapon(this.m_hero, LoopWeaponPos);
            PlayLoopAnimation(LoopAnimationClips[0], Loopeffs);
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// 改变主角武器
        /// </summary>
        /// <param name="weaponName"></param>
        public IEnumerator ChangeDefulsWeapon()
        {
            /*
             * yield return null;
             * byte Vocation = (byte)PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
             * //string[] ItemWeaponPosition = playerGenerateConfigData.Item_WeaponPosition;
             * //string[] weaponPosition = playerGenerateConfigData.WeaponPosition;
             * var weaponObj = PlayerFactory.Instance.GetDefulWeaponPrefab(Vocation);
             * //RoleGenerate.AttachWeapon(this.m_hero, ItemWeaponPosition, weaponObj);
             * //RoleGenerate.AttachWeapon(PlayerManager.Instance.FindHero(), weaponPosition, weaponObj);
             * RoleGenerate.ChangeWeapon(this.m_hero, weaponObj);
             * RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponObj);
             * SetCildLayer(m_hero.transform, 25);
             * PlayerChangeWaeponAnim();
             * TraceUtil.Log("改变武器" + weaponObj);
             */
            yield return(null);

            byte Vocation  = (byte)PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
            var  weaponObj = PlayerFactory.Instance.GetDefulWeaponPrefab(Vocation);

            string[] weaponPosition = playerGenerateConfigData.Item_WeaponPosition;
            RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, weaponObj, null);
            RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponObj, null);
            SetCildLayer(m_hero.transform, 25);
            PlayerChangeWaeponAnim();
            //TraceUtil.Log("改变武器" + weaponObj + " 职业:" + Vocation);
        }
Ejemplo n.º 4
0
        void AssemblyPlayer(int VocationID)
        {
            if (this.m_hero != null)
            {
                Destroy(m_hero);
            }
            playerGenerateConfigData = PlayerDataManager.Instance.GetUIItemData((byte)VocationID);
            this.m_hero = RoleGenerate.GenerateRole(playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAvatar, true);
            this.m_hero.transform.parent           = CreatHeroModelTransform;
            this.m_hero.transform.localEulerAngles = Vector3.zero;
            this.m_hero.transform.localPosition    = Vector3.zero;
            RoleGenerate.AttachAnimation(this.m_hero, playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAnim, playerGenerateConfigData.Animations);
            string[] weaponPosition = GetWeaponPosition();
            this.m_hero.gameObject.AddComponent <RoleViewClickEvent>();
            RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, playerGenerateConfigData.WeaponObj, null);

            var shadowEff = GameObject.Instantiate(playerGenerateConfigData.ShadowEffect) as GameObject;

            shadowEff.name                    = "shadow";
            shadowEff.transform.parent        = m_hero.transform;
            shadowEff.transform.localPosition = new Vector3(0, 1, 0);

            CreatHeroModelTransform.transform.position = MyPanelType == PanelType.FashionInfoPanel ? playerGenerateConfigData.Avatar_CharPos : playerGenerateConfigData.RoleUI_CharPos;
            CameraObj.transform.position    = m_hero.transform.position + (MyPanelType == PanelType.FashionInfoPanel ? playerGenerateConfigData.Avatar_CameraPos : playerGenerateConfigData.RoleUI_CameraPos);
            CameraTarget.transform.position = m_hero.transform.position + (MyPanelType == PanelType.FashionInfoPanel ? playerGenerateConfigData.Avatar_CameraTargetPos : playerGenerateConfigData.RoleUI_CameraTargetPos);
            CameraObj.transform.LookAt(CameraTarget);
            this.m_hero.transform.localPosition = new Vector3(1000, 0, 0);
            //m_hero.SetActive(false);
        }
Ejemplo n.º 5
0
    /// <summary>
    /// 改变主角武器
    /// </summary>
    /// <param name="weaponName"></param>
    public void ChangeWeapon(string weaponName, GameObject weaponEff)
    {
        var weapon = Weapons.SingleOrDefault(P => P.name == weaponName);

        //configData.WeaponPosition.ApplyAllItem(P => //TraceUtil.Log("WeaponPosition:" + P));

        RoleGenerate.AttachWeapon(this.m_heroGo, m_configData.WeaponPosition, weapon, weaponEff);
    }
Ejemplo n.º 6
0
    void  ChangeWeapon(string Weapon, GameObject weaponEff)
    {
        //yield return null;
        var weaponObj = PlayerFactory.Instance.GetWeaponPrefab(Weapon);

        SetCildLayer(weaponObj.transform, 10);
        RoleGenerate.AttachWeapon(this.m_hero, m_defaultWeaponAtt, weaponObj, weaponEff);
        TraceUtil.Log("改变武器" + weaponObj);
    }
Ejemplo n.º 7
0
        /// <summary>
        /// 改变主角武器
        /// </summary>
        /// <param name="weaponName"></param>
        void ChangeDefulsWeapon(object obj)
        {
            byte Vocation  = (byte)PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
            var  weaponObj = PlayerFactory.Instance.GetDefulWeaponPrefab(Vocation);

            string[] weaponPosition = GetWeaponPosition();
            RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, weaponObj, null);
            RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponObj, null);
            SetCildLayer(m_hero.transform, 25);
            PlayerChangeWaeponAnim();
            TraceUtil.Log("改变武器" + weaponObj + " 职业:" + Vocation);
        }
Ejemplo n.º 8
0
    IEnumerator  PlayAnimation(string[] OnceWeaponPos, List <AnimationClip> OnecAnimationClips, PackToFashingEff onceEff, string[] LoopWeaponPos, AnimationClip clip, PackToFashingEff LoopEff)
    {
        RoleGenerate.AttachWeapon(this.m_hero, OnceWeaponPos);
        yield return(null);

        yield return(StartCoroutine(PlayOnceAnimation(OnecAnimationClips, onceEff)));

        RoleGenerate.AttachWeapon(this.m_hero, LoopWeaponPos);
        yield return(null);

        PlayLoopAnimation(clip, LoopEff);
    }
Ejemplo n.º 9
0
    private void MakeRole(string roleName, string avatarName, string defaultAnim, params string[] anims)
    {
        Object.DestroyImmediate(root);
        root = null;
        root = RoleGenerate.GenerateRole(roleName, avatarName);
        root.transform.Rotate(0, 180, 0);

        RoleGenerate.AttachAnimation(root, roleName, defaultAnim, anims);

        RoleGenerate.AttachWeapon(root, AttachPoint.RHWeapon, WeaponPrefab, null);

        root.animation.wrapMode = WrapMode.Loop;
    }
Ejemplo n.º 10
0
        void AssemblyPlayer(int VocationID)
        {
            /*
             * if (this.m_hero != null)
             * {
             *  Destroy(m_hero);
             * }
             * playerGenerateConfigData = PlayerDataManager.Instance.GetUIItemData((byte)VocationID) ;
             * this.m_hero = RoleGenerate.GenerateRole(playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAvatar, true);
             * this.m_hero.transform.parent = transform;
             * //this.m_hero.transform.localPosition = new Vector3(0, -8, 170);
             * this.m_hero.transform.localRotation = Quaternion.Euler(new Vector3(0,180,0));
             *
             * RoleGenerate.AttachAnimation(this.m_hero, playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAnim, playerGenerateConfigData.Animations);
             *
             * string[] weaponPosition = playerGenerateConfigData.Item_WeaponPosition;
             * //RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, playerGenerateConfigData.WeaponObj);
             *
             * ChangeHeroWeapon(null);
             *
             * PlayerIdleAnim();
             * SetCildLayer(m_hero.transform, 25);
             */
            playerGenerateConfigData = PlayerDataManager.Instance.GetUIItemData((byte)VocationID);
            this.m_hero = RoleGenerate.GenerateRole(playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAvatar, true);
            this.m_hero.transform.parent        = transform;
            this.m_hero.transform.localPosition = new Vector3(0, -8, 170);
            this.m_hero.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
            RoleGenerate.AttachAnimation(this.m_hero, playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAnim, playerGenerateConfigData.Animations);

            string[] weaponPosition = playerGenerateConfigData.Avatar_WeaponPos;
            RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, playerGenerateConfigData.WeaponObj, null);

            //光环
            this.m_heroHolo             = (GameObject)Instantiate(Eff_HeroHoloPrefab);
            m_heroHolo.transform.parent = transform;
            this.m_heroHolo.transform.Rotate(Vector3.left * 20, Space.Self);
            SetCildLayer(this.m_heroHolo.transform, 25);
            //ChangeHeroWeapon(null);
            ////SetCildLayer(m_hero.transform, 25);
            //TweenFloat.Begin(1,0,1,null,AddRotateComponentForSeconds);


            ChangeHeroFashion();
            ChangeHeroWeapon(null);

            SetCildLayer(m_hero.transform, 25);

            SetModelPisitionImmediate();
        }
Ejemplo n.º 11
0
    /// <summary>
    /// 装配角色
    /// </summary>
    private GameObject AssemblyPlayer(PlayerGenerateConfigData configData, Vector3 pos)
    {
        string defaultAnim, defaultAvatar;

        string[] attachAnims;//, weaponPosition;

        defaultAnim   = configData.DefaultAnim;
        attachAnims   = configData.Animations;
        defaultAvatar = configData.DefaultAvatar;
        //defaultWeapon = configData.DefaultWeapon;
        //weaponPosition = configData.WeaponPosition;

        var player = RoleGenerate.GenerateRole(configData.PlayerName, defaultAvatar, true);

        player.name = configData.PlayerName;

        RoleGenerate.AttachAnimation(player, configData.PlayerName, defaultAnim, attachAnims);

        PlayerBehaviour playerBehaviour = player.GetComponent <PlayerBehaviour>();

        if (playerBehaviour != null)
        {
            player.RemoveComponent <PlayerBehaviour>("PlayerBehaviour");
        }


        player.transform.position = pos;
        player.animation.CrossFade("BIdle");

        //SetPlayerShadow(player, configData.ShadowEffect);

        //挂武器 jamfing

        /*int vocation = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
         * StroyLineKey key = new StroyLineKey{ VocationID = vocation,ConditionID = GameManager.Instance.GetStoryConfigData._TriggerCondition,
         *      EctypeID = GameManager.Instance.GetStoryConfigData._EctypeID };*/
        if (StroyLineConfigManager.Instance.GetStroyLineConfig.ContainsKey(StroyLineDataManager.Instance.curStroyLineKey))
        {
            if (StroyLineConfigManager.Instance.GetStroyLineConfig[StroyLineDataManager.Instance.curStroyLineKey].WeaponType == 1)
            {
                string[] ItemWeaponPosition = configData.WeaponPosition;
                var      weaponObj          = PlayerFactory.Instance.GetWeaponPrefab(configData.DefaultWeapon);
                RoleGenerate.AttachWeapon(player, ItemWeaponPosition, weaponObj, null);
            }
        }
        return(player);
    }
Ejemplo n.º 12
0
        /// <summary>
        /// 改变主角武器
        /// </summary>
        /// <param name="weaponName"></param>
        void  ChangeDefulsWeapon(bool showAnim)
        {
            //yield return null;
            byte Vocation  = (byte)PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
            var  weaponObj = PlayerFactory.Instance.GetDefulWeaponPrefab(Vocation);

            string[] weaponPosition = playerGenerateConfigData.Item_WeaponPosition;
            RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, weaponObj, null);
            RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponObj, null);
            SetCildLayer(m_hero.transform, 25);
            if (showAnim)
            {
                PlayerChangeWaeponAnim();
            }
            else
            {
                PlayerIdleAnim();
            }
            TraceUtil.Log("改变武器" + weaponObj + " 职业:" + Vocation);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 改变主角武器
        /// </summary>
        /// <param name="weaponName"></param>
        void ChangeWeapon(string Weapon, bool showAnm, GameObject WeaponEff)
        {
            // yield return null;
            string[] ItemWeaponPosition = playerGenerateConfigData.Item_WeaponPosition;
            var      weaponObj          = PlayerFactory.Instance.GetWeaponPrefab(Weapon);

            RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponObj, WeaponEff);
            RoleGenerate.AttachWeapon(this.m_hero, ItemWeaponPosition, weaponObj, WeaponEff);
            //RoleGenerate.ChangeWeapon(this.m_hero, weaponObj);
            SetCildLayer(m_hero.transform, 25);
            if (showAnm)
            {
                PlayerChangeWaeponAnim();
            }
            else
            {
                PlayerIdleAnim();
            }
            TraceUtil.Log("改变武器" + weaponObj);
        }
Ejemplo n.º 14
0
        IEnumerator ChangeWeapon(long weaponID)
        {
            yield return(null);

            if (this.m_hero != null)
            {
                var item = ItemDataManager.Instance.GetItemData((int)weaponID);
                if (item != null)
                {
                    var      weaponGO       = PlayerFactory.Instance.GetWeaponPrefab(item._ModelId);
                    string[] weaponPosition = playerGenerateConfigData.Item_WeaponPosition;
                    var      WeaponEff      = (ItemDataManager.Instance.GetItemData(item._goodID) as EquipmentData).WeaponEff;
                    RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, weaponGO, WeaponEff);
                    RoleGenerate.ChangeWeapon(PlayerManager.Instance.FindHero(), weaponGO, WeaponEff);
                    SetCildLayer(m_hero.transform, 25);
                }
                else
                {
                }
            }
        }
Ejemplo n.º 15
0
 void AssemblyPlayer(int VocationID)
 {
     if (this.m_hero != null)
     {
         Destroy(m_hero);
     }
     playerGenerateConfigData = PlayerDataManager.Instance.GetUIItemData((byte)VocationID);
     this.m_hero = RoleGenerate.GenerateRole(playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAvatar, true);
     this.m_hero.transform.parent        = transform;
     this.m_hero.transform.localScale    = Vector3.one;
     this.m_hero.transform.localPosition = new Vector3(0, -8f, 21);
     this.m_hero.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
     RoleGenerate.AttachAnimation(this.m_hero, playerGenerateConfigData.PlayerName, playerGenerateConfigData.DefaultAnim, playerGenerateConfigData.Animations);
     string[] weaponPosition = playerGenerateConfigData.Avatar_WeaponPos;
     this.m_hero.gameObject.AddComponent <RoleViewClickEvent>();
     RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, playerGenerateConfigData.WeaponObj, null);
     ////SetCildLayer(m_hero.transform, 25);
     TweenFloat.Begin(1, 0, 1, null, AddRotateComponentForSeconds);
     ChangeHeroFashion();
     ChangeHeroWeapon(null, false);
     SetCildLayer(m_hero.transform, 25);
 }
Ejemplo n.º 16
0
    /// <summary>
    /// 武器多个挂载点
    /// </summary>
    /// <param name="root"></param>
    /// <param name="attachPoints"></param>
    /// <param name="weapon"></param>
    /// <returns></returns>
    public static bool AttachWeapon(GameObject root, string[] attachPoints, GameObject weapon, GameObject WeaponEff)
    {
        bool flag = false;

        if (weapon != null)
        {
            ClearPlayerWeapon(root);

            AttachPoint attackPoint;
            bool        hasConfig = false;
            foreach (string pos in attachPoints)
            {
                if (Enum.IsDefined(typeof(AttachPoint), pos))
                {
                    attackPoint = (AttachPoint)Enum.Parse(typeof(AttachPoint), pos);
                    AttachWeapon(root, attackPoint, weapon, WeaponEff);
                    hasConfig = true;
                }
                else
                {
                    TraceUtil.Log(pos);
                }
            }

            if (!hasConfig)
            {
                attackPoint = AttachPoint.RHWeapon;
                RoleGenerate.AttachWeapon(root, attackPoint, weapon, WeaponEff);
            }
        }
        var playerBehaviour = root.GetComponent <PlayerBehaviour>();

        if (playerBehaviour != null && PlayerManager.Instance.m_playerHideFlag)
        {
            //playerBehaviour.RefreshRenderCach();
            PlayerManager.Instance.HideAllPlayerButHero(true);
        }
        return(flag);
    }
Ejemplo n.º 17
0
 /// <summary>
 /// 改变主角武器
 /// </summary>
 /// <param name="weaponName"></param>
 public void ChangeWeapon(GameObject weapon, GameObject weaponEff)
 {
     string[] weaponPosition = m_configData.WeaponPosition.Split('+');
     RoleGenerate.AttachWeapon(this.m_hero, weaponPosition, weapon, weaponEff);
     SetCildLayer(m_hero.transform, 25);
 }