示例#1
0
        public override void SetSenderLevel(int level, uint transferLv)
        {
            if (mSenderPeakLvBg != null)
            {
                uint peakLv = 0;

                // 巅峰等级
                bool isPeak = TransferHelper.IsPeak((uint)level, out peakLv, transferLv);

                mSenderPeakLvBg.SetActive(isPeak);
                mSenderLevelText.text = peakLv.ToString();
            }
            else
            {
                mSenderLevelText.text = level.ToString();
            };
        }
示例#2
0
        /// <summary>
        /// 飞鞋
        /// </summary>
        public static bool TravelBootsJump(Vector3 pos, uint instanceId = 0, bool isFree = false, uint line = 1, bool isAutoFighting = false)
        {
            if (instanceId == 0)
            {
                instanceId = SceneHelp.Instance.CurSceneID;
            }

            if (PKModeManagerEx.Instance.TryToOtherDungeonScene() == false)
            {
                return(false);
            }

            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
            if (instanceInfo == null)
            {
                GameDebug.LogError("Travel boots ump to scene " + instanceId + " error, can not find instance info!!!");
                return(false);
            }

            // 本地玩家处于护送状态不能用飞鞋
            if (CheckLocalPlayerEscortTaskState() == false)
            {
                return(false);
            }

            // 检查道具
            if (isFree == false)
            {
                if (VipHelper.GetIsFlyFree() == false)
                {
                    uint need_goods = GameConstHelper.GetUint("GAME_ITEM_TRAVEL_BOOTS");
                    if (need_goods > 0)
                    {
                        var num = ItemManager.Instance.GetGoodsNumForBagByTypeId(need_goods);
                        if (num <= 0)
                        {
                            UINotice.Instance.ShowMessage(DBConstText.GetText("ITME_NUM_NOTENOUGH"));
                            return(false);
                        }
                    }
                }
            }

            bool isInstance = false;

            if (instanceInfo.mWarType == GameConst.WAR_TYPE_DUNGEON)
            {
                isInstance = true;
            }

            // 检查是否达到等级
            uint needLv = InstanceHelper.GetInstanceNeedRoleLevel(instanceId);

            if (LocalPlayerManager.Instance.LocalActorAttribute.Level < needLv)
            {
                // 巅峰等级
                uint   peakLv   = 0;
                bool   isPeak   = TransferHelper.IsPeak(needLv, out peakLv);
                string levelStr = "";
                if (isPeak)
                {
                    levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                }
                else
                {
                    levelStr = peakLv.ToString(); // {0}
                }
                if (isInstance == true)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                else
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                return(false);
            }

            // 检查是否通关某主线任务
            uint needTaskId = instanceInfo.mNeedTaskId;

            if (needTaskId > 0)
            {
                if (TaskHelper.MainTaskIsPassed(needTaskId) == false)
                {
                    TaskDefine needTaskDefine = TaskDefine.MakeDefine(needTaskId);
                    if (needTaskDefine != null)
                    {
                        // 巅峰等级
                        uint   peakLv   = 0;
                        bool   isPeak   = TransferHelper.IsPeak((uint)needTaskDefine.RequestLevelMin, out peakLv);
                        string levelStr = "";
                        if (isPeak)
                        {
                            levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                        }
                        else
                        {
                            levelStr = peakLv.ToString(); // {0}
                        }
                        if (isInstance == true)
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                        else
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                    }
                    return(false);
                }
            }

            // 判断是否可到达
            if (instanceId == SceneHelp.Instance.CurSceneID)
            {
                if (InstanceHelper.CanWalkTo(pos) == false)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH"));
                    return(false);
                }
            }

            // 跳往不同的场景需要加个转圈,防止同时多次跳转
            if (instanceId != SceneHelp.Instance.CurSceneID)
            {
                ui.ugui.UIManager.GetInstance().ShowWaitScreen(true);
            }

            C2STravelBootsJump data = new C2STravelBootsJump();

            data.dungeon_id = instanceId;
            data.line       = line;
            PkgNwarPos pkgNwarPos = new PkgNwarPos();

            pkgNwarPos.px = (int)(pos.x / GlobalConst.UnitScale);
            pkgNwarPos.py = (int)(pos.z / GlobalConst.UnitScale);
            data.pos      = pkgNwarPos;
            if (isFree == true)
            {
                data.is_free = 1;
            }
            else
            {
                data.is_free = 0;
            }

            NetClient.BaseClient.SendData <C2STravelBootsJump>(NetMsg.MSG_TRAVEL_BOOTS_JUMP, data);

            SceneHelp.Instance.IsAutoFightingAfterSwitchInstance = isAutoFighting;

            InstanceManager.Instance.IsAutoFighting = false;

            return(true);
        }