Example #1
0
 public Basketball(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this._sprite         = new SpriteMap("basketBall", 16, 16);
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(8f, 8f);
     this.collisionOffset = new Vec2(-8f, -8f);
     this.collisionSize   = new Vec2(15f, 15f);
     this.depth           = new Depth(-0.5f);
     this.thickness       = 1f;
     this.weight          = 3f;
     this.flammable       = 0.3f;
     this.collideSounds.Add("basketball");
     this.physicsMaterial  = PhysicsMaterial.Rubber;
     this._bouncy          = 0.8f;
     this.friction         = 0.03f;
     this._impactThreshold = 0.1f;
     this._holdOffset      = new Vec2(6f, 0.0f);
     this.handOffset       = new Vec2(0.0f, -0.0f);
 }
Example #2
0
 public IceBlock(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this._sprite         = new SpriteMap("iceBlock", 16, 16);
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(8f, 8f);
     this.collisionOffset = new Vec2(-8f, -8f);
     this.collisionSize   = new Vec2(16f, 16f);
     this.depth           = new Depth(-0.5f);
     this._editorName     = "Ice Block";
     this.thickness       = 2f;
     this.weight          = 5f;
     this.buoyancy        = 1f;
     this._hitPoints      = 1f;
     this.impactThreshold = -1f;
     this._holdOffset     = new Vec2(2f, 0.0f);
     this.flammable       = 0.0f;
     this.collideSounds.Add("glassHit");
     this.superNonFlammable = true;
 }
Example #3
0
 public ECrate(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this._maxHealth      = 15f;
     this._hitPoints      = 15f;
     this._sprite         = new SpriteMap("eCrate", 16, 16);
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(8f, 8f);
     this.collisionOffset = new Vec2(-8f, -8f);
     this.collisionSize   = new Vec2(16f, 16f);
     this.depth           = new Depth(-0.5f);
     this._editorName     = "E Crate";
     this.thickness       = 2f;
     this.weight          = 5f;
     this.flammable       = 0.3f;
     this._holdOffset     = new Vec2(2f, 0.0f);
     this._light          = new Sprite("eCrateLight");
     this._light.CenterOrigin();
     this.collideSounds.Add("crateHit");
 }
 public WaterCooler(float xpos, float ypos)
   : base(xpos, ypos)
 {
   this._sprite = new SpriteMap("waterCoolerJug", 16, 16);
   this.graphic = (Sprite) this._sprite;
   this.center = new Vec2(8f, 8f);
   this.collisionOffset = new Vec2(-5f, -5f);
   this.collisionSize = new Vec2(10f, 10f);
   this.depth = new Depth(-0.5f);
   this._editorName = "Water Cooler";
   this.thickness = 2f;
   this.weight = 5f;
   this._jugLine = new SpriteMap("waterCoolerJugLine", 16, 16);
   this._jugLine.CenterOrigin();
   this.flammable = 0.3f;
   this._bottom = new Sprite("waterCoolerBottom");
   this._bottom.CenterOrigin();
   this.editorOffset = new Vec2(0.0f, -8f);
   this._fluid = Fluid.Water;
 }
Example #5
0
 public Mine(float xval, float yval)
     : base(xval, yval)
 {
     this.ammo      = 1;
     this._ammoType = (AmmoType) new ATShrapnel();
     this._type     = "gun";
     this._sprite   = new SpriteMap("mine", 18, 16);
     this._sprite.AddAnimation("pickup", 1f, true, new int[1]);
     this._sprite.AddAnimation("idle", 0.05f, true, 1, 2);
     this._sprite.SetAnimation("pickup");
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(9f, 8f);
     this.collisionOffset = new Vec2(-5f, -5f);
     this.collisionSize   = new Vec2(10f, 9f);
     this._mineFlash      = new Sprite("mineFlash");
     this._mineFlash.CenterOrigin();
     this._mineFlash.alpha = 0.0f;
     this.bouncy           = 0.0f;
     this.friction         = 0.2f;
 }
 public Pedestal(float xpos, float ypos, Team team, int place)
     : base(xpos, ypos)
 {
     this._team         = team;
     this._sprite       = new SpriteMap("rockThrow/placePedastals", 38, 45);
     this._sprite.frame = place;
     this.center        = new Vec2((float)(this._sprite.w / 2), (float)this._sprite.h);
     this.graphic       = (Sprite)this._sprite;
     this.depth         = new Depth(0.062f);
     this._scoreCard    = new Sprite("rockThrow/scoreCard");
     this._font         = new BitmapFont("biosFont", 8);
     this._scoreCard.CenterOrigin();
     this._trophy = new Sprite("trophy");
     this._trophy.CenterOrigin();
     if (Network.isServer)
     {
         int num1 = 0;
         foreach (Profile activeProfile in team.activeProfiles)
         {
             float num2 = (float)((team.activeProfiles.Count - 1) * 10);
             Duck  duck = new Duck(xpos - num2 / 2f + (float)(num1 * 10), this.GetYOffset() - 15f, activeProfile);
             duck.depth = new Depth(0.06f);
             Level.Add((Thing)duck);
             if (place == 0)
             {
                 Trophy trophy = new Trophy(duck.x, duck.y);
                 Level.Add((Thing)trophy);
                 if (!Network.isActive)
                 {
                     duck.Fondle((Thing)trophy);
                     duck.GiveHoldable((Holdable)trophy);
                 }
             }
             ++num1;
         }
     }
     Level.Add((Thing) new Platform(xpos - 17f, this.GetYOffset(), 34f, 16f));
     Level.Add((Thing) new Block(-6f, this.GetYOffset() - 100f, 6f, 200f));
     Level.Add((Thing) new Block(320f, this.GetYOffset() - 100f, 6f, 200f));
     Level.Add((Thing) new Block(-20f, 155f, 600f, 100f));
 }
Example #7
0
 public ContextCheckBox(
     string text,
     IContextListener owner,
     FieldBinding field,
     System.Type myType,
     string valTooltip)
     : base(owner)
 {
     this.itemSize.x = 150f;
     this.itemSize.y = 16f;
     this._text      = text;
     this._field     = field;
     this._checkBox  = new SpriteMap("Editor/checkBox", 16, 16);
     this.depth      = new Depth(0.8f);
     this._myType    = myType;
     if (field == null)
     {
         this._field = new FieldBinding((object)this, nameof(isChecked));
     }
     this.tooltip = valTooltip;
 }
        public void Open(
            RenderTarget2D preview,
            string filePath,
            ulong workshopID   = 0,
            LevelType levType  = LevelType.Deathmatch,
            LevelSize levSize  = LevelSize.Ginormous,
            string[] extraTags = null)
        {
            this._currentItem = (WorkshopItem)null;
            Texture2D texture2D = new Texture2D(DuckGame.Graphics.device, preview.width, preview.height);

            Color[] data = new Color[preview.width * preview.height];
            preview.GetData <Color>(data);
            texture2D.SetData <Color>(data);
            this._levelType        = levType;
            this._levelSize        = levSize;
            this._addDeathmatchTag = false;
            this._addMachineTag    = false;
            Editor.lockInput       = (ContextMenu)this;
            SFX.Play("openClick", 0.4f);
            this.opened         = true;
            this._previewTarget = new Sprite((Tex2D)texture2D);
            this._filePath      = filePath;
            this._workshopID    = workshopID;
            if (this._workshopID != 0UL)
            {
                this._currentItem = new WorkshopItem(workshopID);
            }
            if (Editor.workshopName == null || Editor.workshopName == "")
            {
                Editor.workshopName = Path.GetFileNameWithoutExtension(filePath);
            }
            this._nameBox.text        = Editor.workshopName;
            this._descriptionBox.text = Editor.workshopDescription;
            this._workshopTag         = new SpriteMap("workshopTag", 4, 8);
            this._workshopTagMiddle   = new Sprite("workshopTagMiddle");
            this._tagPlus             = new Sprite("tagPlus");
            this._extraTags           = extraTags;
            this._arcadeTestIndex     = 0;
        }
        public RainbowDuelingPistol(float xval, float yval) : base(xval, yval)
        {
            _editorName                = "Rainbow Dueling Pistol";
            this.ammo                  = 25;
            this._ammoType             = new AT9mm();
            this._ammoType.range       = 300f;
            this._ammoType.accuracy    = 0.7f;
            this._ammoType.penetration = 1f;
            this._type                 = "gun";
            sprite  = new SpriteMap(GetPath("weapons/RainbowDuelingPistol"), 12, 9);
            graphic = sprite;
            sprite.AddAnimation("animation", 0.9f, true, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69);


            this.center          = new Vec2(8f, 4.5f);
            this.collisionOffset = new Vec2(-6f, -4f);
            this.collisionSize   = new Vec2(12f, 8f);
            this._barrelOffsetTL = new Vec2(15f, 3f);

            this._fireSound = GetPath("/sfx/yee");
            this._kickForce = 3f;
        }
 public DeathCrate(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this._maxHealth      = 15f;
     this._hitPoints      = 15f;
     this._sprite         = new SpriteMap("deathcrate", 16, 19);
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(8f, 11f);
     this.collisionOffset = new Vec2(-8f, -11f);
     this.collisionSize   = new Vec2(16f, 18f);
     this.depth           = new Depth(-0.5f);
     this._editorName     = "Death Crate";
     this.thickness       = 2f;
     this.weight          = 5f;
     this._sprite.AddAnimation("idle", 1f, true, new int[1]);
     this._sprite.AddAnimation("activate", 0.35f, false, 1, 2, 3, 4, 4, 5, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 5, 7, 7, 7, 7, 7, 7, 7, 7, 5, 8, 8, 8, 8, 8, 8, 8, 8, 5, 9, 9, 5);
     this._sprite.SetAnimation("idle");
     this._holdOffset = new Vec2(2f, 0.0f);
     this.flammable   = 0.0f;
     this.collideSounds.Add("crateHit");
     this.settingIndex = (byte)Rando.Int(DeathCrate._settings.Count - 1);
 }
