public void button_press(int tag) { CGameScene pGameScene = (CGameScene)parent(); if (tag == 10200) { pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_END_GAME, null); //123 try { pGameScene.window_closed(null); Root.instance().queue_end_rendering(); } catch { //pakcj global::exit(0); } } else if (tag == 10201) { CMD_C_Account Account = new CMD_C_Account(); Account.wChairID = pGameScene.GetMeChairID(); pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_ACCOUNT, Account); DisableWindow(true); } else if (tag == 10202) { ShowWidnow(false); } }
public void button_press(int tag) { if (tag == 10300) { //CGameScene *pGameScene = (CGameScene *)parent(); //CMD_GF_WriteMatchScore pWriteMatchScore; //ZeroMemory(&pWriteMatchScore,sizeof(pWriteMatchScore)); //pWriteMatchScore.lMatchScore=2000; //pGameScene->GetClientKernel()->SendWriteMatchScore(&pWriteMatchScore,sizeof(pWriteMatchScore)); //Show(false); CGameScene pGameScene = (CGameScene)parent(); if ((pGameScene.m_dwRoomType == 1) || (pGameScene.m_dwRoomType == 2)) { CMD_C_Match_Start MatchStar = new CMD_C_Match_Start(); MatchStar.wChair = pGameScene.GetMeChairID(); MatchStar.dwScore = 0; MatchStar.dwMatchScore = 0; pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_MATCH_START, MatchStar); } else if (pGameScene.m_dwRoomType == 3) { CMD_C_Gate_Ctrl_Send GateCtrlSend = new CMD_C_Gate_Ctrl_Send(); GateCtrlSend.wChair = pGameScene.GetMeChairID(); GateCtrlSend.cbFirst = 0; GateCtrlSend.nGateCount = 0; pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_GATE_CTRL_SEND, GateCtrlSend); Show(false); } } else if (tag == 10302) { CGameScene pGameScene = (CGameScene)parent(); if (pGameScene.m_dwRoomType == 2) { m_sprBackground.set_display_image(Root.instance().imageset_manager().imageset("ui_load").image("match_start0_image")); } else if (pGameScene.m_dwRoomType == 1) { m_sprBackground.set_display_image(Root.instance().imageset_manager().imageset("ui_load").image("match_start1_image")); } else if (pGameScene.m_dwRoomType == 3) { m_sprBackground.set_display_image(Root.instance().imageset_manager().imageset("ui_load").image("match_start2_image")); } } }
public override void draw() { base.draw(); CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } if (((pGameScene.m_dwRoomType == 1) || (pGameScene.m_dwRoomType == 2)) && (visible())) { Point pt = position_absolute(); pt.x_ += 216; pt.y_ += 84; ostringstream ostr2 = new ostringstream(); ostr2 = ostr2 + pGameScene.m_layRoles[pGameScene.GetMeChairID()].m_dwMatchScore; m_Font.draw_string(pt, ostr2.str(), new Color(241, 37, 0)); pt.x_ += 142; ostr2.str(""); ostr2 = ostr2 + pGameScene.m_layRoles[pGameScene.GetMeChairID()].m_dwMatchIndex; m_Font.draw_string(pt, ostr2.str(), new Color(241, 37, 0)); } }
public void button_press(int tag) { CGameScene pGameScene = (CGameScene)parent(); if (tag == 10400) { Show(false); if (pGameScene.m_dwRoomType == 3) { CMD_C_Gate_Ctrl_Send GateCtrlSend = new CMD_C_Gate_Ctrl_Send(); GateCtrlSend.wChair = pGameScene.GetMeChairID(); GateCtrlSend.cbFirst = 7; GateCtrlSend.nGateCount = pGameScene.m_nCurGateCount; pGameScene.m_layRoles[pGameScene.GetMeChairID()].SetFishGold(pGameScene.m_nFishScoreBase); pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_GATE_CTRL_SEND, GateCtrlSend); int nRand = 1 + random_.Next() % 4; //pakcj Sleep(nRand * 1000); ((CGameScene)parent()).window_closed(null); Root.instance().queue_end_rendering(); } } }
//C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // public void Dispose(); public void button_press(int tag) { int nMaxFishGold = m_nMaxBuyFishGold; int nSetp = nMaxFishGold / 100; if (10013 == tag) { m_nFishGold -= nSetp; if (m_nFishGold < nSetp) { m_nFishGold = nSetp; } SetFishGold(m_nFishGold); SetGameGold(m_nFishGold * m_lCellScore); double dSetp = (nSetp == 0) ? 0.00 : (double)(m_nFishGold - nSetp) / (nSetp * 99); m_sldNumber.set_value(dSetp); } else if (10014 == tag) { m_nFishGold += nSetp; if (m_nFishGold > nMaxFishGold) { m_nFishGold = nMaxFishGold; } SetFishGold(m_nFishGold); SetGameGold(m_nFishGold * m_lCellScore); double dSetp = (nSetp == 0) ? 0.00 : (double)(m_nFishGold - nSetp) / (nSetp * 99); m_sldNumber.set_value(dSetp); } else if (10011 == tag) { m_nFishGold = nMaxFishGold; SetFishGold(m_nFishGold); SetGameGold(m_nFishGold * m_lCellScore); double dSetp = (nSetp == 0) ? 0.00 : (double)(m_nFishGold - nSetp) / (nSetp * 99); m_sldNumber.set_value(dSetp); } else if (10010 == tag) { ShowWidnow(false); } else if (10012 == tag) { CMD_C_Buy_Bullet BuyBullet = new CMD_C_Buy_Bullet(); BuyBullet.dwCount = (int)m_nFishGold; CGameScene pGameScene = (CGameScene)parent(); pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_BUY_BULLET, BuyBullet); m_bSendMessage = true; ShowWidnow(false); } }
public void ShowWidnow(bool bIsShow) { CGameScene pGameScene = (CGameScene)parent(); bool bShow = (pGameScene.m_dwRoomType == 0) ? bIsShow : false; bool bVisible = visible(); if (bVisible == bShow) { return; } set_visible(bShow); m_btnCancle.set_visible(bShow); m_btnMax.set_visible(bShow); m_btnOk.set_visible(bShow); m_btnMinus.set_visible(bShow); m_btnAdd.set_visible(bShow); m_sldNumber.set_visible(bShow); if (bShow) { try { Sound_Instance pSound = Root.instance().sound_manager().sound_instance(16); pSound.play(false, true); } catch { } } if (bIsShow == true) { CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } UserInfo pUserData = pClientKernel.GetMeUserInfo(); if ((pUserData != null) && (pUserData.GetGameMoney() > 100)) { int nMeBuyCount = (pUserData.GetGameMoney() - 100) / m_lCellScore; m_nMaxBuyFishGold = (m_nMaxFishGold <= nMeBuyCount) ? m_nMaxFishGold : nMeBuyCount; } else { m_nMaxBuyFishGold = 0; } button_press(10011); } }
public override void draw() { base.draw(); CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } }
public override void draw() { base.draw(); CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } if (visible()) { SetTimeHour(pGameScene.m_nMatchHour); SetTimeMinute(pGameScene.m_nMatchMinute); SetTimeSecond(pGameScene.m_nMatchSecond); Point pt = position_absolute(); for (int i = 0; i < 2; i++) { m_sprTimeHour[i].set_position(new Point(pt.x_ + 38 + i * 12, pt.y_ + 12)); m_sprTimeMinute[i].set_position(new Point(pt.x_ + 88 + i * 12, pt.y_ + 12)); m_sprTimeSecond[i].set_position(new Point(pt.x_ + 124 + i * 12, pt.y_ + 12)); } } else { SetTimeHour(0); SetTimeMinute(0); SetTimeSecond(0); } //if(visible()) //{ // char data[10]; // Point pt = position_absolute(); // std::ostringstream ostrRank; // pt += Point(50,57); // ostrRank + pGameScene->m_nMatchHour; // m_Font->draw_string(pt, ostrRank.str().c_str(), Color(241,32,0)); // pt += Point(42,0); // sprintf(data,"%02d",pGameScene->m_nMatchMinute); // m_Font->draw_string(pt, data, Color(241,32,0)); // pt += Point(36,0); // sprintf(data,"%02d",pGameScene->m_nMatchSecond); // m_Font->draw_string(pt, data, Color(241,32,0)); //} }
public void button_press(int tag) { if (tag == 10200) { CGameScene pGameScene = (CGameScene)parent(); //pakcj global::ShowWindow(pGameScene.GetClientKernel().m_hWndEdit,SW_HIDE); //pakcj global::SetWindowText(pGameScene.GetClientKernel().m_hWndEdit,""); Show(false); } else if (tag == 10201) { CGameScene pGameScene = (CGameScene)parent(); CMD_C_Send_Message SendMessage = new CMD_C_Send_Message(); //C++ TO C# CONVERTER TODO TASK: The memory management function 'memset' has no equivalent in C#: SendMessage.cbData = string.Empty; SendMessage.wChair = pGameScene.GetMeChairID(); //pakcj SendMessage.nLen = global::GetWindowText(pGameScene.GetClientKernel().m_hWndEdit,(string)SendMessage.cbData,32); pGameScene.GetClientKernel().SendSocketData(FishDefine.SUB_C_SEND_MESSAGE, SendMessage); } else if (tag == 10202) { CGameScene pGameScene = (CGameScene)parent(); Point pt = (pGameScene.GetMeChairID() == 1) ? pGameScene.m_layRoles[pGameScene.GetMeChairID()].position() - new Point(60, 0) : pGameScene.m_layRoles[pGameScene.GetMeChairID()].position(); pt += new Point(10, -60); resize(pt, new Size(396, 286)); //pakcj global::ShowWindow(pGameScene.GetClientKernel().m_hWndEdit,SW_SHOW); pt = position(); //pakcj global::MoveWindow(pGameScene.GetClientKernel().m_hWndEdit,pt.x_ + 32,pt.y_ + 8,222,18,1); //pakcj global::SetFocus(pGameScene.GetClientKernel().m_hWndEdit); Show(true); } }
public void SetMaxFishGold(int nMaxFishGold) { m_nMaxFishGold = nMaxFishGold; CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } UserInfo pUserData = pClientKernel.GetMeUserInfo(); if ((pUserData != null) && (pUserData.GetGameMoney() > 100)) { int nMeBuyCount = (pUserData.GetGameMoney() - 100) / m_lCellScore; m_nMaxBuyFishGold = (m_nMaxFishGold <= nMeBuyCount) ? m_nMaxFishGold : nMeBuyCount; } else { m_nMaxBuyFishGold = 0; } }
//C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // public void Dispose(); //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // virtual void update(float dt); public override void draw() { if (!visible_) { return; } base.draw(); CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } Point pt = new Point(position_absolute()); Point ptDraw = new Point(); ostringstream ostr = new ostringstream(); //for (int i=0; i<4; i++) //{ // ostr.str(""); // ostr = ostr + m_CaptureFishs[i]; // ptDraw.x_ = pt.x_ + 136+i*180; // ptDraw.y_ = pt.y_ +104; // DrawNumber(ostr.str(), ptDraw); //} //for (int i=0; i<4; i++) //{ // ostr.str(""); // ostr = ostr + m_CaptureFishs[i+4]; // ptDraw.x_ = pt.x_ + 136+i*180; // ptDraw.y_ = pt.y_ +104+74; // DrawNumber(ostr.str(), ptDraw); //} //for (int i=0; i<4; i++) //{ // ostr.str(""); // ostr = ostr + m_CaptureFishs[i+8]; // ptDraw.x_ = pt.x_ + 136+i*180; // ptDraw.y_ = pt.y_ +104+148; // DrawNumber(ostr.str(), ptDraw); //} int wMeChairID = pGameScene.GetMeChairID(); if (wMeChairID != GameDefine.INVALID_CHAIR) { int nFishGold = pGameScene.m_layRoles[wMeChairID].GetFishGold(); ostr.str(""); ostr = ostr + nFishGold; ptDraw.x_ = pt.x_ + 296; ptDraw.y_ = pt.y_ + 310; DrawNumber(ostr.str(), ptDraw); int lCellScore = pGameScene.m_layBuyBulletLayer.GetCellScore(); ostr.str(""); ostr = ostr + nFishGold * lCellScore; ptDraw.x_ = pt.x_ + 500; ptDraw.y_ = pt.y_ + 310; DrawNumber(ostr.str(), ptDraw); UserInfo pUserData = pClientKernel.GetMeUserInfo(); if (pUserData != null) { ostr.str(""); ostr = ostr + 0; ptDraw.x_ = pt.x_ + 240; ptDraw.y_ = pt.y_ + 352; DrawNumber(ostr.str(), ptDraw); ostr.str(""); ostr = ostr + pUserData.GetGameMoney(); ptDraw.x_ = pt.x_ + 580; ptDraw.y_ = pt.y_ + 352; DrawNumber(ostr.str(), ptDraw); } } long dwTime = FishDefine.time() - m_dwStartTime; if (dwTime >= 20) { ShowWidnow(false); } else { ostr.str(""); ostr = ostr + (20 - dwTime).ToString(); ptDraw.x_ = pt.x_ + 696; ptDraw.y_ = pt.y_ + 38; DrawTimer(ostr.str(), ptDraw); } }
public bool NetEnd(Node node, int tag) { Point ptNet = new Point(); Point ptTNet = new Point(); Point ptFish = new Point(); Size szFish = new Size(); Point ptDifference = new Point(); Rect rcScreen = new Rect(0, 0, 1280, 738); double sint; double cost; CGameScene pGameScene = (CGameScene)parent(); CNetObjectExtend pNetObjectExtend = (CNetObjectExtend)node.node_extend(); if (pNetObjectExtend.wChairID == pGameScene.GetMeChairID()) { CMD_C_Cast_Net CastNet = new CMD_C_Cast_Net(); CastNet.wChairID = pNetObjectExtend.wChairID; CastNet.cbCount = 0; ptNet = node.position(); foreach (Node j in pGameScene.m_layFishObject.childs()) { if (CastNet.cbCount >= FishDefine.MAX_FISH_IN_NET) { break; } CFishObjectExtend pFishObjectExtend = (CFishObjectExtend)j.node_extend(); if (pFishObjectExtend.wID == FishDefine.INVALID_WORD) { continue; } ptFish = j.position(); szFish = pFishObjectExtend.GetFishObjectSize(); cost = Math.Cos(j.rotation()); sint = Math.Sin(j.rotation()); ptTNet.x_ = (ptNet.x_ - ptFish.x_) * cost + (ptNet.y_ - ptFish.y_) * sint; ptTNet.y_ = -(ptNet.x_ - ptFish.x_) * sint + (ptNet.y_ - ptFish.y_) * cost; if (CFishObjectExtend.ComputeCollision(szFish.width_, szFish.height_, pNetObjectExtend.GetNetRadius(), ptTNet.x_, ptTNet.y_)) { CastNet.FishNetObjects[CastNet.cbCount].wID = pFishObjectExtend.wID; CastNet.FishNetObjects[CastNet.cbCount].wRoundID = pFishObjectExtend.wRoundID; CastNet.FishNetObjects[CastNet.cbCount].wType = (int)pFishObjectExtend.FishType; CastNet.FishNetObjects[CastNet.cbCount].dwTime = pNetObjectExtend.dwMulRate; //时间没用上,占时存放倍数 CastNet.cbCount++; } } CClientKernel pClientKernel = pGameScene.GetClientKernel(); if ((pClientKernel != null) && (pNetObjectExtend.dwMulRate <= 1000)) { pClientKernel.SendSocketData(FishDefine.SUB_C_CAST_NET, CastNet); } } remove_child(node); return(true); }
//C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // public void Dispose(); //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // virtual void update(float dt); public override void draw() { base.draw(); CGameScene pGameScene = (CGameScene)parent(); CClientKernel pClientKernel = pGameScene.GetClientKernel(); if (pClientKernel == null) { return; } UserInfo pUserData = pClientKernel.GetMeUserInfo(); //for(WORD wChair=0;wChair<GAME_PLAYER;wChair++) //{ // if(pGameScene->m_layRoles[wChair]->m_sprMessage->visible()) // { // Point pt = pGameScene->m_layRoles[wChair]->m_sprMessage->position() + pGameScene->m_layRoles[wChair]->position(); // std::ostringstream ostr; // ostr = ostr + "new Point(" + pt.x_ + "," + pt.y_ +")" + pGameScene->m_layRoles[wChair]->m_cbShowData; // m_Font->draw_string(pt, ostr.str().c_str(), Color(176,222,238)); // } //} if (pUserData != null) { int wChair = ((CGameScene)parent()).GetClientKernel().GetMeChairID(); Point pt = position_absolute(); pt.x_ += 56; pt.y_ += 14; // m_Font->draw_string(pt, pUserData->szNickName, Color(14,236,212)); //m_Font->draw_string(pt, g_WideCharToMultiByte(pUserData->szNickName), Color(14,236,212)); m_Font.draw_string(pt, pUserData.Nickname, new Color(14, 236, 212)); //std::string szRank; //if (pUserData->lScore>0 && pUserData->lScore<1000) //{ // szRank = "渔夫"; //} //else //{ // szRank = "船长"; //} ostringstream ostrRank = new ostringstream(); ostrRank = ostrRank + pGameScene.m_layRoles[wChair].GetExpValue(); pt.x_ += 160; m_Font.draw_string(pt, ostrRank.str(), new Color(14, 236, 212)); pt.x_ -= 160; pt.y_ += 28; int nFishGold = pGameScene.m_layRoles[pGameScene.GetMeChairID()].GetFishGold(); ostringstream ostr = new ostringstream(); ostr = ostr + pUserData.GetGameMoney() + "(+" + nFishGold + ")"; m_Font.draw_string(pt, ostr.str(), new Color(14, 236, 212)); pt.x_ += 30; pt.y_ += 27; ostringstream ostr1 = new ostringstream(); ostr1 = ostr1 + pGameScene.m_layRoles[wChair].GetMaxMulRate(); m_Font.draw_string(pt, ostr1.str(), new Color(14, 236, 212)); pt.x_ += 16; pt.y_ += 26; int nExpToLevel = FishDefine.EXP_CHANGE_TO_LEVEL; ostringstream ostr2 = new ostringstream(); ostr2 = ostr2 + pGameScene.m_layRoles[wChair].GetFireCount() % FishDefine.EXP_CHANGE_TO_LEVEL + " / " + nExpToLevel; m_Font.draw_string(pt, ostr2.str(), new Color(14, 236, 212)); } }
//C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // CBulletLayer(); //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found: // public void Dispose(); public override void update(double dt) { base.update(dt); CGameScene pGameScene = (CGameScene)parent(); Point ptBullet = new Point(); Point ptTBullet = new Point(); Point ptFish = new Point(); Size szFish = new Size(); double sint; double cost; Rect rcScreen = new Rect(0, 0, 1280, 738); foreach (Node i in childs_) { CBulletObjectExtend pBulletObjectExtend = (CBulletObjectExtend)i.node_extend(); UserInfo pUserData = null; if (pGameScene.GetClientKernel() != null) { pUserData = pGameScene.GetClientKernel().GetUserInfo(pBulletObjectExtend.wChairID); } ptBullet = i.position(); if (!rcScreen.pt_in_rect(ptBullet)) { if (pUserData != null) { if ((pBulletObjectExtend.nBackCount < 1000) && (GetBulletCount() < 51)) { if ((pBulletObjectExtend.wChairID < GameDefine.GAME_PLAYER) && (pBulletObjectExtend.wChairID >= 0)) { tagBulletBack tBulletBack = new tagBulletBack(); tBulletBack.ptStart = ptBullet; if (tBulletBack.ptStart.x_ < 0) { tBulletBack.ptStart.x_ = 0; } else if (tBulletBack.ptStart.x_ > 1280) { tBulletBack.ptStart.x_ = 1280; } if (tBulletBack.ptStart.y_ < 0) { tBulletBack.ptStart.y_ = 0; } else if (tBulletBack.ptStart.y_ > 738) { tBulletBack.ptStart.y_ = 738; } tBulletBack.wChair = pBulletObjectExtend.wChairID; tBulletBack.nBackCount = pBulletObjectExtend.nBackCount + 1; tBulletBack.fRotation = pBulletObjectExtend.fRotation; tBulletBack.dwMulRate = pBulletObjectExtend.dwMulRate; tBulletBack.wType = (int)pBulletObjectExtend.CannonType; m_BulletBackList.Add(tBulletBack); } } } m_NodeDelete.Add(i); continue; } foreach (Node j in pGameScene.m_layFishObject.childs()) { CFishObjectExtend pFishObjectExtend = (CFishObjectExtend)j.node_extend(); if (pFishObjectExtend.wID == FishDefine.INVALID_WORD) { continue; } ptFish = j.position(); szFish = pFishObjectExtend.GetFishObjectSize(); cost = Math.Cos(j.rotation()); sint = Math.Sin(j.rotation()); ptTBullet.x_ = (ptBullet.x_ - ptFish.x_) * cost + (ptBullet.y_ - ptFish.y_) * sint; ptTBullet.y_ = -(ptBullet.x_ - ptFish.x_) * sint + (ptBullet.y_ - ptFish.y_) * cost; if (CFishObjectExtend.ComputeCollision(szFish.width_, szFish.height_, 10, ptTBullet.x_, ptTBullet.y_)) { pGameScene.m_layNetObject.NetFire(ptBullet, pBulletObjectExtend.wChairID, pBulletObjectExtend.CannonType, pBulletObjectExtend.dwMulRate); m_NodeDelete.Add((i)); break; } } } List <Node> .Enumerator k = m_NodeDelete.GetEnumerator(); while (k.MoveNext()) { remove_child((k.Current)); //delete(k.Current).node_extend(); //delete(k.Current); } m_NodeDelete.Clear(); if (m_BulletBackList.Count() > 0) { List <tagBulletBack> .Enumerator it; foreach (tagBulletBack its in m_BulletBackList) { double fRotation = (its.ptStart.x_ >= 1280) ? -its.fRotation : (its.ptStart.y_ <= 0) ? -its.fRotation + Math.PI : (its.ptStart.y_ >= 738) ? -its.fRotation + Math.PI : -its.fRotation; BulletFireBack(its.ptStart, fRotation, its.wChair, (FishDefine.enCannonType)its.wType, its.nBackCount, its.dwMulRate); } } m_BulletBackList.Clear(); }