Beispiel #1
0
    // 创建坐骑
    public void InitMount(Obj_OtherPlayer PlayerObj, int nMountID)
    {
        if (PlayerObj == null)
        {
            return;
        }

        Tab_MountBase MountBase = TableManager.GetMountBaseByID(nMountID, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + nMountID);
            return;
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return;
        }
        GameObject Obj = PlayerObj.gameObject;

        if (Obj == null)
        {
            return;
        }

        //PlayerObj.MountID = nMountID;
        m_PlayerObj = PlayerObj;

        Singleton <ObjManager> .GetInstance().ReloadModel(Obj, MountTable.MountModel, Obj_Mount.OnAsycLoadMount, PlayerObj, MountTable.BindPoint);
    }
    void HandleFitOnMount(int nGoodsId, int nMountID)
    {
        m_FitOnVisual.Clear();

        Tab_MountBase tabMountBase = TableManager.GetMountBaseByID(nMountID, 0);

        if (tabMountBase == null)
        {
            return;
        }

        Tab_CharMount tabCharMount = TableManager.GetCharMountByID(tabMountBase.ModelID, 0);

        if (tabCharMount == null)
        {
            return;
        }

        Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(tabCharMount.FakeObjID, 0);

        if (tabFakeObject == null)
        {
            return;
        }

        m_FitOnVisual.MountGoodsID = nGoodsId;
        m_FitOnVisual.MountID      = nMountID;

        m_FitOnFakeObj.initFakeObject(tabCharMount.FakeObjID, GameManager.gameManager.ActiveScene.FakeObjTrans, out m_FitOnGameObject);
        m_ModelDrag.ModelTrans = m_FitOnFakeObj.ObjAnim.transform;
    }
Beispiel #3
0
    void initMountFakeObj()
    {
        if (m_MountItem.Count > 0)
        {
            int nMountID = 0;
            if (Singleton <ObjManager> .GetInstance().MainPlayer&&
                Singleton <ObjManager> .GetInstance().MainPlayer.GetEquipMountID() > 0)
            {
                nMountID = Singleton <ObjManager> .GetInstance().MainPlayer.GetEquipMountID();
            }

            if (nMountID <= 0)
            {
                for (int i = 0; i < MountParam.Max_MountCollect_Count; i++)
                {
                    Tab_MountBase MountBase = TableManager.GetMountBaseByID(i, 0);
                    if (MountBase == null)
                    {
                        continue;
                    }

                    bool bCollectFlag = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(i);
                    if (bCollectFlag == true)
                    {
                        nMountID = i;
                        break;
                    }
                }
            }

            string strName = "";
            if (nMountID <= 0)
            {
                nMountID = m_MountItem[0];
                strName += "n";
            }

            strName += "MountItem" + nMountID / 10 + nMountID % 10;
            Transform gItemObjTransform = m_MountRoot_UIGrid.transform.FindChild(strName);
            if (gItemObjTransform != null && gItemObjTransform.gameObject)
            {
                MountItem MountItemObj = gItemObjTransform.gameObject.GetComponent <MountItem>();
                if (MountItemObj)
                {
                    MountItemObj.MountItemClick();
                    //MountItemClick(MountItemObj.MountID);
                }
            }
        }
    }
    string GetMountSpeedValueByItem(int value)
    {
        Tab_UsableItem tUsable = TableManager.GetUsableItemByID(value, 0);

        if (tUsable != null)
        {
            int           nID    = tUsable.UseParamA;
            Tab_MountBase tMount = TableManager.GetMountBaseByID(nID, 0);
            if (tMount != null)
            {
                int speed = tMount.Speed;
                return("+" + speed.ToString() + "%");
            }
        }
        return("");
    }
