Exemple #1
0
        public void SeCurGate(int nNumber)
        {
            bool          bGotHead      = false;
            int           nSingleNumber = 0;
            ostringstream ostr          = new ostringstream();

            nSingleNumber = (int)(nNumber % 100 / 10);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprCurGate[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprCurGate[0].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 10);
            ostr.str("");
            ostr = ostr + "buy_bullet_number_" + nSingleNumber;
            m_sprCurGate[1].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));

            if (nNumber == 0)
            {
                m_sprCurGate[1].set_display_image(null);
            }
        }
Exemple #2
0
        public void SetSceneType(FishDefine.enSceneType SceneType)
        {
            if (SceneType == FishDefine.enSceneType.SceneTypeCount)
            {
                return;
            }

            //if (SceneType == m_SceneType)
            //    return;
            //MessageBox(0,"","",0);

            m_SceneType = SceneType;

            ostringstream ostr = new ostringstream();

            ostr = ostr + "bg_game_" + (int)SceneType;

            m_imgBackground0 = Root.instance().imageset_manager().imageset(ostr.str()).image("bg");
            m_imgBackground1 = null;

            m_sprTideWater.set_position(new Point(1272 - 20, 0));
            m_sprTideWater.set_visible(false);

            if (m_BackSound[m_cbSceneSound] != null)
            {
                m_BackSound[m_cbSceneSound].play(true, false);
            }

            m_cbSceneSoundOld = m_cbSceneSound;
        }
        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));
            }
        }
Exemple #4
0
        public void SetTimeSecond(int nNumber)
        {
            bool          bGotHead      = false;
            int           nSingleNumber = 0;
            ostringstream ostr          = new ostringstream();

            nSingleNumber = (int)(nNumber % 100 / 10);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "match_number_" + nSingleNumber;
                m_sprTimeSecond[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                nSingleNumber = 0;
                bGotHead      = true;
                ostr.str("");
                ostr = ostr + "match_number_" + nSingleNumber;
                m_sprTimeSecond[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }

            nSingleNumber = (int)(nNumber % 10);
            ostr.str("");
            ostr = ostr + "match_number_" + nSingleNumber;
            m_sprTimeSecond[1].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));

            //if(nNumber==0)
            //{
            //	m_sprTimeSecond[1]->set_display_image(0);
            //}
        }
Exemple #5
0
        public void DrawTimer(string number, Point pt)
        {
            ostringstream ostr   = new ostringstream();
            Point         ptDraw = new Point();

            ptDraw = pt - new Point(number.Length / 2.0 * 24.0, 0);

            for (int i = 0; i < number.Length; i++)
            {
                int nIndex = number[i] - '0';
                m_imgTimer[nIndex].draw(ptDraw);

                ptDraw.x_ += 24;
            }
        }
Exemple #6
0
        public void ChangeSceneType(FishDefine.enSceneType SceneType)
        {
            if (SceneType == m_SceneType)
            {
                return;
            }

            if (m_BackSound[m_cbSceneSoundOld] != null)
            {
                m_BackSound[m_cbSceneSoundOld].stop();
            }

            m_cbSceneSoundOld = m_cbSceneSound;

            try
            {
                Sound_Instance pSound = Root.instance().sound_manager().sound_instance(4);
                pSound.play(false, true);
            }
            catch
            {
            }

            m_SceneType  = SceneType;
            m_IsSceneing = 1;

            ostringstream ostr = new ostringstream();

            int nSide = 1;

            Point ptBegin = (nSide == 0) ? new Point(-263, 0) : new Point(1280 + 263, 0);
            Point ptEnd   = (nSide == 0) ? new Point(1272 - 20, 0) : new Point(-283, 0);

            ostr.str("");
            ostr = ostr + "tide_water_" + nSide;

            m_sprTideWater.set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            m_sprTideWater.set_position(ptBegin);
            m_sprTideWater.set_visible(true);

            ostr.str("");
            ostr             = ostr + "bg_game_" + (int)SceneType;
            m_imgBackground1 = Root.instance().imageset_manager().imageset(ostr.str()).image("bg");

            GameControls.XLBE.Action actWater = new Action_Sequence(new Action_Delay(4), new Action_Move_To(4.4135, ptEnd), new Action_Func(ChangeSceneEnd), null);
            m_sprTideWater.run_action(actWater);
        }
        public void SetGameGold(int nGameGold)
        {
            //if (nGameGold == m_nGameGold)
            //    return;

            m_nGameGold = nGameGold;

            bool          bGotHead      = false;
            int           nSingleNumber = 0;
            ostringstream ostr          = new ostringstream();

            nSingleNumber = (int)(m_nGameGold % 1000000000 / 100000000);
            if (nSingleNumber > 0)
            {
                bGotHead = true;
                ostr     = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[0].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 100000000 / 10000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[1].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[1].set_display_image(null);
            }


            nSingleNumber = (int)(m_nGameGold % 10000000 / 1000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[2].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[2].set_display_image(null);
            }


            nSingleNumber = (int)(m_nGameGold % 1000000 / 100000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[3].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[3].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 100000 / 10000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[4].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[4].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 10000 / 1000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[5].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[5].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 1000 / 100);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[6].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[6].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 100 / 10);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprGameGold[7].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprGameGold[7].set_display_image(null);
            }

            nSingleNumber = (int)(m_nGameGold % 10 / 1);
            ostr.str("");
            ostr = ostr + "buy_bullet_number_" + nSingleNumber;
            m_sprGameGold[8].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
        }
