Beispiel #1
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();
                }
            }
        }
        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));
            }
        }
Beispiel #3
0
        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"));
                }
            }
        }
Beispiel #4
0
        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);
            }
        }
Beispiel #5
0
        public void button_press(int tag)
        {
            if (tag == 10102)
            {
                m_bIsOk = true;
                resize(m_ptUp, new Size(253, 173));
                m_btnDown.set_visible(false);
                m_btnUp.set_visible(true);

                CGameScene pGameScene = (CGameScene)parent();
                pGameScene.m_TimerShowUserInf.reset();
            }
            else if (tag == 10103)
            {
                m_bIsOk = true;
                resize(m_ptDown, new Size(253, 173));
                m_btnDown.set_visible(true);
                m_btnUp.set_visible(false);
            }
            else if (tag == 10100)
            {
                CGameScene pGameScene = (CGameScene)parent();
                if (!pGameScene.m_layAccount.visible())
                {
                    pGameScene.m_layBuyBulletLayer.ShowWidnow(false);
                    pGameScene.m_layAccount.ShowWidnow(true);

                    resize(m_ptDown, new Size(253, 173));
                    m_btnDown.set_visible(true);
                    m_btnUp.set_visible(false);
                }
            }
            else if (tag == 10101)
            {
                CGameScene pGameScene = (CGameScene)parent();
                int        nFishGold  = pGameScene.m_layRoles[pGameScene.GetMeChairID()].GetFishGold();
                if (!pGameScene.m_layAccount.visible())
                {
                    if (pGameScene.m_dwRoomType == 0)
                    {
                        if (!pGameScene.m_layBuyBulletLayer.IsSendBuyBulletMessage())
                        {
                            pGameScene.m_layBuyBulletLayer.ShowWidnow(true);

                            resize(m_ptDown, new Size(253, 173));
                            m_btnDown.set_visible(true);
                            m_btnUp.set_visible(false);
                        }
                    }
                }
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
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);
            }
        }
Beispiel #8
0
        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);
        }
Beispiel #9
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()
        {
            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));
            }
        }