Beispiel #5
0
    public override void OnMountOff(int mountId)
    {
        base.OnMountOff(mountId);
        ///清除坐骑绑定点下的粒子
        for (int i = 0; i < m_effectBindPointsOnMountList.Count; i++)
        {
            if (m_effectBindPointCache.ContainsKey(m_effectBindPointsOnMountList[i]))
            {
                ClearBindPoint(m_effectBindPointCache[m_effectBindPointsOnMountList[i]]);
            }
        }
        ///清除坐骑相关粒子计数器 和 播放列表
        for (int i = 0; i < m_effectBindToMountList.Count; i++)
        {
            if (m_EffectCountCache.ContainsKey(m_effectBindToMountList[i]))
            {
                m_EffectCountCache.Remove(m_effectBindToMountList[i]);
            }
            if (m_NeedPlayEffectIdCacheList.Contains(m_effectBindToMountList[i]))
            {
                m_NeedPlayEffectIdCacheList.Remove(m_effectBindToMountList[i]);
            }
        }
        m_cachedParticleScaler = null;
        if (GameManager.gameManager.ActiveScene != null)
        {
            GameManager.gameManager.ActiveScene.OnMainPlayerMountOff();
        }
        Tab_MountBase MountBase = TableManager.GetMountBaseByID(mountId, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + mountId);
            return;
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return;
        }
        PlayEffect(MountTable.EffectMountOff);
        StopEffect(MountTable.MoveEffectId);
    }
Beispiel #6
0
 void SetNameLabel()
 {
     if (m_eItemType == ITEM_TYPE.TYPE_ITEM)
     {
         Tab_CommonItem tabCommonItem = TableManager.GetCommonItemByID(m_ItemID, 0);
         if (tabCommonItem != null)
         {
             m_Name           = tabCommonItem.Name;
             m_NameLabel.text = m_Name;
             int nExistTime = tabCommonItem.ExistTime;
             if (nExistTime > 0)
             {
                 m_NameLabel.text += StrDictionary.GetClientDictionaryString("#{3316}", (float)nExistTime / 60f / 24f);
             }
         }
     }
     else if (m_eItemType == ITEM_TYPE.TYPE_FASHION)
     {
         Tab_FashionData tabFashionData = TableManager.GetFashionDataByID(m_ItemID, 0);
         if (tabFashionData != null)
         {
             m_Name           = tabFashionData.Name;
             m_NameLabel.text = m_Name;
         }
     }
     else if (m_eItemType == ITEM_TYPE.TYPE_FELLOW)
     {
         Tab_CabalFellowAttr tabFellowAttr = TableManager.GetCabalFellowAttrByID(m_ItemID, 0);
         if (tabFellowAttr != null)
         {
             m_Name           = tabFellowAttr.Name;
             m_NameLabel.text = m_Name;
         }
     }
     else if (m_eItemType == ITEM_TYPE.TYPE_MOUNT)
     {
         Tab_MountBase tabMountBase = TableManager.GetMountBaseByID(m_ItemID, 0);
         if (tabMountBase != null)
         {
             m_Name           = tabMountBase.Name;
             m_NameLabel.text = m_Name;
         }
     }
 }
Beispiel #7
0
    // 创建坐骑 fakeobj
    private bool CreateMountFakeObj(int nCurMountID)
    {
        if (null != m_MountFakeObj)
        {
            DestroyMountFakeObj();
        }
        Tab_MountBase MountBase = TableManager.GetMountBaseByID(nCurMountID, 0);

        if (MountBase == null)
        {
            return(false);
        }

        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            return(false);
        }

        m_MountFakeObj = new FakeObject();
        if (m_MountFakeObj == null)
        {
            return(false);
        }

        if (false == m_MountFakeObj.initFakeObject(MountTable.FakeObjID, GameManager.gameManager.ActiveScene.FakeObjTrans))
        {
            return(false);
        }
        m_ModelDrag.ModelTrans = m_MountFakeObj.ObjAnim.transform;

        GameManager.gameManager.ActiveScene.InitFakeObjRoot(m_FakeObjTopLeft, m_FakeObjBottomRight);
        GameManager.gameManager.ActiveScene.ShowFakeObj();
        return(true);
    }