Exemple #8
0
        public void SeNextGateGold(int nNumber)
        {
            m_nNextGateGoldCount = 0;

            bool          bGotHead      = false;
            int           nSingleNumber = 0;
            ostringstream ostr          = new ostringstream();

            nSingleNumber = (int)(nNumber % 1000000000 / 100000000);
            if (nSingleNumber > 0)
            {
                bGotHead = true;
                ostr     = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprNextGateGold[0].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 100000000 / 10000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[1].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprNextGateGold[1].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 10000000 / 1000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[2].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprNextGateGold[2].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 1000000 / 100000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[3].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
                m_nNextGateGoldCount++;
            }
            else
            {
                m_sprNextGateGold[3].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 100000 / 10000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[4].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
                m_nNextGateGoldCount++;
            }
            else
            {
                m_sprNextGateGold[4].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 10000 / 1000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[5].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
                m_nNextGateGoldCount++;
            }
            else
            {
                m_sprNextGateGold[5].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 1000 / 100);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[6].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
                m_nNextGateGoldCount++;
            }
            else
            {
                m_sprNextGateGold[6].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 100 / 10);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprNextGateGold[7].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
                m_nNextGateGoldCount++;
            }
            else
            {
                m_sprNextGateGold[7].set_display_image(null);
            }

            nSingleNumber = (int)(nNumber % 10);
            ostr.str("");
            ostr = ostr + "buy_bullet_number_" + nSingleNumber;
            m_sprNextGateGold[8].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));

            m_nNextGateGoldCount++;

            if (nNumber == 0)
            {
                m_sprNextGateGold[8].set_display_image(null);
            }
        }
Exemple #9
0
        public CAccountLayer()
        {
            this.m_CaptureFishs = new int[15];
            m_Font = Root.instance().font_manager().create_font_ttf("simsun", "fish\\simsun.ttc");
            m_Font.set_size(new Size(14, 15));

            /*m_btnMatchAndExit = new Button_Widget(Root::instance()->imageset_manager()->imageset("account")->image("btn_match_and_exit_image"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_and_exit_over"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_and_exit_down"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_and_exit_disable"));
             * m_btnMatchAndExit->set_tag(10200);
             * m_btnMatchAndExit->set_position(new Point(514,560));
             * m_btnMatchAndExit->set_content_size(new Size(158,57));
             * m_btnMatchAndExit->add_listener(this);
             *
             * m_btnMatch = new Button_Widget(Root::instance()->imageset_manager()->imageset("account")->image("btn_match_image"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_over"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_down"),
             *  Root::instance()->imageset_manager()->imageset("account")->image("btn_match_disable"));
             * m_btnMatch->set_tag(10201);
             * m_btnMatch->set_position(new Point(514,560));
             * m_btnMatch->set_content_size(new Size(158,57));
             * m_btnMatch->add_listener(this);*/

            m_btnAccountAndExit = new Button_Widget(Root.instance().imageset_manager().imageset("account").image("btn_account_and_exit_image"), Root.instance().imageset_manager().imageset("account").image("btn_account_and_exit_over"), Root.instance().imageset_manager().imageset("account").image("btn_account_and_exit_down"), Root.instance().imageset_manager().imageset("account").image("btn_account_and_exit_disable"));
            m_btnAccountAndExit.set_tag(10200);
            m_btnAccountAndExit.set_position(new Point(360, 523));
            m_btnAccountAndExit.set_content_size(new Size(158, 57));
            m_btnAccountAndExit.add_listener(this);

            m_btnAccount = new Button_Widget(Root.instance().imageset_manager().imageset("account").image("btn_account_image"), Root.instance().imageset_manager().imageset("account").image("btn_account_over"), Root.instance().imageset_manager().imageset("account").image("btn_account_down"), Root.instance().imageset_manager().imageset("account").image("btn_account_disable"));
            m_btnAccount.set_tag(10201);
            m_btnAccount.set_position(new Point(540, 523));
            m_btnAccount.set_content_size(new Size(158, 57));
            m_btnAccount.add_listener(this);

            m_btnClose = new Button_Widget(Root.instance().imageset_manager().imageset("account").image("btn_close_image"), Root.instance().imageset_manager().imageset("account").image("btn_close_over"), Root.instance().imageset_manager().imageset("account").image("btn_close_down"), Root.instance().imageset_manager().imageset("account").image("btn_close_disable"));
            m_btnClose.set_tag(10202);
            m_btnClose.set_position(new Point(720, 523));
            m_btnClose.set_content_size(new Size(158, 57));
            m_btnClose.add_listener(this);


            m_sprBackground = new Sprite(Root.instance().imageset_manager().imageset("account").image("bg"));
            m_sprBackground.set_hot(new Point(0, 0));
            add_child(m_sprBackground);

            for (int i = 0; i < m_CaptureFishs.Length; i++)
            {
                m_CaptureFishs[i] = 0;
            }

            ostringstream ostr = new ostringstream();

            for (int i = 0; i < 10; i++)
            {
                ostr.str("");
                ostr           = ostr + "number_" + i;
                m_imgNumber[i] = Root.instance().imageset_manager().imageset("role").image(ostr.str());
            }

            for (int i = 0; i < 10; i++)
            {
                ostr.str("");
                ostr          = ostr + "time_" + i;
                m_imgTimer[i] = Root.instance().imageset_manager().imageset("account").image(ostr.str());
            }
        }
