public void Invite(List <uint> uuids) { if (mInviteAllCD == null) { C2STeamInvite data = new C2STeamInvite(); foreach (uint uuid in uuids) { if (GetInviteCD(uuid) == 0) { data.uuids.Add(uuid); } } NetClient.BaseClient.SendData <C2STeamInvite>(NetMsg.MSG_TEAM_INVITE, data); mInviteAllCD = new Utils.Timer((int)mInviteInterval * 1000, false, 1000, (dt) => { if (dt <= 0f) { mInviteAllCD.Destroy(); mInviteAllCD = null; } ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INVITE_ALL_CD_CHANGED, null); }); ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INVITE_ALL_CD_CHANGED, null); } else { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_INVITE_IN_CD"), (int)(mInviteAllCD.Remain / 1000f))); } }
/// <summary> /// 在进入副本之前检测副本是否下载完成 /// 没下载的话会弹出提示框提示下载 /// </summary> /// <param name="instance_id"></param> /// <returns></returns> public static bool PreCheckInstanceIsDownloaded(uint instance_id) { var instanceInfo = DBInstance.Instance.GetInstanceInfo(instance_id); if (instanceInfo == null) { return(false); } string asset_path; if (TryGetSceneResByInstanceInfo(instanceInfo, out asset_path)) { int patch_id; if (!xpatch.XPatchManager.Instance.IsAssetDownloaded(asset_path, out patch_id)) { //需要下载最新资源才能体验当前内容 var content = DBConstText.GetText("DOWNLOAD_PATCH_TIPS"); UIWidgetHelp.Instance.ShowNoticeDlg(ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, content, (param) => { ui.ugui.UIManager.Instance.ShowSysWindow("UIPatchWindow", patch_id); }, null); return(false); } } return(true); }
protected void StopRecord(bool upload_file) { if (mState == State.Recording) { VoiceManager.Instance.StopRecord(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_GVOICE_STOP_RECORD, new CEventBaseArgs()); if (upload_file) { if (mPressTime - DelayTime > RecordMinTime) { VoiceManager.Instance.UploadFile(); } else { if (VoiceManager.Instance.IsCanSendByGameLogic) { // 录音时间太短 UINotice.Instance.ShowMessage(DBConstText.GetText("GAME_CHAT_RECORD_TIPS1")); } } } } mState = State.Idle; }
public bool CheckReply(string url, string error, System.Object replyObject) { if (string.IsNullOrEmpty(error) == false) { GameDebug.LogError("Control server error: " + error); xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("GET_SERVER_INFO_FAIL")); return(false); } Hashtable hashtable = replyObject as Hashtable; if (hashtable != null) { System.Object resultObject = hashtable["result"]; if (resultObject != null) { int result = System.Convert.ToInt32(resultObject); if (result == 1) { return(true); } else if (result == 2)//result=2代表ticket过期 { //登出游戏 IBridge bridge = DBOSManager.getDBOSManager().getBridge(); bridge.logout(); return(false); } } } return(false); }
/// <summary> /// 删除好友 /// </summary> /// <param name="id"></param> public void DeleteFriend(FriendType friendType, FriendsInfo friendInfo) { var data = new C2SRelationDel(); if (friendInfo != null) { data.target_id = friendInfo.Uid; data.type = (uint)friendType; string tips = string.Format(DBConstText.GetText("FRIENDS_DEL_1"), friendInfo.Name); if (friendType == FriendType.Friend) { tips = string.Format(DBConstText.GetText("FRIENDS_DEL_FRIEND"), friendInfo.Name); } else if (friendType == FriendType.Black) { tips = string.Format(DBConstText.GetText("FRIENDS_DEL_BLACKLIST"), friendInfo.Name); } ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, tips, (dt) => { NetClient.GetBaseClient().SendData <C2SRelationDel>(NetMsg.MSG_RELATION_DEL, data); } , null); } }
public bool CheckServerState(ServerInfo serverInfo, bool isShowTips = true) { bool canEnter = true; if (serverInfo.State == EServerState.WillOpen) { canEnter = false; if (isShowTips == true) { UINotice.Instance.ShowMessage(serverInfo.Desc); } } else if (serverInfo.State == EServerState.RoleIsFull) { canEnter = false; if (isShowTips == true) { UINotice.Instance.ShowMessage(DBConstText.GetText("SERVER_CAN_NOT_LOGIN_TIPS")); } } else if (serverInfo.State == EServerState.Maintaining) { canEnter = false; if (isShowTips == true) { UINotice.Instance.ShowMessage(serverInfo.Desc); } } return(canEnter); }
public void HandleApply(uint choice, List <uint> uuids) { if (uuids == null || uuids.Count == 0) { return; } if (choice == 1) { if (IsFull == true || IsReachTargetMemberLimit == true) { UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_IS_FULL")); return; } } C2STeamHandleApply data = new C2STeamHandleApply(); data.choice = choice; data.uuids.AddRange(uuids); NetClient.BaseClient.SendData <C2STeamHandleApply>(NetMsg.MSG_TEAM_HANDLE_APPLY, data); foreach (uint uuid in uuids) { RemoveApplyInfo(uuid); } ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null); }
/// <summary> /// 暂停自动战斗 /// </summary> public void PauseAutoFighting(bool isShowTips = false) { if (InstanceHelper.InstanceIsInPlay() == false) { return; } Actor localPlayer = Game.GetInstance().GetLocalPlayer(); if (localPlayer == null) { return; } if (IsAutoFighting && localPlayer.GetAIEnable() == true) { localPlayer.ActiveAI(false); localPlayer.AttackCtrl.ClearCacheSkill(); GameInput.Instance.EnableInput(true); mAutoFightBreakingTime = 0.0f; mAutoBreakRecoverTime = GameConstHelper.GetFloat("GAME_AUTO_FIGHT_BREAK_RECOVER_TIME"); if (isShowTips == true) { UINotice.Instance.ShowMessage(DBConstText.GetText("AUTO_FIGHT_PAUSE")); } } }
public void LocalPlayerWalkToDestination(Vector3 targetPos, Task relateTask = null) { Actor player = Game.GetInstance().GetLocalPlayer(); if (player == null) { return; } targetPos.y = RoleHelp.GetHeightInScene(player.ActorId, targetPos.x, targetPos.z); targetPos = InstanceHelper.ClampInWalkableRange(targetPos, 10); // 判断是否可到达 XNavMeshPath walkMeshPath = new XNavMeshPath(); XNavMesh.CalculatePath(player.transform.position, targetPos, xc.Dungeon.LevelManager.GetInstance().AreaExclude, walkMeshPath); if (walkMeshPath.status != XNavMeshPathStatus.PathComplete) { // 如果通过任务导航寻路,且在新手副本的不可到达区域,则直接飞过去,以免因为配置错误而导致卡死 if (relateTask != null && SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON")) { GameDebug.LogWarning(DBConstText.GetText("MAP_POS_CAN_NOT_REACH") + ",该场景是新手场景,直接瞬移过去"); player.MoveCtrl.SendFly(targetPos); player.SetPosition(targetPos); } else { UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH")); } return; } InstanceManager.Instance.IsAutoFighting = false; mPathWalker.WalkTo(targetPos); //player.MoveCtrl.TryWalkTo(targetPos); /* * uint instanceType = InstanceManager.Instance.InstanceType; * * if (instanceType == GameConst.WAR_TYPE_WILD || instanceType == GameConst.WAR_TYPE_HOLE || instanceType == GameConst.WAR_SUBTYPE_WILD_PUB || instanceType == GameConst.WAR_TYPE_MULTI) * { * if(mPathWalker == null) * { * return; * } * * mPathWalker.WalkTo(targetPos); * } * else * { * player.MoveCtrl.TryWalkTo(targetPos); * }*/ TaskNavigationActive(true); IsNavigating = true; }
static void TryInitTimeFormat() { m_time_format_houras_hours = DBConstText.GetText("TIME_FORMAT_HAS_HOURS"); m_time_format_houras_minutes = DBConstText.GetText("TIME_FORMAT_HAS_MINUTES"); m_time_format_houras_seconds = DBConstText.GetText("TIME_FORMAT_HAS_SECONDS"); m_time_format_hour = DBConstText.GetText("TIME_FORMAT_HOUR"); //时 m_time_format_min = DBConstText.GetText("TIME_FORMAT_MIN"); //分 m_time_format_sec = DBConstText.GetText("TIME_FORMAT_SEC"); //秒 }
public static string GetFlyWordById(uint id) { var db = DBManager.Instance.GetDB <DBFlyWord>(); string key = db.GetFlyWordKey(id); if (key != null) { return(DBConstText.GetText(key)); } return(""); }
/// <summary> /// 通过查副本切换控制表来检查能否切换 /// </summary> /// <param name="warType"></param> /// <param name="warSubType"></param> /// <returns></returns> public static bool CheckCanSwitch(uint warType, uint warSubType, bool show_notice = true) { uint curWarType = InstanceManager.Instance.InstanceType; uint curWarSubType = InstanceManager.Instance.InstanceSubType; // 游戏初始副本类型的值都是0,这时候可以跳转到任何副本 if (curWarType == 0 && curWarSubType == 0) { return(true); } List <string> datas = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "instance_switch_control", "id", curWarType + "_" + curWarSubType, "type_" + warType + "_" + warSubType); if (datas != null && datas.Count > 0) { uint val = 0; uint.TryParse(datas[0], out val); if (val > 0) { return(true); } } else { GameDebug.LogError("Check can switch instance error, can not find config in excel, current war type: " + curWarType + ", current war sub type: " + curWarSubType + ", target war type: " + warType + ", target war sub type: " + warSubType); return(false); } bool isInstance = false; if (warType == GameConst.WAR_TYPE_DUNGEON) { isInstance = true; } if (isInstance == true) { if (show_notice) { UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_SWITCH_INSTANCE")); } } else { if (show_notice) { UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_SWITCH_WILD_INSTANCE")); } } GameDebug.Log("Can not switch instance, current war type: " + curWarType + ", current war sub type: " + curWarSubType + ", target war type: " + warType + ", target war sub type: " + warSubType); return(false); }
/// <summary> /// 同意好友申请 /// </summary> /// <param name="uuid"></param> public void ApproveApplicant(uint uuid) { if (FriendsManager.Instance.IsBlackList(uuid)) { UINotice.Instance.ShowMessage(DBConstText.GetText("GAME_PLAYER_IN_BLACKLIST_TIPS")); return; } var pack = new C2SRelationFriendApprove(); pack.uuid = uuid; NetClient.GetBaseClient().SendData <C2SRelationFriendApprove>(NetMsg.MSG_RELATION_FRIEND_APPROVE, pack); }
/// <summary> /// 是否可以跳转到其他副本去 /// </summary> /// <returns></returns> public bool TryToOtherDungeonScene() { if (SceneHelp.IsReEnterScene)//处于重进当前场景中,一直允许切换 { return(true); } if (PKModeManagerEx.Instance.IsInPVPState() || PKModeManagerEx.Instance.IsPVPBattleState) { xc.UINotice.Instance.ShowMessage(DBConstText.GetText("SKILL_CANNT_FLY_IN_PVP_BATTLE")); return(false); } return(true); }
public bool CheckSysDownloaded(uint sys_id) { int patch_id; if (!SysConfigManager.Instance.CheckSysHasDownloaded(sys_id, out patch_id)) { //需要下载最新资源才能体验当前内容 var content = DBConstText.GetText("DOWNLOAD_PATCH_TIPS"); ui.UIWidgetHelp.Instance.ShowNoticeDlg(ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, content, (param) => { ui.ugui.UIManager.Instance.ShowSysWindow("UIPatchWindow", patch_id); }, null); return(false); } return(true); }
public bool Apply(uint teamId) { if (HaveTeam == true) { UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_HAVE_TEAM_CAN_NOT_APPLY")); return(false); } C2STeamApply data = new C2STeamApply(); data.team_id = teamId; NetClient.BaseClient.SendData <C2STeamApply>(NetMsg.MSG_TEAM_APPLY, data); return(true); }
/// <summary> /// 判断是否满足组件的条件(图片名称,文本内容) /// </summary> /// <param name="widget"></param> /// <returns></returns> public bool MatchComponent(GameObject widget, string path) { var pathParams = path.Split(new char[] { ':' }); if (pathParams.Length <= 2) //没有组件条件,当做满足处理 { return(true); } if (pathParams.Length <= 3) //配置格式错误 { return(false); } var componentType = pathParams[2]; var componentValue = pathParams[3]; if (componentType == "Image") { Image image = widget.GetComponent <Image>(); return(image != null && image.sprite.name == componentValue); } else if (componentType == "Text") { Text text = widget.GetComponent <Text>(); return(text != null && text.text == DBConstText.GetText(componentValue)); } else if (componentType == "GoodsNameText") { Text text = widget.GetComponent <Text>(); uint goodsId; if (!uint.TryParse(componentValue, out goodsId)) { return(false); } return(text != null && text.text == GoodsHelper.GetGoodsOriginalNameByTypeId(goodsId)); } if (componentType == "RawImage") { RawImage rawImage = widget.GetComponent <RawImage>(); return(rawImage != null && rawImage.mainTexture.name == componentValue); } else { return(false); } }
public void OnGetPackFinished(string url, string error, string reply, System.Object userData) { if (string.IsNullOrEmpty(error) == false) { GameDebug.LogError("OnGetPackFinished error: " + error); UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_FAIL")); mPostGetPackFinishedCallback?.Invoke(false); return; } bool ret = false; Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable; if (hashtable != null) { int result = DBTextResource.ParseI(hashtable["result"].ToString()); if (result == 1) { UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_EXCHANGE_SUCCESS")); ret = true; } else { Hashtable argsHashtable = hashtable["args"] as Hashtable; if (argsHashtable != null) { string msg = argsHashtable["error_msg"].ToString(); string translatedMsg = xc.TextHelper.GetTranslateText(msg); UINotice.GetInstance().ShowMessage(translatedMsg); } else { UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_FAIL")); } } } else { GameDebug.LogError("OnGetPackFinished error: " + reply); } mPostGetPackFinishedCallback?.Invoke(ret); }
public void SystemMessageEx(string param) { /*{ * "action":"PayCallback", * "code":1, // 1:成功 -1:取消 * "msg":"支付成功" * * }*/ var json_object = MiniJSON.JsonDecode(param); if (json_object == null) { Debug.LogError("SystemMessageEx: json is invalid"); return; } Hashtable param_info = json_object as Hashtable; if (param_info == null) { Debug.LogError("SystemMessageEx: param_info is invalid"); return; } string action = param_info["action"].ToString(); if (action == "PayCallback") // 支付的回调 { int code = int.Parse(param_info["code"].ToString()); string msg = param_info["msg"].ToString(); if (code == 1)// 成功或者取消的时候才提示 { UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_SUCC")); } else if (code == -1) { UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_CANCEL")); } else { UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_FAIL")); } } }
/// <summary> /// 能否进入结婚场景 /// </summary> public static bool CanJumpToMarryScene(bool needTips) { List <uint> npcParams = xc.GameConstHelper.GetUintList("GAME_MARRY_NPC"); uint id = npcParams[0]; var attr = LocalPlayerManager.Instance.LocalActorAttribute; var needLv = InstanceHelper.GetInstanceNeedRoleLevel(id); if (attr != null && attr.Level < needLv) { if (needTips) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("MARRIAGE_LEVEL_NOT_ENOUGH"), needLv)); //UINotice.Instance.ShowMessage(string.Format("情缘岛地图{0}级开放,等级不足无法进入", needLv)); } return(false); } return(true); }
/// <summary> /// 发送申请好友请求 /// </summary> /// <param name="id"></param> public void SendAddFriendRequest(FriendType type, uint id, uint targetLv = 0) { if (targetLv > 0) { uint limit = GameConstHelper.GetUint("GAME_FRIEND_LV_LIMIT"); if (targetLv < limit) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("FRIENDS_ADD_OTHER_LEVEL_NOT_ENOUGH"), limit)); return; } } var data = new C2SRelationAdd(); data.type = (uint)type; data.target_id = id; NetClient.GetBaseClient().SendData <C2SRelationAdd>(NetMsg.MSG_RELATION_ADD, data); //if (type == FriendType.Friend) // UINotice.Instance.ShowMessage(DBConstText.GetText("HAS_SENT_FRIEND_APPLICATION")); }
public bool GotoSoulTownWnd(params object[] args) { if (!SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_SOUL_TOWN, true)) { return(false); } if (!CheckSysDownloaded(GameConst.SYS_OPEN_SOUL_TOWN)) { return(false); } if (SceneHelp.Instance.IsKungfuInstance == false) { UIManager.Instance.ShowSysWindow("UIKungfuGodWindow"); } else { xc.UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_ALREADY_IN_IT")); } return(true); }
public bool Invite(uint uuid) { uint cd = GetInviteCD(uuid); if (cd == 0) { C2STeamInvite data = new C2STeamInvite(); data.uuids.Add(uuid); NetClient.BaseClient.SendData <C2STeamInvite>(NetMsg.MSG_TEAM_INVITE, data); return(true); } else { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_INVITE_IN_CD"), cd)); return(false); } }
/// <summary> /// 获取指定技能槽未开启时候的提示文本 /// </summary> /// <param name="vocationId"></param> /// <param name="slotPos"></param> /// <returns></returns> public string GetSkillSlotNotice(uint vocationId, uint slotPos) { VocationSkillSlotInfo info; mInfos.TryGetValue(vocationId, out info); if (info != null) { var slotInfo = info.GetSlotInfo(slotPos); if (slotInfo != null) { var textKey = slotInfo.NotOpenNotice; if (!string.IsNullOrEmpty(textKey)) { var notice = DBConstText.GetText(textKey); return(notice); } } } return(""); }
public void AddBlackList(uint uuid) { FriendsInfo black = null; List <FriendsInfo> friendList = null; if (mCommon.TryGetValue(FriendType.Black, out friendList) == true) { black = friendList.Find(delegate(FriendsInfo _info) { return(_info.Uid == uuid); }); if (black != null) { UINotice.Instance.ShowMessage(DBConstText.GetText("FRIENDS_ADD_1")); } else { if (uuid == LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx) { UINotice.Instance.ShowMessage(DBConstText.GetText("FRIENDS_ADD_2")); return; } ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, DBConstText.GetText("FRIENDS_ADD_8"), (dt) => { FriendsNet.Instance.SendAddFriendRequest(FriendType.Black, uuid); } , null); } } else { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, DBConstText.GetText("FRIENDS_ADD_8"), (dt) => { FriendsNet.Instance.SendAddFriendRequest(FriendType.Black, uuid); } , null); } }
public void OnGetServerListFinished(string url, string error, string reply, System.Object userData) { System.Object replyObject = MiniJSON.JsonDecode(reply); if (string.IsNullOrEmpty(error) == false) { GameDebug.LogError("Control server error: " + error); xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("GET_SERVER_INFO_FAIL")); if (mGetServerListFinishedCallback != null) { mGetServerListFinishedCallback(null); } return; } List <ServerInfo> serverList = ParseServerList((replyObject as Hashtable)["args"]); if (mGetServerListFinishedCallback != null) { mGetServerListFinishedCallback(serverList); } }
// 大于1小时->小时xx分 // 小于1小时->xx分xx秒 public static string SecondsToStr_4(int total_seconds) { if (total_seconds < 0) { total_seconds = 0; } int hour = total_seconds / 3600; int min = (total_seconds - hour * 3600) / 60; int sec = total_seconds % 60; string ret = ""; if (hour > 0) { ret = string.Format(DBConstText.GetText("OFFLINE_TIME_FORMAT_HAS_HOURS"), hour, min); } else { ret = string.Format(DBConstText.GetText("TIME_FORMAT_HAS_MINUTES"), min, sec); } return(ret); }
/// <summary> /// 触发技能 /// </summary> /// <param name="item"></param> /// <returns></returns> bool TrggerSkill(uint skill_id) { LocalPlayer localPlayer = Game.GetInstance().GetLocalPlayer() as LocalPlayer; if (localPlayer == null) { return(false); } if (!localPlayer.IsResLoaded) { return(false); } Skill skill = localPlayer.GetSelfSkill(skill_id); if (skill == null) { return(false); } if (localPlayer.AttackCtrl.IsSkillCanCast_showTipsWhenFalse(skill, 0, ref m_tips_type) == false) { if (m_tips_type != ClickRockButtonTipsType.None) { Dictionary <ClickRockButtonTipsType, float> m_tipsData; if (m_clickRockButtonTips.TryGetValue(skill_id, out m_tipsData) == false) { m_clickRockButtonTips[skill_id] = new Dictionary <ClickRockButtonTipsType, float>(); m_tipsData = m_clickRockButtonTips[skill_id]; } if (m_tipsData.ContainsKey(m_tips_type) == false) { m_tipsData[m_tips_type] = 0; } if (Time.realtimeSinceStartup >= m_tipsData[m_tips_type] + m_rockButtonTipsInterval) { m_tipsData[m_tips_type] = Time.realtimeSinceStartup; if (m_tips_type == ClickRockButtonTipsType.IsInCD) { UINotice.GetInstance().ShowMessage(DBConstText.GetText("SKILL_IN_CD")); } else if (m_tips_type == ClickRockButtonTipsType.NotEnoughMp) { UINotice.GetInstance().ShowMessage(DBConstText.GetText("MP_NOT_ENOUGH")); } } } return(false); } bool needAi = false; if (skill.GetAction(0).ActionData.SkillInfo.Target == "rival") { needAi = true; //InstanceManager.Instance.IsInAutoFireOneSkillModel = true; } bool attack_succ = false; if (localPlayer.IsGrounded()) { attack_succ = localPlayer.AttackCtrl.Attack(skill.SkillData.SkillID); localPlayer.MoveCtrl.Interrupt(); } return(attack_succ); }
public void OnGetServerStateFinished(string url, string error, string reply, System.Object userData) { #if UNITY_IPHONE reply = Utils.AES.Decode(reply, Const.CS_URL_KEY, Const.CS_URL_IV); #endif System.Object replyObject = MiniJSON.JsonDecode(reply); if (CheckReply(url, error, replyObject) == false) { if (mGetServerStateFinishedCallback != null) { mGetServerStateFinishedCallback(null, false); } return; } ServerInfo serverInfo = userData as ServerInfo; if (serverInfo == null) { GameDebug.LogError("Error in OnGetServerStateFinished, serverInfo is null!!!"); return; } Hashtable hashtable = (replyObject as Hashtable)["args"] as Hashtable; if (hashtable != null) { serverInfo.State = (EServerState)DBTextResource.ParseI(hashtable["status"].ToString()); } bool canEnter = CheckServerState(serverInfo); // 如果是不推荐进入的服务器,则读取recomm属性选中推荐的服务器 if (serverInfo.State == EServerState.NotRecomm) { if (hashtable != null) { Hashtable recommHashtable = hashtable["recomm"] as Hashtable; if (recommHashtable != null) { ServerInfo recommServerInfo = ParseServerInfo(recommHashtable); if (recommServerInfo != null) { xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("SERVER_NOT_RECOMM_TIPS"), (x) => { ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SELECT_SERVER, new CEventBaseArgs(recommServerInfo)); }); canEnter = false; } } } } if (mGetServerStateFinishedCallback != null) { mGetServerStateFinishedCallback(serverInfo, canEnter); } if (canEnter == false || mEnterWhenGetServerStateFinished == false) { return; } GlobalConfig.GetInstance().LoginInfo.ServerInfo = serverInfo; string[] ips = serverInfo.Url.Split(':'); Game game = Game.GetInstance(); game.ServerIP = ips[0]; game.ServerPort = DBTextResource.ParseI(ips[1]); game.ServerID = (uint)serverInfo.SId; ControlServerLogHelper.GetInstance().PostAccountLoginLogS(serverInfo.ServerId, serverInfo.State); game.GameMode = (Game.EGameMode)((int)game.GameMode | (int)xc.Game.EGameMode.GM_Net); game.Login(); }
public string GetStepFixedDescription(int stepIndex) { var step = GetStep(stepIndex); if (step == null || step.Description == null) { return(string.Empty); } string result = DBConstText.GetText(step.Description); // 对目标名字进行替换 if (step.Goal == GameConst.GOAL_TALK) { result = string.Format(result, NpcHelper.GetNpcName(step.InstanceId, step.NpcId)); } else if (step.Goal == GameConst.GOAL_KILL_MON) { result = string.Format(result, RoleHelp.GetActorName(step.MonsterId)); } else if (step.Goal == GameConst.GOAL_INTERACT) { result = string.Format(result, RoleHelp.GetActorName(NpcHelper.MakeNpcDefine(step.NpcId).ActorId)); } else if (step.Goal == GameConst.GOAL_KILL_COLLECT) { result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } else if (step.Goal == GameConst.GOAL_COLLECT_GOODS) { if (step.MinWorldBossSpecialMonId > 0 && step.MaxWorldBossSpecialMonId > 0) { DBSpecialMon dbSpecialMon = DBManager.Instance.GetDB <DBSpecialMon>(); uint minLevel = dbSpecialMon.GetSpecialMonLevel(step.MinWorldBossSpecialMonId); uint maxLevel = dbSpecialMon.GetSpecialMonLevel(step.MaxWorldBossSpecialMonId); result = string.Format(result, minLevel, maxLevel, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } else { result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } } else if (step.Goal == GameConst.GOAL_WAR_WIN || step.Goal == GameConst.GOAL_WAR_ENTER || step.Goal == GameConst.GOAL_WAR_GRADE) { result = string.Format(result, InstanceHelper.GetInstanceName(step.InstanceId2)); } else if (step.Goal == GameConst.GOAL_EQUIP_SUBMIT) { result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep)); } else if (step.Goal == GameConst.GOAL_SECRET_AREA) { result = string.Format(result, InstanceHelper.GetKungfuGodInstanceName(step.SecretAreaId)); } else if (step.Goal == GameConst.GOAL_TRIGRAM) { result = string.Format(result, TaskHelper.GetTrigramName(step.TrigramId)); } else if (step.Goal == GameConst.GOAL_EQUIP_WEAR) { result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep)); } else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH) { result = string.Format(result, step.EquipStrenghtLv); } else if (step.Goal == GameConst.GOAL_EQUIP_GEM) { } else if (step.Goal == GameConst.GOAL_PET_LV) { result = string.Format(result, step.PetLv); } else if (step.Goal == GameConst.GOAL_GROW_LV) { } else if (step.Goal == GameConst.GOAL_STIGMA_LV) { DBStigma dbStigma = DBManager.Instance.GetDB <DBStigma>(); DBStigma.DBStigmaInfo stigmaInfo = dbStigma.GetOneDBStigmaInfo(step.StigmaId); if (stigmaInfo != null) { string name = stigmaInfo.Name; result = string.Format(result, name); } else { GameDebug.LogError("GetStepFixedDescription error, can not find stigma info by id " + step.StigmaId); } } else if (step.Goal == GameConst.GOAL_DRAGON_SOUL) { result = string.Format(result, step.ExpectResult); } else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH_TLV) { result = string.Format(result, step.EquipStrenghtLv); } else if (step.Goal == GameConst.GOAL_KILL_BOSS) { if (step.MonsterLevel > 0) { result = string.Format(result, step.ExpectResult, step.MonsterLevel); } else { result = string.Format(result, step.ExpectResult); } } else if (step.Goal == GameConst.GOAL_LIGHT_EQUIP) { List <string> names = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_light_equip", "id", step.LightEquipLv.ToString(), "desc"); if (names != null && names.Count > 0) { result = string.Format(result, names[0]); } } else { result = TaskHelper.GetStepFixedDescriptionByLua(step); } return(result); }