Beispiel #8
0
    public void MountItemClick(int nMountID)
    {
        if (m_CurMountID == nMountID)
        {
            UpdateMountLeftTime();
            return;
        }

        if (m_CurMountID > 0)
        {
            if (m_MountRoot_UIGrid != null)
            {
                // 去除上次点击效果
                string strName      = "";
                bool   bCollectFlag = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(m_CurMountID);
                if (bCollectFlag == false)
                {
                    strName += "n";
                }
                strName += "MountItem" + m_CurMountID / 10 + m_CurMountID % 10;
                Transform gLastItemTrans = m_MountRoot_UIGrid.transform.FindChild(strName);
                if (gLastItemTrans != null)
                {
                    gLastItemTrans.gameObject.GetComponent <MountItem>().DisableItemUI();
                }
            }
        }

        m_CurMountID = nMountID;
        UpdateMountLeftTime();

        if (m_CurMountID <= 0)
        {
            return;
        }

        // 销毁模型FakeObj
        if (m_MountFakeObj != null)
        {
            DestroyMountFakeObj();
        }

        if (false == CreateMountFakeObj(nMountID))
        {
            LogModule.DebugLog("[MountAndFellowLogic:CreateMountFakeObj()] return false!");
            return;
        }

        // 修改 描述性文字
        Tab_MountBase MountBase = TableManager.GetMountBaseByID(nMountID, 0);

        if (MountBase != null)
        {
            m_MountName.text   = MountBase.Name;
            m_MountDec.text    = MountBase.MountDesc;
            m_MountSource.text = MountBase.MountSource;
            m_SpeedDec.text    = GetSpeedPlus(MountBase.Speed);
        }
        else
        {
            m_MountName.text   = "";
            m_MountDec.text    = "";
            m_MountSource.text = "";
            m_SpeedDec.text    = "";
        }

        RefreshInfo();
    }
Beispiel #9
0
    void CreateChildForGrid(GameObject resItem, GameObject gParentObj, bool bCollectFlag, int i, Tab_MountBase mountTab)
    {
        if (mountTab == null || null == GameManager.gameManager.PlayerDataPool)
        {
            return;
        }

        GameObject gMountItem = Utils.BindObjToParent(resItem, gParentObj, "MountItem" + i / 10 + i % 10);

        if (null != gMountItem)
        {
            MountItem mountItemScript = gMountItem.GetComponent <MountItem>();
            if (null != mountItemScript)
            {
                mountItemScript.MountID = i;
                mountItemScript.SetName(mountTab.Name);
                mountItemScript.SetIcon(mountTab.MountIcon);

                // 是否有该坐骑
                if (bCollectFlag)
                {
                    mountItemScript.SetCollectFlag(true);

                    //added by mawenbin
                    //获取新坐骑,红点提示,控制显示
                    bool bRemindFlag = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountRemindFlag(i);
                    mountItemScript.SetRemindFlag(bRemindFlag);
                }
                else
                {
                    gMountItem.name = "n" + gMountItem.name;
                }

                m_MountItem.Add(i);
            }
        }
    }