Exemple #10
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);
            }
        }
Exemple #11
0
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //	CNetLayer();
        //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);
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //	virtual void draw();

        public bool NetFire(Point pt, int wChairID, FishDefine.enCannonType CannonType, int dwMulRate)
        {
            CNetObjectExtend pNetObjectExtend = new CNetObjectExtend();

            pNetObjectExtend.wChairID   = wChairID;
            pNetObjectExtend.CannonType = CannonType;
            pNetObjectExtend.dwMulRate  = dwMulRate;

            int nFirst = 0;

            if (CannonType > FishDefine.enCannonType.CannonType_5)
            {
                nFirst = 1;
            }

            Size szScale = new Size();

            switch (CannonType)
            {
            case FishDefine.enCannonType.CannonType_0:
            {
                szScale.width_  = 0.5;
                szScale.height_ = 0.5;
                break;
            }

            case FishDefine.enCannonType.CannonType_1:
            {
                szScale.width_  = 0.6;
                szScale.height_ = 0.6;
                break;
            }

            case FishDefine.enCannonType.CannonType_2:
            {
                szScale.width_  = 0.7;
                szScale.height_ = 0.7;
                break;
            }

            case FishDefine.enCannonType.CannonType_3:
            {
                szScale.width_  = 0.8;
                szScale.height_ = 0.8;
                break;
            }

            case FishDefine.enCannonType.CannonType_4:
            {
                szScale.width_  = 0.9;
                szScale.height_ = 0.9;
                break;
            }

            case FishDefine.enCannonType.CannonType_5:
            {
                szScale.width_  = 0.9;
                szScale.height_ = 0.9;
                break;
            }

            case FishDefine.enCannonType.CannonType_6:
            {
                szScale.width_  = 1.0;
                szScale.height_ = 1.0;
                break;
            }
            }


            ostringstream ostr = new ostringstream();

            ostr = ostr + "net_" + nFirst + "_" + (int)wChairID;

            Sprite sprNet = new Sprite(Root.instance().imageset_manager().imageset(ostr.str()).image("0"));

            sprNet.set_node_extend(pNetObjectExtend);

            sprNet.set_position(pt);
            sprNet.set_scale(szScale);
            add_child(sprNet);

            Animation aniBullet = Root.instance().animation_manager().animation(ostr.str());

            sprNet.run_action(new Action_Sequence(new Action_Animation(0.06, aniBullet, false), new Action_Func(NetEnd), null));

            try
            {
                Sound_Instance pSound = Root.instance().sound_manager().sound_instance(nFirst + 7);
                pSound.play(false, true);
            }
            catch
            {
            }

            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));
            }
        }