Example #11
0
 public CombatShotgun(float xval, float yval)
     : base(xval, yval)
 {
     this.ammo                 = this._ammoMax;
     this._ammoType            = (AmmoType) new ATShotgun();
     this._ammoType.range      = 140f;
     this._type                = "gun";
     this.graphic              = new Sprite("combatShotgun");
     this.center               = new Vec2(16f, 16f);
     this.collisionOffset      = new Vec2(-12f, -3f);
     this.collisionSize        = new Vec2(24f, 9f);
     this._barrelOffsetTL      = new Vec2(29f, 15f);
     this._fireSound           = "shotgunFire2";
     this._kickForce           = 5f;
     this._numBulletsPerFire   = 7;
     this._manualLoad          = true;
     this._loaderSprite        = new SpriteMap("combatShotgunLoader", 16, 16);
     this._loaderSprite.center = new Vec2(8f, 8f);
     this._ammoSprite          = new SpriteMap("combatShotgunAmmo", 16, 16);
     this._ammoSprite.center   = new Vec2(8f, 8f);
     this.handOffset           = new Vec2(0.0f, 1f);
     this._holdOffset          = new Vec2(4f, 0.0f);
 }
Example #12
0
 public override void Initialize()
 {
     this._profile = Profiles.EnvironmentProfile;
     this.InitProfile();
     this._sprite   = new SpriteMap("woodDuck", 32, 32);
     this._base     = new Sprite("popupPad");
     this._woodWing = new Sprite("woodWing");
     this.graphic   = (Sprite)this._sprite;
     if (!(Level.current is Editor))
     {
         if (this._stance != TargetStance.Fly)
         {
             this.scale = new Vec2(1f, 0.0f);
         }
         else
         {
             this.scale = new Vec2(0.0f, 1f);
         }
         ChallengeLevel.allTargetsShot = false;
         this._autoFireWait            = this.autofire.value;
     }
     this.UpdateCollision();
 }
 public Chaingun(float xval, float yval)
     : base(xval, yval)
 {
     this.ammo               = 100;
     this._ammoType          = (AmmoType) new AT9mm();
     this._ammoType.range    = 170f;
     this._ammoType.accuracy = 0.5f;
     this._type              = "gun";
     this._sprite            = new SpriteMap("chaingun", 42, 28);
     this.graphic            = (Sprite)this._sprite;
     this.center             = new Vec2(14f, 14f);
     this.collisionOffset    = new Vec2(-8f, -3f);
     this.collisionSize      = new Vec2(24f, 10f);
     this._tip               = new SpriteMap("chaingunTip", 42, 28);
     this._barrelOffsetTL    = new Vec2(39f, 14f);
     this._fireSound         = "pistolFire";
     this._fullAuto          = true;
     this._fireWait          = 0.7f;
     this._kickForce         = 1f;
     this.weight             = 8f;
     this._spinUp            = SFX.Get("chaingunSpinUp");
     this._spinDown          = SFX.Get("chaingunSpinDown");
     this._holdOffset        = new Vec2(0.0f, 2f);
 }