Beispiel #10
0
    void OnLoadMountItem(GameObject resItem, object param)
    {
        if (null == resItem)
        {
            return;
        }

        List <int> unSortedList = new List <int> ();

        for (int i = 0; i < MountParam.Max_MountCollect_Count; i++)
        {
            Tab_MountBase MountBase = TableManager.GetMountBaseByID(i, 0);
            if (MountBase == null)
            {
                continue;
            }

            bool bCollectFlag = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(i);
            // 未获得并且不显示
            if (MountBase.IsShowInUI == 0 && bCollectFlag == false)
            {
                continue;
            }

            GameObject gParentObj = m_MountRoot_UIGrid;
            if (null == gParentObj)
            {
                return;
            }

            // bCollectFlag
            if (bCollectFlag == false)
            {
                unSortedList.Add(i);
                continue;
            }
            CreateChildForGrid(resItem, gParentObj, bCollectFlag, i, MountBase);
        }

        foreach (var item in unSortedList)
        {
            Tab_MountBase MountBase = TableManager.GetMountBaseByID(item, 0);
            if (MountBase == null)
            {
                continue;
            }

            bool bCollectFlag = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(item);
            // 未获得并且不显示
            if (MountBase.IsShowInUI == 0 && bCollectFlag == false)
            {
                continue;
            }

            GameObject gParentObj = m_MountRoot_UIGrid;
            if (null == gParentObj)
            {
                return;
            }

            CreateChildForGrid(resItem, gParentObj, bCollectFlag, item, MountBase);
        }

        AutoFlagClick(GameManager.gameManager.PlayerDataPool.m_objMountParam.AutoFlagMountID);

        m_MountRoot_UIGrid.GetComponent <UICabalGrid>().sorted        = true;
        m_MountRoot_UIGrid.GetComponent <UICabalGrid>().repositionNow = true;
        if (m_MountItem.Count <= 0)
        {
            m_RideButton.gameObject.SetActive(false);
            m_NoMountDec.text = Utils.GetDicByID(2741);
            m_NoMountDec.gameObject.SetActive(true);
        }
        else
        {
            m_NoMountDec.gameObject.SetActive(false);
            m_RideButton.gameObject.SetActive(true);
        }
        initMountFakeObj();
    }
Beispiel #11
0
    public override void OnMountModelOk()
    {
        base.OnMountModelOk();

        if (m_effectBindPointCache == null || m_EffectGameObj == null)
        {
            LogModule.ErrorLog("OnMountModelOk called but m_effectBindPointCache || m_EffectGameObj is null!");
            return;
        }
        Obj_OtherPlayer player = m_cachedObjCharacter as Obj_OtherPlayer;

        if (player == null)
        {
            LogModule.ErrorLog("OnMountModelOk called but m_cachedObjCharacter is not a Obj_OtherPlayer!");
            return;
        }

        int           moundid   = -1;
        Tab_MountBase MountBase = TableManager.GetMountBaseByID(player.MountID, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + moundid);
            return;
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return;
        }
        if (GameManager.gameManager.ActiveScene != null)
        {
            GameManager.gameManager.ActiveScene.SetMainPlayerCircleSizeOnMount(MountTable.SelectCircleSize);
        }
        Transform effectPointBone;

        //索引左翼绑定点
        effectPointBone = m_EffectGameObj.transform.Find(MountTable.LMountFlankPointPath);
        if (effectPointBone != null)
        {
            if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_MOUNT_LFLANK))
            {
                m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_MOUNT_LFLANK] = effectPointBone.gameObject;
            }
            else
            {
                m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_LFLANK, effectPointBone.gameObject);
            }
            m_effectBindPointsOnMountList.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_LFLANK);
        }
        //索引右翼绑定点
        effectPointBone = m_EffectGameObj.transform.Find(MountTable.RMountFlankPointPath);
        if (effectPointBone != null)
        {
            if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_MOUNT_RFLANK))
            {
                m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_MOUNT_RFLANK] = effectPointBone.gameObject;
            }
            else
            {
                m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_RFLANK, effectPointBone.gameObject);
            }
            m_effectBindPointsOnMountList.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_RFLANK);
        }
        //索引尾部绑定点
        effectPointBone = m_EffectGameObj.transform.Find(MountTable.MountBackPointPath);
        if (effectPointBone != null)
        {
            if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_MOUNT_BACK))
            {
                m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_MOUNT_BACK] = effectPointBone.gameObject;
            }
            else
            {
                m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_BACK, effectPointBone.gameObject);
            }
            m_effectBindPointsOnMountList.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_BACK);
        }
        //索引中心点
        effectPointBone = m_EffectGameObj.transform.Find(MountTable.MountCenterPointPath);
        if (effectPointBone != null)
        {
            if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_MOUNT_CENTER))
            {
                m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_MOUNT_CENTER] = effectPointBone.gameObject;
            }
            else
            {
                m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_CENTER, effectPointBone.gameObject);
            }
            m_effectBindPointsOnMountList.Add(GlobeVar.EFFECT_BIND_POINT_MOUNT_CENTER);
        }

        PlayEffect(MountTable.MoveEffectId, OnMountMoveEffectAdd);
    }
