public async Task <JsonResult> Update(UserAttendanceVM vm) { try { var modelReal = AttendanceUtility.FilterByID(vm.id, _attendanceService.GetAll().Result.ToList()).FirstOrDefault(); var time = TimeUtility.GetTimeZoneByName(CurrentUser.TimeZone); var model = AttendanceUtility.VMToM(vm); model.CreatedAt = modelReal.CreatedAt; model.CreatedBy = model.CreatedBy; model.TotalOverBreak = modelReal.TotalOverBreak; model.TotalLateTime = modelReal.TotalLateTime; model.TotalUnderTime = modelReal.TotalUnderTime; model.UpdatedAt = time; model.UpdatedBy = CurrentUser.ID; _attendanceService.Update(model); return(Json(new { success = true })); } catch { return(Json(new { success = false })); } }
internal static void Execute(object msg, NetConnection conn) { Msg_RC_AddImpact message = msg as Msg_RC_AddImpact; if (null == message) { return; } int skillId = message.skill_id; int impactId = message.impact_id; EntityInfo target = PluginFramework.Instance.SceneContext.GetEntityById(message.target_id); if (null == target) { LogSystem.Info("Receive Msg_RC_AddImpact, message.target_id={0} is not available", message.target_id); return; } else { LogSystem.Info("Receive Msg_RC_AddImpact, TargetId={0}, ImpactId={1}, SenderId={2}, SkillId={3}", message.target_id, impactId, message.sender_id, skillId); } Vector3 senderPos = Vector3.Zero; EntityInfo sender = PluginFramework.Instance.GetEntityById(message.sender_id); senderPos = sender.GetMovementStateInfo().GetPosition3D(); ImpactInfo impactInfo = new ImpactInfo(impactId); impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.SkillId = skillId; impactInfo.DurationTime = message.duration; impactInfo.SenderPosition = senderPos; impactInfo.ImpactSenderId = message.sender_id; if (null != impactInfo.ConfigData) { target.GetSkillStateInfo().AddImpact(impactInfo); int seq = impactInfo.Seq; if (GfxSkillSystem.Instance.StartSkill(target.GetId(), impactInfo.ConfigData, seq)) { } } }
protected override void OnTick() { long curTime = TimeUtility.GetLocalMilliseconds(); if (m_LastTickTime != 0) { long elapsedTickTime = curTime - m_LastTickTime; if (elapsedTickTime > c_WarningTickTime) { LogSys.Log(LOG_TYPE.MONITOR, "GlobalProcessThread Tick:{0}", elapsedTickTime); } } m_LastTickTime = curTime; if (m_LastLogTime + 60000 < curTime) { m_LastLogTime = curTime; DebugPoolCount((string msg) => { LogSys.Log(LOG_TYPE.INFO, "GlobalProcessThread.ActionQueue {0}", msg); }); LogSys.Log(LOG_TYPE.MONITOR, "GlobalProcessThread.ActionQueue Current Action {0}", this.CurActionNum); } }
protected override void OnTick() { try { long curTime = TimeUtility.GetServerMilliseconds(); if (m_LastLogTime + 60000 < curTime) { m_LastLogTime = curTime; DebugPoolCount((string msg) => { LogSys.Log(LOG_TYPE.INFO, "DataOperator.ActionQueue {0}", msg); }); m_LoadActionQueue.DebugPoolCount((string msg) => { LogSys.Log(LOG_TYPE.INFO, "DataOperator.LoadActionQueue {0}", msg); }); } m_LoadActionQueue.HandleActions(1024); } catch (Exception ex) { LogSys.Log(LOG_TYPE.ERROR, "DataOperator ERROR:{0} \n StackTrace:{1}", ex.Message, ex.StackTrace); } }
private void CheckTimeOut() { float currentTime = TimeUtility.GetTimeSinceStartup(); if (currentTime - lastCheckTimeoutStamp >= 5) { lastCheckTimeoutStamp = currentTime; foreach (KeyValuePair <uint, ListenerHelper> listenerHelper in rspHelpers) { var currentHelper = listenerHelper.Value; float dt = currentTime - currentHelper.timestamp; if (dt >= currentHelper.timeout) { rspHelpers.Remove(listenerHelper.Key); currentHelper.errorHandle?.DynamicInvoke(enNetErrorCode.Timeout); } Debuger.LogWarning("cmd:{0} Is Timeout!", currentHelper.cmd); } } }
public void Tick() { try { if (m_NetClient == null) { return; } if (m_IsConnected) { if (TimeUtility.GetLocalMilliseconds() - m_LastPingTime >= m_PingInterval) { InternalPing(); } } ProcessMsg(); } catch (Exception e) { string err = "Exception:" + e.Message + "\n" + e.StackTrace + "\n"; GfxSystem.GfxLog("Exception:{0}\n{1}", e.Message, e.StackTrace); } }
internal void SyncPlayerMoveStart(float dir) { WorldSystem.Instance.IsAlreadyNotifyMeetObstacle = false; UserInfo userInfo = WorldSystem.Instance.GetPlayerSelf(); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); ArkCrossEngineMessage.Msg_CRC_MoveStart builder = new ArkCrossEngineMessage.Msg_CRC_MoveStart(); builder.send_time = TimeUtility.GetServerMilliseconds(); builder.dir = dir; Position pos = new Position(); pos.x = msi.PositionX; pos.z = msi.PositionZ; builder.position = pos; builder.is_skill_moving = msi.IsSkillMoving; SendMessage(builder); } }
/// <summary> /// Idle time event handler. Kicks background parsing if there are pending changes /// </summary> private void OnIdle(object sender, EventArgs e) { if (Thread.CurrentThread.ManagedThreadId != _ownerThreadId && !EditorShell.Current.IsUnitTestEnvironment) { throw new ThreadStateException("Method should only be called on the main thread"); } if (TextBuffer == null || TextBuffer.EditInProgress) { return; } if (_lastChangeTime != DateTime.MinValue && TimeUtility.MillisecondsSinceUtc(_lastChangeTime) > _parserDelay) { // Kick background parsing when idle slot comes so parser does not hit on every keystroke ProcessPendingTextBufferChanges(async: true); _lastChangeTime = DateTime.MinValue; } }
private void Start() { //奖状倒计时,使用TimeEventType.Time的话,当游戏失去焦点(后台运行)时间会静止不动 TimerMgr.instance.Subscribe(2389797f, false, TimeEventType.Time).SetIntervalTime(1f).OnUpdate(x => { //lambda 表达式有着很强大的生产力,但是不要在注重性能的地方滥用 mTextAwardCountdown.text = TimeUtility.TimeToChineseString(x.surplusTimeRound); }).Start(); //榜单刷新,使用TimeEventType.Time的话,当游戏失去焦点(后台运行)时间依然在正常的流逝 TimerMgr.instance.Subscribe(3234f, false, TimeEventType.IngoreTimeScale).SetIntervalTime(1f).OnUpdate(x => { mTextRefrestCountdown.text = TimeUtility.TimeToChineseString(x.surplusTimeRound); }).Start(); //挑战倒计时 TimerMgr.instance.Subscribe(10f, false, TimeEventType.IngoreTimeScale).SetIntervalTime(1f).OnUpdate(x => { mTextChallengeCountdown.text = string.Format("挑战({0})", x.surplusTimeRound); }).OnComplete(() => mButtonChallenge.enabled = true).Start(); }
public static void Execute(object msg, RoomPeer peer) { Msg_Ping ping = msg as Msg_Ping; if (ping == null) { LogSys.Log(LOG_TYPE.DEBUG, "warning: convert to ping message failed!"); return; } LogSys.Log(LOG_TYPE.DEBUG, "got {0} ping msg send ping time = {1}", peer.Guid, ping.send_ping_time); Msg_Pong pongBuilder = new Msg_Pong(); long curtime = TimeUtility.GetLocalMilliseconds(); pongBuilder.send_ping_time = ping.send_ping_time; pongBuilder.send_pong_time = curtime; peer.SetLastPingTime(curtime); Msg_Pong msg_pong = pongBuilder; peer.SendMessage(RoomMessageDefine.Msg_Pong, msg_pong); }
private static void ShareTracks(string trackType) { try { var currentSharedList = HttpUtility.Get <SharedReflexTracks[]>("https://spptqssmj8.execute-api.us-east-1.amazonaws.com/test/share"); var randomNames = HttpUtility.Get <string[]>("http://names.drycodes.com/10?nameOptions=games"); var trackSetName = randomNames.Where(n => currentSharedList.Any(t => t.Name == n) == false).FirstOrDefault(); if (trackSetName != null) { var installedTracks = LocalSettings.GetTracks().Where(t => t.Installed && t.Type == trackType).Select(t => t.Name).ToArray(); SharedReflexTracks tracksToShare = new SharedReflexTracks { Name = trackSetName, Type = trackType, Tracks = string.Join(",", installedTracks), CreationTime = TimeUtility.DateTimeToUnixTimeStamp(DateTime.UtcNow) }; bool success = HttpUtility.Post("https://spptqssmj8.execute-api.us-east-1.amazonaws.com/test/share", tracksToShare); if (success) { Log.Add(Trackmanagement.LogMessageType.LogInfo, string.Format("Uploaded your {0} tracks as '{1}'. Tell your party to install it from the Shared Tracks Window.", trackType, trackSetName)); long nextShareTime = TimeUtility.DateTimeToUnixTimeStamp(DateTime.UtcNow) + TrackSharing.ShareRateLimitInSeconds; m_shareRateLimiter[trackType] = nextShareTime; } else { Log.Add(Trackmanagement.LogMessageType.LogError, string.Format("An unexpected error occured attempting to share your {0} tracks.", trackType)); } } else { Log.Add(Trackmanagement.LogMessageType.LogError, string.Format("Unable to share your {0} tracks because a unique name could not be generated. Please try again later.", trackType)); } } catch (Exception e) { ExceptionLogger.LogException(e); } }
public void Tick() { if (!m_IsWaitStart) { long curTime = TimeUtility.GetLocalMilliseconds(); if (!IsConnected) { if (m_LastConnectTime + 10000 < curTime) { ConnectIfNotOpen(); } } else { if (/*m_IsLogged &&*/ m_LastConnectTime + 5000 < curTime) { if (m_LastHeartbeatTime + 5000 < curTime) { m_LastHeartbeatTime = curTime; if (m_LastReceiveHeartbeatTime == 0) { m_LastReceiveHeartbeatTime = curTime; } SendHeartbeat(); } if (m_LastReceiveHeartbeatTime > 0 && m_LastReceiveHeartbeatTime + 30000 < curTime) { //断开连接 if (IsConnected) { m_WebSocket.Close(); m_LastReceiveHeartbeatTime = 0; } //触发重连 m_LastConnectTime = curTime - 10000; } } } } }
IEnumerator CheckQueueAsync() { while (taskDictionary.Count > 0) { while (assetBundleRecordQueue.Count > 0 && downloadingCount < MaxDownloadingCount) { AssetBundleRecord record = assetBundleRecordQueue.Dequeue(); coroutineOwner.Run(downloader.LoadAsync(record, downloadFinishedAction)); downloadingCount++; if (TimeUtility.DropFrameExists()) { break; } } yield return(null); } isCheckingQueue = false; }
internal void SyncPlayerSkill(CharacterInfo entity, int skillId) { if (entity.IsHaveStateFlag(CharacterState_Type.CST_Sleep)) { return; } Vector3 standPos = entity.GetMovementStateInfo().GetPosition3D(); Msg_CRC_Skill bd = new Msg_CRC_Skill(); bd.skill_id = skillId; bd.stand_pos = new ArkCrossEngineMessage.Position(); bd.stand_pos.x = standPos.X; bd.stand_pos.z = standPos.Z; bd.face_direction = entity.GetMovementStateInfo().GetFaceDir(); bd.want_face_dir = entity.GetMovementStateInfo().GetWantFaceDir(); bd.send_time = TimeUtility.GetServerMilliseconds(); SendMessage(bd); //LogSystem.Debug("SyncPlayerSkill skill {0}, entity {1}, pos:{2}", skillId, entity.GetId(), entity.GetMovementStateInfo().GetPosition2D().ToString()); }
public void Tick() { if (IsRunning) { lock (mapSession) { uint current = (uint)TimeUtility.GetTotalMillisecondsSince1970(); if (current - lastClearSessionTime > FSPSession.ActiveTimeout * 1000 / 2) { lastClearSessionTime = current; ClearNoActiveSession(); } foreach (KeyValuePair <uint, FSPSession> keyValuePair in mapSession) { keyValuePair.Value.Tick(current); } } } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var deltaTime = TimeUtility.GetLimitedDeltaTime(); return(Entities.ForEach((ref CoinBrickStates states, in CoinBrickConfigData config) => { if (!states.TimerStarted || states.CoinLeft <= 1) { return; } states.TimeElapsed += deltaTime; if (states.TimeElapsed < config.CoinDecrementInterval) { return; } states.TimeElapsed = 0; states.CoinLeft -= 1; }).Schedule(inputDeps)); }
public override Task <Trackmanagement.TrackResponse> GetInstalledTracks(Trackmanagement.InstalledTrackRequest request, ServerCallContext context) { return(Task.FromResult(new Trackmanagement.TrackResponse { Tracks = { LocalSettings.GetTracks().Where(t => t.Installed == true && t.Type == request.TrackType) .Select(t => new Trackmanagement.Track { Name = t.Name, Type = t.Type, Image = t.Image, Author = t.Author, Slot = t.Slot, Date = TimeUtility.UnixTimeStampToString(t.CreationTime), Installs = t.TotalDownloads, MyInstalls = t.MyDownloads, Favorite = t.Favorite }) .OrderBy(t => t.Slot) .ToArray() } })); }
internal void Disconnect(bool disconnectImmediately) { try { long curTime = TimeUtility.GetLocalMilliseconds(); LogSystem.Info("Disconnect({0}). CurTime {1} LastConnectTime {2}", disconnectImmediately, curTime, m_LastConnectTime); if (m_WebSocket != null) { m_WebSocket.Close(disconnectImmediately); if (!disconnectImmediately) { //等待3秒再触发重连 m_LastConnectTime = curTime - c_ConnectionTimeout + 3000; } } } catch (Exception ex) { LogSystem.Warn("m_WebSocket.Close throw exception {0}\n{1}", ex.Message, ex.StackTrace); BuildWebSocket(); //下次tick立即重连 m_LastConnectTime = 0; } }
private void ConnectIfNotOpen() { if (!IsConnected) { m_IsLogged = false; m_LastReceiveHeartbeatTime = 0; m_LastConnectTime = TimeUtility.GetLocalMilliseconds(); LogSystem.Info("ConnectIfNotOpen at time {0}", m_LastConnectTime); m_WebSocket = new WebSocket4Net.WebSocket(m_Url); m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.EnableAutoSendPing = true; m_WebSocket.AutoSendPingInterval = 10; m_WebSocket.Opened += OnOpened; m_WebSocket.MessageReceived += OnMessageReceived; m_WebSocket.DataReceived += OnDataReceived; m_WebSocket.Error += OnError; m_WebSocket.Closed += OnClosed; m_WebSocket.Open(); } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var deltaTime = TimeUtility.GetLimitedDeltaTime(); var playerLevelChangeTimeConfig = m_PlayerLevelChangeTimeConfig; var playerLevelDownProtectionTimeConfig = m_PlayerLevelDownProtectionTimeConfig; var playerConfig = GameEntry.Instance.Config.Global.Player; var defaultScale = playerConfig.DefaultScale; var superScale = playerConfig.SuperScale; var jobHandle = Entities .ForEach((ref PlayerStates playerStates, ref Translation translation, ref CompositeScale scaleComponent, ref PhysicsCollider physicsCollider) => { if (!PlayerUtility.IsChangingLevel(playerStates)) { return; } if (math.abs(playerStates.LevelChangeTimeUsed) <= float.Epsilon) { playerStates.LevelDownProtectionTime = 0; var oldScale = MathUtility.MatrixToScale(scaleComponent.Value); var newScale = playerStates.NextLevel == PlayerLevel.Default ? defaultScale : superScale; scaleComponent.Value = MathUtility.ScaleToMatrix(newScale); translation.Value.y += newScale.y / 2 - oldScale.y / 2; PhysicsUtility.SetBoxColliderSize(physicsCollider, newScale); } if (playerStates.LevelChangeTimeUsed >= playerLevelChangeTimeConfig) { playerStates = CompleteLevelChange(playerStates, playerLevelDownProtectionTimeConfig); } else { playerStates.LevelChangeTimeUsed += deltaTime; } }).Schedule(inputDeps); jobHandle.Complete(); return(jobHandle); }
IEnumerator LoadPrefabAsync <T>(string assetEntryKey, Action <T> onLoaded) where T : Component { while (TimeUtility.DropFrameExists()) { yield return(null); } #if UNITY_EDITOR if (localMode) { string localFilePath = GetLocalFilePath(assetEntryKey); ResourceRequest resourceRequest = Resources.LoadAsync <T>(localFilePath); while (!resourceRequest.isDone) { yield return(null); } T localAsset = resourceRequest.asset as T; if (localAsset != null) { while (linker.IsPaused || TimeUtility.DropFrameExists()) { yield return(null); } onLoaded?.Invoke(localAsset); yield break; } } #endif string loweredAssetEntryKey = assetEntryKey.ToLower(); AssetEntryRecord assetEntryRecord = GetAssetEntryRecord(loweredAssetEntryKey, onLoaded); if (assetEntryRecord == null) { yield break; } linker.LoadPrefab <T>(assetEntryRecord, this.Table.GetNecessaryAssetBundleRecords(loweredAssetEntryKey), onLoaded); }
protected override void OnTick() { long curTime = TimeUtility.GetLocalMilliseconds(); if (m_LastTickTime != 0) { long elapsedTickTime = curTime - m_LastTickTime; if (elapsedTickTime > c_WarningTickTime) { LogSys.Log(LOG_TYPE.MONITOR, "RoomProcessThread Tick:{0}", elapsedTickTime); } } m_LastTickTime = curTime; if (m_LastLogTime + 60000 < curTime) { m_LastLogTime = curTime; DebugPoolCount((string msg) => { LogSys.Log(LOG_TYPE.INFO, "RoomProcessThread.ActionQueue {0}", msg); }); LogSys.Log(LOG_TYPE.MONITOR, "RoomProcessThread.ActionQueue Current Action {0}", this.CurActionNum); int gameRoomCount = 0; int gameUserCount = 0; foreach (KeyValuePair <int, RoomInfo> pair in m_LobbyInfo.Rooms) { var room = pair.Value; if (room.CurrentState == RoomState.Game) { gameRoomCount++; gameUserCount += room.UserCount; } } LogSys.Log(LOG_TYPE.MONITOR, "Lobby Game Room Count:{0}, GameUserCount:{1}", gameRoomCount, gameUserCount); } m_LobbyInfo.Tick(); }
public override void Tick(CharacterInfo obj, int impactId) { ImpactInfo impactInfo = obj.GetSkillStateInfo().GetImpactInfoById(impactId); if (null != impactInfo && !obj.IsDead()) { if (impactInfo.m_IsActivated) { DamageImmunityShieldInfo info = impactInfo.LogicDatas.GetData <DamageImmunityShieldInfo>(); if (null != info) { if (TimeUtility.GetServerMilliseconds() - info.LastHitTime > info.RefreshInterval * 1000) { if (info.CountRemain <= 0) { if (null != EventStartDamageImmunityShiled) { EventStartDamageImmunityShiled(obj, impactId); } } info.CountRemain = info.CountMax; // refresh ui if (null != EventUpdateDamageImmunityShiled) { EventUpdateDamageImmunityShiled(obj, impactId); } } } } } else { if (null != EventStopDamageImmunityShiled) { EventStopDamageImmunityShiled(obj, impactId); } } }
internal void Tick() { try { if (m_NetClient == null) { return; } long curTime = TimeUtility.GetLocalMilliseconds(); if (m_IsConnected) { if (m_WaitShakeHands) { if (m_LastShakeHandsTime > 0 && curTime - m_LastShakeHandsTime >= c_ShakeHandTimeout) { Disconnect("bye for shakehands timeout"); LogSystem.Info("ShakeHands time out, CurTime {0} LastShakeHandsTime {1}", curTime, m_LastShakeHandsTime); } } if (m_CanSendMessage) { if (curTime - m_LastPingTime >= c_PingInterval) { InternalPing(); } if (m_LastReceivePongTime > 0 && curTime - m_LastReceivePongTime > c_PingTimeout) { Disconnect("bye for timeout"); LogSystem.Info("PingPong time out, CurTime {0} LastReceivePongTime {1} LastPingTime {2}", curTime, m_LastReceivePongTime, m_LastPingTime); } } } ProcessMsg(); } catch (Exception e) { LogSystem.Error("Exception:{0}\n{1}", e.Message, e.StackTrace); } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var gravityAcc = GameEntry.Instance.Config.Global.Item.ItemGravityAcc; var deltaTime = TimeUtility.GetLimitedDeltaTime(); var random = m_Random; var jobHandle = Entities.WithoutBurst().ForEach(( ref Translation translation, ref SimpleMovementAbilityData movementAbilityData, ref GravityAbility gravityAbility, ref MovementData movementData, ref ItemStates states, in ItemTag itemTag) => { if (states.Status != ItemStatus.BeingBorn) { return; } var moveAmount = states.UpSpeed * deltaTime; if (moveAmount > states.UpToGo) { states.Status = ItemStatus.Normal; moveAmount = states.UpToGo; gravityAbility.GravityAcc = gravityAcc; movementAbilityData.InteractsWithGround = true; movementData.Velocity.x = movementAbilityData.HorizontalSpeed; movementData.Velocity.y = random.NextFloat(itemTag.InitialMinVerticalSpeed, itemTag.InitialMaxVerticalSpeed); } states.UpToGo -= moveAmount; var position = translation.Value; position.y += moveAmount; translation.Value = position; }).Schedule(inputDeps); jobHandle.Complete(); return(jobHandle); }
private void ConnectIfNotOpen() { if (!(this.m_ReadyState == WebSocketState.Connecting || this.m_ReadyState == WebSocketState.Open)) { try { m_Handshake = RequestHandshake(m_Uri); if (m_Handshake == null || m_Handshake.SID.Trim() == string.Empty || m_Handshake.HadError) { GfxSystem.GfxLog("Failed to request socketio handshake "); } else { string wsScheme = (m_Uri.Scheme == Uri.UriSchemeHttps ? "wss" : "ws"); m_WebsocketClient = new WebSocket( string.Format("{0}://{1}:{2}/socket.io/1/websocket/{3}", wsScheme, m_Uri.Host, m_Uri.Port, m_Handshake.SID), string.Empty, m_SocketVersion); m_WebsocketClient.EnableAutoSendPing = false; m_WebsocketClient.add_Opened(new EventHandler <EventArgs>(webSocketClient_Opened)); m_WebsocketClient.add_Closed(new EventHandler <EventArgs>(webSocketClient_Closed)); m_WebsocketClient.add_Error(new EventHandler <ErrorEventArgs>(webSocketClient_Error)); m_WebsocketClient.add_MessageReceived(new EventHandler <MessageReceivedEventArgs>(webSocketClient_MessageReceived)); /* * m_WebsocketClient.Opened += this.webSocketClient_Opened; * m_WebsocketClient.MessageReceived += this.webSocketClient_MessageReceived; * m_WebsocketClient.Closed += webSocketClient_Closed; * m_WebsocketClient.Error += this.webSocketClient_Error; */ m_WebsocketClient.Open(); m_LastConnectTime = TimeUtility.GetLocalMilliseconds(); GfxSystem.GfxLog("Try to Open ... {0}", DateTime.Now.ToString()); } } catch (Exception ex) { GfxSystem.GfxLog("Websocket connect error : " + ex.ToString()); } } }
public void Tick() { if (isRunning) { lock (sessions) { uint current = (uint)TimeUtility.GetTotalMillisecondsSince1970(); if (current - lastClearSessionTime > KCPSession.ActiveTimeout * 1000 / 2) { lastClearSessionTime = current; ClearNoActiveSession(); } if (protocolType == enProtocolType.KCP) { foreach (KeyValuePair <uint, ISession> keyValuePair in sessions) { keyValuePair.Value.Tick(current); } } } } }
/// <summary> /// get prepare login status. /// </summary> /// <param name="UserName">user name</param> /// <returns>is success?</returns> private bool GetPreloginStatus(string UserName) { try { long timestart = TimeUtility.ConvertDateTimeInt(DateTime.Now); string prelogin_url = "http://login.sina.com.cn/sso/prelogin.php?entry=account&callback=sinaSSOController.preloginCallBack&su=" + get_user(UserName) + "&rsakt=mod&client=ssologin.js(v1.4.15)&_=" + timestart; string Content = HttpHelper.GetHttpContent(prelogin_url, cookies: cookies, encode: Encoding.GetEncoding("GB2312")); long dateTimeEndPre = TimeUtility.ConvertDateTimeInt(DateTime.Now); prelt = Math.Max(dateTimeEndPre - timestart, 50).ToString(); dynamic prepareJson = JsonConvert.DeserializeObject(Content.Split('(')[1].Split(')')[0]); servertime = prepareJson.servertime; nonce = prepareJson.nonce; weibo_rsa_n = prepareJson.pubkey; rsakv = prepareJson.rsakv; return(true); } catch // (Exception ex) { return(false); } }
internal void ConnectIfNotOpen() { if (!IsConnected) { m_LastReceiveHeartbeatTime = 0; m_LastQueueingTime = 0; m_IsLogining = true; m_IsQueueing = false; m_LastConnectTime = TimeUtility.GetLocalMilliseconds(); LogSystem.Info("ConnectIfNotOpen at time {0} {1} {2}", m_LastConnectTime, m_User, LobbyRobot.Robot.GetDateTime()); m_WebSocket = new WebSocket4Net.WebSocket(m_Url); m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.EnableAutoSendPing = true; m_WebSocket.AutoSendPingInterval = 10; m_WebSocket.Opened += OnWsOpened; m_WebSocket.MessageReceived += OnWsMessageReceived; m_WebSocket.DataReceived += OnWsDataReceived; m_WebSocket.Error += OnWsError; m_WebSocket.Closed += OnWsClosed; m_WebSocket.Open(); } }
public override void Tick(CharacterInfo character, int impactId) { ImpactInfo impactInfo = character.GetSkillStateInfo().GetImpactInfoById(impactId); if (null == impactInfo) { return; } if (!impactInfo.m_IsActivated) { return; } if (!impactInfo.m_HasEffectApplyed) { character.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_Invincible); impactInfo.m_HasEffectApplyed = true; } if (TimeUtility.GetServerMilliseconds() > impactInfo.m_StartTime + impactInfo.m_ImpactDuration) { character.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible); impactInfo.m_IsActivated = false; } }