Example #14
0
 public override void PostDrawLayer(Layer layer)
 {
     if (NetworkDebugger._instances.Count == 0)
     {
         return;
     }
     if (layer == Layer.Console)
     {
         if (NetworkDebugger._interfaces[0].pin || (double)Mouse.xConsole < (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole < (double)Layer.Console.height / 2.0)
         {
             DevConsoleCore core = DevConsole.core;
             DevConsole.core = NetworkDebugger._instances[0].consoleCore;
             NetworkDebugger._interfaces[0].Draw(NetworkDebugger._instances[0].network);
             DevConsole.core = core;
         }
         else
         {
             NetworkDebugger._interfaces[0].visible = false;
         }
         if (NetworkDebugger._interfaces[1].pin || (double)Mouse.xConsole > (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole < (double)Layer.Console.height / 2.0)
         {
             if (NetworkDebugger._instances.Count > 1)
             {
                 DevConsoleCore core = DevConsole.core;
                 DevConsole.core = NetworkDebugger._instances[1].consoleCore;
                 NetworkDebugger._interfaces[1].Draw(NetworkDebugger._instances[1].network);
                 DevConsole.core = core;
             }
         }
         else
         {
             NetworkDebugger._interfaces[1].visible = false;
         }
         if (NetworkDebugger._interfaces[2].pin || (double)Mouse.xConsole <(double)Layer.Console.width / 2.0 && (double)Mouse.yConsole> (double) Layer.Console.height / 2.0)
         {
             if (NetworkDebugger._instances.Count > 2)
             {
                 DevConsoleCore core = DevConsole.core;
                 DevConsole.core = NetworkDebugger._instances[2].consoleCore;
                 NetworkDebugger._interfaces[2].Draw(NetworkDebugger._instances[2].network);
                 DevConsole.core = core;
             }
         }
         else
         {
             NetworkDebugger._interfaces[2].visible = false;
         }
         if (NetworkDebugger._interfaces[3].pin || (double)Mouse.xConsole > (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole > (double)Layer.Console.height / 2.0)
         {
             if (NetworkDebugger._instances.Count > 3)
             {
                 DevConsoleCore core = DevConsole.core;
                 DevConsole.core = NetworkDebugger._instances[3].consoleCore;
                 NetworkDebugger._interfaces[3].Draw(NetworkDebugger._instances[3].network);
                 DevConsole.core = core;
             }
         }
         else
         {
             NetworkDebugger._interfaces[3].visible = false;
         }
         if (this._connectionArrow == null)
         {
             this._connectionArrow = new SpriteMap("connectionArrow", 56, 13);
             this._connectionArrow.CenterOrigin();
             this._connectionX = new Sprite("connectionX");
             this._connectionX.CenterOrigin();
         }
         for (int i = 0; i < 4; ++i)
         {
             if (NetworkDebugger._instances.Count > i && NetworkDebugger._instances[i].active)
             {
                 for (int j = 0; j < 4; ++j)
                 {
                     if (i != j && NetworkDebugger._instances.Count > j && NetworkDebugger._instances[j].active)
                     {
                         NetworkConnection networkConnection1 = NetworkDebugger._instances[i].network.core.connections.FirstOrDefault <NetworkConnection>((Func <NetworkConnection, bool>)(x => x.identifier == NetworkDebugger.GetID(j)));
                         NetworkConnection networkConnection2 = NetworkDebugger._instances[j].network.core.connections.FirstOrDefault <NetworkConnection>((Func <NetworkConnection, bool>)(x => x.identifier == NetworkDebugger.GetID(i)));
                         Vec2  vec2_1 = NetworkDebugger._interfaces[i].position + new Vec2((float)(DuckGame.Graphics.width / 4 - 10), (float)(DuckGame.Graphics.height / 4 - 10));
                         Vec2  vec2_2 = NetworkDebugger._interfaces[j].position + new Vec2((float)(DuckGame.Graphics.width / 4 - 10), (float)(DuckGame.Graphics.height / 4 - 10));
                         Vec2  p2     = vec2_2 - vec2_1;
                         Vec2  vec2_3 = p2.normalized.Rotate(Maths.DegToRad(90f), Vec2.Zero);
                         float num1   = -Maths.PointDirection(Vec2.Zero, p2);
                         float num2   = 0.0f;
                         if (networkConnection1 != null)
                         {
                             float num3 = 0.0f;
                             float num4 = 0.0f;
                             if (networkConnection2 != null)
                             {
                                 num3 = NetworkDebugger.GetReceived(networkConnection1.identifier, networkConnection2.identifier);
                                 num4 = NetworkDebugger.GetSent(networkConnection1.identifier, networkConnection2.identifier);
                                 num2 = 6f;
                             }
                             this._connectionArrow.frame        = networkConnection1.status != ConnectionStatus.Connected ? 0 : 3;
                             this._connectionArrow.angleDegrees = num1;
                             this._connectionArrow.alpha        = 1f;
                             this._connectionArrow.depth        = new Depth(0.92f);
                             Vec2 vec2_4 = (vec2_1 + vec2_2) / 2f + vec2_3 * num2;
                             DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y);
                             if (networkConnection1.status != ConnectionStatus.Disconnecting)
                             {
                                 this._connectionX.depth = new Depth(0.98f);
                                 Vec2 vec2_5 = vec2_4 - p2.normalized * 22f;
                                 if ((double)(Mouse.positionConsole - vec2_5).length < 8.0)
                                 {
                                     this._connectionX.alpha = 1f;
                                     if (this.lefpres)
                                     {
                                         networkConnection1.Disconnect();
                                         SFX.Play("quack");
                                     }
                                 }
                                 else
                                 {
                                     this._connectionX.alpha = 0.4f;
                                 }
                                 DuckGame.Graphics.Draw(this._connectionX, vec2_5.x, vec2_5.y);
                             }
                             if ((double)num4 > 0.0)
                             {
                                 ++this._connectionArrow.frame;
                                 this._connectionArrow.alpha = num4;
                                 this._connectionArrow.depth = new Depth(0.95f);
                                 DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y);
                                 --this._connectionArrow.frame;
                             }
                             if ((double)num3 > 0.0)
                             {
                                 this._connectionArrow.frame += 2;
                                 this._connectionArrow.alpha  = num3;
                                 this._connectionArrow.depth  = new Depth(0.95f);
                                 DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y);
                                 this._connectionArrow.frame -= 2;
                             }
                         }
                     }
                 }
             }
         }
     }
     base.PostDrawLayer(layer);
 }
        public override void Update()
        {
            ChallengeLevel._timer.Update();
            if (this._fading)
            {
                DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, 0.0f, 0.05f);
                if ((double)DuckGame.Graphics.fade >= 0.00999999977648258)
                {
                    return;
                }
                if (this._validityTest)
                {
                    ArcadeTestDialogue.success = this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer;
                    Level.current          = (Level)ArcadeTestDialogue.currentEditor;
                    DuckGame.Graphics.fade = 1f;
                }
                else
                {
                    if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0)
                    {
                        Level.current = (Level)(this.things[typeof(EditorTestLevel)].First <Thing>() as EditorTestLevel).editor;
                        Music.Stop();
                    }
                    else
                    {
                        Level.current = Arcade.currentArcade == null ? (Level)ArcadeLevel.currentArcade : (Level)Arcade.currentArcade;
                    }
                    this._fading = false;
                }
            }
            else
            {
                if ((double)this._restartMessageWait > 0.0)
                {
                    this._restartMessageWait -= 0.008f;
                }
                else
                {
                    HUD.CloseCorner(HUDCorner.TopLeft);
                }
                if (this._doRestart)
                {
                    ChallengeLevel.running = false;
                    this._waitForRestart  -= 0.04f;
                    if ((double)this._waitForRestart <= 0.0)
                    {
                        this._restarting = true;
                    }
                }
                this._waitFade -= 0.04f;
                if (!this._didFade && (double)this._waitFade <= 0.0 && (double)DuckGame.Graphics.fade < 1.0)
                {
                    DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, 1f, 0.04f);
                }
                else if (this._restarting)
                {
                    ChallengeLevel.running         = false;
                    this.transitionSpeedMultiplier = 2f;
                    EditorTestLevel editorTestLevel = (EditorTestLevel)null;
                    if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0)
                    {
                        editorTestLevel = this.things[typeof(EditorTestLevel)].First <Thing>() as EditorTestLevel;
                    }
                    Level.current = !(this._level != "") ? (Level) new ChallengeLevel(this._levelData, this._validityTest) : (Level) new ChallengeLevel(this._level);
                    Level.current.transitionSpeedMultiplier    = 2f;
                    ((ChallengeLevel)Level.current)._waitSpawn = 0.0f;
                    if (editorTestLevel == null)
                    {
                        return;
                    }
                    Level.current.AddThing((Thing)editorTestLevel);
                }
                else
                {
                    if ((double)this._waitFade > 0.0)
                    {
                        return;
                    }
                    this._didFade = true;
                    if (this._finished)
                    {
                        ChallengeLevel.running = false;
                        this.PauseLogic();
                        if ((double)this._finishWait > 0.0)
                        {
                            this._finishWait -= 0.01f;
                        }
                        else
                        {
                            if (!this._playedEndMusic)
                            {
                                this._playedEndMusic          = true;
                                Level.current.simulatePhysics = false;
                                ArcadeFrame arcadeFrame = (ArcadeFrame)null;
                                if (this._win)
                                {
                                    if (ArcadeLevel.currentArcade != null)
                                    {
                                        arcadeFrame = ArcadeLevel.currentArcade.GetFrame();
                                        if (arcadeFrame != null)
                                        {
                                            Vec2  renderTargetSize = arcadeFrame.GetRenderTargetSize();
                                            float renderTargetZoom = arcadeFrame.GetRenderTargetZoom();
                                            if (this._captureTarget == null)
                                            {
                                                this._captureTarget = new RenderTarget2D((int)((double)renderTargetSize.x * 6.0), (int)((double)renderTargetSize.y * 6.0));
                                            }
                                            int    num    = DuckGame.Graphics.width / 320;
                                            Camera camera = new Camera(0.0f, 0.0f, (float)this._captureTarget.width * renderTargetZoom, (float)this._captureTarget.height * renderTargetZoom);
                                            if (ChallengeLevel._duck != null)
                                            {
                                                Layer.HUD.visible = false;
                                                MonoMain.RenderGame(MonoMain.screenCapture);
                                                Layer.HUD.visible = true;
                                                Matrix result;
                                                Matrix.CreateOrthographicOffCenter(0.0f, (float)MonoMain.screenCapture.width, (float)MonoMain.screenCapture.height, 0.0f, 0.0f, -1f, out result);
                                                result.M41 += -0.5f * result.M11;
                                                result.M42 += -0.5f * result.M22;
                                                Matrix matrix = Level.current.camera.getMatrix();
                                                Vec3   vec3   = (Vec3)DuckGame.Graphics.viewport.Project((Vector3) new Vec3(ChallengeLevel._duck.cameraPosition.x, ChallengeLevel._duck.cameraPosition.y, 0.0f), (Microsoft.Xna.Framework.Matrix)result, (Microsoft.Xna.Framework.Matrix)matrix, (Microsoft.Xna.Framework.Matrix)Matrix.Identity);
                                                DuckGame.Graphics.SetRenderTarget(this._captureTarget);
                                                camera.center = new Vec2(vec3.x, vec3.y);
                                                if ((double)camera.bottom > (double)MonoMain.screenCapture.height)
                                                {
                                                    camera.centerY = (float)MonoMain.screenCapture.height - camera.height / 2f;
                                                }
                                                if ((double)camera.top < 0.0)
                                                {
                                                    camera.centerY = camera.height / 2f;
                                                }
                                                if ((double)camera.right > (double)MonoMain.screenCapture.width)
                                                {
                                                    camera.centerX = (float)MonoMain.screenCapture.width - camera.width / 2f;
                                                }
                                                if ((double)camera.left < 0.0)
                                                {
                                                    camera.centerX = camera.width / 2f;
                                                }
                                                DuckGame.Graphics.Clear(Color.Black);
                                                DuckGame.Graphics.screen.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.DepthRead, RasterizerState.CullNone, (MTEffect)null, camera.getMatrix());
                                                DuckGame.Graphics.Draw((Tex2D)MonoMain.screenCapture, 0.0f, 0.0f);
                                                DuckGame.Graphics.screen.End();
                                                DuckGame.Graphics.SetRenderTarget((RenderTarget2D)null);
                                            }
                                        }
                                    }
                                    if (this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer)
                                    {
                                        SFX.Play("developerWin");
                                    }
                                    else
                                    {
                                        SFX.Play("challengeWin");
                                    }
                                    this._showEndTextWait = 1f;
                                }
                                else
                                {
                                    SFX.Play("challengeLose");
                                    this._showEndTextWait = 1f;
                                }
                                if (this._challenge.wonTrophies.Count > 0)
                                {
                                    this._trophyGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
                                    this._trophyMenu  = new UIMenu("@LWING@" + this._challenge.challenge.name + "@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 210f, conString: "@DPAD@MOVE  @SELECT@SELECT");
                                    UIDivider uiDivider1 = new UIDivider(false, 0.0f, 6f);
                                    UIDivider uiDivider2 = new UIDivider(true, 0.0f);
                                    SpriteMap spriteMap  = new SpriteMap("challengeTrophy", 70, 65);
                                    if (this._challenge.wonTrophies.Count > 0)
                                    {
                                        if (this._challenge.wonTrophies[0].type == TrophyType.Bronze)
                                        {
                                            spriteMap.frame = 1;
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("BRONZE", Colors.Bronze, UIAlign.Top), true);
                                        }
                                        else if (this._challenge.wonTrophies[0].type == TrophyType.Silver)
                                        {
                                            spriteMap.frame = 2;
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("SILVER", Colors.Silver, UIAlign.Top), true);
                                        }
                                        else if (this._challenge.wonTrophies[0].type == TrophyType.Gold)
                                        {
                                            spriteMap.frame = 3;
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("GOLD", Colors.Gold, UIAlign.Top), true);
                                        }
                                        else if (this._challenge.wonTrophies[0].type == TrophyType.Platinum)
                                        {
                                            spriteMap.frame = 4;
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("PLATINUM", Colors.Platinum, UIAlign.Top), true);
                                        }
                                        else if (this._challenge.wonTrophies[0].type == TrophyType.Developer)
                                        {
                                            spriteMap.frame = 5;
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("UR THE BEST", Colors.Developer, UIAlign.Top), true);
                                        }
                                    }
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    bool flag = false;
                                    ChallengeSaveData saveData = Challenges.GetSaveData(this.id, ChallengeLevel._duck.profile);
                                    int bestTime = saveData.bestTime;
                                    if (saveData.bestTime == 0 || (int)(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0) < saveData.bestTime)
                                    {
                                        saveData.bestTime = (int)(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0);
                                    }
                                    if (this._challenge.wonTrophies[0].type > saveData.trophy)
                                    {
                                        saveData.trophy = this._challenge.wonTrophies[0].type;
                                        if (saveData.trophy > TrophyType.Silver)
                                        {
                                            flag = true;
                                        }
                                    }
                                    int targets1 = saveData.targets;
                                    if (ChallengeLevel.targetsShot > saveData.targets)
                                    {
                                        saveData.targets = ChallengeLevel.targetsShot;
                                    }
                                    int targets2 = saveData.targets;
                                    if (ChallengeLevel.goodiesGot > saveData.goodies)
                                    {
                                        saveData.goodies = ChallengeLevel.goodiesGot;
                                    }
                                    if (this._challenge.challenge.hasTimeRequirements)
                                    {
                                        uiDivider2.leftSection.Add((UIComponent) new UIText("TIME", Color.White, UIAlign.Left), true);
                                        uiDivider2.leftSection.Add((UIComponent) new UIText(MonoMain.TimeString(ChallengeLevel.timer.elapsed, small: true), Color.Lime, UIAlign.Right), true);
                                        uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                        if (targets1 != 0)
                                        {
                                            if ((double)bestTime < ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0)
                                            {
                                                TimeSpan span = TimeSpan.FromMilliseconds(ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0 - (double)bestTime);
                                                uiDivider2.leftSection.Add((UIComponent) new UIText("DIFFERENCE", Color.White, UIAlign.Left), true);
                                                uiDivider2.leftSection.Add((UIComponent) new UIText("+" + MonoMain.TimeString(span, small: true), Color.Red, UIAlign.Right), true);
                                            }
                                            else
                                            {
                                                TimeSpan span = TimeSpan.FromMilliseconds((double)bestTime - ChallengeLevel.timer.elapsed.TotalSeconds * 1000.0);
                                                uiDivider2.leftSection.Add((UIComponent) new UIText("DIFFERENCE", Color.White, UIAlign.Left), true);
                                                uiDivider2.leftSection.Add((UIComponent) new UIText("-" + MonoMain.TimeString(span, small: true), Color.Lime, UIAlign.Right), true);
                                                flag = true;
                                            }
                                        }
                                        else
                                        {
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                        }
                                    }
                                    if (saveData.trophy < TrophyType.Gold)
                                    {
                                        flag = false;
                                    }
                                    if (this._challenge.challenge.countTargets)
                                    {
                                        if (this._challenge.challenge.prefix != "" && this._challenge.challenge.prefix != null)
                                        {
                                            uiDivider2.leftSection.Add((UIComponent) new UIText(this._challenge.challenge.prefix, Color.White, UIAlign.Left), true);
                                        }
                                        else
                                        {
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("TARGETS", Color.White, UIAlign.Left), true);
                                        }
                                        string textVal = Convert.ToString(ChallengeLevel.targetsShot);
                                        Color  c       = Color.Lime;
                                        if (targets1 != 0)
                                        {
                                            if (targets1 < ChallengeLevel.targetsShot)
                                            {
                                                int num = ChallengeLevel.targetsShot - targets1;
                                                c       = Color.Lime;
                                                textVal = textVal + " (+" + Convert.ToString(num) + ")";
                                                flag    = true;
                                            }
                                            else if (targets1 > ChallengeLevel.targetsShot)
                                            {
                                                int num = targets1 - ChallengeLevel.targetsShot;
                                                c       = Color.Red;
                                                textVal = textVal + " (-" + Convert.ToString(num) + ")";
                                            }
                                            else
                                            {
                                                c = Color.White;
                                            }
                                        }
                                        uiDivider2.leftSection.Add((UIComponent) new UIText(textVal, c, UIAlign.Right), true);
                                        uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    }
                                    if (this._challenge.challenge.countGoodies)
                                    {
                                        if (this._challenge.challenge.prefix != "" && this._challenge.challenge.prefix != null)
                                        {
                                            uiDivider2.leftSection.Add((UIComponent) new UIText(this._challenge.challenge.prefix, Color.White, UIAlign.Left), true);
                                        }
                                        else
                                        {
                                            uiDivider2.leftSection.Add((UIComponent) new UIText("NUMBER", Color.White, UIAlign.Left), true);
                                        }
                                        string textVal = Convert.ToString(ChallengeLevel.goodiesGot);
                                        Color  c       = Color.Lime;
                                        if (targets2 != 0)
                                        {
                                            if (targets2 < ChallengeLevel.goodiesGot)
                                            {
                                                int num = ChallengeLevel.goodiesGot - targets2;
                                                c       = Color.Lime;
                                                textVal = textVal + " (+" + Convert.ToString(num) + ")";
                                                flag    = true;
                                            }
                                            else if (targets2 > ChallengeLevel.goodiesGot)
                                            {
                                                int num = targets2 - ChallengeLevel.goodiesGot;
                                                c       = Color.Red;
                                                textVal = textVal + " (-" + Convert.ToString(num) + ")";
                                            }
                                            else
                                            {
                                                c = Color.White;
                                            }
                                        }
                                        uiDivider2.leftSection.Add((UIComponent) new UIText(textVal, c, UIAlign.Right), true);
                                        uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    }
                                    uiDivider2.rightSection.Add((UIComponent) new UIImage((Sprite)spriteMap, UIAlign.Right), true);
                                    uiDivider1.leftSection.Add((UIComponent)uiDivider2, true);
                                    uiDivider1.rightSection.vertical     = false;
                                    uiDivider1.rightSection.borderSize.y = 2f;
                                    if (this._validityTest)
                                    {
                                        if (this._challenge.wonTrophies.Count > 0 && this._challenge.wonTrophies[0].type == TrophyType.Developer)
                                        {
                                            uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE   ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true);
                                        }
                                        else
                                        {
                                            uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true);
                                        }
                                    }
                                    else
                                    {
                                        uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE   ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true);
                                        uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true);
                                    }
                                    this._trophyMenu.Add((UIComponent)uiDivider1, true);
                                    this._trophyMenu.Close();
                                    this._trophyGroup.Add((UIComponent)this._trophyMenu, false);
                                    this._trophyGroup.Close();
                                    Level.Add((Thing)this._trophyGroup);
                                    if (arcadeFrame != null && flag && saveData != null)
                                    {
                                        saveData.frameID     = arcadeFrame._identifier;
                                        saveData.frameImage  = Editor.TextureToString((Texture2D)(Tex2D)this._captureTarget);
                                        arcadeFrame.saveData = saveData;
                                    }
                                    Challenges.Save(this.id);
                                    Profiles.Save(ChallengeLevel._duck.profile);
                                }
                                else
                                {
                                    this._trophyGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
                                    this._trophyMenu  = new UIMenu("@LWING@" + this._challenge.challenge.name + "@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 210f, conString: "@DPAD@MOVE  @SELECT@SELECT");
                                    UIDivider uiDivider1 = new UIDivider(false, 0.0f, 6f);
                                    UIDivider uiDivider2 = new UIDivider(true, 0.0f);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("FAILED", Color.Red, UIAlign.Top), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.Lime, UIAlign.Right), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    uiDivider2.leftSection.Add((UIComponent) new UIText("               ", Color.White, UIAlign.Left), true);
                                    uiDivider2.rightSection.Add((UIComponent) new UIImage((Sprite) new SpriteMap("challengeTrophy", 70, 65)
                                    {
                                        frame = 0
                                    }, UIAlign.Right), true);
                                    uiDivider1.leftSection.Add((UIComponent)uiDivider2, true);
                                    uiDivider1.rightSection.vertical     = false;
                                    uiDivider1.rightSection.borderSize.y = 2f;
                                    uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("CONTINUE   ", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._quit), UIAlign.Left), true);
                                    uiDivider1.rightSection.Add((UIComponent) new UIMenuItem("RETRY", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._trophyGroup, this._restart), UIAlign.Left), true);
                                    this._trophyMenu.Add((UIComponent)uiDivider1, true);
                                    this._trophyMenu.Close();
                                    this._trophyGroup.Add((UIComponent)this._trophyMenu, false);
                                    this._trophyGroup.Add((UIComponent)Options.optionsMenu, false);
                                    Options.openOnClose = this._trophyMenu;
                                    this._trophyGroup.Close();
                                    Level.Add((Thing)this._trophyGroup);
                                }
                            }
                            if ((double)this._showEndTextWait > 0.0)
                            {
                                this._showEndTextWait -= 0.01f;
                            }
                            else
                            {
                                this._fontFade = 1f;
                                if ((double)this._showResultsWait > 0.0)
                                {
                                    this._showResultsWait -= 0.01f;
                                }
                                else if (!this._showedEndMenu)
                                {
                                    this._trophyGroup.Open();
                                    this._trophyMenu.Open();
                                    MonoMain.pauseMenu = this._trophyGroup;
                                    SFX.Play("pause", 0.6f, -0.2f);
                                    this._showedEndMenu = true;
                                }
                                if (this._restart.value)
                                {
                                    this._restarting = true;
                                    SFX.Play("resume", 0.6f);
                                }
                                else
                                {
                                    if (!this._quit.value)
                                    {
                                        return;
                                    }
                                    this._fading = true;
                                    SFX.Play("resume", 0.6f);
                                }
                            }
                        }
                    }
                    else
                    {
                        this._waitSpawn -= 0.06f;
                        if ((double)this._waitSpawn > 0.0)
                        {
                            return;
                        }
                        if (this._pendingSpawns != null && this._pendingSpawns.Count > 0)
                        {
                            this._waitSpawn = 0.5f;
                            Duck pendingSpawn = this._pendingSpawns[0];
                            this.AddThing((Thing)pendingSpawn);
                            this._pendingSpawns.RemoveAt(0);
                            Vec3 color = pendingSpawn.profile.persona.color;
                            Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, 0.0f, new Color((int)color.x, (int)color.z, (int)color.z), 32f));
                            Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, -4f, new Color((int)color.x, (int)color.y, (int)color.z), 4f));
                            Level.Add((Thing) new SpawnLine(pendingSpawn.x, pendingSpawn.y, 0, 4f, new Color((int)color.x, (int)color.y, (int)color.z), 4f));
                            SFX.Play("pullPin", 0.7f);
                            ChallengeLevel._duck          = pendingSpawn;
                            this._challenge               = this.things[typeof(ChallengeMode)].First <Thing>() as ChallengeMode;
                            ChallengeLevel.random         = this._challenge.random.value;
                            this._challenge.duck          = pendingSpawn;
                            ChallengeLevel._timer.maxTime = TimeSpan.FromSeconds((double)this._challenge.challenge.trophies[0].timeRequirement);
                            HUD.AddCornerTimer(HUDCorner.BottomRight, "", (Timer)ChallengeLevel._timer);
                            if (this._challenge.challenge.countTargets)
                            {
                                int targets = this._challenge.challenge.trophies[0].targets;
                                HUD.AddCornerCounter(HUDCorner.BottomLeft, "@RETICULE@", new FieldBinding((object)this, "targetsShot"), targets > 0 ? targets : 0);
                            }
                            if (this._challenge.challenge.countGoodies)
                            {
                                MultiMap <System.Type, ISequenceItem> multiMap = new MultiMap <System.Type, ISequenceItem>();
                                foreach (ISequenceItem element in Level.current.things[typeof(ISequenceItem)])
                                {
                                    System.Type  type     = element.GetType();
                                    SequenceItem sequence = (element as Thing).sequence;
                                    if (sequence.isValid && sequence.type == SequenceItemType.Goody)
                                    {
                                        multiMap.Add(type, element);
                                    }
                                }
                                System.Type key = (System.Type)null;
                                int         num = 0;
                                foreach (KeyValuePair <System.Type, List <ISequenceItem> > keyValuePair in (MultiMap <System.Type, ISequenceItem, List <ISequenceItem> >)multiMap)
                                {
                                    if (keyValuePair.Value.Count > num)
                                    {
                                        key = keyValuePair.Key;
                                        num = keyValuePair.Value.Count;
                                    }
                                }
                                if (key != (System.Type)null)
                                {
                                    ISequenceItem sequenceItem = multiMap[key][0];
                                    string        text         = "@STARGOODY@";
                                    switch (sequenceItem)
                                    {
                                    case LapGoody _:
                                    case InvisiGoody _:
                                        text = "@LAPGOODY@";
                                        break;

                                    case SuitcaseGoody _:
                                        text = "@SUITCASEGOODY@";
                                        break;

                                    case Window _:
                                    case YellowBarrel _:
                                    case Door _:
                                        text = "@RETICULE@";
                                        break;
                                    }
                                    int goodies = this._challenge.challenge.trophies[0].goodies;
                                    HUD.AddCornerCounter(HUDCorner.BottomLeft, text, new FieldBinding((object)this, "goodiesGot"), goodies > 0 ? goodies : 0);
                                }
                            }
                            if (this._firstStart)
                            {
                                if (ChallengeLevel.random)
                                {
                                    IEnumerable <Thing> thing = this.things[typeof(ISequenceItem)];
                                    if (thing.Count <Thing>() > 0)
                                    {
                                        thing.ElementAt <Thing>(Rando.Int(thing.Count <Thing>() - 1)).sequence.BeginRandomSequence();
                                    }
                                }
                                else
                                {
                                    foreach (TargetDuck targetDuck in this.things[typeof(TargetDuck)])
                                    {
                                        if (targetDuck.sequence.order == 0)
                                        {
                                            targetDuck.sequence.Activate();
                                        }
                                    }
                                }
                                this._firstStart = false;
                            }
                            if (!Music.stopped)
                            {
                                return;
                            }
                            if ((string)this._challenge.music == "")
                            {
                                Music.Load("Challenging");
                            }
                            else if ((string)this._challenge.music == "donutmystery")
                            {
                                Music.Load("spacemystery");
                            }
                            else
                            {
                                Music.Load(Music.FindSong((string)this._challenge.music));
                            }
                        }
                        else if (!this._started)
                        {
                            this._waitAfterSpawn -= 0.06f;
                            if ((double)this._waitAfterSpawn > 0.0)
                            {
                                return;
                            }
                            ++this._waitAfterSpawnDings;
                            if (this._waitAfterSpawnDings > 2)
                            {
                                this._started          = true;
                                this.simulatePhysics   = true;
                                ChallengeLevel.running = true;
                                SFX.Play("ding");
                                ChallengeLevel._timer.Start();
                                if (Music.stopped)
                                {
                                    Music.PlayLoaded();
                                }
                            }
                            else
                            {
                                SFX.Play("preStartDing");
                            }
                            this._waitSpawn = 1.1f;
                        }
                        else
                        {
                            this._fontFade -= 0.1f;
                            if ((double)this._fontFade < 0.0)
                            {
                                this._fontFade = 0.0f;
                            }
                            this.PauseLogic();
                        }
                    }
                }
            }
        }