Exemple #13
0
        public bool BulletFireBack(Point ptStart, double rotation, int wChairID, FishDefine.enCannonType CannonType, int nBackCount, int dwMulRate)
        {
            if (GetBulletCount() > 51)
            {
                return(true);
            }

            CBulletObjectExtend BulletObjectExtend = new CBulletObjectExtend();

            BulletObjectExtend.nBackCount = nBackCount;
            BulletObjectExtend.fRotation  = rotation;
            BulletObjectExtend.wChairID   = wChairID;
            BulletObjectExtend.CannonType = CannonType;
            BulletObjectExtend.dwMulRate  = dwMulRate;

            int nFirst = 0;

            if (CannonType > FishDefine.enCannonType.CannonType_5)
            {
                nFirst = 1;
            }

            Size szScale = new Size();

            switch (CannonType)
            {
            case FishDefine.enCannonType.CannonType_0:
            {
                szScale.width_  = 0.5;
                szScale.height_ = 0.5;
                break;
            }

            case FishDefine.enCannonType.CannonType_1:
            {
                szScale.width_  = 0.6;
                szScale.height_ = 0.6;
                break;
            }

            case FishDefine.enCannonType.CannonType_2:
            {
                szScale.width_  = 0.7;
                szScale.height_ = 0.7;
                break;
            }

            case FishDefine.enCannonType.CannonType_3:
            {
                szScale.width_  = 0.8;
                szScale.height_ = 0.8;
                break;
            }

            case FishDefine.enCannonType.CannonType_4:
            {
                szScale.width_  = 0.9;
                szScale.height_ = 0.9;
                break;
            }

            case FishDefine.enCannonType.CannonType_5:
            {
                szScale.width_  = 0.9;
                szScale.height_ = 0.9;
                break;
            }

            case FishDefine.enCannonType.CannonType_6:
            {
                szScale.width_  = 1.0;
                szScale.height_ = 1.0;
                break;
            }
            }


            ostringstream ostr = new ostringstream();

            ostr = ostr + "shot_" + nFirst + "_" + (int)wChairID;

            Sprite sprBullet = new Sprite(Root.instance().imageset_manager().imageset(ostr.str()).image("0"));

            sprBullet.set_node_extend(BulletObjectExtend);

            Point pt = new Point(ptStart.x_ + 56 * Math.Cos(rotation - FishDefine.M_PI_2), ptStart.y_ + 56 * Math.Sin(rotation - FishDefine.M_PI_2));

            sprBullet.set_position(pt);
            sprBullet.set_rotation(rotation);
            sprBullet.set_scale(szScale);
            add_child(sprBullet);

            GameControls.XLBE.Action actBullet = new Action_Move_By(3, new Point(2000 * Math.Cos(rotation - FishDefine.M_PI_2), 2000 * Math.Sin(rotation - FishDefine.M_PI_2)));
            sprBullet.run_action(actBullet);

            Animation aniBullet = Root.instance().animation_manager().animation(ostr.str());

            sprBullet.run_action(new Action_Repeat_Forever(new Action_Animation(0.06, aniBullet, false)));

            //CGameScene *pGameScene = (CGameScene *)parent();
            //if (wChairID == pGameScene->GetMeChairID())
            //{
            //	CMD_C_Fire Fire;
            //	Fire.cbIsBack = TRUE;
            //	Fire.fRote = rotation;
            //	Fire.dwMulRate = dwMulRate;
            //	Fire.xStart = ptStart.x_;
            //	Fire.yStart = ptStart.y_;
            //	pGameScene->GetClientKernel()->SendSocketData(MDM_GF_GAME, SUB_C_FIRE, &Fire, sizeof(CMD_C_Fire));
            //}

            return(true);
        }
Exemple #14
0
        public void SetMatchGold(int dwMatchScoreBase)
        {
            m_dwMatchScoreBase = dwMatchScoreBase;

            //std::ostringstream ostrTemp;
            //ostrTemp + m_dwMatchScoreBase;
            //MessageBox(0,ostrTemp.str().c_str(),"",0);
            bool          bGotHead      = false;
            int           nSingleNumber = 0;
            ostringstream ostr          = new ostringstream();

            nSingleNumber = (int)(m_dwMatchScoreBase % 1000000000 / 100000000);
            if (nSingleNumber > 0)
            {
                bGotHead = true;
                ostr     = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[0].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[0].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 100000000 / 10000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[1].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[1].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 10000000 / 1000000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[2].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[2].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 1000000 / 100000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[3].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[3].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 100000 / 10000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[4].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[4].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 10000 / 1000);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[5].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[5].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 1000 / 100);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[6].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[6].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 100 / 10);
            if (nSingleNumber > 0 || bGotHead)
            {
                bGotHead = true;
                ostr.str("");
                ostr = ostr + "buy_bullet_number_" + nSingleNumber;
                m_sprMatchGold[7].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));
            }
            else
            {
                m_sprMatchGold[7].set_display_image(null);
            }

            nSingleNumber = (int)(m_dwMatchScoreBase % 10);
            ostr.str("");
            ostr = ostr + "buy_bullet_number_" + nSingleNumber;
            m_sprMatchGold[8].set_display_image(Root.instance().imageset_manager().imageset("ui_game").image(ostr.str()));

            if (m_dwMatchScoreBase == 0)
            {
                m_sprMatchGold[8].set_display_image(null);
            }
        }