public void InitClient() { try { bootstrap .Group(group) .Channel <TcpSocketChannel>() .Option(ChannelOption.TcpNodelay, true) .Option(ChannelOption.ConnectTimeout, TimeSpan.FromSeconds(3)) .Handler(new ActionChannelInitializer <ISocketChannel>(channel => { IChannelPipeline pipeline = channel.Pipeline; //pipeline.AddLast("log", new LoggingHandler("Log")); pipeline.AddLast("timeout", new IdleStateHandler(0, 0, 30)); pipeline.AddLast("connectionWatchdog", new ConnectionWatchdog(bootstrap, Config, sessionMap, timer, loggerFactory)); pipeline.AddLast("activeIdleStateTrigger", new ActiveIdleStateTrigger(loggerFactory)); pipeline.AddLast("enc", new Cmpp2Encoder(loggerFactory)); pipeline.AddLast("dec", new Cmpp2Decoder(loggerFactory, ushort.MaxValue, 0, 4, -4, 0)); pipeline.AddLast(eventExecutorGroup, "submit", new CmppSubmitRespHandler(smsHandler, matchQueue, loggerFactory)); pipeline.AddLast(eventExecutorGroup, "deliver", new CmppDeliverHandler(smsHandler, loggerFactory)); pipeline.AddLast(eventExecutorGroup, "connetc", new CmppConnectHandler(Config, sessionMap, ConnectCallBack, timer, loggerFactory)); pipeline.AddLast(eventExecutorGroup, "active", new CmppActiveHandler(loggerFactory)); pipeline.AddLast(eventExecutorGroup, "connectClose", new ConnectCloseHandler(sessionMap, smsHandler.ConnectCloseCompleteCallBack, loggerFactory)); })); if (Config.AutoReConnect) { ForeverReConnect(); } else { //ConnectAsync().GetAwaiter().GetResult(); } } catch (Exception e) { logger.Error(e); group.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)); } }
private static void CreateNotifyEffect(TeamSignalType signalType, Position pos) { string signalPerform = TeamSignalManager.GetSignalPerform(signalType); if (signalType == TeamSignalType.Fire || signalType == TeamSignalType.Defense) { return; } if (string.IsNullOrEmpty(signalPerform)) { return; } SysSkillPerformVo dataById = BaseDataMgr.instance.GetDataById <SysSkillPerformVo>(signalPerform); if (dataById == null) { ClientLogger.Error("cannot found SysSkillPerformVo #" + signalPerform); } else { ResourceHandle resourceHandle = MapManager.Instance.SpawnResourceHandle(dataById.effect_id, new Vector3(pos.x, pos.y, pos.z), Quaternion.identity, 0); if (resourceHandle != null) { resourceHandle.DelayRelease(1.8f); } else { ClientLogger.Error("SpawnEffect failed #" + dataById.effect_id); } } }
public void Save(Action <Exception> callback) { if (this._threadZipping) { ClientLogger.Error("zipping is not finished"); if (callback != null) { callback(new InvalidOperationException("zipping is not finished")); } return; } List <ReplayMessage> savedMsgs = this._savedMsgs; this._savedMsgs = new List <ReplayMessage>(10); this._threadException = null; this._finishCallback = callback; this._threadZipping = true; new Thread(delegate(object x) { List <ReplayMessage> data = x as List <ReplayMessage>; try { SerializerUtils.ReplaySerialize(this._path, data); } catch (Exception threadException) { this._threadException = threadException; } this._threadZipping = false; }).Start(savedMsgs); new Task(this.Monitor(), true); }
private void ConfigureVideoCaptureDevice(VideoCaptureDevice device) { // Configure the video capture device. // The weird thing about this is that sometimes (at least on a Macintosh), a video capture device // can have an empty device.SupportedFormats collection, but still be able to capture video. // Generally that format seems to work, but I don't think we can guarantee that. if (device != null) { MediaDeviceConfig.SelectBestVideoFormat(device); if (device.DesiredFormat == null) { ClientLogger.Debug("No appropriate video format was found; current format = {0}.", device.DesiredFormat); // ks 12/13/10 - Since limited testing has shown that some cameras on the Mac that work fine have an empty SupportedFormats collection, // we'd rather not show this error on Mac platforms. There may be other instances where we don't want to show an error, // and there may also be a better way of handling this situation in general. But good enough for now. if (Environment.OSVersion.Platform != PlatformID.MacOSX) { ClientLogger.Error(CommonStrings.Media_NoVideoFormat); MessageService.ShowErrorHint(CommonStrings.Media_NoVideoFormat); } } } else { // Only show an error if there really is no webcam attached. var videoDevices = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices(); if (videoDevices.Count == 0) { ClientLogger.Debug(CommonStrings.Media_NoVideoDevice); MessageService.ShowErrorHint(CommonStrings.Media_NoVideoDevice); } } }
private void CalcScreenWidth() { Vector3?vector = this.ScreenPos2WorldPos(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f)); if (!vector.HasValue) { vector = this.ScreenPos2WorldPos(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 4), 0f)); } if (!vector.HasValue) { vector = this.ScreenPos2WorldPos(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 8), 0f)); } Vector3?vector2 = this.ScreenPos2WorldPos(new Vector3((float)Screen.width, (float)(Screen.height / 2), 0f)); if (!vector2.HasValue) { vector2 = this.ScreenPos2WorldPos(new Vector3((float)Screen.width, (float)(Screen.height / 4 * 3), 0f)); } if (!vector2.HasValue) { vector2 = this.ScreenPos2WorldPos(new Vector3((float)Screen.width, (float)(Screen.height / 8 * 7), 0f)); } if (vector.HasValue && vector2.HasValue) { this.m_fScreenWidth = Mathf.Abs(vector.Value.x - vector2.Value.x) * 2f; } else { ClientLogger.Error("m_fScreenWidth calc failed, levelId = " + LevelManager.CurLevelId); } }
public void SetData(ReplayMetaInfo.ReplayMetaEntry replayInfo) { if (replayInfo == null) { return; } this.ReplayId = replayInfo.ReplayId; string extra = replayInfo.Extra; if (extra == null) { return; } string[] array = extra.Split(new char[] { '|' }); if (array.Length != 7) { ClientLogger.Error("RecordItem: Data Unknown: " + extra); return; } this.Kill = array[0]; this.Death = array[1]; this.Assist = array[2]; this.GameMode = array[3]; this.GameTime = array[5]; this.IsMvp = array[6].Equals("1"); SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(array[4]); this.Hero = heroMainData; }
public void NewbieSetInfo(int inMyUserId, ReadyPlayerSampleInfo[] inPlayerInfos) { this.IsRoomReady = true; this.MyUserId = inMyUserId; this._pvpPlayers.Clear(); this._pvpPlayers.AddRange(inPlayerInfos); for (int i = 0; i < this._pvpPlayers.Count; i++) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this._pvpPlayers[i]; if (readyPlayerSampleInfo != null) { readyPlayerSampleInfo.selfDefSkillId = "1"; } } this.NewbieSetUserNameForRobot(); ReadyPlayerSampleInfo readyPlayerSampleInfo2 = this._pvpPlayers.Find((ReadyPlayerSampleInfo x) => x.newUid == inMyUserId); if (readyPlayerSampleInfo2 != null) { this.SelfTeam = readyPlayerSampleInfo2.GetTeam(); } else { ClientLogger.Error("NewbieSetInfo cannot found related playerinfo"); } }
public override void Init(DropItemData data) { base.Init(data); Sub_DropItemBase sub_DropItemBase; if (base.ItemID == 7777) { sub_DropItemBase = new GameItem_Bottle(); } else { SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(base.ItemID.ToString()); if (dataById == null) { return; } if (dataById.type == 4) { sub_DropItemBase = new GameItem_Rune(); } else { sub_DropItemBase = new GameItem_Other(); } } if (sub_DropItemBase == null) { ClientLogger.Error("配置错误,找不到对应gameitem类型:ItemID=7777,gameitem.type=4"); } else { sub_DropItemBase.Init(data); sub_DropItemBase.SetData(); } }
private bool TryGetComponentReady() { bool flag; switch (this.languageCheckerType) { case LanguageCheckerType.UILabel: this._label = base.gameObject.GetComponent <UILabel>(); flag = (this._label != null); break; case LanguageCheckerType.UISprite: this._sprite = base.gameObject.GetComponent <UISprite>(); flag = (this._sprite != null); break; case LanguageCheckerType.UITexture: this._texture = base.gameObject.GetComponent <UITexture>(); flag = (this._texture != null); break; default: ClientLogger.Error("Undefined Language Checker Type"); return(false); } if (!flag) { ClientLogger.Error("LanguageChecker 无法获得对应脚本 gameObject.name=" + this.GetObjectPath(base.transform)); } return(flag); }
private void CheackParam(string[] param, int count) { if (param.Length < count) { ClientLogger.Error("高级效果参数缺失,请检查高级效果表 id=" + this.config.higheff_id + " name=" + this.config.higheff_name); } }
protected override void P2C_LoginAsViewer(MobaMessage msg) { RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>(); byte retaCode = probufMsg.retaCode; PvpStateBase.LogState("===>receive: P2C_LoginAsViewer:" + retaCode); if (retaCode == 0) { if (this._prevState == PvpStateCode.PveLoad) { Singleton <PvpManager> .Instance.LoadPvpSceneBegin(); base.RecoverFinish(new PvpStateLoad()); } else { base.QueryPsPvpState(); base.RecoverFinish(new PvpStateStart(PvpStateCode.PvpStart)); } } else { ClientLogger.Error("P2C_LoginAsViewer: failed for " + retaCode); Singleton <PvpManager> .Instance.AbandonGame(PvpErrorCode.UnknowError); } }
private void OnMsg_GetActivityTask(MobaMessage msg) { ActivityData activityData = base.Data as ActivityData; OperationResponse operationResponse = msg.Param as OperationResponse; if (operationResponse != null) { base.LastError = (int)operationResponse.Parameters[1]; if (base.LastError == 0) { byte[] buffer = operationResponse.Parameters[124] as byte[]; activityData.listTask = SerializeHelper.Deserialize <List <ActivityTaskData> >(buffer); buffer = (operationResponse.Parameters[125] as byte[]); activityData.listHasReadActivity = SerializeHelper.Deserialize <List <int> >(buffer); this.UpdateActivityNewState(); MobaMessageManagerTools.SendClientMsg(ClientC2V.Receive_GetActivityTask, activityData, false); } else { ClientLogger.Error("OnMsg_GetActivityTask:mobaOpKey=" + base.LastError); } } else { ClientLogger.Error("OnMsg_GetActivityTask:,msg.Param=错误数据"); } base.Valid = (base.LastError == 0 && null != activityData); }
public static List <RewardItemBase> GetRewardInfo(string rewardID) { List <RewardItemBase> list = new List <RewardItemBase>(); SysDropRewardsVo dataById = BaseDataMgr.instance.GetDataById <SysDropRewardsVo>(rewardID); if (dataById == null) { ClientLogger.Error("配置错误,SysDropRewardsVo找不到 id=" + rewardID); } else { string[] array = dataById.drop_items.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { SysDropItemsVo dataById2 = BaseDataMgr.instance.GetDataById <SysDropItemsVo>(array[i]); if (dataById2 != null) { RewardItemBase rewardItem = RewardTools.GetRewardItem(dataById2.rewards); if (rewardItem != null) { list.Add(rewardItem); } } } } return(list); }
public void RequestRewardDrop(int battle_type) { this.RegisterStart(); this.selectheros = CharacterDataMgr.instance.GetSelectedHeros(CharacterDataMgr.instance.ChangeStrUserKey(battle_type.ToString())).ToArray(); for (int i = 0; i < this.rewards.Length; i++) { this.rewards[i] = new List <string>(); } string curBattleId = LevelManager.CurBattleId; string curLevelId = LevelManager.CurLevelId; if (curLevelId.ToCharArray()[0] != curBattleId.ToCharArray()[0]) { Singleton <TipView> .Instance.ShowViewSetText("关卡号与关卡类型不匹配", 1f); ClientLogger.Error("关卡号与关卡类型不匹配"); return; } SendMsgManager.SendMsgParam param = new SendMsgManager.SendMsgParam(true, "等待服务器响应...", true, 15f); SendMsgManager.Instance.SendMsg(MobaGameCode.GetEquipmentDrop, param, new object[] { curBattleId, curLevelId, this.selectheros }); }
public void ReadySkillCheck(ReadySkillCheckInfo info) { Skill skillOrAttackById = this.self.getSkillOrAttackById(info.skillId); Units units = null; if (info.targetUnits != null && info.targetUnits.Count > 0) { units = MapManager.Instance.GetUnit((int)info.targetUnits[0]); } if (null == units && ((skillOrAttackById.needTarget && skillOrAttackById.IsSkill) || skillOrAttackById.IsAttack)) { ClientLogger.Error("Recv ReadySkillCheck target null: " + info); return; } if (info.checkSuccess) { if (skillOrAttackById.IsAttack) { this.ComboAttack_Impl(skillOrAttackById.skillIndex, units, false); } else if (info.targetPosition == null) { this.Conjure_Impl(info.skillId, units, null, false); } else { this.Conjure_Impl(info.skillId, units, new Vector3?(MoveController.SVectgor3ToVector3(info.targetPosition)), false); } } else if (info.targetPosition != null && units != null) { units.transform.position = MoveController.SVectgor3ToVector3(info.targetPosition); } }
public void CheackSaveData() { if (this.saveData != string.Empty) { string[] array = this.saveData.Split(new char[] { '|' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[] { '&' }); int num; if (array2.Length > 4 && int.TryParse(array2[4], out num)) { this.AddInvitation(array2[0], array2[1], array2[2], array2[3], (InvitateType)int.Parse(array2[4])); } else { ClientLogger.Error(string.Concat(new object[] { "something wrong _datas[", i, "]=", array[i] })); } } } this.saveData = string.Empty; }
public T GetProbufMsg <T>() where T : class { T result; try { if (this.Param is byte[]) { byte[] buffer = this.Param as byte[]; T t = SerializeHelper.Deserialize <T>(buffer); result = t; } else { OperationResponse operationResponse = this.Param as OperationResponse; byte[] buffer2 = (byte[])operationResponse.Parameters[0]; T t2 = SerializeHelper.Deserialize <T>(buffer2); result = t2; } } catch (Exception ex) { ClientLogger.Error(string.Concat(new object[] { "pvp GetProbufMsg error:", this.mID, " type:", typeof(T), " ", ex.ToString() })); result = (T)((object)null); } return(result); }
private static string GetResId(EntityVo vo) { if (vo == null) { return(null); } string npc_id = vo.npc_id; if (npc_id != string.Empty) { if (vo.entity_type == EntityType.Hero) { SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(npc_id); if (heroMainData == null) { } return(heroMainData.model_id); } if (vo.entity_type == EntityType.Monster) { SysMonsterMainVo monsterMainData = BaseDataMgr.instance.GetMonsterMainData(npc_id); return(monsterMainData.model_id); } ClientLogger.Error("cannot support " + vo.entity_type); } return(null); }
private void OnGetMsg_ModifyEmailState(OperationResponse operationResponse) { base.LastError = (int)operationResponse.Parameters[1]; MailModelData mailModelData = base.Data as MailModelData; MobaErrorCode lastError = (MobaErrorCode)base.LastError; if (lastError != MobaErrorCode.Ok) { ClientLogger.Error("ModifyEmailState Error: " + base.LastError); SendMsgManager.Instance.SendMsg(MobaGameCode.GetMailList, null, new object[0]); } else { long mailId = (long)operationResponse.Parameters[73]; mailModelData.modifyMailId = mailId; mailModelData.mailList.ForEach(delegate(MailData obj) { if (obj.Id == mailId) { obj.IsRead = true; } }); base.DebugMessage = "收到邮件信息!"; } }
private void Awake() { this.listItemID = new List <int>(); this.dicComs = new Dictionary <int, Activity_activityMenu>(); this.dicNoticeData = new Dictionary <int, NoticeBoardData>(); Dictionary <string, object> dicByType = BaseDataMgr.instance.GetDicByType <SysActivityVo>(); this.config = new Dictionary <int, SysActivityVo>(); DateTime serverCurrentTime = ToolsFacade.ServerCurrentTime; foreach (KeyValuePair <string, object> current in dicByType) { SysActivityVo sysActivityVo = current.Value as SysActivityVo; if (sysActivityVo != null) { DateTime dateTime = ActivityTools.GetDateTime(sysActivityVo.show_start_time, true); DateTime dateTime2 = ActivityTools.GetDateTime(sysActivityVo.show_end_time, false); if (string.IsNullOrEmpty(sysActivityVo.show_start_time) || !(serverCurrentTime < dateTime)) { if (string.IsNullOrEmpty(sysActivityVo.show_end_time) || !(serverCurrentTime > dateTime2)) { this.config.Add(int.Parse(current.Key), sysActivityVo); } } } } if (this.config == null) { this.valid = false; ClientLogger.Error("SysActivityVo 读取失败"); } }
private void Awake() { if (this.noticeRoot == null && this.content == null && this.tween == null) { ClientLogger.Error("ServerNotice 指定组件为空。"); } }
public override void OnInit() { if (this.isInited) { return; } this.isInited = true; if (this.self.npc_id != "[]") { this.configAttr = BaseDataMgr.instance.GetHeroMainData(this.self.npc_id); if (this.configAttr == null) { ClientLogger.Error("hero SetConfigData Data Error : " + this.self.npc_id); return; } this.MainAttrType = this.GetMainAttr(this.configAttr.character_type); base.ClearDataPool(); this.SetConfigData(); this.CollectGameItemAttr(); this.CollectTalent(); this.SetL1AttrGrowth(1); base.CalcAllAttrs(); this.InitDynamicData(); } }
public void RefreshEquips() { List <ItemDynData> list = null; Units unit = MapManager.Instance.GetUnit(this.UniqueId); if (unit) { list = ((Hero)unit).EquipPackage.EquipList; } for (int i = 0; i < 6; i++) { this._equipIcons[i].mainTexture = null; if (i < list.Count) { string typeId = list[i].typeId; SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(typeId); if (dataById == null) { ClientLogger.Error("item not found for id=" + typeId); return; } this._equipIcons[i].mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false); } } }
private void OnGetMsg_GetPlayerData(MobaMessage msg) { if (msg == null) { return; } OperationResponse operationResponse = msg.Param as OperationResponse; if (operationResponse == null) { return; } int num = (int)operationResponse.Parameters[1]; MobaErrorCode mobaErrorCode = (MobaErrorCode)num; if (mobaErrorCode == MobaErrorCode.Ok) { if (this.targetId == null) { ClientLogger.Error(" targetId is null @shaohe"); } else { this.ShowDetailsInfo(this.targetId); } } }
public void GetErrorInformation(int arg1) { IEnumerator enumerator = Enum.GetValues(typeof(MobaErrorCode)).GetEnumerator(); try { while (enumerator.MoveNext()) { MobaErrorCode mobaErrorCode = (MobaErrorCode)((int)enumerator.Current); if (arg1 == (int)mobaErrorCode) { if (arg1 != 0) { ClientLogger.Error("错误信息:" + mobaErrorCode.ToString()); } break; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public string GetStringById(string id) { this.txt = string.Empty; if (this.getDataReady) { this.tampLanguageVo = BaseDataMgr.instance.GetLanguageData(id); if (this.tampLanguageVo == null) { ClientLogger.Error("语言包中找不到语言id为* " + id + " *的文本内容,详情请咨询相关策划在检查Language之后"); Match match = Regex.Match(id, "[\\u4e00-\\u9fa5]"); if (match.Success) { this.txt = id; } else { this.txt = string.Empty; } } else { this.txt = this.tampLanguageVo.content; } } this.FixBrokenWord(this.txt, 1); return(this.txt); }
private void L2C_StartGame(MobaMessage msg) { OperationResponse operationResponse = msg.Param as OperationResponse; byte[] array = (byte[])operationResponse.Parameters[0]; byte[] buffer = (byte[])operationResponse.Parameters[1]; PvpStartGameInfo pvpStartGameInfo = SerializeHelper.Deserialize <PvpStartGameInfo>(array); BattleRoomInfo battleRoomInfo = SerializeHelper.Deserialize <BattleRoomInfo>(buffer); PvpStateBase.LogState("L2C_StartGame:" + (StringUtils.DumpObject(array) ?? "null")); if (pvpStartGameInfo != null && battleRoomInfo != null) { this._isGsConnected = false; NetWorkHelper.Instance.DisconnectFromGateServer(false); NetWorkHelper.Instance.DisconnectLobbyServer(); Singleton <PvpManager> .Instance.LoginInfo = pvpStartGameInfo; Singleton <PvpManager> .Instance.ServerBattleRoomInfo = battleRoomInfo; NetWorkHelper.Instance.ConnectToPvpServer(); if (!string.IsNullOrEmpty(battleRoomInfo.roomVoiceID)) { } } else { ClientLogger.Error("L2C_StartGame: PvpStartGameInfo is null"); PvpStateManager.Instance.ChangeState(new PvpStateHome()); } }
private void Init() { this.config = new Dictionary<int, SysActivityTypeVo>(); Dictionary<string, object> dicByType = BaseDataMgr.instance.GetDicByType<SysActivityTypeVo>(); long exp = ModelManager.Instance.Get_userData_filed_X("Exp"); int userLevel = CharacterDataMgr.instance.GetUserLevel(exp); foreach (KeyValuePair<string, object> current in dicByType) { SysActivityTypeVo sysActivityTypeVo = current.Value as SysActivityTypeVo; if (sysActivityTypeVo.level_limit_floor == 0 || userLevel >= sysActivityTypeVo.level_limit_floor) { if (sysActivityTypeVo.level_limit_top == 0 || userLevel <= sysActivityTypeVo.level_limit_top) { this.config.Add(int.Parse(current.Key), sysActivityTypeVo); } } } if (this.config != null) { this.keys = new List<int>(this.config.Keys); this.keys.Sort(); } else { this.valid = false; ClientLogger.Error("SysActivityTypeVo 读取失败"); } this.dicComs = new Dictionary<int, Activity_title>(); }
private void AssignPersonalData() { if (this.self is Hero) { Hero hero = this.self as Hero; if (hero.heroData == null) { return; } if (hero.heroData.backEffectId != 0) { SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(hero.heroData.backEffectId.ToString()); if (dataById != null) { this.personalBackHomeSkilltId = dataById.hero_decorate_param; } else { ClientLogger.Error("私人定制道具没找到 error id=" + hero.heroData.backEffectId); } } if (hero.heroData.eyeUnitSkinId != 0) { SysGameItemsVo dataById2 = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(hero.heroData.eyeUnitSkinId.ToString()); if (dataById2 != null) { this.personalEyeSkillId = dataById2.hero_decorate_param; } else { ClientLogger.Error("私人定制道具没找到 error id=" + hero.heroData.eyeUnitSkinId); } } } }
public static void End() { ClientLogger.Error("end"); ProfilerHelper._newStats = ProfilerHelper.Capture(); ClientLogger.Error("old:" + ProfilerHelper._oldStats.ToString()); ClientLogger.Error("new:" + ProfilerHelper._newStats.ToString()); ClientLogger.Error("diff:" + (ProfilerHelper._newStats - ProfilerHelper._oldStats).ToString()); }