public UIConnectionInfo(Profile p, UIMenu rootMenu, UIMenu kickMenu) : base(p.name) { this._profile = p; this._littleFont = new BitmapFont("smallBiosFontUI", 7, 5); this.SetFont(this._littleFont); string str1 = "|WHITE|"; if (p.networkIndex == (byte)1) { str1 = "|LIGHTGRAY|"; } else if (p.networkIndex == (byte)2) { str1 = "|DGYELLOW|"; } else if (p.networkIndex == (byte)3) { str1 = "|MENUORANGE|"; } string source1 = p.name; int num1 = source1.Count <char>(); bool flag1 = false; if (p.connection != null && p.connection.isHost) { flag1 = true; ++num1; } int num2 = 17; if (flag1) { num2 = 16; } if (num1 > num2) { source1 = source1.Substring(0, num2 - 1) + "."; num1 = num2; } for (; num1 < num2 + 2; ++num1) { source1 += " "; } if (flag1) { source1 = "@HOSTCROWN@" + source1; } this._nameText = str1 + source1; bool flag2 = false; int num3; if (this._profile.connection != null) { num3 = (int)Math.Round((double)this._profile.connection.manager.ping * 1000.0); flag2 = this._profile.connection.status == ConnectionStatus.Connected; } else { num3 = 1000; } string source2 = num3.ToString() + "|WHITE|MS"; int num4 = source2.Count <char>(); string str2 = num3 >= 150 ? (num3 >= 250 ? (!flag2 ? "|DGRED|" + source2 + "@SIGNALDEAD@" : "|DGRED|" + source2 + "@SIGNALBAD@") : "|DGYELLOW|" + source2 + "@SIGNALNORMAL@") : "|DGGREEN|" + source2 + "@SIGNALGOOD@"; for (; num4 < 5; ++num4) { str2 = " " + str2; } this._textElement.text = str1 + source1 + str2; if (Network.isServer && p.connection != DuckNetwork.localConnection) { this.controlString = "@DPAD@MOVE @GRAB@KICK"; } this._kickMenu = kickMenu; this._rootMenu = rootMenu; }
public Furniture( bool canflip, bool neverflip, string desc, int rarityval, string spr, int wide, int high, string nam, FurnitureGroup gr, SpriteMap ico = null, FurnitureType t = FurnitureType.Prop, BitmapFont f = null, string bak = null, bool stickToroof = false, bool stickTofloor = false, int deepval = 0, int maxval = -1, bool canGacha = true) { this.neverFlip = neverflip; this.canGetInGacha = canGacha; this.canFlip = canflip; this.stickToFloor = stickTofloor; this.stickToRoof = stickToroof; this.max = maxval; this._rarity = rarityval; this.description = desc; if (spr != null) { this.sprite = new SpriteMap("furni/" + gr.name + "/" + spr, wide, high); } if (bak != null) { this.background = new SpriteMap("furni/" + gr.name + "/" + bak, wide, high); } this.name = nam; this.icon = ico; this.type = t; this.font = f; this.group = gr; this.deep = deepval; if (stickToroof) { this.deep += 20; } if (!stickToroof && !stickTofloor) { --this.deep; } 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 UIControlConfig( UIMenu openOnClose, string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null) : base(title, xpos, ypos, wide, high, conString, conProfile) { this._openOnClose = openOnClose; List <string> stringList1 = new List <string>() { "P1 ", "P2 ", "P3 ", "P4" }; List <string> stringList2 = new List <string>() { "GAMEPAD", "KEYBOARD", "PAD + KEYS" }; BitmapFont bitmapFont = new BitmapFont("smallBiosFontUI", 7, 5); UIBox uiBox = new UIBox(isVisible: false); this._configuringToggle = new UIMenuItemToggle("", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.SwitchConfigType)), new FieldBinding((object)this, nameof(inputConfigType)), multi: this.inputTypes, compressedMulti: true, tiny: true); uiBox.Add((UIComponent)this._configuringToggle, true); UIText uiText1 = new UIText(" ", Color.White); this._controlElements.Add(new UIControlElement("|DGBLUE|{LEFT", "LEFT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|/RIGHT", "RIGHT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|}UP", "UP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|~DOWN", "DOWN", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|START", "START", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|ACCEPT", "SELECT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|JUMP", "JUMP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|GRAB", "GRAB", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|TRIP", "RAGDOLL", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|FIRE", "SHOOT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|STRAFE", "STRAFE", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|QUACK", "QUACK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L STICK", "LSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R STICK", "RSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L TRIGGER", "LTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R TRIGGER", "RTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); UIMenuItem uiMenuItem = new UIMenuItem("|RED|REVERT TO DEFAULT", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.ResetToDefault))); uiMenuItem.SetFont(bitmapFont); uiBox.Add((UIComponent)uiMenuItem, true); UIText uiText2 = new UIText(" ", Color.White); uiText2.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText2, true); UIText uiText3 = new UIText("PERSONAL CONTROLS CAN BE", Color.White); uiText3.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText3, true); UIText uiText4 = new UIText("SET IN PROFILE SCREEN", Color.White); uiText4.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText4, true); this._controlBox = uiBox; this._playerBoxes.Add(uiBox); this.Add((UIComponent)this._playerBoxes[0], true); this._confirmMenu = new UIMenu("SAVE CHANGES?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenuSaving))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenu))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("CANCEL!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this)), true); this._confirmMenu.Close(); }
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() { ChallengeLevel.targetsShot = 0; ChallengeLevel.goodiesGot = 0; ChallengeLevel.allTargetsShot = true; ChallengeLevel.running = false; ChallengeLevel._timer = new ChallengeTimer(); base.Initialize(); this._font = new BitmapFont("biosFont", 8); foreach (Team team in Teams.all) { team.prevScoreboardScore = team.score = 0; } bool flag = true; foreach (Profile prof in Profiles.active) { if (flag) { flag = false; } else { if (prof.team != null) { prof.team.Leave(prof); } prof.inputProfile = (InputProfile)null; } } this._pendingSpawns = new Deathmatch((Level)this).SpawnPlayers(); this._pendingSpawns = this._pendingSpawns.OrderBy <Duck, float>((Func <Duck, float>)(sp => sp.x)).ToList <Duck>(); foreach (Thing pendingSpawn in this._pendingSpawns) { this.followCam.Add(pendingSpawn); } this._pauseGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._pauseMenu = new UIMenu("@LWING@PAUSE@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@DPAD@MOVE @SELECT@SELECT"); this._confirmMenu = new UIMenu("REALLY QUIT?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._captureMenu = (UIMenu) new UICaptureBox(this._pauseMenu, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f); this._captureMenu.Close(); this._pauseGroup.Add((UIComponent)this._captureMenu, false); UIDivider uiDivider = new UIDivider(true, 0.8f); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("RESTART!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._restart), UIAlign.Left), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("RESUME", (UIMenuAction) new UIMenuActionCloseMenu(this._pauseGroup), UIAlign.Left), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("OPTIONS", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)Options.optionsMenu), UIAlign.Left), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("QUIT", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)this._confirmMenu), UIAlign.Left), true); if (this.things[typeof(EditorTestLevel)].Count <Thing>() > 0) { uiDivider.leftSection.Add((UIComponent) new UIText("", Color.White), true); uiDivider.leftSection.Add((UIComponent) new UIMenuItem("CAPTURE ICON", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._pauseMenu, (UIComponent)this._captureMenu), UIAlign.Left), true); } uiDivider.rightSection.Add((UIComponent) new UIImage("pauseIcons", UIAlign.Right), true); this._pauseMenu.Add((UIComponent)uiDivider, true); this._pauseMenu.Close(); this._pauseGroup.Add((UIComponent)this._pauseMenu, false); this._pauseGroup.Add((UIComponent)Options.optionsMenu, false); Options.openOnClose = this._pauseMenu; this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this._pauseMenu)), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._pauseGroup, this._quit)), true); this._confirmMenu.Close(); this._pauseGroup.Add((UIComponent)this._confirmMenu, false); this._pauseGroup.Close(); Level.Add((Thing)this._pauseGroup); Music.volume = 1f; this.followCam.Adjust(); }
public UIMenuItemToggle( string text, UIMenuAction action = null, FieldBinding field = null, Color c = default(Color), FieldBinding filterBinding = null, List <string> multi = null, bool compressedMulti = false, bool tiny = false) : base(action) { if (c == new Color()) { c = Colors.MenuOption; } BitmapFont f = (BitmapFont)null; if (tiny) { f = new BitmapFont("smallBiosFontUI", 7, 5); } UIDivider uiDivider = new UIDivider(true, 0.0f); if (text != "") { UIText uiText = new UIText(text, c); if (tiny) { uiText.SetFont(f); } uiText.align = UIAlign.Left; uiDivider.leftSection.Add((UIComponent)uiText, true); } if (multi != null) { this._multiToggleElement = new UIMultiToggle(-1f, -1f, field, multi, compressedMulti); this._multiToggleElement.align = compressedMulti ? UIAlign.Right : UIAlign.Right; if (text != "") { uiDivider.rightSection.Add((UIComponent)this._multiToggleElement, true); } else { uiDivider.leftSection.Add((UIComponent)this._multiToggleElement, true); this._multiToggleElement.align = UIAlign.Left; } if (tiny) { this._multiToggleElement.SetFont(f); } this._multiToggle = multi; this._compressed = compressedMulti; } else { UIOnOff uiOnOff = new UIOnOff(-1f, -1f, field, filterBinding); if (tiny) { uiOnOff.SetFont(f); } uiOnOff.align = UIAlign.Right; uiDivider.rightSection.Add((UIComponent)uiOnOff, true); } this.rightSection.Add((UIComponent)uiDivider, true); if (tiny) { this._arrow = new UIImage("littleContextArrowRight"); } else { this._arrow = new UIImage("contextArrowRight"); } this._arrow.align = UIAlign.Right; this._arrow.visible = false; this.leftSection.Add((UIComponent)this._arrow, true); this._field = field; this._filterField = filterBinding; }