Example #1
0
        private void Activate(ExciterOperationMode value)
        {
            operation_ = value;
            switch (operation_)
            {
            case ExciterOperationMode.Barrage:
                Barrage.Activate();
                break;

            case ExciterOperationMode.MultiSpot:
                MultiSpot.Activate();
                break;

            case ExciterOperationMode.Spot:
                Spot.Activate();
                break;

            case ExciterOperationMode.Sweep:
                Sweep.Activate();
                break;

            case ExciterOperationMode.Comb:
                Comb.Activate();
                break;
            }
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            gs               = new Barrage();
            tra1             = trackBar1.Value;
            tra2             = trackBar2.Value;
            tra3             = trackBar3.Value;
            tra4             = trackBar4.Value;
            tra5             = trackBar5.Value;
            tra6             = trackBar6.Value;
            bitmapheight     = 900;
            bitmapwidth      = 1000;
            this.WindowState = FormWindowState.Maximized;
            Bitmap     MyNewBmp    = new Bitmap(bitmapwidth, bitmapheight);
            Rectangle  MyRec       = new Rectangle(0, 0, MyNewBmp.Width, MyNewBmp.Height);
            BitmapData MyBmpData   = MyNewBmp.LockBits(MyRec, ImageLockMode.ReadWrite, MyNewBmp.PixelFormat);
            IntPtr     MyPtr       = MyBmpData.Scan0;
            int        MyByteCount = MyBmpData.Stride * MyNewBmp.Height;

            byte[] MyNewColor = new byte[MyByteCount];
            Marshal.Copy(MyPtr, MyNewColor, 0, MyByteCount);
            for (int n = 0; n < MyByteCount; n++)
            {
                MyNewColor[n] = 255;
            }
            Marshal.Copy(MyNewColor, 0, MyPtr, MyByteCount);
            MyNewBmp.UnlockBits(MyBmpData);
            pictureBox1.Image = MyNewBmp;
            image0            = MyNewBmp;
            pictureBox1.Image = MyNewBmp;
            nowimage          = MyNewBmp;
            tempbitmap        = new Bitmap(nowimage, nowimage.Width, nowimage.Height);
            gs.penarray();
            timer1.Enabled = true;
        }
Example #3
0
    protected void Beam(float _attackTime, Barrage _barrage)
    {
        Vector3        pos        = this.Trans.position;
        int            beamNumber = this.SearchAvailableBullet(this.beams);
        QueenBeeBullet bullet     = this.beams[beamNumber];

        bullet.BulletType = _barrage;
        bullet.Bullet.transform.position = pos;
        bullet.AttackTime = _attackTime;
        bullet.Bullet.gameObject.SetActive(true);
    }
Example #4
0
    protected void Funnel(Vector2 _toPos, float _moveSecond, Barrage _barrage)
    {
        Vector3        pos            = this.Trans.position;
        float          distance       = Vector2.Distance(pos, _toPos);
        int            childBeeNumber = this.SearchAvailableBullet(this.childBees);
        QueenBeeBullet bullet         = this.childBees[childBeeNumber];

        bullet.BulletType = _barrage;
        bullet.Bullet.transform.position = pos;
        bullet.HitPoint             = 5;
        bullet.ToPos                = _toPos;
        bullet.ToMoveSpeed          = distance / _moveSecond;
        bullet.VectorMyselfPosition = new Vector2(_toPos.x - pos.x, _toPos.y - pos.y).normalized;
        bullet.MovingFlag           = true;
        bullet.Bullet.gameObject.SetActive(true);
        this.occupiedFunnel.Add(bullet);
    }
Example #5
0
    protected void LeftFan(int _fanNum, Barrage _barrage)
    {
        Vector3 pos = this.Trans.position;

        pos.x -= 10.5f;
        int appearSpace = (this.maxRad - this.minRad) / (_fanNum - 1);

        for (int i = 0; i < _fanNum; i += 1)
        {
            int            needleNumber = this.SearchAvailableBullet(this.needles);
            QueenBeeBullet bullet       = this.needles[needleNumber];
            bullet.BulletType = _barrage;
            bullet.Bullet.transform.position = pos;
            bullet.Bullet.transform.rotation = new Quaternion(0.7f, 0.0f, 0.0f, 0.7f);
            bullet.Bullet.transform.Rotate(new Vector3(0, 1, 0), this.minRad + i * appearSpace);
            bullet.Bullet.SetActive(true);
        }
    }
