コード例 #1
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);
        }
コード例 #2
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);
        }