Beispiel #12
0
    public static void OnAsycLoadMount(string modelName, GameObject resObj, object param1, object param2, object param3)
    {
        if (param1 == null || param2 == null || param3 == null)
        {
            return;
        }

        GameObject      objRoot      = (GameObject)param1;
        Obj_OtherPlayer PlayerObj    = (Obj_OtherPlayer)param2;
        string          strBindPoint = (string)param3;

        if (null == objRoot || null == PlayerObj || null == strBindPoint)
        {
            return;
        }

        if (PlayerObj.MountObj == null)
        {
            return;
        }

        if (resObj == null || PlayerObj.MountID <= 0)
        {
            if (PlayerObj.MountObj != null)
            {
                DestroyMount(PlayerObj.MountObj);
                PlayerObj.MountObj = null;
            }
            return;
        }

        // 保存角色模型 找Model 放在MountPlayer下

        string strModelName = "Model";
        //if (Singleton<ObjManager>.GetInstance().MainPlayer.IsChangedMainPlayer)
        //{
        //    strModelName = "ModelChange";
        //}

        Transform gMountPlayerTrans = objRoot.transform.FindChild(strModelName);

        if (gMountPlayerTrans == null || gMountPlayerTrans.gameObject == null)
        {
            DestroyMount(PlayerObj.MountObj);
            PlayerObj.MountObj = null;
            return;
        }
        gMountPlayerTrans.parent        = PlayerObj.MountObj.gameObject.transform;
        gMountPlayerTrans.localPosition = Vector3.zero;
        gMountPlayerTrans.localRotation = Quaternion.identity;
        // 初始化动作
        PlayerObj.MountObj.MountPlayer = PlayerObj.MountObj.gameObject.AddComponent <ObjAnimModel>() as ObjAnimModel;
        ObjAnimModel mountPlayer = PlayerObj.MountObj.MountPlayer;

        if (mountPlayer == null)
        {
            DestroyMount(PlayerObj.MountObj);
            PlayerObj.MountObj = null;
            return;
        }
        mountPlayer.AnimationFilePath = PlayerObj.AnimationFilePath;
        mountPlayer.InitAnimation();

        // 添加马Model
        Singleton <ObjManager> .GetInstance().AsycReloadMountModelOver(modelName, resObj, objRoot, PlayerObj.AnimationFilePath, null);

        string    str            = strModelName + strBindPoint;
        Transform mountTransferm = objRoot.transform.FindChild(str);

        if (null == mountTransferm)
        {
            LogModule.ErrorLog("can not find the mount's bindpoint:" + str);
            DestroyMount(PlayerObj.MountObj);
            PlayerObj.MountObj = null;
            return;
        }
        GameObject gBindPoint = mountTransferm.gameObject;

        if (gBindPoint)
        {
            mountPlayer.transform.parent        = gBindPoint.transform;
            mountPlayer.transform.localPosition = Vector3.zero;
            mountPlayer.transform.rotation      = objRoot.transform.rotation;
        }

        PlayerObj.OnSwithObjAnimState(PlayerObj.CurObjAnimState);
        //需要下马时 还骑着马 走下面流程(防止出现 上马立马下马的情况 下马失败)
        if (PlayerObj.IsNeedUnMount && PlayerObj.MountID != -1)
        {
            UnMount(PlayerObj);
        }

        if (null != PlayerObj)
        {
            PlayerObj.OnReloadModle();
            if (PlayerObj.ObjEffectController != null)
            {
                PlayerObj.ObjEffectController.OnMountModelOk();

                //非登陆状态才有上骑乘的特效
                if (PlayerObj.ShowRideOnEffect)
                {
                    Tab_MountBase MountBase = TableManager.GetMountBaseByID(PlayerObj.MountID, 0);
                    if (MountBase != null)
                    {
                        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);
                        if (MountTable != null)
                        {
                            PlayerObj.ObjEffectController.PlayEffect(MountTable.EffectMountOn);
                            PlayerObj.ShowRideOnEffect = false;
                        }
                    }
                }
            }

            PlayerObj.RideMountWeapon();

            PlayerObj.IsLoadingModel = false;
            if (PlayerObj.WaitChangeState != GlobeVar.INVALID_ID)
            {
                int nChangeState = PlayerObj.WaitChangeState;
                PlayerObj.WaitChangeState = GlobeVar.INVALID_ID;
                PlayerObj.UpdateOtherPlayerChangeState(nChangeState);
            }
        }
    }