Example #16
0
        public void Feed(FluidData dat)
        {
            if (this._lava == null && dat.sprite != "" && dat.sprite != null)
            {
                if (this.data.sprite == null)
                {
                    this.data.sprite = dat.sprite;
                }
                this._lava = new SpriteMap(dat.sprite, 16, 16);
                this._lava.AddAnimation("idle", 0.1f, true, 0, 1, 2, 3);
                this._lava.SetAnimation("idle");
                this._lava.center   = new Vec2(8f, 10f);
                this._lavaAlternate = new SpriteMap(dat.sprite, 16, 16);
                this._lavaAlternate.AddAnimation("idle", 0.1f, true, 2, 3, 0, 1);
                this._lavaAlternate.SetAnimation("idle");
                this._lavaAlternate.center = new Vec2(8f, 10f);
            }
            if (this._lightRect == null && Layer.lighting)
            {
                this._lightRect = new WhiteRectangle(this.x, this.y, this.width, this.height, (double)dat.heat <= 0.0);
                Level.Add((Thing)this._lightRect);
            }
            if ((double)dat.amount > 0.0)
            {
                this._framesSinceFeed = 0;
            }
            this.data.Mix(dat);
            this.data.amount = Maths.Clamp(this.data.amount, 0.0f, this.MaxFluidFill());
            this._wide       = this.FeedAmountToDistance(this.data.amount);
            float num1 = this._wide + 4f;

            this._collisionOffset.x = (float)-((double)num1 / 2.0);
            this._collisionSize.x   = num1;
            this.FeedEdges();
            if (this._leftCorner != null && this._rightCorner != null && (double)this._wide > (double)this._rightCorner.corner.x - (double)this._leftCorner.corner.x)
            {
                this._wide = this._rightCorner.corner.x - this._leftCorner.corner.x;
                this.x     = this._leftCorner.corner.x + (float)(((double)this._rightCorner.corner.x - (double)this._leftCorner.corner.x) / 2.0);
            }
            float num2 = this._wide + 4f;

            this._collisionOffset.x = (float)-((double)num2 / 2.0);
            this._collisionSize.x   = num2;
            if (!(this.data.sprite == "water") || this._leftCorner == null)
            {
                return;
            }
            Block block = this._leftCorner.block;

            while (true)
            {
                switch (block)
                {
                case null:
                    goto label_19;

                case SnowTileset _:
                    if ((double)block.left + 2.0 > (double)this.left && (double)block.right - 2.0 < (double)this.right)
                    {
                        (block as SnowTileset).Freeze();
                        break;
                    }
                    break;

                case SnowIceTileset _:
                    if ((double)block.left + 2.0 > (double)this.left && (double)block.right - 2.0 < (double)this.right)
                    {
                        (block as SnowIceTileset).Freeze();
                        break;
                    }
                    break;
                }
                block = block.rightBlock;
            }
            label_19 :;
        }
 public static void Update()
 {
     foreach (KeyValuePair <NetworkConnection, ConnectionIndicatorElement> connection in ConnectionIndicator._connections)
     {
         if (connection.Value.duck != null && (connection.Value.duck.removeFromLevel || connection.Value.duck.level != Level.current))
         {
             connection.Value.duck = (Duck)null;
         }
         connection.Value.position = connection.Value.duck == null ? new Vec2(-1000f, -1000f) : connection.Value.duck.cameraPosition;
         foreach (KeyValuePair <ConnectionIndicatorType, ConnectionIndicatorDetail> detail in connection.Value.details)
         {
             detail.Value.buildup -= Maths.IncFrameTimer() * 0.25f;
             if ((double)detail.Value.buildup > (double)detail.Value.maxBuildup)
             {
                 detail.Value.buildup = detail.Value.maxBuildup;
             }
             if ((double)detail.Value.buildup < 0.0)
             {
                 detail.Value.buildup = 0.0f;
                 detail.Value.popOut += 0.02f;
                 if ((double)detail.Value.popOut > 1.0)
                 {
                     detail.Value.popOut = 1f;
                 }
                 detail.Value.grow -= 0.1f;
                 if ((double)detail.Value.grow < 0.0)
                 {
                     detail.Value.grow = 0.0f;
                 }
             }
             else
             {
                 detail.Value.popOut = 0.0f;
                 detail.Value.grow   = Lerp.FloatSmooth(detail.Value.grow, 1f, 0.2f);
                 if ((double)detail.Value.grow > 1.0)
                 {
                     detail.Value.grow = 1f;
                 }
             }
         }
     }
     foreach (Duck duck in Level.current.things[typeof(Duck)])
     {
         NetworkConnection key = (NetworkConnection)null;
         if (duck.profile != null && duck.profile.connection != null)
         {
             key = duck.profile.connection;
         }
         if (Network.isActive && key != null)
         {
             ConnectionIndicatorElement indicatorElement = (ConnectionIndicatorElement)null;
             if (!ConnectionIndicator._connections.TryGetValue(key, out indicatorElement))
             {
                 indicatorElement = new ConnectionIndicatorElement();
                 ConnectionIndicator._connections[key] = indicatorElement;
             }
             indicatorElement.duck = duck;
             if ((double)key.manager.ping > 0.25)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Lag).buildup += Maths.IncFrameTimer();
             }
             if ((double)key.manager.ping > 0.899999976158142 || key.status != ConnectionStatus.Connected)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Failure).buildup += Maths.IncFrameTimer();
             }
             if (key.manager.lossThisFrame)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.2f;
                 key.manager.lossThisFrame = false;
             }
             if ((double)key.manager.jitter > 0.800000011920929)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.25f;
             }
             ConnectionIndicatorDetail detail1 = indicatorElement.GetDetail(ConnectionIndicatorType.AFK);
             if (!duck.afk)
             {
                 detail1.buildup = 0.0f;
             }
             else
             {
                 detail1.buildup += Maths.IncFrameTimer();
             }
             ConnectionIndicatorDetail detail2 = indicatorElement.GetDetail(ConnectionIndicatorType.Chatting);
             if (duck.chatting)
             {
                 detail2.buildup += 0.25f;
             }
             else
             {
                 detail2.buildup = 0.0f;
             }
         }
     }
     if (ConnectionIndicator._lagIcons != null)
     {
         return;
     }
     ConnectionIndicator._lagIcons = new SpriteMap("lagturtle", 16, 16);
     ConnectionIndicator._lagIcons.CenterOrigin();
     ConnectionIndicator._rainbowGradient = new Sprite("rainbowGradient");
 }
 public UIGachaBoxNew(
     float xpos,
     float ypos,
     float wide         = -1f,
     float high         = -1f,
     bool rare          = false,
     UIMenu openOnClose = null)
     : base("", xpos, ypos, wide, high)
 {
     this._openOnClose = openOnClose;
     this._rare        = rare;
     this._duckCoin    = new SpriteMap("duckCoin", 18, 18);
     this._duckCoin.CenterOrigin();
     this._gachaMachine = new Sprite("arcade/gotcha/machine");
     this._gachaMachine.CenterOrigin();
     this._gachaGlass = new Sprite("arcade/gotcha/glass");
     this._gachaGlass.CenterOrigin();
     this._gachaDoor = new Sprite("arcade/gotcha/door");
     this._gachaDoor.CenterOrigin();
     this._gachaTwister = new Sprite("arcade/gotcha/twister");
     this._gachaTwister.CenterOrigin();
     this._gachaBall = new SpriteMap("arcade/gotcha/balls", 40, 42);
     this._gachaBall.CenterOrigin();
     this._gachaTwisterShadow = new Sprite("arcade/gotcha/twisterShadow");
     this._gachaTwisterShadow.CenterOrigin();
     this._whiteCircle = new Sprite("furni/whiteCircle");
     this._whiteCircle.CenterOrigin();
     this._coin = new SpriteMap("arcade/gotcha/coin", 22, 22);
     this._coin.CenterOrigin();
     this._coinSlot = new Sprite("arcade/gotcha/coinSlot");
     this._coinSlot.CenterOrigin();
     this._rainbow = new Sprite("arcade/rainbow");
     Graphics.fade = 1f;
     this._frame   = new Sprite("unlockFrame");
     this._frame.CenterOrigin();
     this._furni        = new Sprite("furni/tub");
     this._furni.center = new Vec2((float)(this._furni.width / 2), (float)this._furni.height);
     this._star         = new Sprite("prettyStar");
     this._star.CenterOrigin();
     this._font      = new BitmapFont("biosFontUI", 8, 7);
     this._fancyFont = new FancyBitmapFont("smallFontGacha");
     this._gachaEgg  = new SpriteMap("gachaEgg", 44, 36);
     this._capsule   = new SpriteMap("arcade/egg", 40, 23);
     this._capsule.CenterOrigin();
     this._capsuleBorder = new SpriteMap("arcade/eggBorder", 66, 65);
     this._capsuleBorder.CenterOrigin();
     this._rare           = false;
     this.numGenerate     = MonoMain.core.gachas;
     this.numGenerateRare = MonoMain.core.rareGachas;
     for (int index = 0; index < this.numGenerate; ++index)
     {
         Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0];
         furniture.ballRot = Rando.Float(360f);
         furniture.rareGen = false;
         this.prizes.Add(furniture);
     }
     for (int index = 0; index < this.numGenerateRare; ++index)
     {
         Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.VeryVeryRare, 1, 0.4f, true).OrderBy <Furniture, int>((Func <Furniture, int>)(x => - x.rarity)).ElementAt <Furniture>(0);
         furniture.ballRot = Rando.Float(360f);
         furniture.rareGen = true;
         this.prizes.Add(furniture);
     }
     for (int index = 0; index < 3; ++index)
     {
         Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0];
         furniture.ballRot = Rando.Float(360f);
         furniture.rareGen = false;
         this.prizes.Add(furniture);
     }
     this.LoadNextPrize();
     this._gachaEgg.CenterOrigin();
 }
 public override void Initialize()
 {
     if (this._testMode)
     {
         this._endOfHighlights  = true;
         Options.Data.sfxVolume = 0.0f;
         DuckStory duckStory = new DuckStory();
         duckStory.text          = "|SUAVE||RED|John Mallard|WHITE| here dancing|CALM| for you |EXCITED|and wearing ties!";
         HighlightLevel._stories = new List <DuckStory>();
         for (int index = 0; index < 9999; ++index)
         {
             HighlightLevel._stories.Add(duckStory);
         }
     }
     HighlightLevel._cancelSkip = false;
     this._tv       = new Sprite("bigTV");
     this._duck     = new SpriteMap("newsDuck", 140, 100);
     this._duckBeak = new SpriteMap("newsDuckBeak", 140, 100);
     this._tie      = new SpriteMap("ties", 12, 21);
     this._pumpkin  = new Sprite("pump");
     this._pumpkin.CenterOrigin();
     this._newsTable = new Sprite("newsTable");
     this._logo      = new Sprite("duckGameTitle");
     this._logo.CenterOrigin();
     this._background = new Sprite("duckChannelBackground");
     this._blurLayer  = new Layer("BLUR", Layer.HUD.depth + 5, Layer.HUD.camera);
     Layer.Add(this._blurLayer);
     this._blurLayer.effect = Content.Load <Effect>("Shaders/blur");
     this._transition       = new DuckChannelLogo();
     Level.Add((Thing)this._transition);
     this._tl            = new Vec2(30f, 32f);
     this._size          = new Vec2(207f, 141f);
     this._rockImage2    = new Sprite(RockScoreboard.finalImage, 0.0f, 0.0f);
     this._talker        = new Teleprompter(0.0f, 0.0f, this._duck);
     this._talker.active = this._talker.visible = false;
     Level.Add((Thing)this._talker);
     if (HighlightLevel.didSkip)
     {
         this._skip = true;
     }
     if (this._endOfHighlights)
     {
         this._state        = TVState.ShowNewscaster;
         this._desiredState = this._state;
     }
     else
     {
         HighlightLevel._image     = (Sprite)null;
         HighlightLevel.currentTie = Rando.Int(15);
         Music.Play("SportsCap");
         HighlightLevel._stories = DuckNews.CalculateStories();
     }
     this._hotness   = new HotnessAnimation();
     this._tie.frame = HighlightLevel.currentTie;
     for (int index = 0; index < HighlightLevel._stories.Count; index = index - 1 + 1)
     {
         bool flag = HighlightLevel._stories[index].text == "%CUEHIGHLIGHTS%";
         if (HighlightLevel._stories[index].text == "CUE%HOTNESSIMAGE%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessImage);
         }
         if (HighlightLevel._stories[index].text == "CUE%CUEHOTNESS%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessStory);
         }
         if (HighlightLevel._stories[index].text == "CUE%ENDHOTNESS%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessEnd);
         }
         if (HighlightLevel._stories[index].text == "CUE%INTERVIEWIMAGE%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnInterviewImage);
         }
         if (HighlightLevel._stories[index].text == "CUE%CUEINTERVIEW%")
         {
             this._interviewIndex = index;
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnInterview);
         }
         if (!flag)
         {
             this._talker.ReadLine(HighlightLevel._stories[index]);
         }
         HighlightLevel._stories.RemoveAt(index);
         if (flag)
         {
             break;
         }
     }
     Vote.OpenVoting("SKIP", "START");
 }
 public override void Update()
 {
     if (this._testMode)
     {
         this._wait += Maths.IncFrameTimer();
         if (Keyboard.Pressed(Keys.F5) || (double)this._wait > 0.1)
         {
             this._wait = 0.0f;
             try
             {
                 this._tie        = new SpriteMap((Tex2D)ContentPack.LoadTexture2D("tieTest.png"), 64, 64);
                 this._tie.center = new Vec2(26f, 27f);
             }
             catch (Exception ex)
             {
             }
         }
     }
     DuckGame.Graphics.fadeAdd = Lerp.Float(DuckGame.Graphics.fadeAdd, 0.0f, 0.01f);
     if (Main.isDemo && this._skip && !this._firedSkipLogic)
     {
         this._firedSkipLogic = true;
         Vote.CloseVoting();
         HUD.CloseAllCorners();
         this.DoSkip();
     }
     if ((double)DuckGame.Graphics.fade > 0.990000009536743 && !this._skip && Vote.Passed(VoteType.Skip))
     {
         this._skip = true;
     }
     if (this._talker.finished || !HighlightLevel._cancelSkip && this._skip && !Main.isDemo)
     {
         this._done -= 0.04f;
     }
     DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, (double)this._done < 0.0 ? 0.0f : 1f, 0.02f);
     if ((double)DuckGame.Graphics.fade < 0.00999999977648258 && (this._talker.finished || this._skip))
     {
         if (this._endOfHighlights || this._skip)
         {
             Vote.CloseVoting();
             Level.current = (Level) new RockScoreboard(RockScoreboard.returnLevel, ScoreBoardMode.ShowWinner, true);
         }
         else
         {
             Level.current = (Level) new HighlightPlayback(4);
         }
     }
     if (this._state == TVState.ShowPedestals)
     {
         this._waitZoom -= 0.008f;
         if ((double)this._waitZoom < 0.00999999977648258)
         {
             this._waitZoom     = 0.0f;
             this._desiredState = TVState.ShowNewscaster;
         }
     }
     if (this._state == TVState.ShowHotness && this._hotness.ready)
     {
         this._talker.Resume();
     }
     if (this._state == TVState.ShowInterview)
     {
         this._interviewWait -= 0.02f;
         if ((double)this._interviewWait < 0.0 && !this._askedQuestion)
         {
             this._talker.InsertLine(Script.winner() + "! To what do you attribute your success?", this._interviewIndex);
             this._talker.Resume();
             this._askedQuestion = true;
         }
     }
     this._cameraOffset.x = Lerp.Float(this._cameraOffset.x, HighlightLevel._image != null ? 20f : 0.0f, 2f);
     this._talker.active  = this._talker.visible = this._state != TVState.ShowPedestals;
     if (this._state == this._desiredState)
     {
         return;
     }
     this._talker.active = false;
     this._transition.PlaySwipe();
     if (!this._transition.doTransition)
     {
         return;
     }
     this._state = this._desiredState;
 }
