public UIInviteMenu( string title, UIMenuAction act, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null, bool tiny = false) : base(title, xpos, ypos, wide, high) { if (Steam.IsInitialized()) { int num = Steam.friends.OrderBy <User, int>((Func <User, int>)(u => UIInviteMenu._sortDictionary[(int)u.state])).Count <User>(); if (num > this._maxShow) { num = this._maxShow; } this._littleFont = new BitmapFont("smallBiosFont", 7, 6); this._moreArrow = new Sprite("moreArrow"); this._moreArrow.CenterOrigin(); this._box = new UIBox(0.0f, 0.0f, 100f, (float)(14 * num + 8), isVisible: false); this._noAvatar = new Sprite("noAvatar"); this._noAvatar.CenterOrigin(); this.Add((UIComponent)this._box, true); } this._menuAction = act; }
public UIServerBrowser( 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.defaultImage = Content.Load <Tex2D>("server_default"); this._splitter.topSection.components[0].align = UIAlign.Left; this._openOnClose = openOnClose; this._moreArrow = new Sprite("moreArrow"); this._moreArrow.CenterOrigin(); this._steamIcon = new Sprite("steamIconSmall"); this._steamIcon.scale = new Vec2(1f) / 2f; this._localIcon = new SpriteMap("iconSheet", 16, 16); this._localIcon.scale = new Vec2(1f) / 2f; this._localIcon.SetFrameWithoutReset(1); this._newIcon = new SpriteMap("presents", 16, 16); this._newIcon.scale = new Vec2(2f); this._newIcon.SetFrameWithoutReset(0); this._noImage = new Sprite("notexture"); this._noImage.scale = new Vec2(2f); this._cursor = new SpriteMap("cursors", 16, 16); this._maxLobbiesToShow = 8; this._box = new UIBox(0.0f, 0.0f, high: ((float)(this._maxLobbiesToShow * 36)), isVisible: false); this.Add((UIComponent)this._box, true); this._fancyFont = new FancyBitmapFont("smallFont"); this._fancyFont.maxWidth = (int)this.width - 100; this._fancyFont.maxRows = 2; this.scrollBarOffset = 0; this._editModMenu = new UIMenu("<mod name>", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._editModMenu.Add((UIComponent) new UIText(" ", Color.White), true); this._editModMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._editModMenu, (UIComponent)this)), true); this._editModMenu.Close(); this._yesNoMenu = new UIMenu("ARE YOU SURE?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._yesNoMenu.Add((UIComponent)(this._yesNoYes = new UIMenuItem("YES")), true); this._yesNoMenu.Add((UIComponent)(this._yesNoNo = new UIMenuItem("NO")), true); this._yesNoMenu.Close(); this._updateTextBox = new Textbox(0.0f, 0.0f, 0.0f, 0.0f); this._updateTextBox.depth = new Depth(0.9f); this._updateTextBox.maxLength = 5000; this._downloadModsMenu = new UIMenu("MODS REQUIRED!", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 290f, conString: "@SELECT@SELECT"); this._downloadModsMenu.Add((UIComponent) new UIText("You're missing the mods required", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("to join this game. Would you", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("like to automatically subscribe to", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("all required mods, restart and", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("join the game?", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._downloadModsMenu, (UIComponent)this)), true); this._downloadModsMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)this._downloadModsMenu, new UIMenuActionCloseMenuCallFunction.Function(UIServerBrowser.SubscribeAndRestart))), true); this._downloadModsMenu.Close(); }
public void RecreateProfiles() { this.profiles.Clear(); for (int index = 0; index < 4; ++index) { this.profiles.Add(new Profile("Netduck" + (index + 1).ToString(), InputProfile.GetVirtualInput(index), varDefaultPersona: Persona.all.ElementAt <DuckPersona>(index), network: true) { networkIndex = (byte)index }); } }
public NMInputSettings(Profile pro) { this._device = pro.inputProfile.lastActiveDevice; if (this._device.productName == null && this._device.productGUID == null) { this._device = (InputDevice)null; } this._index = pro.networkIndex; this._profile = pro; this._inputProfile = pro.inputProfile; }
public InputProfile Add(string name) { InputProfile inputProfile1 = new InputProfile(name); InputProfile inputProfile2; if (this._profiles.TryGetValue(name, out inputProfile2)) { return(inputProfile2); } this._profiles[name] = inputProfile1; return(inputProfile1); }
public bool Update(InputProfile p) { InputCode.InputCodeProfileStatus codeProfileStatus = (InputCode.InputCodeProfileStatus)null; if (!this.status.TryGetValue(p, out codeProfileStatus)) { codeProfileStatus = new InputCode.InputCodeProfileStatus(); this.status[p] = codeProfileStatus; } if (codeProfileStatus.lastUpdateFrame == Graphics.frame) { return(codeProfileStatus.lastResult); } codeProfileStatus.lastUpdateFrame = Graphics.frame; codeProfileStatus.breakTimer -= this.breakSpeed; if ((double)codeProfileStatus.breakTimer <= 0.0) { codeProfileStatus.Break(); } string trigger = this.triggers[codeProfileStatus.currentIndex]; int num = 1 << Network.synchronizedTriggers.Count - Network.synchronizedTriggers.IndexOf(trigger); if ((int)p.state == num) { if (!codeProfileStatus.release) { if (codeProfileStatus.currentIndex == this.triggers.Count - 1) { codeProfileStatus.Break(); codeProfileStatus.lastResult = true; return(true); } codeProfileStatus.release = true; if (codeProfileStatus.currentIndex == 0) { codeProfileStatus.breakTimer = 1f; } } } else if (p.state == (ushort)0) { if (codeProfileStatus.release) { codeProfileStatus.Progress(); } } else { codeProfileStatus.Break(); } codeProfileStatus.lastResult = false; return(false); }
public UIModManagement( 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._splitter.topSection.components[0].align = UIAlign.Left; this._openOnClose = openOnClose; this._moreArrow = new Sprite("moreArrow"); this._moreArrow.CenterOrigin(); this._steamIcon = new Sprite("steamIconSmall"); this._steamIcon.scale = new Vec2(1f) / 2f; this._localIcon = new SpriteMap("iconSheet", 16, 16); this._localIcon.scale = new Vec2(1f) / 2f; this._localIcon.SetFrameWithoutReset(1); this._newIcon = new SpriteMap("presents", 16, 16); this._newIcon.scale = new Vec2(2f); this._newIcon.SetFrameWithoutReset(0); this._noImage = new Sprite("notexture"); this._noImage.scale = new Vec2(2f); this._cursor = new SpriteMap("cursors", 16, 16); this._mods = (IList <Mod>)ModLoader.allMods.Where <Mod>((Func <Mod, bool>)(a => !(a is CoreMod))).ToList <Mod>(); this._mods.Add((Mod)null); this._maxModsToShow = 8; this._box = new UIBox(0.0f, 0.0f, high: ((float)(this._maxModsToShow * 36)), isVisible: false); this.Add((UIComponent)this._box, true); this._fancyFont = new FancyBitmapFont("smallFont"); this._fancyFont.maxWidth = (int)this.width - 100; this._fancyFont.maxRows = 2; this.scrollBarOffset = 0; this._editModMenu = new UIMenu("<mod name>", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._editModMenu.Add((UIComponent)(this._disableOrEnableItem = new UIMenuItem("DISABLE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.EnableDisableMod)))), true); this._deleteOrUnsubItem = new UIMenuItem("DELETE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.DeleteMod))); this._uploadItem = new UIMenuItem("UPLOAD", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.UploadMod))); this._visitItem = new UIMenuItem("VISIT PAGE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.VisitModPage))); this._editModMenu.Add((UIComponent) new UIText(" ", Color.White), true); this._editModMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._editModMenu, (UIComponent)this)), true); this._editModMenu.Close(); this._yesNoMenu = new UIMenu("ARE YOU SURE?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._yesNoMenu.Add((UIComponent)(this._yesNoYes = new UIMenuItem("YES")), true); this._yesNoMenu.Add((UIComponent)(this._yesNoNo = new UIMenuItem("NO")), true); this._yesNoMenu.Close(); this._updateTextBox = new Textbox(0.0f, 0.0f, 0.0f, 0.0f); this._updateTextBox.depth = new Depth(0.9f); this._updateTextBox.maxLength = 5000; }
public void UpdateDefault() { if (Profiles.IsDefault(Profiles.active[0])) { InputProfile inputProfile = Profiles.active[0].inputProfile; Team team = Profiles.active[0].team; Profiles.active[0].team = (Team)null; Profiles.DefaultPlayer1.team = team; Profiles.DefaultPlayer1.inputProfile = inputProfile; } if (Level.current == null) { return; } foreach (Door door in Level.current.things[typeof(Door)]) { if (door._lockDoor) { door.locked = !Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]); } } }
public InputProfile GetVirtualInput(int index) { InputProfile inputProfile1; if (this._virtualProfiles.TryGetValue(index, out inputProfile1)) { return(inputProfile1); } InputProfile inputProfile2 = this.Add("virtual" + (object)index); inputProfile2.dindex = NetworkDebugger.networkDrawingIndex; VirtualInput virtualInput = new VirtualInput(index); virtualInput.pdraw = NetworkDebugger.networkDrawingIndex; for (int index1 = 0; index1 < Network.synchronizedTriggers.Count; ++index1) { inputProfile2.Map((InputDevice)virtualInput, Network.synchronizedTriggers[index1], index1); } virtualInput.availableTriggers = Network.synchronizedTriggers; this._virtualProfiles[index] = inputProfile2; return(inputProfile2); }
public override void DoUpdate() { this.lefpres = Mouse.left == InputState.Pressed; List <DCLine> dcLineList = (List <DCLine>)null; lock (DevConsole.debuggerLines) { dcLineList = DevConsole.debuggerLines; DevConsole.debuggerLines = new List <DCLine>(); } for (int index1 = 0; index1 < 4; ++index1) { if (index1 >= NetworkDebugger._instances.Count || !NetworkDebugger._instances[index1].active) { if (index1 <= NetworkDebugger._instances.Count) { int init = -1; InputProfile inputProfile1 = (InputProfile)null; foreach (InputProfile defaultProfile in InputProfile.defaultProfiles) { if (defaultProfile.Pressed("START")) { foreach (InputProfile inputProfile2 in NetworkDebugger.inputProfiles) { if (defaultProfile == inputProfile2) { break; } } for (int index2 = 0; index2 < 4; ++index2) { if (NetworkDebugger.inputProfiles[index2].name == "") { bool flag = false; foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces) { if (netDebugInterface.visible) { flag = true; break; } } if (!flag) { init = index1; inputProfile1 = defaultProfile; } NetworkDebugger.inputProfiles[index2] = defaultProfile; break; } } } } if (init != -1) { this.CreateInstance(init, false); NetworkDebugger._instances[index1].ipro = inputProfile1; } } } else { NetworkInstance instance = NetworkDebugger._instances[index1]; NetworkDebugger._networkDrawingIndex = index1; this.LockInstance(instance); float volume = SFX.volume; if (NetworkDebugger.Mute(NetworkDebugger._networkDrawingIndex)) { SFX.volume = 0.0f; } InputProfile.Update(); foreach (DCLine dcLine in dcLineList) { if (dcLine.threadIndex == index1) { DevConsole.core.lines.Enqueue(dcLine); } } DevConsole.Update(); Network.PreUpdate(); FireManager.Update(); Level.UpdateLevelChange(); Level.UpdateCurrentLevel(); MonoMain.UpdatePauseMenu(); int index2 = 0; foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces) { MonoMain.instance.IsMouseVisible = true; if (index2 == index1 && index2 < NetworkDebugger._instances.Count) { netDebugInterface.Update(NetworkDebugger._instances[index2].network); } ++index2; } Network.PostUpdate(); if (DuckNetwork.status == DuckNetStatus.Disconnected) { NetworkDebugger._instances[index1].active = false; foreach (Profile profile in NetworkDebugger._instances[index1].duckNetworkCore.profiles) { for (int index3 = 0; index3 < 4; ++index3) { if (NetworkDebugger.inputProfiles[index3] == profile.inputProfile || NetworkDebugger.inputProfiles[index3] == NetworkDebugger._instances[index1].ipro) { NetworkDebugger.inputProfiles[index3] = new InputProfile(); } } } } SFX.volume = volume; this.UnlockInstance(); } } if (!Keyboard.Pressed(Keys.F11)) { return; } foreach (NetworkInstance instance in NetworkDebugger._instances) { instance.network.core.ForcefulTermination(); } Network.activeNetwork.core.ForcefulTermination(); NetworkDebugger._instances.Clear(); NetworkDebugger.inputProfiles.Clear(); Level.current = (Level) new NetworkDebugger(); }
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 DuckAI(InputProfile manualQuacker = null) : base() { this._state.Push((AIState) new AIStateDeathmatchBot()); this._manualQuack = manualQuacker; }