Beispiel #13
0
    public int GetMountAnimation(CharacterDefine.MountAction value, Obj_Character obj)
    {
        if (PlayerObj == null || obj == null)
        {
            return(-1);
        }
        Tab_MountBase MountBase = TableManager.GetMountBaseByID(PlayerObj.MountID, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + PlayerObj.MountID);
            return(-1);
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return(-1);
        }
        int nProfession = -1;

        if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER ||
            obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER ||
            obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_ZOMBIE_PLAYER)
        {
            Obj_OtherPlayer objPlayer = obj as Obj_OtherPlayer;
            nProfession = objPlayer.Profession;
        }


        if (value == CharacterDefine.MountAction.STAND)
        {
            if (nProfession == (int)CharacterDefine.PROFESSION.SHAOLIN)
            {
                return(MountTable.StandAniShaoLin);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.TIANSHAN)
            {
                return(MountTable.StandAniTianShan);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.DALI)
            {
                return(MountTable.StandAniDaLi);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.XIAOYAO)
            {
                return(MountTable.StandAniXiaoYao);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.GAIBANG)
            {
                return(MountTable.StandAniGaiBang);
            }

            return(-1);
        }
        else if (value == CharacterDefine.MountAction.RUN)
        {
            if (nProfession == (int)CharacterDefine.PROFESSION.SHAOLIN)
            {
                return(MountTable.RunAniShaoLin);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.TIANSHAN)
            {
                return(MountTable.RunAniTianShan);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.DALI)
            {
                return(MountTable.RunAniDaLi);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.XIAOYAO)
            {
                return(MountTable.RunAniXiaoYao);
            }
            else if (nProfession == (int)CharacterDefine.PROFESSION.GAIBANG)
            {
                return(MountTable.RunAniGaiBang);
            }

            return(-1);
        }
        else
        {
            return(-1);
        }
    }
Beispiel #14
0
    // 骑马
    static public void RideMount(Obj_OtherPlayer PlayerObj, int nMountID)
    {
        if (null == PlayerObj)
        {
            return;
        }

        Tab_MountBase MountBase = TableManager.GetMountBaseByID(nMountID, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + nMountID);
            return;
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return;
        }
        GameObject Obj = PlayerObj.gameObject;

        if (Obj != null)
        {
            if (PlayerObj.MountObj) // 换个马
            {
                if (PlayerObj.MountObj.MountID > 0)
                {
                    if (PlayerObj.MountObj.MountID == nMountID)
                    {
                        return;
                    }
                    PlayerObj.MountObj.ChangeMount(PlayerObj, nMountID);
                }
            }
            else //  创建个马
            {
                GameObject MountPlayerObj = ResourceManager.InstantiateResource("Prefab/Model/PlayerRoot", "MountPlayer") as GameObject;
                if (MountPlayerObj != null)
                {
                    PlayerObj.MountObj = MountPlayerObj.AddComponent <Obj_Mount>() as Obj_Mount;

                    if (PlayerObj.MountObj)
                    {
                        PlayerObj.MountObj.InitMount(PlayerObj, nMountID);
                    }
                }
            }

            if (PlayerObj.MountObj)
            {
                PlayerObj.MountObj.MountID = nMountID;
            }

            // 上坐骑时名字板高度修正
            if (PlayerObj.HeadInfoBoard != null)
            {
                BillBoard billboard = PlayerObj.HeadInfoBoard.GetComponent <BillBoard>();
                if (billboard != null)
                {
                    billboard.fDeltaHeight = PlayerObj.DeltaHeight + PlayerObj.GetMountNameBoardHeight();
                }
            }
        }
    }