Example #21
0
 public override void Draw()
 {
     if (!this._root)
     {
         float num = 1f;
         if (this.greyOut)
         {
             num = 0.3f;
         }
         if (this._hover && !this.greyOut)
         {
             DuckGame.Graphics.DrawRect(this.position, this.position + this.itemSize, new Color(70, 70, 70), new Depth(0.82f));
         }
         DuckGame.Graphics.DrawFancyString(this._text, this.position + new Vec2(2f, 4f), Color.White * num, new Depth(0.85f));
         this._contextArrow.color = Color.White * num;
         DuckGame.Graphics.Draw(this._contextArrow, (float)((double)this.x + (double)this.itemSize.x - 11.0), this.y + 3f, new Depth(0.85f));
     }
     if (this.opened)
     {
         SpriteMap graphic = this._thing.graphic as SpriteMap;
         this.menuSize = new Vec2((float)(graphic.texture.width + 2), (float)(graphic.texture.height + 2));
         float x  = this.menuSize.x;
         float y  = this.menuSize.y;
         Vec2  p1 = new Vec2(this.x, this.y);
         if (!this._root)
         {
             p1.x += this.itemSize.x + 4f;
             p1.y -= 2f;
         }
         Vec2 vec2_1 = new Vec2(graphic.position);
         this._thing.x     = (float)((double)p1.x + 1.0 + (double)graphic.w / 2.0);
         this._thing.y     = (float)((double)p1.y + 1.0 + (double)graphic.h / 2.0);
         this._thing.depth = new Depth(0.7f);
         DuckGame.Graphics.DrawRect(p1, p1 + new Vec2(x, y), new Color(70, 70, 70), new Depth(0.5f));
         DuckGame.Graphics.DrawRect(p1 + new Vec2(1f, 1f), p1 + new Vec2(x - 1f, y - 1f), new Color(30, 30, 30), new Depth(0.6f));
         DuckGame.Graphics.Draw(graphic.texture, new Vec2(this._thing.x, this._thing.y), new Rectangle?(), Color.White, 0.0f, this._thing.center, this._thing.scale, SpriteEffects.None, new Depth(0.7f));
         if (this._root && this._file != null)
         {
             Vec2 vec2_2 = new Vec2(p1 + new Vec2(x + 4f, 0.0f));
             Vec2 vec2_3 = new Vec2(p1 + new Vec2(x + 97f, 12f));
             this._file.position = vec2_2;
             this._file.Update();
             this._file.Draw();
         }
         int num1 = graphic.texture.width / graphic.w;
         int num2 = graphic.texture.height / graphic.h;
         if (Editor.gamepadMode && (this._file == null || !this._file.hover))
         {
             this._hoverPos = new Vec2((float)(this._selectedIndex % num1 * graphic.w), (float)(this._selectedIndex / num1 * graphic.h));
             if (Input.Pressed("LEFT"))
             {
                 --this._selectedIndex;
             }
             if (Input.Pressed("RIGHT"))
             {
                 if (this._file != null && this._selectedIndex == num1 - 1)
                 {
                     this._file.hover = true;
                 }
                 else
                 {
                     ++this._selectedIndex;
                 }
             }
             if (Input.Pressed("UP"))
             {
                 this._selectedIndex -= num1;
             }
             if (Input.Pressed("DOWN"))
             {
                 this._selectedIndex += num1;
             }
             if (this._selectedIndex < 0)
             {
                 this._selectedIndex = 0;
             }
             if (this._selectedIndex > num1 * num2 - 1)
             {
                 this._selectedIndex = num1 * num2 - 1;
             }
         }
         else
         {
             this._hoverPos = new Vec2(Mouse.x - this._thing.x, Mouse.y - this._thing.y);
         }
         if (this._file != null && this._file.hover && Input.Pressed("LEFT"))
         {
             this._file.hover    = false;
             this._selectedIndex = num1 - 1;
         }
         Editor current = Level.current as Editor;
         this._hoverPos.x = (float)Math.Round((double)this._hoverPos.x / (double)graphic.w) * (float)graphic.w;
         this._hoverPos.y = (float)Math.Round((double)this._hoverPos.y / (double)graphic.h) * (float)graphic.h;
         if ((this._file == null || !this._file.hover) && ((double)this._hoverPos.x >= 0.0 && (double)this._hoverPos.x < (double)graphic.texture.width) && ((double)this._hoverPos.y >= 0.0 && (double)this._hoverPos.y < (double)graphic.texture.height))
         {
             DuckGame.Graphics.DrawRect(this._hoverPos + p1, this._hoverPos + p1 + new Vec2((float)(graphic.w + 2), (float)(graphic.h + 2)), Color.Lime * 0.8f, new Depth(0.8f), false);
             if (Mouse.left == InputState.Pressed || Input.Pressed("SELECT"))
             {
                 graphic.frame         = (int)((double)this._hoverPos.x / (double)graphic.w + (double)this._hoverPos.y / (double)graphic.h * (double)(graphic.texture.width / graphic.w));
                 current.placementType = this._thing;
                 current.placementType = this._thing;
                 if (!this.floatMode || Editor.gamepadMode)
                 {
                     current.CloseMenu();
                 }
             }
         }
         if (!this.justOpened && Input.Pressed("SHOOT"))
         {
             current.CloseMenu();
         }
         this.justOpened = false;
     }
     else
     {
         this.justOpened = true;
     }
 }
