public override void Read(ByteArray by) { base.Read(by); srv_info.Read(by); result = (eResult)by.ReadUInt(); ws_time = by.ReadLong(); }
/// <summary> /// Sets the result. /// </summary> /// <param name="_eResult">E result.</param> public void SetResult(eResult _eResult, float _iNumber) { switch (_eResult) { case eResult.eBest: Best.SetActive(true); Good.SetActive(false); Bad.SetActive(false); S.SetActive(true); A.SetActive(false); C.SetActive(false); break; case eResult.eGood: Best.SetActive(false); Good.SetActive(true); Bad.SetActive(false); S.SetActive(false); A.SetActive(true); C.SetActive(false); break; case eResult.eBad: Best.SetActive(false); Good.SetActive(false); Bad.SetActive(true); S.SetActive(false); A.SetActive(false); C.SetActive(true); break; } TextScore.GetComponent <Text>().text = _iNumber.ToString(); }
public HttpResponseMessage updateSemester(HttpRequestMessage req, eSemester semester) { DateTime mDate = DateTime.ParseExact(semester.OPENING_DATE, "dd/MM/yyyy", null); semester.OPENING_DATE = mDate.ToString("yyyyMMdd"); mDate = DateTime.ParseExact(semester.REGISTER_FROM, "dd/MM/yyyy", null); semester.REGISTER_FROM = mDate.ToString("yyyyMMdd"); mDate = DateTime.ParseExact(semester.REGISTER_TO, "dd/MM/yyyy", null); semester.REGISTER_TO = mDate.ToString("yyyyMMdd"); return(CreateHttpResponse(req, () => { HttpResponseMessage res = null; if (!ModelState.IsValid) { res = req.CreateResponse(HttpStatusCode.BadRequest, ModelState); return res; } DataTable dtResult = aSemesterAccess.updateSemester(semester); eResult insertResult = new eResult { dbResult = dtResult.Rows[0][0].ToString(), dbMessage = dtResult.Rows[0][1].ToString() }; res = req.CreateResponse(HttpStatusCode.Created, insertResult); return res; })); }
public void _OnBattle() { m_resultPopUpPanel.SetActive(false); m_ending30Days.SetActive(false); m_result = eResult.Fail; m_launchingSpaceShip = false; }
/// <summary> /// コンストラクタ /// </summary> public SleepController(int threadSleepTime = 100, int sleepIntervalTime = 70) { _sleepCheckInterval = threadSleepTime; _sleepIntervalTime = sleepIntervalTime; _sleepElapsedTime = _sleepIntervalTime; _mouceController = new MouceController(); _status = eStatus.None; _result = eResult.None; IsCancel = false; }
private void ShowResultSelection(eResult _eResult) { //Cambiar materiales al color que sea. switch (_eResult) { case eResult.FAIL: Debug.Log("FAIL"); break; case eResult.PROXIMITY: Debug.Log("PROXIMITY"); break; case eResult.SUCCESS: Debug.Log("SUCCESS"); break; } }
private void ComputeEndpoints() { m_startNavRef = m_navMesh.ComputeNavRefAtPoint(m_startPosition); m_endNavRef = m_navMesh.ComputeNavRefAtPoint(m_endPosition); if (m_startNavRef.IsValid) { if (m_endNavRef.IsValid) { if (m_navMesh.AreNavRefsConnected(m_startNavRef, m_endNavRef)) { if (m_startNavRef.Equals(m_endNavRef)) { // We can head directly to the destination m_finalPath.Add(new PathStep(m_startNavRef, m_startPosition)); m_finalPath.Add(new PathStep(m_endNavRef, m_endPosition)); m_state = eState.complete; } else { // We have to do the expensive query m_state = eState.setup_raw_path; } } else { m_state = eState.complete; m_resultCode = eResult.failed_start_off_nav_mesh; } } else { m_state = eState.complete; m_resultCode = eResult.failed_end_off_nav_mesh; } } else { m_state = eState.complete; m_resultCode = eResult.failed_start_off_nav_mesh; } }
private void FinalizeRawPath() { PathNode currentNode = m_nodeHeap.Top(); // If the current best node in the heap isn't the end, // then we couldn't find a path to end if (currentNode.NavCellIndex == m_endNavRef.NavCellIndex) { uint iterations_left = MAX_TOTAL_NODES_SEARCHED_ALLOWED; // Walk from the end to the start, then reverse the path while (currentNode != null && iterations_left > 0) { m_rawPath.Add(new NavRef((int)currentNode.NavCellIndex, m_roomKey)); currentNode = currentNode.ParentNode; iterations_left--; } if (iterations_left > 0) { m_rawPath.Reverse(); m_state = eState.compute_smoothed_path; } else { // Sanity check to make sure we don't hit any infinite loops // TODO: Probably should log this case m_resultCode = eResult.failed_raw_path_search; m_state = eState.complete; } } else { // This case should technically be cause by the connectivity ID case // TODO: Probably should log this case m_resultCode = eResult.failed_raw_path_search; m_state = eState.complete; } }
public override void HandleAttack(int AttackingValue, int AttackMod, int AttackingDamage, decimal AverageDamage) { eResult attackResult = eResult.Fail; int effectiveAC = AC; if (AttackingValue + AttackMod >= effectiveAC) { attackResult = eResult.Suc; if (AttackingValue + AttackMod >= effectiveAC + 10) { attackResult++; } } if (AttackingValue == 20 && attackResult != eResult.CritSuc) { attackResult++; } if (attackResult == eResult.CritSuc) { AttackingDamage *= 2; } if (attackResult == eResult.Fail || attackResult == eResult.critFail) { MainWindow.Log("SB Attack Missed! " + AttackingValue + "+" + AttackMod, logFile); } else { MainWindow.Log("SB Attack Hit! " + AttackingValue + "+" + AttackMod + " For " + AttackingDamage + " points of damage", logFile); } if (attackResult >= eResult.Suc) { HP -= AttackingDamage; } }
//---------------------------------------------------------------------------------------------------- /// <summary> /// 채널에 소속된 클라이언트에 데이터 송신. /// </summary> /// <param name="channel_id">채널 아이디</param> /// <param name="order">명령코드</param> /// <param name="result">결과코드</param> //---------------------------------------------------------------------------------------------------- public void SendChannel( byte channel_id, eOrder order, eResult result ) { cBitStream bits = new cBitStream(); WriteOrder( bits, order ); WriteResult( bits, result ); SendChannel( channel_id, bits ); }
public GameResult(eResult i_Result, uint i_WinPlayerIndex) { r_Result = i_Result; r_WinPlayerIndex = i_WinPlayerIndex; }
public GameResult(eResult i_Result) { r_Result = i_Result; r_WinPlayerIndex = null; }
public void Set(eResult i_eResult, Int32 i_iNumHits, Int32 i_iNumTrailingSilenceBytes) { m_eResult = i_eResult; m_iNumHits = i_iNumHits; m_iNumTrailingSilenceBytes = i_iNumTrailingSilenceBytes; }
//---------------------------------------------------------------------------------------------------- /// <summary> /// 데이터 송신. /// </summary> /// <param name="order">명령코드</param> /// <param name="result">결과코드</param> //---------------------------------------------------------------------------------------------------- public void Send( eOrder order, eResult result ) { cBitStream bits = new cBitStream(); WriteOrder( bits, order ); WriteResult( bits, result ); Send( bits ); }
private void ResetResult() { m_resultCode = eResult.success; m_rawPath = new List <NavRef>(); m_finalPath = new List <PathStep>(); }
/// <summary> /// /// </summary> public async void DoStartAsync() { System.Diagnostics.Stopwatch _stopWatch; _stopWatch = new System.Diagnostics.Stopwatch(); _status = eStatus.Init; _result = eResult.None; IsCancel = false; bool isBeforeMove = false; try { await Task.Run(() => { while (!IsCancel) { _mouceController.MouceMoveCheck(); // 移動したならタイマー停止 if (_mouceController.IsMove) { // 前回移動したならばタイマーリセット if (!isBeforeMove) { _stopWatch.Reset(); isBeforeMove = true; _status = eStatus.Pause; } } // 移動していないならばタイマー開始 else { // 処理開始していないならば if (_status != eStatus.Process) { _stopWatch.Start(); _status = eStatus.Process; isBeforeMove = false; } // スリープチェック中ならば else { // スリープ時間経過したならば if (SleepIntervalTime <= (int)_stopWatch.Elapsed.TotalSeconds) { _result = eResult.Success; break; } } } // スレッドスリープ System.Threading.Thread.Sleep(ThreadSleepTime); lock (SleepElapsedTimeLock) { _sleepElapsedTime = SleepIntervalTime - _stopWatch.Elapsed.Seconds; } } // ループの終了がキャンセルならば if (IsCancel) { return; } // ループの終了がスリープチェックならば else { SystemSleep(); } }); } catch (Exception ex) { MessageBox.Show(ex.Message); Program.logger.Error("障害:" + ex.Message); // 何もしない } }
private void btnClose_Click(object sender, EventArgs e) { this.eresult = eResult.None; this.Close(); }
private void ResetResult() { m_resultCode = eResult.success; m_rawPath = new List<NavRef>(); m_finalPath = new List<PathStep>(); }
private void ComputeRawPath() { int nodesSearchedThisUpdate = 0; // Keep searching until we either find the end // or we're not allowed to search anymore while (!m_nodeHeap.Empty() && m_totalNodesSearched < MAX_TOTAL_NODES_SEARCHED_ALLOWED && (m_maxNodesSearchedPerUpdate == 0 || (m_maxNodesSearchedPerUpdate > 0 && nodesSearchedThisUpdate < m_maxNodesSearchedPerUpdate))) { PathNode currentNode = m_nodeHeap.Top(); // Keep track of how many nodes total we have visited so far m_totalNodesSearched++; // Keep track of how many nodes were searched this update nodesSearchedThisUpdate++; // Make sure we haven't hit the destination if (currentNode.NavCellIndex != m_endNavRef.NavCellIndex) { // Remove the current node from the heap now that we're investigating it m_nodeHeap.Pop(); // Add the current nav-cell to the closed set // (since we just visited it and don't want to visit it again) currentNode.MarkAsInClosedSet(); // See which neighbor, if any, looks best at this moment to search from for (NavCellNeighborIterator iterator = new NavCellNeighborIterator(m_navMesh, currentNode.NavCellIndex); iterator.Valid(); iterator.Next()) { // See if we already have a search node for the neighbor nav-cell uint neighborNavCellIndex = iterator.NeighborNavCellIndex; PathNode neighborNode = null; bool hasNeighbor = m_navCellToNodeMap.TryGetValue(neighborNavCellIndex, out neighborNode); // Skip this neighbor if we already put it in the closed set if (!hasNeighbor || !neighborNode.InClosedSet) { // Compute G(x): The path cost from the start to this neighbor float netTraversalCostToNeighbor = currentNode.Cost + ComputeTraversalCost(currentNode.NavCellIndex, neighborNavCellIndex); // Add this neighbor into consideration if: // A) We haven't seen it before (i.e. not in the open set) // B) We have seen it before, but the net traversal cost to the neighbor // from the start through the current node is cheaper than some previous // traversal to the neighbor. if (neighborNode == null || netTraversalCostToNeighbor < neighborNode.Cost) { // Compute F(x)= G(x) + H(x): The past cost to the neighbor plus the estimated distance to the end Point3d neighborCenter = m_navMesh.ComputeNavCellCenter(neighborNavCellIndex); float netTraversalPlusHeuristicCost = netTraversalCostToNeighbor + ComputeHeuristicCostEstimate(neighborCenter, m_endPosition); // Make sure to add the neighbor to the open set if not already added if (neighborNode == null) { neighborNode = new PathNode( (int)m_nextPathNodeID, currentNode, neighborNavCellIndex, netTraversalCostToNeighbor, netTraversalPlusHeuristicCost); m_nextPathNodeID++; m_navCellToNodeMap[neighborNavCellIndex] = neighborNode; } else { neighborNode.ParentNode = currentNode; neighborNode.Cost = netTraversalCostToNeighbor; neighborNode.Total = netTraversalPlusHeuristicCost; } // Add the neighbor into the heap for future consideration m_nodeHeap.Push(neighborNode); } } } } else { // Stop searching and compute the raw path from the search nodes m_state = eState.finalize_raw_path; break; } } // Sanity check to make sure we never get in an infinite loop if (m_nodeHeap.Empty()) { m_resultCode = eResult.failed_raw_path_search; m_state = eState.complete; } else if (m_totalNodesSearched >= MAX_TOTAL_NODES_SEARCHED_ALLOWED) { //Debug.log("PathComputer: Ran out of search node!", Debug.RED); m_resultCode = eResult.failed_raw_path_search; m_state = eState.complete; } }
//---------------------------------------------------------------------------------------------------- /// <summary> /// 파티에 소속된 클라이언트에 데이터 송신. /// </summary> /// <param name="party_id">파티 아이디</param> /// <param name="order">명령코드</param> /// <param name="result">결과코드</param> //---------------------------------------------------------------------------------------------------- public void SendParty( uint party_id, eOrder order, eResult result ) { cBitStream bits = new cBitStream(); WriteOrder( bits, order ); WriteResult( bits, result ); SendParty( party_id, bits ); }
/// <summary> /// Simple time-domain based detector. Perhaps not the best approach. /// If we search the entire 1 sec buffer with no energy above the noise level, then the /// user has completed speaking. /// </summary> /// <param name="i_abData">Array containing PCM audio data.</param> /// <returns></returns> public eResult TimeDomainDetect(Int16[] i_abData) { eResult eRet = eResult.SILENCE; int iDataLen; int iNumHits = 0; try { iNumHits = m_PRes.m_iNumHits; // Preset with previous results. // FIX - This could result in false detects if the frame size is too large! (Greater than 0.5 second?) iDataLen = i_abData.Length; if (iDataLen < FRAME_SIZE_MIN) // Bail if we don't have a FRAME_SIZE_MIN of data. { eRet = eResult.ERROR; Console.Error.WriteLine("ERROR: Not enough data to work on: {0} bytes available, but need {1} bytes.", iDataLen, FRAME_SIZE_MIN); } else { bool bFound = false; for (int ii = 0; ((ii < iDataLen) && (bFound == false)); ++ii) { if (i_abData[ii] > m_wNoiseLevel) { ++iNumHits; if (iNumHits >= HITS_FOR_DETECT) { bFound = true; eRet = eResult.ENERGY; } } } // for } // else // First subtract out previous hits before updating. iNumHits -= m_PRes.m_iNumHits; // Update previous results data. switch (eRet) { case eResult.ENERGY: m_PRes.Set(eRet, iNumHits, 0); break; case eResult.SILENCE: // Doublecheck that we haven't hit the endpoint yet. if (((m_PRes.m_iNumTrailingSilenceBytes + m_abCurrBuf.Length) < m_iEndpointInBytes) && (m_PRes.m_eResult == eResult.ENERGY)) { // Not yet, so return this as energy. eRet = eResult.ENERGY; m_PRes.Set(eResult.ENERGY, iNumHits, (m_PRes.m_iNumTrailingSilenceBytes + m_abCurrBuf.Length)); } else { m_PRes.Set(eResult.SILENCE, iNumHits, 0); } break; default: break; } } catch (Exception exc) { eRet = eResult.UNDETERMINED; Console.Error.WriteLine("EnergyDetector.TimeDomainDetect() - Caught exception '{0}'!", exc); } return(eRet); }
private void FrmIntro_Load(object sender, EventArgs e) { this.eresult = eResult.None; }
//---------------------------------------------------------------------------------------------------- /// <summary> /// 동기화 오브젝트를 파싱. /// </summary> /// <param name="client">수신 클라이언트</param> /// <param name="result">결과값</param> /// <param name="bits">수신 데이터</param> //---------------------------------------------------------------------------------------------------- public void RecvObjectUpdate( cClient client, eResult result, cBitStream bits ) { bool host; bits.Read( out host ); bool cobject; bits.Read( out cobject ); uint object_id; bits.Read( out object_id, uint.MaxValue ); if( cobject ) { cObject value; if( m_sync_cobject.TryGetValue( object_id, out value ) ) { Type ctype = value.GetType(); foreach( FieldInfo field in ctype.GetFields(BindingFlags.NonPublic|BindingFlags.Public) ) { if( host ) { HOSTAttribute attrib=GetHostAttribute( field ); if( attrib != null ) { object data = field.GetValue(value); bits.Read( field.GetType(), out data, data, attrib.MaxSize, attrib.MaxPoint ); } } else { GUESTAttribute attrib=GetGuestAttribute( field ); if( attrib != null ) { object data = field.GetValue(value); bits.Read( field.GetType(), out data, data, attrib.MaxSize, attrib.MaxPoint ); } } } } } else { cUnityObject value; if( cUnityObject.GetInstance( object_id, out value ) ) { Type ctype = value.GetType(); foreach( FieldInfo field in ctype.GetFields(BindingFlags.NonPublic|BindingFlags.Public) ) { if( host ) { HOSTAttribute attrib=GetHostAttribute( field ); if( attrib != null ) { object data = field.GetValue(value); bits.Read( field.GetType(), out data, data, attrib.MaxSize, attrib.MaxPoint ); } } else { GUESTAttribute attrib=GetGuestAttribute( field ); if( attrib != null ) { object data = field.GetValue(value); bits.Read( field.GetType(), out data, data, attrib.MaxSize, attrib.MaxPoint ); } } } } } }
private void btn_Exit_Click(object sender, EventArgs e) { this.Close(); DialogResult = DialogResult.Cancel; m_Result = eResult.CANCEL; }
private void btnOpenSeason_Click(object sender, EventArgs e) { this.eresult = eResult.OpenSeason; this.Close(); }