Beispiel #15
0
    public static void OnAsycLoadChangeMount(string modelName, GameObject resObj, object param1, object param2, object param3)
    {
        if (param1 == null || param2 == null || param3 == null)
        {
            return;
        }

        GameObject objRoot = param1 as GameObject;

        if (null == objRoot)
        {
            return;
        }

        Obj_OtherPlayer PlayerObj = param2 as Obj_OtherPlayer;

        if (null == PlayerObj || null == PlayerObj.gameObject)
        {
            return;
        }

        if (PlayerObj.MountObj == null)
        {
            return;
        }

        if (resObj == null || PlayerObj.MountID <= 0)
        {
            if (PlayerObj.MountObj != null)
            {
                DestroyMount(PlayerObj.MountObj);
                PlayerObj.MountObj = null;
            }
            return;
        }

        string strBindPoint = param3 as string;

        if (strBindPoint == null)
        {
            return;
        }

        // 保存角色模型
        PlayerObj.MountObj.transform.parent = PlayerObj.transform;

        // 添加马Model
        //Singleton<ObjManager>.GetInstance().AsycReloadModelOver(modelName, resObj, objRoot, PlayerObj.AnimationFilePath, null);

        GameObject model = (GameObject)GameObject.Instantiate(resObj);

        if (null == model)
        {
            return;
        }
        else
        {
            model.name = "Model";
        }

        Singleton <ObjManager> .GetInstance().ReloadModel(objRoot, model, PlayerObj.AnimationFilePath, null);

        string    str            = "Model" + strBindPoint;
        Transform mountTransferm = objRoot.transform.FindChild(str);

        if (mountTransferm == null)
        {
            LogModule.ErrorLog("can not find the mount's bindpoint:" + str);
            return;
        }
        GameObject gBindPoint = mountTransferm.gameObject;

        if (gBindPoint)
        {
            PlayerObj.MountObj.transform.parent        = gBindPoint.transform;
            PlayerObj.MountObj.transform.localPosition = Vector3.zero;
            PlayerObj.MountObj.transform.rotation      = objRoot.transform.rotation;
        }

        PlayerObj.OnSwithObjAnimState(PlayerObj.CurObjAnimState);

        //需要下马时 还骑着马 走下面流程(防止出现 上马立马下马的情况 下马失败)
        if (PlayerObj.IsNeedUnMount && PlayerObj.MountID != -1)
        {
            UnMount(PlayerObj);
        }

        PlayerObj.OnReloadModle();
        //策划说只要上骑乘就要播特效
        if (PlayerObj.ObjEffectController != null)
        {
            PlayerObj.ObjEffectController.OnMountOff(PlayerObj.MountID);

            PlayerObj.ObjEffectController.OnMountModelOk();



            //非登陆状态才有上骑乘的特效
            if (PlayerObj.ShowRideOnEffect)
            {
                Tab_MountBase MountBase = TableManager.GetMountBaseByID(PlayerObj.MountID, 0);
                if (MountBase != null)
                {
                    Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);
                    if (MountTable != null)
                    {
                        PlayerObj.ObjEffectController.PlayEffect(MountTable.EffectMountOn);
                        PlayerObj.ShowRideOnEffect = false;
                    }
                }
            }
        }

        PlayerObj.IsLoadingModel = false;
        if (PlayerObj.WaitChangeState != GlobeVar.INVALID_ID)
        {
            int nChangeState = PlayerObj.WaitChangeState;
            PlayerObj.WaitChangeState = GlobeVar.INVALID_ID;
            PlayerObj.UpdateOtherPlayerChangeState(nChangeState);
        }
    }
    public override void InitBindPointInfo()
    {
        m_effectBindPointCache.Clear();
        base.InitBindPointInfo();
        if (m_EffectHolder != null)
        {
            Tab_CharModel _CharModelInfo = TableManager.GetCharModelByID(m_EffectHolder.ModelID, 0);
            if (_CharModelInfo != null && _CharModelInfo.ModelType != -1)
            {
                Tab_EffectPoint _EffectPointInfo = TableManager.GetEffectPointByID(_CharModelInfo.ModelType, 0);
                if (_EffectPointInfo != null)
                {
                    string path_prefix = ""; // 路径的前缀,用来处理乘骑的情况

                    do
                    {
                        int mountid = -1;
                        if (m_EffectHolder == null)
                        {
                            break; // 如果是空,则跳出
                        }
                        if (m_EffectHolder.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                        {
                            Obj_OtherPlayer op = m_EffectHolder as Obj_OtherPlayer;
                            if (op == null)
                            {
                                break;
                            }
                            if (op.MountID > 0 && op.MountObj != null)
                            {
                                mountid = op.MountID;
                            }
                        }
                        else if (m_EffectHolder.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                        {
                            Obj_MainPlayer mp = m_EffectHolder as Obj_MainPlayer;
                            if (mp == null)
                            {
                                break;
                            }
                            if (mp.MountID > 0 && mp.MountObj != null)
                            {
                                mountid = mp.MountID;
                            }
                        }
                        if (mountid == -1)
                        {
                            break; // 没有找到相应的乘骑
                        }
                        Tab_MountBase MountBase = TableManager.GetMountBaseByID(mountid, 0);
                        if (null == MountBase)
                        {
                            LogModule.DebugLog("MountBase.txt has not Line ID=" + mountid);
                            break;
                        }
                        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);
                        if (MountTable == null)
                        {
                            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
                            break;
                        }

                        path_prefix = "Model" + MountTable.BindPoint + "/MountPlayer/";
                    } while (false);


                    //身体中心点
                    Transform effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.CenterPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_CENTER, effectPointBone.gameObject);
                    }
                    //base节点
                    if (m_BaseEffectBindPoint != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_BASE, m_BaseEffectBindPoint.gameObject);
                    }
                    //头节点
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.HeadPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_HEAD, effectPointBone.gameObject);
                    }
                    //左手(左前足)节点
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.LHandPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LHAND, effectPointBone.gameObject);
                    }
                    //右手(右前足)节点
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.RHandPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RHAND, effectPointBone.gameObject);
                    }
                    //左脚(左后足)节点
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.LFootPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LFOOT, effectPointBone.gameObject);
                    }
                    //右脚(右后足)节点
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.RFootPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RFOOT, effectPointBone.gameObject);
                    }
                    //头顶
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.HeadTopPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_HEADTOP, effectPointBone.gameObject);
                    }
                    //左肩
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.LShoulderPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LSHOULDER, effectPointBone.gameObject);
                    }
                    //右肩
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.RShoulderPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RSHOULDER, effectPointBone.gameObject);
                    }
                    //右手手背
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.RHandBackPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RHANDBACK, effectPointBone.gameObject);
                    }
                    //左手手背
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.LHandBackPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LHANDBACK, effectPointBone.gameObject);
                    }
                    //尾饰
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.TailPointPath);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_TAIL, effectPointBone.gameObject);
                    }
                    //附加物
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.AddOnsItem);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_ADDONS, effectPointBone.gameObject);
                    }
                    //特殊
                    effectPointBone = m_EffectGameObj.transform.Find(path_prefix + _EffectPointInfo.SpecialWeaponPoint);
                    if (effectPointBone != null)
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_SPECIALWEAPON, effectPointBone.gameObject);
                    }
                }
            }
        }
    }