Пример #1
0
        /// <summary>
        /// 是否在普通野外
        /// </summary>
        public bool IsInNormalWild(uint instanceId = 0)
        {
            if (instanceId == 0)
            {
                instanceId = CurSceneID;
            }

            if (instanceId == CurSceneID)
            {
                if (InstanceManager.Instance.InstanceType == GameConst.WAR_TYPE_WILD && InstanceManager.Instance.InstanceSubType == GameConst.WAR_SUBTYPE_WILD)
                {
                    return(true);
                }
            }
            else
            {
                DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
                if (instanceInfo != null)
                {
                    if (instanceInfo.mWarType == GameConst.WAR_TYPE_WILD && instanceInfo.mWarSubType == GameConst.WAR_SUBTYPE_WILD)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #2
0
        /// <summary>
        /// 执行NPC的功能
        /// </summary>
        public static void RunNpcFunction(NpcDefine npcDefine)
        {
            NpcDefine.EFunction func       = npcDefine.Function;
            List <string>       funcParams = npcDefine.FunctionParams;

            switch (func)
            {
            case NpcDefine.EFunction.EMPTY:
                break;

            case NpcDefine.EFunction.TRANSFER:
            {
                uint instanceId = 0;
                uint.TryParse(funcParams[0], out instanceId);
                DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
                if (instanceInfo != null && instanceInfo.mWarType != GameConst.WAR_TYPE_WILD)
                {
                    UIManager.GetInstance().ShowSysWindow("UIInstanceEnterWindow", instanceInfo);
                }
                else
                {
                    SceneHelp.JumpToScene(instanceId);
                }
            }
            break;

            case NpcDefine.EFunction.EXCHANGE:
            {
                xc.ui.UIWidgetHelp.Instance.ShowNoticeDlg(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_73") + npcDefine.FunctionParams[0]);
            }
            break;

            case NpcDefine.EFunction.DIALOG:
                break;

            case NpcDefine.EFunction.EVENT:
            {
                uint triggerId = 0;
                uint.TryParse(funcParams[0], out triggerId);
                Uranus.Runtime.UranusManager.Instance.ActiveLevelNode(triggerId);
            }
            break;

            case NpcDefine.EFunction.INTERACTION:
            {
                CommonSliderHelper.Interrupt();
                int second = 0;
                int.TryParse(npcDefine.FunctionParams[0], out second);
                CommonSliderHelper.Start(second, npcDefine.ConstBtnText, npcDefine.ConstBtnPic, null, () => {; });
            }
            break;

            default:
                break;
            }
        }
Пример #3
0
        public uint GetWarSubType()
        {
            DBInstance.InstanceInfo instanceInfo = InstanceManager.Instance.InstanceInfo;
            if (instanceInfo != null)
            {
                return(instanceInfo.mWarSubType);
            }

            return(0);
        }
Пример #4
0
        public static bool CheckCanSwitch(uint instanceId, bool show_notice = true)
        {
            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
            if (instanceInfo != null)
            {
                return(CheckCanSwitch(instanceInfo.mWarType, instanceInfo.mWarSubType, show_notice));
            }

            return(false);
        }
Пример #5
0
        /// <summary>
        /// 获取指定副本的第一个关卡id
        /// </summary>
        public static uint GetFirstStageId(uint instanceId)
        {
            DBInstance dbInstance = DBManager.Instance.GetDB <DBInstance>();

            if (dbInstance != null)
            {
                DBInstance.InstanceInfo instanceInfo = dbInstance.GetInstanceInfo(instanceId);
                if (instanceInfo != null)
                {
                    return(instanceInfo.mStages[0]);
                }
            }

            return(0);
        }
Пример #6
0
        bool IsSecretArea(uint scene_id)
        {
            var dbInstance = DBManager.GetInstance().GetDB <DBInstance>();

            DBInstance.InstanceInfo pre_instance_info = dbInstance.GetInstanceInfo(scene_id);
            if (pre_instance_info == null)
            {
                return(false);
            }
            if (pre_instance_info.mWarType == GameConst.WAR_TYPE_DUNGEON &&
                pre_instance_info.mWarSubType == GameConst.WAR_SUBTYPE_SECRET_AREA)
            {
                return(true);
            }
            return(false);
        }
Пример #7
0
        /// <summary>
        /// 是否在跨服帮战副本
        /// </summary>
        public bool IsInSpanGuildWarInstance(uint instanceId = 0)
        {
            if (instanceId == 0)
            {
                instanceId = CurSceneID;
            }

            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
            if (instanceInfo != null)
            {
                if (instanceInfo.mWarType == GameConst.WAR_TYPE_DUNGEON && instanceInfo.mWarSubType == GameConst.WAR_SUBTYPE_SPAN_GUILD_WAR)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #8
0
        public CooldownCtrl GetNewCoolDown(Actor owner)
        {
            if (owner == null)
            {
                return(null);
            }
            if (owner.IsLocalPlayer)
            {
                uint pre_scene_id            = SceneHelp.Instance.PreSceneID;
                bool pre_scene_is_secretArea = IsSecretArea(pre_scene_id);
                uint cur_scene_id            = SceneHelp.Instance.CurSceneID;
                bool cur_scene_is_secretArea = IsSecretArea(cur_scene_id);

                bool can_reset_cd = false;
                DBInstance.InstanceInfo cur_instance_info = InstanceManager.Instance.InstanceInfo;
                if (DBInstanceTypeControl.Instance.ClearCd(cur_instance_info.mWarType, cur_instance_info.mWarSubType))
                {
                    can_reset_cd = true;
                }
                if ((pre_scene_is_secretArea || cur_scene_is_secretArea) &&
                    pre_scene_id != cur_scene_id)
                {//进出武神塔(同一武神塔内切换不重置),都要重置CD
                    can_reset_cd = true;
                }
                if (can_reset_cd == true)
                {
                    m_localPlayerCtrl = null;
                }
                if (m_localPlayerCtrl == null)
                {
                    m_localPlayerCtrl = new CooldownCtrl(owner);
                }
                else
                {
                    m_localPlayerCtrl.SetOwner(owner);
                }
                return(m_localPlayerCtrl);
            }
            return(new CooldownCtrl(owner));
        }
Пример #9
0
        /// <summary>
        /// 根据InstanceInfo,查询其需要的场景资源
        /// 成功返回true
        /// </summary>
        /// <param name="instanceInfo"></param>
        /// <param name="asset_path"></param>
        /// <returns></returns>
        protected static bool TryGetSceneResByInstanceInfo(DBInstance.InstanceInfo instanceInfo, out string asset_path)
        {
            asset_path = string.Empty;
            if (instanceInfo.mStages == null || instanceInfo.mStages.Count <= 0)
            {
                return(false);
            }

            var stage_id = instanceInfo.mStages[0];
            var map_ids  = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_stage_map", "id", stage_id, "map");

            if (map_ids == null || map_ids.Count <= 0)
            {
                return(false);
            }

            var map_id = Convert.ToUInt32(map_ids[0]);

            var db = DBManager.GetInstance().GetDB <DBMap>();

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

            var map_info = db.GetMapInfo(map_id);

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


            asset_path = map_info.SceneResPath;
            GameDebug.LogYellow(asset_path);

            return(true);
        }
Пример #10
0
 public void RefreshStyle()
 {
     if (mNameComponent != null)
     {
         if (m_StyleInfo.IsShowBar || m_StyleInfo.IsShowBg || m_StyleInfo.IsShowBgPreHead)
         {
             DBInstance.InstanceInfo instanceInfo = InstanceManager.Instance.InstanceInfo;
             if (instanceInfo != null)
             {
                 if (DBInstanceTypeControl.Instance.HideHpBar(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     m_StyleInfo.IsShowBar = false;
                 }
                 if (DBInstanceTypeControl.Instance.HideCamp(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     m_StyleInfo.IsShowBg        = false;
                     m_StyleInfo.IsShowBgPreHead = false;
                 }
             }
         }
         mNameComponent.ResetStyleInfo(m_StyleInfo, mOwner);
     }
 }
Пример #11
0
        /// <summary>
        /// 创建角色头顶的名字组件
        /// </summary>
        void Start(GameObject bind_object)
        {
            if (mNameComponent == null)
            {
                mNameComponent = bind_object.AddComponent <UI3DText>();
            }

            if (m_StyleInfo != null)
            {
                mNameComponent.ResetStyleInfo(m_StyleInfo);
            }

            if (mHeadTrans != null)
            {
                mNameComponent.SetHeadTrans(mHeadTrans);
            }

            mNameComponent.HeadOffset = m_HeadOffset;
            mNameComponent.Text       = mName;
            SetGuildName(mTextNameStruct.GuildNameText);
            SetHangUp(mTextNameStruct.HangUpText);
            SetHonor(mTextNameStruct.Honor);
            SetTitle(mTextNameStruct.Title);

            DBInstance.InstanceInfo instanceInfo = InstanceManager.Instance.InstanceInfo;
            if (instanceInfo != null)
            {
                if (DBInstanceTypeControl.Instance.HideHpBar(instanceInfo.mWarType, instanceInfo.mWarSubType))
                {
                    HideHpBar();
                }
                if (DBInstanceTypeControl.Instance.HideCamp(instanceInfo.mWarType, instanceInfo.mWarSubType))
                {
                    HideCamp();
                }
            }
        }
Пример #12
0
 public void SetStyle(UI3DText.StyleInfo style_info)
 {
     m_StyleInfo = style_info;
     if (mNameComponent != null)
     {
         if (style_info.IsShowBar || style_info.IsShowBg || style_info.IsShowBgPreHead)
         {
             DBInstance.InstanceInfo instanceInfo = InstanceManager.Instance.InstanceInfo;
             if (instanceInfo != null)
             {
                 if (DBInstanceTypeControl.Instance.HideHpBar(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     style_info.IsShowBar = false;
                 }
                 if (DBInstanceTypeControl.Instance.HideCamp(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     style_info.IsShowBg        = false;
                     style_info.IsShowBgPreHead = false;
                 }
             }
         }
         mNameComponent.ResetStyleInfo(style_info, mOwner);
     }
 }
Пример #13
0
        public static string FillTemplateByContentList(string template, string[] param_list)
        {
            if (param_list.Length <= 0)
            {
                return(template);
            }
            if (string.IsNullOrEmpty(template))
            {
                return(string.Empty);
            }

            int index = 0;

            return(mNoticeRegex.Replace(template, new MatchEvaluator(
                                            delegate(Match match)
            {
                string ret = string.Empty;
                if (index >= param_list.Length)
                {
                    return ret;
                }

                string content = param_list [index];
                string target = match.ToString();
                if (target.Length >= 3)
                {
                    target = target.Substring(1, target.Length - 2);
                    EFillType contentType = (EFillType)(int.Parse(target));
                    uint contentNum = 0xffffffff;
                    try
                    {
                        contentNum = Convert.ToUInt32(content);
                    } catch
                    {
                        // Do nothing.
                    }

                    switch (contentType)
                    {
                    // 怪物名字是后端未经过翻译就发过来的,要翻译一下
                    case EFillType.MONSTER_NAME:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;

                    // 玩法场景名字是后端未经过翻译就发过来的,要翻译一下
                    case EFillType.ACTIVITY_SCENE_NAME:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;

                    case EFillType.COLOR_TYPE:
                        ret = GoodsHelper.GetGoodsColor(contentNum);
                        break;

                    case EFillType.CHAT_GOODS_TYPELINK:         // 物品超链接
                        {
                            if (param_list.Length >= 3)
                            {
                                uint playerId = Convert.ToUInt32(param_list[index - 2]);
                                uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                                ulong goods_oid = Convert.ToUInt64(content);

                                uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                                string color_str = GoodsHelper.GetGoodsColor(color_type);
                                string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);

                                uint goodsType = GoodsHelper.GetGoodsType(goods_gid);
                                if (goodsType == GameConst.GIVE_TYPE_EQUIP ||        // 装备
                                    goodsType == GameConst.GIVE_TYPE_RIDE_EQUIP ||   // 坐骑装备
                                    goodsType == GameConst.GIVE_TYPE_MAGIC_EQUIP ||  // 法宝装备
                                    goodsType == GameConst.GIVE_TYPE_DECORATE ||     // 饰品
                                    goodsType == GameConst.GIVE_TYPE_ELEMENT_EP ||   // 元素装备
                                    goodsType == GameConst.GIVE_TYPE_GOD_EQUIP ||    // 神兵
                                    goodsType == GameConst.GIVE_TYPE_ARTIFACT_EP ||  // 神器装备
                                    goodsType == GameConst.GIVE_TYPE_FIVE_ELEM)      // 五行战印
                                {
                                    ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_20"), color_str, goods_name);
                                    ret = ret + "{" + playerId + "," + goods_oid + "," + goods_gid + "})";
                                }
                                else
                                {
                                    ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_21"), color_str, goods_name);
                                    ret = ret + "{" + playerId + "," + goods_gid + "})";
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.CLIENT_GOODS_TYPELINK:       // 客户端物品超链接
                        {
                            uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                            uint goods_oid = contentNum;

                            uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                            string color_str = GoodsHelper.GetGoodsColor(color_type);
                            string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);
                            ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_22"), color_str, goods_name);
                            ret = ret + "{" + content + "})";
                        }
                        break;

                    case EFillType.GOODS_GID:
                        ret = string.Empty;
                        break;

                    case EFillType.HIDE_PLAYER_ID:
                        ret = string.Empty;
                        break;

                    case EFillType.GOODS_GID_NEW:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint playerId = Convert.ToUInt32(param_list[index - 1]);
                                uint goods_gid = Convert.ToUInt32(param_list[index]);

                                uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                                string color_str = GoodsHelper.GetGoodsColor(color_type);
                                string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);
                                ret = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_21"), color_str, goods_name);
                                ret = ret + "{" + playerId + "," + goods_gid + "})";
                            }
                            else
                            {
                                ret = content;
                            }

                            break;
                        }

                    case EFillType.PET_ID:     // 守护ID(显示带守护品质颜色的守护名字)
                        {
                            uint pet_id = Convert.ToUInt32(content);
                            var pet_info = DBManager.Instance.GetDB <DBPet>().GetOnePetInfo(pet_id);
                            if (pet_info != null)
                            {
                                string color_str = GoodsHelper.GetGoodsColor(pet_info.Quality + 1);    //守护品质颜色和物品相差1
                                string actor_name = ActorHelper.GetActorName(pet_info.Actor_id);
                                ret = string.Format("{0}{1}</color>", color_str, actor_name);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.TITLE_ID:
                        {
                            uint title_id = Convert.ToUInt32(content);
                            var title_info = DBManager.Instance.GetDB <DBHonor>().GetData(title_id);
                            if (title_info != null)
                            {
                                string color_str = GoodsHelper.GetGoodsColor(title_info.Quality);
                                string title_name = title_info.Name;
                                ret = string.Format("{0}{1}</color>", color_str, title_name);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.QUAL_WORD:
                        {
                            uint qual = Convert.ToUInt32(content);
                            string color_str_name = GoodsHelper.GetGoodsColorName(qual);
                            string color_str = GoodsHelper.GetGoodsColor(qual);
                            ret = string.Format("{0}{1}</color>", color_str, color_str_name);
                        }
                        break;

                    case EFillType.TRANSFER_LV:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint init_vocation = Convert.ToUInt32(param_list[index]);
                                uint transfer_lv = Convert.ToUInt32(param_list[index - 1]);
                                object[] param = { transfer_lv, init_vocation };
                                System.Type[] returnType = { typeof(string) };
                                object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "TransferMgr_GetVocationName", param, returnType);
                                if (objs != null && objs.Length > 0 && objs[0] != null)
                                {
                                    ret = (string)objs[0];
                                }
                                else
                                {
                                    ret = content;
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.InitVocation:
                        ret = string.Empty;
                        break;

                    case EFillType.SHOW_TYPE_TO_NAME:     //外显系统ID =>外显系统名字
                        {
                            uint show_type = Convert.ToUInt32(param_list[index]);
                            object[] param = { show_type };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetShowName", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_PARAM:    //外显系统ID => 与25一起使用,组成外显系统的外观名字
                        {
                            ret = string.Empty;
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_FACADE_ID:
                        {
                            if (param_list.Length >= 2)
                            {
                                uint facade_id = Convert.ToUInt32(param_list[index]);
                                uint show_type = Convert.ToUInt32(param_list[index - 1]);
                                object[] param = { show_type, facade_id };
                                System.Type[] returnType = { typeof(string) };
                                object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetFacadeName", param, returnType);
                                if (objs != null && objs.Length > 0 && objs[0] != null)
                                {
                                    ret = (string)objs[0];
                                }
                                else
                                {
                                    ret = content;
                                }
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.SHOW_TYPE_TO_SYS_ID:       //外显系统ID =>外显系统ID
                        {
                            uint show_type = Convert.ToUInt32(param_list[index]);
                            object[] param = { show_type };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "ShowManager_GetSysIdStr", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.FASHION_NAME:       //时装
                        {
                            uint fashionId = Convert.ToUInt32(param_list[index]);
                            object[] param = { fashionId };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "FashionManager_GetFashionNameWithColor", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.MALL_NAME:     //商城名字
                        {
                            uint mall_id = Convert.ToUInt32(param_list[index]);
                            var mall_tmpl = xc.DBManager.Instance.GetDB <DBMallType>().GetOneItem(mall_id);
                            if (mall_tmpl != null)
                            {
                                //string color_str = GoodsHelper.GetGoodsColor(mall_tmpl);
                                string tmall_name = mall_tmpl.Name;
                                //ret = string.Format("{0}{1}</color>", color_str, tmall_name);
                                ret = tmall_name;
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.ESCORT_TASK_ID:     //护送任务的id
                        {
                            uint taskId = Convert.ToUInt32(param_list[index]);
                            TaskDefine taskDefine = TaskDefine.MakeDefine(taskId);
                            if (taskDefine != null)
                            {
                                ret = taskDefine.GetFollowNpcName(0);
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.INSTANCE_ID:     //副本id
                        {
                            uint instanceId = Convert.ToUInt32(param_list[index]);
                            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
                            if (instanceInfo != null)
                            {
                                ret = instanceInfo.mName;
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.GODWARE_ID:    //神器id
                        {
                            uint god_ware_id = Convert.ToUInt32(param_list[index]);
                            object[] param = { god_ware_id };
                            System.Type[] returnType = { typeof(string) };
                            object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GodWareManager_GetGodWareName", param, returnType);
                            if (objs != null && objs.Length > 0 && objs[0] != null)
                            {
                                ret = (string)objs[0];
                            }
                            else
                            {
                                ret = content;
                            }
                        }
                        break;

                    case EFillType.TIMEFORMAT:
                        int time = Convert.ToInt32(param_list[index]);
                        string strShowTime = CommonTool.SecondsToStr_2(time);
                        ret = strShowTime;
                        break;

                    case EFillType.BIG_PACKET:
                        uint bigNum = Convert.ToUInt32(param_list[index]);
                        if (bigNum != 0)
                        {
                            //ret = string.Format("{0}个大红包,", bigNum);
                            ret = string.Format(xc.DBConstText.GetText("RAIN_RED_PACKET_BIG"), bigNum);
                        }
                        else
                        {
                            ret = "";
                        }
                        break;

                    case EFillType.SMALL_PACKET:
                        uint smallNum = Convert.ToUInt32(param_list[index]);
                        if (smallNum != 0)
                        {
                            //ret = string.Format("{0}个小红包,", smallNum);
                            ret = string.Format(xc.DBConstText.GetText("RAIN_RED_PACKET_SMALL"), smallNum);
                        }
                        else
                        {
                            ret = "";
                        }
                        break;

                    case EFillType.MARKET_ID:
                        {
                            uint goods_gid = Convert.ToUInt32(param_list[index - 1]);
                            uint goods_oid = contentNum;

                            uint color_type = GoodsHelper.GetGoodsColorTypeByTypeId(goods_gid);
                            string color_str = GoodsHelper.GetGoodsColor(color_type);
                            string goods_name = GoodsHelper.GetGoodsOriginalNameByTypeId(goods_gid);

                            // 【click={0}[{1}]</color>】(marketGoodsTips=
                            ret = string.Format(xc.TextHelper.GetConstText("GAME_CHAT_CLICK_MARKET_GOODS"), color_str, goods_name);
                            ret = ret + "{" + content + "})";
                        }
                        break;

                    case EFillType.CONTROL_ID:
                        var id = Convert.ToInt32(param_list[index]);
                        ret = SpanServerManager.Instance.GetServerNameByControlServerId((uint)id);
                        break;

                    case EFillType.CHANNEL_ID:
                        ret = ChannelHelper.GetChannelName(param_list[index]);
                        break;

                    default:
                        ret = xc.TextHelper.GetTranslateText(content);
                        break;
                    }
                }

                index++;
                return ret;
            }
                                            )));
        }
Пример #14
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);
        }