Example #22
0
        public void Update(GameTime gt)
        {
            doLobbyStuff();

            if (Level.current?.initialized != true)
            {
                return;
            }

            if (Level.current != prevLevel)
            {
                LevelChange();
            }

            prevLevel = Level.current;

            var profiles = ActiveProfiles.Where(x => x.duck != null && x.team != null);

            foreach (var profile in profiles)
            {
                SpriteMap teamHat = profile?.team?.hat, previousHat = null;

                if (teamHat == null)
                {
                    continue;
                }

                if (!pHats.TryGetValue(profile, out previousHat) || previousHat != teamHat)
                {
                    HatChange(profile);
                }
            }

            pHats = profiles.ToDictionary(profile => profile, profile => profile?.team?.hat);


            DuckEvents.Update();
            foreach (var kvp in ActiveReskins)
            {
                var duck = kvp.Key.duck;
                if (duck == null)
                {
                    continue;
                }

                var skin = kvp.Value;

                skin.Update(duck);

                var persona = kvp.Key.persona;

                var hat = duck.hat as TeamHat;
                if (hat != null && hat.team == duck.team)
                {
                    removeHat(duck);
                }

                if (persona.sprite.texture.textureName != "RESKIN" || Keyboard.Pressed(Keys.F6) || persona.sprite.texture.IsDisposed)
                {
                    skin.Apply(duck);
                }
            }
        }