Example #6
0
    protected void Suicide(int _fanNum, float _radius, Barrage _barrage)
    {
        Vector3 pos   = this.Trans.position;
        float   angle = 360.0f / (_fanNum - 1) * Mathf.Deg2Rad;

        for (int i = 0; i < _fanNum; i += 1)
        {
            int            childBeeNumber = this.SearchAvailableBullet(this.childBees);
            QueenBeeBullet bullet         = this.childBees[childBeeNumber];
            bullet.Bullet.transform.position = pos;
            bullet.Angle         = angle * i;
            bullet.StartPosition = pos;
            bullet.BulletType    = _barrage;
            bullet.MaxRadius     = _radius;
            bullet.Bullet.gameObject.SetActive(true);
            this.occupiedFunnel.Add(bullet);
        }
    }
Example #7
0
        internal static Mass Load(string filename)
        {
            var mass = new Mass();

            mass.Init();
            mass.name = filename;

            var fs    = new FileStream(Mass.SETTING_PATH + mass.name + Mass.EXTENSION, FileMode.Open, FileAccess.Read);
            var array = new byte[fs.Length];

            fs.Read(array, 0, (int)fs.Length);
            fs.Close();

            var offset  = 0;
            var version = BitConverter.ToInt32(array, offset);

            offset += 4;

            if (version != VERSION)
            {
                throw new InvalidDataException();
            }

            var hotKeySize = BitConverter.ToInt32(array, offset);

            offset += 4;
            var headerSize = BitConverter.ToInt32(array, offset);

            offset       += 4;
            mass.Sequence = BitConverter.ToInt32(array, offset);
            offset       += 4;
            mass.hotKey   = array.Skip(offset).Take(hotKeySize).ToArray()[0];
            offset       += hotKeySize;
            var headerCount = headerSize / 28;
            var headers     = new List <ArdHeader>();

            for (var i = 0; i < headerCount; i++)
            {
                var ardHeader = new ArdHeader();
                ardHeader.id                   = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.instanceType         = (Act.InstanceType)BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.priority             = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.skillIconSize        = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.disableSkillIconSize = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.pushDataSize         = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.sendDataSize         = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                headers.Add(ardHeader);
            }


            foreach (var ardHeader in headers)
            {
                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (ardHeader.instanceType)
                {
                case Act.InstanceType.COMMAND:
                    var c = new Command();
                    c.Id               = ardHeader.id;
                    c.Priority         = ardHeader.priority;
                    c.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    c.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    c.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    c.sendList         = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray();
                    offset            += ardHeader.sendDataSize;
                    mass.Add(c);
                    break;

                case Act.InstanceType.BARRAGE:
                    var b = new Barrage();
                    b.Id               = ardHeader.id;
                    b.Priority         = ardHeader.priority;
                    b.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    b.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    b.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    b.send             = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray()[0];
                    offset            += ardHeader.sendDataSize;
                    mass.Add(b);
                    break;

                case Act.InstanceType.TOGGLE:
                    var t = new Toggle();
                    t.Id               = ardHeader.id;
                    t.Priority         = ardHeader.priority;
                    t.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    t.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    t.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    t.send             = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray()[0];
                    offset            += ardHeader.sendDataSize;
                    mass.Add(t);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            return(mass);
        }
Example #8
0
        public void Update(Barrage objects)
        {
            if (this.changetype == 1)
            {
                switch (this.changevalue)
                {
                case 0:
                    if (this.change == 0)
                    {
                        objects.life = (int)this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.life += (int)this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.life -= (int)this.value;
                        break;
                    }
                    break;

                case 1:
                    if (this.change == 0)
                    {
                        objects.type = (int)this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.type += (int)this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.type -= (int)this.value;
                        break;
                    }
                    break;

                case 2:
                    if (this.change == 0)
                    {
                        objects.wscale = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.wscale += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.wscale -= this.value;
                        break;
                    }
                    break;

                case 3:
                    if (this.change == 0)
                    {
                        objects.hscale = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.hscale += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.hscale -= this.value;
                        break;
                    }
                    break;

                case 4:
                    if (this.change == 0)
                    {
                        objects.R = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.R += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.R -= this.value;
                        break;
                    }
                    break;

                case 5:
                    if (this.change == 0)
                    {
                        objects.G = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.G += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.G -= this.value;
                        break;
                    }
                    break;

                case 6:
                    if (this.change == 0)
                    {
                        objects.B = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.B += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.B -= this.value;
                        break;
                    }
                    break;

                case 7:
                    if (this.change == 0)
                    {
                        objects.alpha = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.alpha += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.alpha -= this.value;
                        break;
                    }
                    break;

                case 8:
                    if (this.change == 0)
                    {
                        objects.head = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.head += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.head -= this.value;
                        break;
                    }
                    break;

                case 9:
                    if (this.change == 0)
                    {
                        objects.speed = this.value;
                    }
                    else if (this.change == 1)
                    {
                        objects.speed += this.value;
                    }
                    else if (this.change == 2)
                    {
                        objects.speed -= this.value;
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 10:
                    if (this.change == 0)
                    {
                        objects.speedd = this.value;
                    }
                    else if (this.change == 1)
                    {
                        objects.speedd += this.value;
                    }
                    else if (this.change == 2)
                    {
                        objects.speedd -= this.value;
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 11:
                    if (this.change == 0)
                    {
                        objects.aspeed = this.value;
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeed += this.value;
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeed -= this.value;
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 12:
                    if (this.change == 0)
                    {
                        objects.aspeedd = this.value;
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeedd += this.value;
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeedd -= this.value;
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 13:
                    if (this.change == 0)
                    {
                        objects.xscale = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.xscale += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.xscale -= this.value;
                        break;
                    }
                    break;

                case 14:
                    if (this.change == 0)
                    {
                        objects.yscale = this.value;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.yscale += this.value;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.yscale -= this.value;
                        break;
                    }
                    break;

                case 15:
                    if ((double)this.value > 0.0)
                    {
                        objects.Mist = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Mist = false;
                        break;
                    }
                    break;

                case 16:
                    if ((double)this.value > 0.0)
                    {
                        objects.Dispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Dispel = false;
                        break;
                    }
                    break;

                case 17:
                    if ((double)this.value > 0.0)
                    {
                        objects.Blend = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Blend = false;
                        break;
                    }
                    break;

                case 18:
                    if ((double)this.value > 0.0)
                    {
                        objects.Afterimage = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Afterimage = false;
                        break;
                    }
                    break;

                case 19:
                    if ((double)this.value > 0.0)
                    {
                        objects.Outdispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Outdispel = false;
                        break;
                    }
                    break;

                case 20:
                    if ((double)this.value > 0.0)
                    {
                        objects.Invincible = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Invincible = false;
                        break;
                    }
                    break;
                }
            }
            else if (this.changetype == 0)
            {
                switch (this.changevalue)
                {
                case 0:
                    if (this.change == 0)
                    {
                        objects.life = (int)(((double)objects.life * ((double)this.ctime - 1.0) + (double)this.value) / (double)this.ctime);
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.life += (int)((double)this.value / (double)this.time);
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.life -= (int)((double)this.value / (double)this.time);
                        break;
                    }
                    break;

                case 1:
                    if (this.change == 0)
                    {
                        objects.type = (int)(((double)objects.type * ((double)this.ctime - 1.0) + (double)this.value) / (double)this.ctime);
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.type += (int)((double)this.value / (double)this.time);
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.type -= (int)((double)this.value / (double)this.time);
                        break;
                    }
                    break;

                case 2:
                    if (this.change == 0)
                    {
                        objects.wscale = (objects.wscale * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.wscale += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.wscale -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 3:
                    if (this.change == 0)
                    {
                        objects.hscale = (objects.hscale * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.hscale += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.hscale -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 4:
                    if (this.change == 0)
                    {
                        objects.R = (objects.R * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.R += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.R -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 5:
                    if (this.change == 0)
                    {
                        objects.G = (objects.G * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.G += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.G -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 6:
                    if (this.change == 0)
                    {
                        objects.B = (objects.B * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.B += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.B -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 7:
                    if (this.change == 0)
                    {
                        objects.alpha = (objects.alpha * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.alpha += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.alpha -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 8:
                    if (this.change == 0)
                    {
                        objects.head = (objects.head * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.head += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.head -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 9:
                    if (this.change == 0)
                    {
                        objects.speed = (objects.speed * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                    }
                    else if (this.change == 1)
                    {
                        objects.speed += this.value / (float)this.time;
                    }
                    else if (this.change == 2)
                    {
                        objects.speed -= this.value / (float)this.time;
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 10:
                    if (this.change == 0)
                    {
                        objects.speedd = (objects.speedd * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                    }
                    else if (this.change == 1)
                    {
                        objects.speedd += this.value / (float)this.time;
                    }
                    else if (this.change == 2)
                    {
                        objects.speedd -= this.value / (float)this.time;
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 11:
                    if (this.change == 0)
                    {
                        objects.aspeed = (objects.aspeed * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeed += this.value / (float)this.time;
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeed -= this.value / (float)this.time;
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 12:
                    if (this.change == 0)
                    {
                        objects.aspeedd = (objects.aspeedd * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeedd += this.value / (float)this.time;
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeedd -= this.value / (float)this.time;
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 13:
                    if (this.change == 0)
                    {
                        objects.xscale = (objects.xscale * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.xscale += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.xscale -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 14:
                    if (this.change == 0)
                    {
                        objects.yscale = (objects.yscale * ((float)this.ctime - 1f) + this.value) / (float)this.ctime;
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.yscale += this.value / (float)this.time;
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.yscale -= this.value / (float)this.time;
                        break;
                    }
                    break;

                case 15:
                    if ((double)this.value > 0.0)
                    {
                        objects.Mist = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Mist = false;
                        break;
                    }
                    break;

                case 16:
                    if ((double)this.value > 0.0)
                    {
                        objects.Dispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Dispel = false;
                        break;
                    }
                    break;

                case 17:
                    if ((double)this.value > 0.0)
                    {
                        objects.Blend = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Blend = false;
                        break;
                    }
                    break;

                case 18:
                    if ((double)this.value > 0.0)
                    {
                        objects.Afterimage = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Afterimage = false;
                        break;
                    }
                    break;

                case 19:
                    if ((double)this.value > 0.0)
                    {
                        objects.Outdispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Outdispel = false;
                        break;
                    }
                    break;

                case 20:
                    if ((double)this.value > 0.0)
                    {
                        objects.Invincible = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Invincible = false;
                        break;
                    }
                    break;
                }
            }
            else if (this.changetype == 2)
            {
                switch (this.changevalue)
                {
                case 0:
                    if (this.change == 0)
                    {
                        objects.life = (int)((double)float.Parse(this.region) + ((double)this.value - (double)float.Parse(this.region)) * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.life = (int)((double)float.Parse(this.region) + (double)this.value * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.life = (int)((double)float.Parse(this.region) - (double)this.value * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    break;

                case 1:
                    if (this.change == 0)
                    {
                        objects.type = (int)((double)float.Parse(this.region) + ((double)this.value - (double)float.Parse(this.region)) * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.type = (int)((double)float.Parse(this.region) + (double)this.value * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.type = (int)((double)float.Parse(this.region) - (double)this.value * Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime)))));
                        break;
                    }
                    break;

                case 2:
                    if (this.change == 0)
                    {
                        objects.wscale = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.wscale = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.wscale = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 3:
                    if (this.change == 0)
                    {
                        objects.hscale = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.hscale = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.hscale = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 4:
                    if (this.change == 0)
                    {
                        objects.R = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.R = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.R = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 5:
                    if (this.change == 0)
                    {
                        objects.G = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.G = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.G = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 6:
                    if (this.change == 0)
                    {
                        objects.B = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.B = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.B = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 7:
                    if (this.change == 0)
                    {
                        objects.alpha = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.alpha = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.alpha = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 8:
                    if (this.change == 0)
                    {
                        objects.head = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.head = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.head = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 9:
                    if (this.change == 0)
                    {
                        objects.speed = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 1)
                    {
                        objects.speed = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 2)
                    {
                        objects.speed = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 10:
                    if (this.change == 0)
                    {
                        objects.speedd = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 1)
                    {
                        objects.speedd = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 2)
                    {
                        objects.speedd = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    objects.speedx = objects.xscale * objects.speed * (float)Math.Cos((double)MathHelper.ToRadians(objects.speedd));
                    objects.speedy = objects.yscale * objects.speed * (float)Math.Sin((double)MathHelper.ToRadians(objects.speedd));
                    break;

                case 11:
                    if (this.change == 0)
                    {
                        objects.aspeed = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeed = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeed = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 12:
                    if (this.change == 0)
                    {
                        objects.aspeedd = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 1)
                    {
                        objects.aspeedd = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    else if (this.change == 2)
                    {
                        objects.aspeedd = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                    }
                    objects.aspeedx = objects.xscale * objects.aspeed * (float)Math.Cos((double)MathHelper.ToRadians(objects.aspeedd));
                    objects.aspeedy = objects.yscale * objects.aspeed * (float)Math.Sin((double)MathHelper.ToRadians(objects.aspeedd));
                    break;

                case 13:
                    if (this.change == 0)
                    {
                        objects.xscale = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.xscale = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.xscale = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 14:
                    if (this.change == 0)
                    {
                        objects.yscale = float.Parse(this.region) + (this.value - float.Parse(this.region)) * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 1)
                    {
                        objects.yscale = float.Parse(this.region) + this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    if (this.change == 2)
                    {
                        objects.yscale = float.Parse(this.region) - this.value * (float)Math.Sin((double)MathHelper.ToRadians((float)(360.0 / (double)this.time * ((double)this.time - (double)this.ctime))));
                        break;
                    }
                    break;

                case 15:
                    if ((double)this.value > 0.0)
                    {
                        objects.Mist = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Mist = false;
                        break;
                    }
                    break;

                case 16:
                    if ((double)this.value > 0.0)
                    {
                        objects.Dispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Dispel = false;
                        break;
                    }
                    break;

                case 17:
                    if ((double)this.value > 0.0)
                    {
                        objects.Blend = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Blend = false;
                        break;
                    }
                    break;

                case 18:
                    if ((double)this.value > 0.0)
                    {
                        objects.Afterimage = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Afterimage = false;
                        break;
                    }
                    break;

                case 19:
                    if ((double)this.value > 0.0)
                    {
                        objects.Outdispel = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Outdispel = false;
                        break;
                    }
                    break;

                case 20:
                    if ((double)this.value > 0.0)
                    {
                        objects.Invincible = true;
                    }
                    if ((double)this.value <= 0.0)
                    {
                        objects.Invincible = false;
                        break;
                    }
                    break;
                }
            }
            --this.ctime;
            if (this.changetype == 2 & this.ctime == -1)
            {
                this.NeedDelete = true;
            }
            else
            {
                if (!(this.changetype != 2 & this.ctime == 0))
                {
                    return;
                }
                this.NeedDelete = true;
            }
        }
Example #9
0
        public override void InitializeStates(Projectile projectile)
        {
            AttackSpeed = 18;

            string path = "Projectiles/Stands/Italy/KingCrimson/";

            AddAnimation(KCStates.Spawn.ToString(), path + "KCSpawn", 7, 20);
            AddAnimation(KCStates.Despawn.ToString(), path + "KCSpawn", 7, 20).AsReversed();
            AddAnimation("PunchMid1", path + "KCPunchRight", 4, 10);
            AddAnimation("PunchMid2", path + "KCPunchLeft", 4, 10);
            AddAnimation("PunchUp1", path + "KCPunchRightU", 4, 10);
            AddAnimation("PunchUp2", path + "KCPunchLeftU", 4, 10);
            AddAnimation("PunchDown1", path + "KCPunchRightD", 4, 10);
            AddAnimation("PunchDown2", path + "KCPunchLeftD", 4, 10);
            AddAnimation(KCStates.Idle.ToString(), path + "KCIdle", 5, 5, true);
            AddAnimation(KCStates.Slice.ToString(), path + "KCYeet", 13, 12);
            AddAnimation(KCStates.Donut, path + "KCDonutCommit", 6, 10);
            AddAnimation("DonutEnd", path + "KCDonutUndo", 12, 12);
            AddAnimation("DonutMiss", path + "KCDonutMiss", 7, 12);
            AddAnimation(KCStates.Barrage, path + "KCRush", 4, 15, true);

            StandState spawnState = AddState(KCStates.Spawn, 20);

            spawnState.OnStateUpdate += SpawnState_OnStateUpdate;
            spawnState.OnStateEnd    += GoIdle;

            StandState idleState = AddState(KCStates.Idle);

            idleState.OnStateUpdate += Idle;

            StandState despawnState = AddState(KCStates.Despawn.ToString(), 14);

            despawnState.OnStateEnd += delegate { projectile.Kill(); };

            StandState punchState = AddState(KCStates.Punch, AttackSpeed);

            punchState.OnStateBegin  += BeginPunch;
            punchState.OnStateUpdate += UpdatePunch;
            punchState.OnStateEnd    += EndPunch;

            StandState cutState = AddState(KCStates.Slice.ToString(), 60);

            cutState.OnStateBegin  += CutState_OnStateBegin;
            cutState.OnStateUpdate += UpdatePunch;
            cutState.OnStateEnd    += EndPunch;

            StandState donutState = AddState(KCStates.Donut, 40);

            donutState.OnStateUpdate += DonutState_OnStateUpdate;
            donutState.OnStateEnd    += DonutState_OnStateEnd;
            donutState.OnStateBegin  += DonutState_OnStateBegin;

            StandState donutEndState = AddState(KCStates.DonutEnd, 60);

            donutEndState.OnStateEnd += GoIdle;

            StandState barrageState = AddState(KCStates.Barrage, 180);

            barrageState.OnStateBegin += BarrageState_OnStateBegin;

            barrageState.OnStateUpdate += delegate
            {
                if (Barrage != null)
                {
                    SpriteFX = Barrage.Center.X < projectile.Center.X ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
                }

                projectile.Center = Vector2.Lerp(projectile.Center, Owner.Center + PunchDirection, 0.35f);
            };

            barrageState.OnStateEnd += delegate
            {
                Barrage.Kill();
                PunchDirection = Vector2.Zero;
                Barrage        = null;
                SetState(KCStates.Idle.ToString());
            };

            SetState(KCStates.Spawn.ToString());
        }
Example #10
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            new Main().Initialize("set.xna");
            while (true)
            {
                string command = Console.ReadLine();
                switch (command[0])
                {
                case 'q':
                    return;

                case 'o':
                    Th902Interface.OpenMbg(command.Substring(1));
                    break;

                case 'p':
                    string[] s = command.Substring(1).Split(',');
                    Th902Interface.SetPlayerPosition(float.Parse(s[0]) / 1.5f, float.Parse(s[1]) / 1.5f);
                    break;

                case 'r':
                    Th902Interface.SetRandomSeed(int.Parse(command.Substring(1)));
                    break;

                case 'u':
                    Th902Interface.Update();
                    break;

                case 'g':
                    var list     = Th902Interface.GetBulletList();
                    var filtered = new List <Barrage> ();
                    foreach (var item in list)
                    {
                        if (item.IsLase || item.IsRay)
                        {
                            continue;
                        }
                        if (item.x < -320.0f || item.x > 960.0f || item.y < -240.0f || item.y > 720.0f)
                        {
                            continue;
                        }
                        filtered.Add(item);
                    }
                    using (MemoryStream ms = new MemoryStream()) {
                        using (BinaryWriter bw = new BinaryWriter(ms)) {
                            for (int i = 0; i < filtered.Count; i++)
                            {
                                Barrage b = filtered[i];
                                bw.Write(b.x * 1.5f);
                                bw.Write(b.y * 1.5f);
                                bw.Write(b.type);
                                bw.Write(b.wscale);
                                bw.Write(b.hscale);
                                bw.Write(b.Blend);
                                bw.Write(b.R / 255.0f);
                                bw.Write(b.G / 255.0f);
                                bw.Write(b.B / 255.0f);
                                bw.Write(b.alpha / 100.0f);
                                bw.Write(b.head + 90.0f);
                            }
                            Console.Write(ms.Length.ToString("0000000000"));
                            Console.Out.Flush();
                            using (Stream stdout = Console.OpenStandardOutput()) {
                                stdout.Flush();
                                ms.Seek(0, SeekOrigin.Begin);
                                ms.CopyTo(stdout, Math.Max(32768, (int)ms.Length));
                                stdout.Flush();
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            ;
        }
Example #11
0
 public async Task<bool> UpdateAsync(Barrage prod)
 {
     return await _dBContext.DbConnection.UpdateAsync(prod);
 }
Example #12
0
        public async Task<bool> AddAsync(Barrage prod)
        {

            return await _dBContext.DbConnection.InsertAsync(prod) > 0;
        }
Example #13
0
        public override IResponseMessageBase OnTextRequest(RequestMessageText requestMessage)
        {
            //记录用户行为
            //_wr.CallUserBehavior("TEXT_EVENT", requestMessage.FromUserName, requestMessage.AgentID.ToString(CultureInfo.InvariantCulture), requestMessage.Content, "", 8);
            LogManager.GetLogger(this.GetType()).Debug("ON Activity TEXT behavior1 ");

            var            agentid = requestMessage.AgentID.ToString();
            string         keyword = string.Empty;
            BarrageSummary barrageSummary;
            int            signal  = 0;
            string         content = requestMessage.Content;

            if (string.IsNullOrEmpty(content))
            {
                return(null);
            }
            content = content.Trim();
            LogManager.GetLogger(this.GetType()).Debug("BarrageSummary - content={0}", content);
            int startIndex = content.IndexOf("+", System.StringComparison.Ordinal);

            if (content.Length >= 3 && startIndex > 0 && content.Length > startIndex)
            {
                keyword = content.Substring(0, startIndex);
                content = content.Substring(startIndex + 1);

                LogManager.GetLogger(this.GetType()).Debug("BarrageSummary - keyword={0}", keyword);
                barrageSummary = _BarrageSummaryService.Repository.Entities.AsNoTracking().FirstOrDefault(a => a.AppId == agentid && a.Keyword.Equals(keyword, StringComparison.InvariantCultureIgnoreCase) && a.IsDeleted == false && a.IsEnabled == true);
            }
            else if (content.Length > 0 && startIndex < 0)
            {
                barrageSummary = _BarrageSummaryService.Repository.Entities.AsNoTracking().FirstOrDefault(a => a.AppId == agentid && a.Keyword.Equals(null, StringComparison.InvariantCultureIgnoreCase) && a.IsDeleted == false && a.IsEnabled == true);
            }
            else
            {
                return(null);
            }
            if (barrageSummary != null)
            {
                LogManager.GetLogger(this.GetType()).Debug("BarrageSummary.Title={0}", barrageSummary.Title);
                string wxId      = requestMessage.FromUserName;
                var    name      = string.Empty;
                var    weixinPic = string.Empty;
                if (!string.IsNullOrEmpty(wxId))
                {
                    List <GetMemberResult> userlist = WeChatCommonService.lstUser;
                    var emp = userlist.SingleOrDefault(a => a.userid.Equals(wxId, StringComparison.InvariantCultureIgnoreCase));
                    if (emp != null)
                    {
                        name      = emp.name;
                        weixinPic = emp.avatar ?? null;
                    }
                }
                var barrage = new Barrage
                {
                    AppId   = agentid,
                    Keyword = keyword,
                    //FeedBackContent = ConvertEmotion(content),
                    FeedBackContent = content,
                    CreatedDate     = DateTime.Now,
                    SummaryId       = barrageSummary.Id,
                    WeixinId        = requestMessage.FromUserName,
                    Status          = 0,
                    WeixinName      = name,
                    IsDisplay       = false,
                    WeixinPic       = weixinPic
                };
                signal = _BarrageService.Repository.Insert(barrage);
                LogManager.GetLogger(this.GetType()).Debug("插入成功");
                if (signal > 0)
                {
                    LogManager.GetLogger(this.GetType()).Debug("BarrageSummary.ReturnText={0}", barrageSummary.ReturnText);
                    var responseMessage = this.CreateResponseMessage <ResponseMessageText>();
                    responseMessage.Content = barrageSummary.ReturnText;
                    return(responseMessage);
                }
            }
            LogManager.GetLogger(this.GetType()).Debug("not found, BarrageSummary is null");
            return(null);
        }
Example #14
0
 public Task <bool> UpdateAsync(Barrage prod)
 {
     return(_barrageRepository.UpdateAsync(prod));
 }
Example #15
0
 public Task <bool> AddAsync(Barrage prod)
 {
     return(_barrageRepository.AddAsync(prod));
 }
Example #16
0
        internal static Mass Load(string filename)
        {
            var mass = new Mass();

            mass.Init();
            mass.name = filename;

            var fs    = new FileStream(Mass.SETTING_PATH + mass.name + Mass.EXTENSION, FileMode.Open, FileAccess.Read);
            var array = new byte[fs.Length];

            fs.Read(array, 0, (int)fs.Length);
            fs.Close();

            var offset  = 0;
            var version = BitConverter.ToInt32(array, offset);

            offset += 4;

            if (version != VERSION)
            {
                throw new InvalidDataException();
            }

            var hotKeySize = BitConverter.ToInt32(array, offset);

            offset += 4;
            var headerSize = BitConverter.ToInt32(array, offset);

            offset       += 4;
            mass.Sequence = BitConverter.ToInt32(array, offset);
            offset       += 4;
            mass.hotKey   = array.Skip(offset).Take(hotKeySize).ToArray()[0];
            offset       += hotKeySize;
            var headerCount = headerSize / 28;
            var headers     = new List <ArdHeader>();

            for (var i = 0; i < headerCount; i++)
            {
                var ardHeader = new ArdHeader();
                ardHeader.id                   = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.instanceType         = (Act.InstanceType)BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.priority             = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.skillIconSize        = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.disableSkillIconSize = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.pushDataSize         = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                ardHeader.sendDataSize         = BitConverter.ToInt32(array, offset);
                offset                        += 4;
                headers.Add(ardHeader);
            }

            foreach (var ardHeader in headers)
            {
                switch (ardHeader.instanceType)
                {
                case Act.InstanceType.COMMAND:
                    var c = new Command();
                    c.Id               = ardHeader.id;
                    c.Priority         = ardHeader.priority;
                    c.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    c.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    c.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    c.sendList         = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray();
                    offset            += ardHeader.sendDataSize;
                    mass.Add(c);
                    break;

                case Act.InstanceType.BARRAGE:
                    var b = new Barrage();
                    b.Id               = ardHeader.id;
                    b.Priority         = ardHeader.priority;
                    b.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    b.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    b.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    b.send             = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray()[0];
                    offset            += ardHeader.sendDataSize;
                    mass.Add(b);
                    break;

                case Act.InstanceType.TOGGLE:
                    var t = new Toggle();
                    t.Id               = ardHeader.id;
                    t.Priority         = ardHeader.priority;
                    t.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    t.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    t.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    t.send             = array.Skip(offset).Take(ardHeader.sendDataSize).ToArray()[0];
                    offset            += ardHeader.sendDataSize;
                    mass.Add(t);
                    break;

                case Act.InstanceType.MOUSE:
                    var m = new Action.Mouse();
                    m.Id               = ardHeader.id;
                    m.Priority         = ardHeader.priority;
                    m.SkillIcon        = BinaryToBitmap(array.Skip(offset).Take(ardHeader.skillIconSize).ToArray());
                    offset            += ardHeader.skillIconSize;
                    m.DisableSkillIcon = BinaryToBitmap(array.Skip(offset).Take(ardHeader.disableSkillIconSize).ToArray());
                    offset            += ardHeader.disableSkillIconSize;
                    m.Push             = array.Skip(offset).Take(ardHeader.pushDataSize).ToArray();
                    offset            += ardHeader.pushDataSize;
                    var msList    = new List <Mouse.ActionPattern>();
                    var tmpOffset = offset;
                    while (tmpOffset < offset + ardHeader.sendDataSize)
                    {
                        var op = (Mouse.Operation)BitConverter.ToInt32(array, tmpOffset);
                        tmpOffset += 4;
                        var x = BitConverter.ToInt32(array, tmpOffset);
                        tmpOffset += 4;
                        var y = BitConverter.ToInt32(array, tmpOffset);
                        tmpOffset += 4;
                        var sleepBetween = BitConverter.ToInt32(array, tmpOffset);
                        tmpOffset += 4;
                        var sleepAfter = BitConverter.ToInt32(array, tmpOffset);
                        tmpOffset += 4;
                        msList.Add(new Mouse.ActionPattern(op, x, y, sleepBetween, sleepAfter));
                    }
                    offset            = tmpOffset;
                    m.mouseData.Value = msList;
                    mass.Add(m);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            return(mass);
        }
    void Update()
    {
        GameObject[] word_good = GameObject.FindGameObjectsWithTag(Consts.Barrage_Good);
        GameObject[] word_bad  = GameObject.FindGameObjectsWithTag(Consts.Barrage_Word);
        GameObject[] word_arr  = new GameObject[word_good.Length + word_bad.Length];
        for (int i = 0; i < word_arr.Length; i++)
        {
            if (i < word_good.Length)
            {
                word_arr[i] = word_good[i];
            }
            else
            {
                word_arr[i] = word_bad[i - word_good.Length];
            }
        }

        foreach (GameObject word in word_arr)
        {
            Barrage barrage = word.GetComponent <Barrage>();
            // 生成后停留3s再聚集
            int delta_time = GameManager.Instance.timer - barrage.born_time;
            //Debug.Log(delta_time);
            if (delta_time > 3)
            {
                //Debug.Log((word.transform.localPosition - target.transform.localPosition).magnitude);
                if (!barrage.init_flag && (word.transform.localPosition - target.transform.localPosition).magnitude > 0.01f)
                {
                    word.transform.SetParent(GameObject.Find("Canvas").transform);// 重新设置parent,方便后续定位字
                    float step = Consts.BarrageSpeed_Gather * Time.deltaTime;
                    //Debug.Log("word:" + word.transform.localPosition.ToString());
                    //Debug.Log("target:" + target.transform.localPosition.ToString());
                    word.transform.localPosition = new Vector3(Mathf.Lerp(word.transform.localPosition.x, target.transform.localPosition.x, step),
                                                               Mathf.Lerp(word.transform.localPosition.y, target.transform.localPosition.y, step),
                                                               Mathf.Lerp(word.transform.localPosition.z, target.transform.localPosition.z, step));
                }
                else
                {
                    // 设置初始化flag
                    barrage.init_flag = true;

                    // destroy聚集后的字的父亲
                    foreach (GameObject parent in GameObject.FindGameObjectsWithTag(Consts.Barrage_String))
                    {
                        if (parent.transform.childCount == 0)
                        {
                            _barrages_list.Remove(parent);
                            Destroy(parent);
                        }
                    }

                    // 随机散开
                    word.transform.Translate(barrage.dir * Time.deltaTime * Consts.BarrageSpeed_Move, Space.Self);
                }
            }
        }
        // 小于一定数量则继续生成
        if (GameManager.Instance.gameState == GameState.Start && GameManager.Instance.timer >= 4 && word_arr.Length < Consts.WordNum
            /* && GameObject.FindGameObjectsWithTag(Consts.Barrage_String).Length < 3*/)// 可控制同时出现的弹幕数
        {
            //先弄个随机数判断生成的弹幕是好的还是坏的
            int  random_num = Random.Range(1, 10);
            bool good       = random_num > 7 ? true : false;
            if (_count == 0)
            {
                _random_pos_sequence       = Util.GetRandomSequence(10, Consts.BarrageNum + Consts.BarrageNum_g, 5, 1);
                _random_barrage_sequence   = Util.GetRandomSequence(Consts.BarragesAll.Length, Consts.BarrageNum + Consts.BarrageNum_g);
                _random_barrage_sequence_g = Util.GetRandomSequence(Consts.BarragesGoodAll.Length, Consts.BarrageNum + Consts.BarrageNum_g);
                _count = Consts.BarrageNum + Consts.BarrageNum_g;
                _index = 0;// 位置索引清零
            }
            if (good)
            {
                CreateBarrage(Consts.BarragesGoodAll[_random_barrage_sequence_g[--_count]], true);
            }
            else
            {
                CreateBarrage(Consts.BarragesAll[_random_barrage_sequence[--_count]], false);
            }
        }
    }