Example #23
0
 public Teleprompter(float xpos, float ypos, SpriteMap newsCaster)
     : base(xpos, ypos)
     => this._newsCaster = newsCaster;
Example #24
0
        // Token: 0x06002232 RID: 8754
        public CoilGun(float xval, float yval) : base(xval, yval)
        {
            this.ammo            = 30;
            this._type           = "gun";
            this.center          = new Vec2(16f, 16f);
            this.collisionOffset = new Vec2(-11f, -8f);
            this.collisionSize   = new Vec2(22f, 12f);
            this._barrelOffsetTL = new Vec2(25f, 13f);
            this._fireSound      = "";
            this._fullAuto       = false;
            this._fireWait       = 1f;
            this._kickForce      = 1f;
            this._holdOffset     = new Vec2(3f, 1f);
            this._editorName     = "Death Laser";
            this._chargeAnim     = new SpriteMap("coilGun", 32, 32, false);
            SpriteMap chargeAnim = this._chargeAnim;
            string    name       = "idle";
            float     speed      = 1f;
            bool      looping    = true;

            int[] frames = new int[1];
            chargeAnim.AddAnimation(name, speed, looping, frames);
            this._chargeAnim.AddAnimation("charge", 0.38f, false, new int[]
            {
                1,
                2,
                3,
                0,
                1,
                2,
                3,
                4,
                5,
                6,
                7,
                4,
                5,
                6,
                7
            });
            this._chargeAnim.AddAnimation("charged", 1f, true, new int[]
            {
                8,
                9,
                10,
                11
            });
            this._chargeAnim.AddAnimation("uncharge", 1.2f, false, new int[]
            {
                7,
                6,
                5,
                4,
                7,
                6,
                5,
                4,
                3,
                2,
                1,
                0,
                3,
                2,
                1,
                0
            });
            this._chargeAnim.AddAnimation("drain", 2f, false, new int[]
            {
                7,
                6,
                5,
                4,
                7,
                6,
                5,
                4,
                3,
                2,
                1,
                0,
                3,
                2,
                1,
                0
            });
            this._chargeAnim.SetAnimation("idle");
            this.graphic = this._chargeAnim;
        }
Example #25
0
        public void Draw(
            Vec2 pos,
            Depth depth,
            int variation    = 0,
            ulong seed       = 0,
            bool affectScale = false,
            bool halfscale   = false,
            float angle      = 0.0f)
        {
            if (seed == 0UL && Profiles.experienceProfile != null)
            {
                seed = Profiles.experienceProfile.steamID;
            }
            SpriteMap spriteMap = this.sprite;

            if (this.icon != null)
            {
                spriteMap = this.icon;
            }
            if (spriteMap != null && this.neverFlip)
            {
                spriteMap.flipH = false;
            }
            if (this.name == "EGG")
            {
                VariatingSprite sprite = this.GetSprite(seed, variation, VSType.Egg);
                if (sprite != null)
                {
                    if (sprite.sprite.texture != null)
                    {
                        sprite.sprite.depth = depth + 6;
                        sprite.sprite.scale = this.sprite.scale;
                        DuckGame.Graphics.Draw(sprite.sprite, pos.x - 8f * sprite.sprite.xscale, pos.y - 12f * sprite.sprite.yscale);
                        spriteMap.frame = 0;
                    }
                    if ((sprite.sprite.renderTexture.nativeObject as Microsoft.Xna.Framework.Graphics.RenderTarget2D).IsContentLost)
                    {
                        this._eggSprites.Remove(sprite);
                    }
                }
            }
            else if (this.name == "PHOTO")
            {
                if (this._photoSprite == null)
                {
                    this._photoSprite = new SpriteMap("littleMan", 16, 16);
                }
                this._photoSprite.frame = UILevelBox.LittleManFrame(variation, 7, seed);
                this._photoSprite.depth = depth + 6;
                this._photoSprite.scale = this.sprite.scale;
                DuckGame.Graphics.Draw((Sprite)this._photoSprite, pos.x - 6f * this._photoSprite.xscale, pos.y - 4f * this._photoSprite.yscale, new Rectangle(2f, 0.0f, 12f, 10f));
                DuckGame.Graphics.DrawRect(pos + new Vec2(-6f * this._photoSprite.xscale, -6f * this._photoSprite.yscale), pos + new Vec2(6f * this._photoSprite.xscale, 6f * this._photoSprite.yscale), Colors.DGBlue, depth - 4);
                spriteMap.frame = 0;
            }
            else if (this.name == "EASEL")
            {
                VariatingSprite sprite = this.GetSprite(seed, variation, VSType.Portrait);
                if (sprite != null)
                {
                    sprite.sprite.depth = depth + 6;
                    sprite.sprite.scale = this.sprite.scale;
                    DuckGame.Graphics.Draw(sprite.sprite, pos.x - 9f * sprite.sprite.xscale, pos.y - 8f * sprite.sprite.yscale);
                    spriteMap.frame = 0;
                    if ((sprite.sprite.renderTexture.nativeObject as Microsoft.Xna.Framework.Graphics.RenderTarget2D).IsContentLost)
                    {
                        this._eggSprites.Remove(sprite);
                    }
                }
            }
            else
            {
                spriteMap.frame = variation;
            }
            if (this.font != null && this.sprite == null)
            {
                this.font.scale = new Vec2(1f, 1f);
                this.font.Draw("F", pos + new Vec2(-3.5f, -3f), Color.Black, depth + 8);
            }
            if (affectScale)
            {
                if (halfscale && (spriteMap.width > 30 || spriteMap.height > 30))
                {
                    spriteMap.scale = new Vec2(0.5f);
                }
                else
                {
                    spriteMap.scale = new Vec2(1f);
                }
            }
            spriteMap.depth = depth;
            spriteMap.angle = angle;
            DuckGame.Graphics.Draw((Sprite)spriteMap, pos.x, pos.y);
        }
Example #26
0
 public Furniture(
     bool canflip,
     bool neverflip,
     string desc,
     int rarityval,
     string spr,
     int wide,
     int high,
     string nam,
     FurnitureGroup gr,
     SpriteMap ico,
     bool stickTofloor,
     bool stickToroof = false,
     bool surface     = false,
     float topoff     = 0.0f,
     int maxval       = -1,
     bool canGacha    = true)
 {
     this.neverFlip     = neverflip;
     this.canGetInGacha = canGacha;
     this.canFlip       = canflip;
     this.stickToFloor  = stickTofloor;
     this.stickToRoof   = stickToroof;
     this.isSurface     = surface;
     this.topOffset     = topoff;
     this.description   = desc;
     this.max           = maxval;
     this._rarity       = rarityval;
     if (spr != null)
     {
         this.sprite = new SpriteMap("furni/" + gr.name + "/" + spr, wide, high);
     }
     if (stickToroof)
     {
         this.deep += 20;
     }
     if (!stickToroof && !stickTofloor)
     {
         --this.deep;
     }
     this.name  = nam;
     this.icon  = ico;
     this.type  = FurnitureType.Prop;
     this.group = gr;
     if (this.sprite != null)
     {
         this.sprite.CenterOrigin();
         if ((double)this.sprite.height / 2.0 - Math.Floor((double)this.sprite.height / 2.0) == 0.0)
         {
             --this.sprite.centery;
         }
         else
         {
             this.sprite.centery = (float)Math.Floor((double)this.sprite.height / 2.0);
         }
     }
     if (this.icon != null)
     {
         this.icon.CenterOrigin();
     }
     if (this.background == null)
     {
         return;
     }
     this.background.CenterOrigin();
 }
 public void Initialize()
 {
     this.hats        = new SpriteMap("hatCollection", 32, 32);
     this.hats.center = new Vec2(16f, 16f);
     this.teams       = new List <Team>()
     {
         new Team("Player 1", "hats/noHat", true),
         new Team("Player 2", "hats/noHat", true),
         new Team("Player 3", "hats/noHat", true),
         new Team("Player 4", "hats/noHat", true),
         new Team("Sombreros", "hats/sombrero", true),
         new Team("Dappers", "hats/dapper", true),
         new Team("Dicks", "hats/dicks", true),
         new Team("Frank", "hats/frank", lockd: true),
         new Team("DUCKS", "hats/reallife", lockd: true),
         new Team("Frogs?", "hats/frogs", true),
         new Team("Drunks", "hats/drunks"),
         new Team("Joey", "hats/joey", lockd: true),
         new Team("BALLZ", "hats/ballhead"),
         new Team("Agents", "hats/agents"),
         new Team("Sailors", "hats/sailors"),
         new Team("astropal", "hats/astrobud", lockd: true),
         new Team("Cowboys", "hats/cowboys", lockd: true),
         new Team("Pulpy", "hats/pulpy", lockd: true),
         new Team("SKULLY", "hats/skelly", lockd: true),
         new Team("Hearts", "hats/hearts"),
         new Team("LOCKED", "hats/locked"),
         new Team("Jazzducks", "hats/jazzducks", false, false, new Vec2(-2f, -7f)),
         new Team("Divers", "hats/divers"),
         new Team("Uglies", "hats/uglies"),
         new Team("Dinos", "hats/dinos"),
         new Team("Caps", "hats/caps"),
         new Team("Burgers", "hats/burgers"),
         new Team("Turing", "hats/turing", true),
         new Team("Retro", "hats/retros"),
         new Team("Senpai", "hats/sensei"),
         new Team("BAWB", "hats/bawb", false, true, new Vec2(-1f, -10f)),
         new Team("SWACK", "hats/guac", true, true),
         new Team("eggpal", "hats/eggy", lockd: true),
         new Team("Valet", "hats/valet"),
         new Team("Pilots", "hats/pilots"),
         new Team("Cyborgs", "hats/cyborgs"),
         new Team("Tubes", "hats/tube", false, false, new Vec2(-1f, 0.0f)),
         new Team("Gents", "hats/gents"),
         new Team("Potheads", "hats/pots"),
         new Team("Skis", "hats/ski"),
         new Team("Fridges", "hats/fridge"),
         new Team("Witchtime", "hats/witchtime"),
         new Team("Wizards", "hats/wizbiz"),
         new Team("FUNNYMAN", "hats/FunnyMan"),
         new Team("Pumpkins", "hats/Dumplin"),
         new Team("CAPTAIN", "hats/devhat", lockd: true),
         new Team("BRICK", "hats/brick", lockd: true),
         new Team("Pompadour", "hats/pompadour"),
         new Team("Super", "hats/super"),
         new Team("Chancy", "hats/chancy", lockd: true),
         new Team("Log", "hats/log"),
         new Team("Meeee", "hats/toomany", lockd: true),
         new Team("BRODUCK", "hats/broduck", lockd: true),
         new Team("brad", "hats/handy", lockd: true),
         new Team("eyebob", "hats/gross"),
         new Team("tubes", "hats/tube", false, false, new Vec2(-1f, 0.0f)),
         new Team("gents", "hats/gents"),
         new Team("pots", "hats/pots"),
         new Team("poles", "hats/ski"),
         new Team("CYCLOPS", "hats/cyclops", lockd: true, desc: "These wounds they will not heal."),
         new Team("MOTHERS", "hats/motherduck", lockd: true, desc: "Not a goose."),
         new Team("BIG ROBO", "hats/newrobo", false, true, new Vec2()),
         new Team("TINCAN", "hats/oldrobo", false, true, new Vec2()),
         new Team("WELDERS", "hats/WELDER", lockd: true, desc: "Safety has never looked so cool."),
         new Team("PONYCAP", "hats/ponycap", false, true, new Vec2()),
         new Team("TRICORNE", "hats/tricorne", lockd: true, desc: "We fight for freedom!"),
         new Team("TWINTAIL", "hats/twintail", lockd: true, desc: "Two tails are better than one."),
         new Team("MAJESTY", "hats/royalty", lockd: true, capeTex: ((Texture2D)Content.Load <Tex2D>("hats/royalCape"))),
         new Team("MOONWALK", "hats/moonwalker", lockd: true, capeTex: ((Texture2D)Content.Load <Tex2D>("hats/moonCape")))
     };
 }