コード例 #1
0
ファイル: InputManager.cs プロジェクト: delveam/keep-stalling
        private static InputProfile BasicInputProfile()
        {
            InputProfile basic = new InputProfile("Basic")
                                 .RegisterMapping(new InputMapping("Up")
            {
                Keys = new Keys[] { Keys.W, Keys.Up }, GamepadButtons = new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown }
            })
                                 .RegisterMapping(new InputMapping("Down")
            {
                Keys = new Keys[] { Keys.S, Keys.Down }, GamepadButtons = new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp, Buttons.RightThumbstickUp }
            })
                                 .RegisterMapping(new InputMapping("Left")
            {
                Keys = new Keys[] { Keys.A, Keys.Left }, GamepadButtons = new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft, Buttons.RightThumbstickLeft }
            })
                                 .RegisterMapping(new InputMapping("Right")
            {
                Keys = new Keys[] { Keys.D, Keys.Right }, GamepadButtons = new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight, Buttons.RightThumbstickRight }
            })
                                 .RegisterMapping(new InputMapping("Start")
            {
                Keys = new Keys[] { Keys.Enter }, GamepadButtons = new Buttons[] { Buttons.Start }
            });


            return(basic);
        }
コード例 #2
0
        public UIMenu(
            string title,
            float xpos,
            float ypos,
            float wide              = -1f,
            float high              = -1f,
            string conString        = "",
            InputProfile conProfile = null,
            bool tiny = false)
            : base(xpos, ypos, wide, high)
        {
            this._controlProfile = conProfile;
            this._splitter       = new UIDivider(false, 0.0f, 4f);
            this._section        = this._splitter.rightSection;
            UIText uiText = new UIText(title, Color.White);

            if (tiny)
            {
                BitmapFont f = new BitmapFont("smallBiosFontUI", 7, 5);
                uiText.SetFont(f);
            }
            uiText.align |= UIAlign.Top;
            this._splitter.topSection.Add((UIComponent)uiText, true);
            this._controlString = conString;
            if (this._controlString != "" && this._controlString != null)
            {
                UIDivider uiDivider = new UIDivider(false, 0.0f, 4f);
                this._controlText = new UIText(this._controlString, Color.White, heightAdd: 4f, controlProfile: this._controlProfile);
                uiDivider.bottomSection.Add((UIComponent)this._controlText, true);
                this.Add((UIComponent)uiDivider, true);
                this._section = uiDivider.topSection;
            }
            base.Add((UIComponent)this._splitter, true);
        }
コード例 #3
0
        public static Profile JoinLocalDuck(InputProfile input)
        {
            int num = 1;

            foreach (Profile profile in DuckNetwork.profiles)
            {
                if (profile.connection == DuckNetwork.localConnection)
                {
                    ++num;
                }
            }
            string name = Network.activeNetwork.core.GetLocalName();

            if (num > 1)
            {
                name = name + "(" + num.ToString() + ")";
            }

            //Invoke the private method. Hope its not too slow
            Profile profile1 = (Profile)createProfile.Invoke(null, new object[] { DuckNetwork.localConnection, name, -1, input, false, false, true });

            if (profile1 == null)
            {
                return((Profile)null);
            }
            profile1.networkStatus = !Network.isClient ? DuckNetStatus.Connected : DuckNetStatus.Connecting;

            // Our new OnNetworkConnecting which should bloody work
            TeamSelect2Edits.OnNetworkConnecting(profile1);

            DuckNetwork.SendNewProfile(profile1, DuckNetwork.localConnection, false);
            return(profile1);
        }
コード例 #4
0
        private static InputProfile BasicInputProfile()
        {
            InputProfile basic = new InputProfile("Basic");

            basic.CreateMapping(
                "Up",
                new Keys[] { Keys.W, Keys.Up },
                new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp, Buttons.RightThumbstickUp }
                );
            basic.CreateMapping(
                "Down",
                new Keys[] { Keys.S, Keys.Down },
                new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown }
                );
            basic.CreateMapping(
                "Left",
                new Keys[] { Keys.A, Keys.Left },
                new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft, Buttons.RightThumbstickLeft }
                );
            basic.CreateMapping(
                "Right",
                new Keys[] { Keys.D, Keys.Right },
                new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight, Buttons.RightThumbstickRight }
                );
            basic.CreateMapping(
                "Start",
                new Keys[] { Keys.Enter },
                new Buttons[] { Buttons.Start }
                );

            return(basic);
        }
コード例 #5
0
 public static bool Prefix()
 {
     for (int index = 0; index < 8; ++index)
     {
         InputProfile inputProfile = InputProfile.Add("MPPlayer" + (index + 1).ToString());
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "LEFT", 4, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "RIGHT", 8, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "UP", 1, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "DOWN", 2, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "JUMP", 4096, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "SHOOT", 16384, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "GRAB", 32768, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "QUACK", 8192, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "START", 16, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "STRAFE", 256, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "RAGDOLL", 512, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "LTRIGGER", 8388608, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "RTRIGGER", 4194304, false);
         inputProfile.Map((InputDevice)Input.GetDevice <GenericController>(index), "SELECT", 4096, false);
         if (index == 0)
         {
             InputProfile.active = inputProfile;
         }
     }
     Input.ApplyDefaultMappings();
     InputProfile.Add("Blank");
     return(false);
 }
コード例 #6
0
        /// <summary>
        /// A co-routine that checks for when the sensor becomes available.
        /// </summary>
        protected IEnumerator WaitForSensorAvailable()
        {
            int      timeoutMS = 4000;
            long     startTime = DateTime.Now.Ticks;
            TimeSpan elapsedTime;

            do
            {
                elapsedTime = new TimeSpan(DateTime.Now.Ticks - startTime);
                if (InputProfile.IsDeviceOn)
                {
                    break;
                }
                yield return(null);
            }while (elapsedTime.TotalMilliseconds < timeoutMS);

            if (!InputProfile.IsDeviceOn)
            {
                Debug.LogWarning("Cinema Mocap: Device failed to turn on. Ensure drivers are installed and your device is connected properly.");
                InputProfile.TurnOffDevice(); //profile can be "open" even when device isn't plugged in, close it.
            }
            else
            {
                Debug.Log("Cinema Mocap: Device started.");
                this.startTime = DateTime.Now;
            }
        }
コード例 #7
0
        public override void DrawInputSettings()
        {
            EditorGUILayout.BeginHorizontal();

            bool isDeviceActive = (InputProfile != null) && InputProfile.IsDeviceOn;

            EditorGUI.BeginDisabledGroup(isDeviceActive);

            GUIContent[] content = new GUIContent[inputProfiles.Count];
            for (int i = 0; i < inputProfiles.Count; i++)
            {
                content[i] = new GUIContent(inputProfiles[i].Attribute.ProfileName);
            }
            int tempSelection = EditorGUILayout.Popup(new GUIContent(INPUT), mocapProfileSelection, content);


            if (mocapProfileSelection != tempSelection || InputProfile == null)
            {
                mocapProfileSelection = tempSelection;

                InputProfile = BaseSystem.Activator.CreateInstance(inputProfiles[mocapProfileSelection].Type) as InputProfile;

                // Input Profile changed.
                inputProfileChanged();
            }

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();

            InputProfile.DrawInputSettings();
        }
コード例 #8
0
        public Player(float x, float y) : base(x, y, 64, 48)
        {
            sprite = new Sprite(x, y, "player");
            sprite.RotationOffset = new Vector2(sprite.Width / 2, sprite.Height / 2);

            InputProfile iprofile = new InputProfile("player")
                                    .RegisterMapping(new InputMapping("Up")
            {
                Keys = new Keys[] { Keys.W, Keys.Up }, GamepadButtons = new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp, Buttons.RightThumbstickUp }
            })
                                    .RegisterMapping(new InputMapping("Down")
            {
                Keys = new Keys[] { Keys.S, Keys.Down }, GamepadButtons = new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown }
            })
                                    .RegisterMapping(new InputMapping("Left")
            {
                Keys = new Keys[] { Keys.A, Keys.Left }, GamepadButtons = new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft, Buttons.RightThumbstickLeft }
            })
                                    .RegisterMapping(new InputMapping("Right")
            {
                Keys = new Keys[] { Keys.D, Keys.Right }, GamepadButtons = new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight, Buttons.RightThumbstickRight }
            })
                                    .RegisterMapping(new InputMapping("Air")
            {
                Keys = new Keys[] { Keys.LeftShift }, GamepadButtons = new Buttons[] { Buttons.LeftTrigger, Buttons.RightTrigger }
            });

            input = new InputHandler(PlayerIndex.One);
            input.LoadProfile(iprofile);

            Farts = new List <Gas>();

            stepSoundTracker = new Timer(400);
            canStep          = true;

            fartSoundTracker = new Timer(200);
            CanFart          = true;

            airCooldown = new Timer(1000);
            airTimer    = new Timer(500);
            airCooldown.Start();
            airTimer.Start();

            fartTimer = new Timer(2500);
            fartTimer.Start();

            debugBounds = new Quad(X, Y, Width, Height)
            {
                LineWidth = 2
            };

            debugBounds.ApplyChanges();

            DebugManager.RegisterDebugEntry(new DebugEntry("playerPos", "X:{0}, Y:{1}"));

            SetPosition(X, Y);
        }
コード例 #9
0
ファイル: Game1.cs プロジェクト: Fusionnist/LD43
        } //entity groups

        void CreateInputProfile()
        {
            ipp = new InputProfile(new List <KeyManager>()
            {
                new KeyManager(Keys.Left, "left"),
                new KeyManager(Keys.Right, "right"),
                new KeyManager(Keys.Up, "up"),
                new KeyManager(Keys.Down, "down")
            });
        } //check whatever is plugged in to create input settings
コード例 #10
0
        private void beginRecording()
        {
            cache        = new CaptureCache();
            captureState = RecordingState.Recording;
            session      = ScriptableObject.CreateInstance <MocapSession>();

            session.MetaData    = InputProfile.GetSessionMetaData();
            session.CaptureData = new List <MocapSessionKeyframe>();

            startTime = DateTime.Now;
        }
コード例 #11
0
        protected override void Initialize()
        {
            transitionTimer = new Timer(2f);
            ipp             = new InputProfile(new KeyManager[]
            {
                new KeyManager(Keys.Right, "right"),
                new KeyManager(Keys.Left, "left"),
                new KeyManager(Keys.R, "restart"),
            });

            inputProfile   = new InputProfile(new KeyManager[] { new KeyManager(Keys.Left, "playerLeft"), new KeyManager(Keys.Right, "playerRight"), new KeyManager(Keys.Up, "playerUp"), new KeyManager(Keys.Down, "playerDown") });
            phase          = GamePhase.Menu;
            mouseMan       = new CursorManager();
            IsMouseVisible = false;
            EntityCollection.CreateGroup("turret", "turrets");
            EntityCollection.CreateGroup("rock", "rocks");
            EntityCollection.CreateGroup("enemy", "enemies");
            EntityCollection.CreateGroup("bgElement", "bgElements");
            EntityCollection.CreateGroup(new Property("isEnt", "isEnt", "isEnt"), "entities");
            virtualDims = new Point(400, 272);

            TDdims = new Point(240, 240);
            TAdims = new Point(160, 272);

            TDFrame = new Rectangle(0, 0, TDdims.X, TDdims.Y);
            TAFrame = new Rectangle(240, 0, TAdims.X, TAdims.Y);

            scenes = new SceneCollection();
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TAdims.X, TAdims.Y), "text"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, virtualDims.X, virtualDims.Y), "menu"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TDdims.X, TDdims.Y), "td"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, virtualDims.X, virtualDims.Y), "game"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TDdims.X, virtualDims.Y - TDdims.Y), "status"));

            eventNb = 0;
            XDocument xdoc = XDocument.Load("Content\\eventStuff.xml");
            XElement  el;

            do
            {
                el = xdoc.Root.Element("EventQueue" + eventNb.ToString());
                eventNb++;
            } while (el != null);
            eventNb--;

            waitingEventQueueNbs = new List <int>();

            base.Initialize();

            waveTimer = new Timer(15);
        }
コード例 #12
0
        public MocapWorkflow GetUserDefaultWorkflow()
        {
            //Get workflow phase from default input
            List <InputProfileMetaData> inputProfiles = InputProfile.LoadMetaData(MocapWorkflow.Record, MocapWorkflow.Review);

            // Try to load the user's preferred input method.
            if (EditorPrefs.HasKey(CinemaMocapSettingsWindow.InputProfileKey))
            {
                string label  = EditorPrefs.GetString(CinemaMocapSettingsWindow.InputProfileKey);
                int    result = inputProfiles.FindIndex(item => item.Attribute.ProfileName == label);
                // Set the correct workflow phase
                return(inputProfiles[result].Attribute.MocapPhase);
            }
            return(MocapWorkflow.Record);
        }
コード例 #13
0
        public override void DrawPipelineSettings()
        {
            EditorGUI.BeginDisabledGroup(!InputProfile.IsDeviceOn);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(" ");
            if (GUILayout.Button(new GUIContent("Save"), EditorStyles.miniButton))
            {
                saveSession = false;

                MocapSession session = InputProfile.GetSession();
                saveAnimation(session);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();
        }
コード例 #14
0
ファイル: ConfigsGB.cs プロジェクト: fattard/xFF
                public ConfigsGB( )
                {
                    paths          = new Paths();
                    bootRomDMG     = new BootROM();
                    bootRomSGB     = new BootROM();
                    bootRomCGB     = new BootROM();
                    audio          = new Audio();
                    graphics       = new Graphics();
                    dmgColors      = new DMGColors();
                    inputProfiles  = new InputProfile[4];
                    emulatedSystem = Defs.HardwareModel.DMG.ToString();
                    linkPortDevice = Defs.LinkPortDevices.None.ToString();

                    for (int i = 0; i < inputProfiles.Length; ++i)
                    {
                        inputProfiles[i] = new InputProfile();
                    }
                }
コード例 #15
0
ファイル: InputFrame.cs プロジェクト: jshavs1/Momentum
    public InputFrame(InputProfile inputProfile)
    {
        x      = inputProfile.x();
        y      = inputProfile.y();
        h      = inputProfile.h();
        v      = inputProfile.v();
        scroll = inputProfile.scroll();

        CameraController cc;

        if (cc = Camera.main.GetComponent <CameraController>())
        {
            Vector2 relInput = cc.InputToCameraSpace(new Vector2(x, y));
            x = relInput.x;
            y = relInput.y;
        }

        JumpPress = inputProfile.JumpPress();
        JumpHold  = inputProfile.JumpHold();

        PrimaryPress = inputProfile.PrimaryPress();
        PrimaryHold  = inputProfile.PrimaryHold();

        SecondaryPress = inputProfile.SecondaryPress();
        SecondaryHold  = inputProfile.SecondaryHold();

        Ability3Press = inputProfile.Ability1Press();
        Ability3Hold  = inputProfile.Ability1Hold();

        Ability4Press = inputProfile.Ability2Press();
        Ability4Hold  = inputProfile.Ability2Hold();

        Ability5Press = inputProfile.Ability3Press();
        Ability5Hold  = inputProfile.Ability3Hold();

        DidScrollUp   = inputProfile.DidScrollUp();
        DidScrollDown = inputProfile.DidScrollDown();
    }
コード例 #16
0
        protected override void Initialize()
        {
            dist = new Timer(0.2f);

            easeOut = new Timer(5f);
            easeIn  = new Timer(3f);

            gameState      = GameState.Menu;
            currentUInb    = 0;
            score          = 0;
            IsMouseVisible = true;
            blackness      = 0.5f;
            fading         = true;
            goingToMenu    = false;
            //VALUES

            //UTILITY
            ebuilder = new EntBuilder42();

            scenes = new SceneCollection();
            scenes.scenes.Add(new Scene(
                                  new RenderTarget2D(GraphicsDevice, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, wdims.X, wdims.Y),
                                  "main"
                                  ));

            scenes.scenes.Add(new Scene(
                                  new RenderTarget2D(GraphicsDevice, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  "UI"
                                  ));

            scenes.scenes.Add(new Scene(
                                  new RenderTarget2D(GraphicsDevice, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  "game"
                                  ));

            scenes.scenes.Add(new Scene(
                                  new RenderTarget2D(GraphicsDevice, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  new Rectangle(0, 0, vdims.X, vdims.Y),
                                  "inven"
                                  ));

            cursorManager = new CursorManager();
            KeyManager[] keyManagers = new KeyManager[] { };
            ipp     = InputProfile.GetLetterProfile();
            fdrawer = new FontDrawer();

            List <TextureDrawer> chars = new List <TextureDrawer>();
            string white = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!:;.-_@";

            for (int i = 0; i < white.Length; i++)
            {
                chars.Add(new TextureDrawer(Content.Load <Texture2D>("Placeholder/font_white"), new TextureFrame(new Rectangle(i * 6, 0, 5, 11), Point.Zero), null, white[i].ToString()));
            }
            white = "abcdefghijklmnopqrstuvwxyz";
            for (int i = 0; i < white.Length; i++)
            {
                chars.Add(new TextureDrawer(Content.Load <Texture2D>("Placeholder/font_white"), new TextureFrame(new Rectangle(i * 6, 13, 5, 11), Point.Zero), null, white[i].ToString()));
            }
            //real font
            List <TextureDrawer> char2s = new List <TextureDrawer>();

            white = "01234";
            for (int i = 0; i < white.Length; i++)
            {
                char2s.Add(new TextureDrawer(Content.Load <Texture2D>("UI/score"), new TextureFrame(new Rectangle(i * 16, 16, 16, 16), Point.Zero), null, white[i].ToString()));
            }
            white = "56789";
            for (int i = 0; i < white.Length; i++)
            {
                char2s.Add(new TextureDrawer(Content.Load <Texture2D>("UI/score"), new TextureFrame(new Rectangle(i * 16, 32, 16, 16), Point.Zero), null, white[i].ToString()));
            }


            fdrawer.fonts = new List <DrawerCollection> {
                new DrawerCollection(chars, "whitefont"), new DrawerCollection(char2s, "realfont")
            };

            ipp.AddArrowInput();

            base.Initialize();
        }
コード例 #17
0
            static bool Prefix(TeamSelect2 __instance)
            {
                // TO IMPLEMENT
                //++Global.data.bootedSinceUpdate;
                //Global.Save();
                // TO IMPLEMENT

                List <DuckPersona> personas = Persona.all as List <DuckPersona>;
                // Get the private fields by reflection
                Type teamselect2type = typeof(TeamSelect2);

                dynamic littleFont           = teamselect2type.GetField("_littleFont", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic countdownScreen      = teamselect2type.GetField("_countdownScreen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic countdown            = teamselect2type.GetField("_countdown", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic profiles             = teamselect2type.GetField("_profiles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic font                 = teamselect2type.GetField("_font", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic buttons              = teamselect2type.GetField("_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic beam                 = teamselect2type.GetField("_beam", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic configGroup          = teamselect2type.GetField("_configGroup", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic multiplayerMenu      = teamselect2type.GetField("_multiplayerMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic modifierMenu         = teamselect2type.GetField("_modifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic levelSelectMenu      = teamselect2type.GetField("_levelSelectMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic playOnlineGroup      = teamselect2type.GetField("_playOnlineGroup", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic playOnlineMenu       = teamselect2type.GetField("_playOnlineMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic hostGameMenu         = teamselect2type.GetField("_hostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic browseGamesMenu      = teamselect2type.GetField("_browseGamesMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic miniHostGameMenu     = teamselect2type.GetField("_miniHostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic joinGameMenu         = teamselect2type.GetField("_joinGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic filtersMenu          = teamselect2type.GetField("_filtersMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic filterModifierMenu   = teamselect2type.GetField("_filterModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic matchmaker           = teamselect2type.GetField("_matchmaker", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic hostGameSettingsMenu = teamselect2type.GetField("_hostGameSettingsMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic hostGameModifierMenu = teamselect2type.GetField("_hostGameModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic createGame           = teamselect2type.GetField("_createGame", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
                dynamic hostGame             = teamselect2type.GetField("_hostGame", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);

                // End of getting fields

                TeamSelect2.customLevels = TeamSelect2.prevCustomLevels = 0;
                if (!Network.isActive)
                {
                    Level.core.gameInProgress = false;
                }
                if (!Level.core.gameInProgress)
                {
                    Main.ResetMatchStuff();
                    Main.ResetGameStuff();
                    DuckNetwork.ClosePauseMenu();
                }
                else
                {
                    ConnectionStatusUI.Hide();
                    if (Network.isServer)
                    {
                        if (Steam.lobby != null)
                        {
                            Steam.lobby.SetLobbyData("started", "false");
                            Steam.lobby.joinable = true;
                        }
                        DuckNetwork.inGame = false;
                        foreach (Profile profile in DuckNetwork.profiles)
                        {
                            if (profile.connection == null && profile.slotType != SlotType.Reserved)
                            {
                                profile.slotType = SlotType.Closed;
                            }
                        }
                    }
                }
                if (Network.isActive && Network.isServer)
                {
                    DuckNetwork.ChangeSlotSettings();
                }
                littleFont                 = new BitmapFont("smallBiosFontUI", 7, 5);
                countdownScreen            = new Sprite("title/wideScreen", 0.0f, 0.0f);
                __instance.backgroundColor = Color.Black;
                DuckNetwork.levelIndex     = (byte)0;
                if (Network.isActive && Network.isServer)
                {
                    GhostManager.context.SetGhostIndex((NetIndex16)32);
                }
                countdown        = new SpriteMap("countdown", 32, 32, false);
                countdown.center = new Vec2(16f, 16f);
                Profile defaultProfile1 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == Persona.Duck1);
                    }
                    return(false);
                })) ?? Profiles.DefaultPlayer1;
                Profile defaultProfile2 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == Persona.Duck2);
                    }
                    return(false);
                })) ?? Profiles.DefaultPlayer2;
                Profile defaultProfile3 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == Persona.Duck3);
                    }
                    return(false);
                })) ?? Profiles.DefaultPlayer3;
                Profile defaultProfile4 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == Persona.Duck4);
                    }
                    return(false);
                })) ?? Profiles.DefaultPlayer4;
                Profile defaultProfile5 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == personas[4]);
                    }
                    return(false);
                })) ?? Profiles.core.all.ElementAt(4);
                Profile defaultProfile6 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == personas[5]);
                    }
                    return(false);
                })) ?? Profiles.core.all.ElementAt(5);
                Profile defaultProfile7 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == personas[6]);
                    }
                    return(false);
                })) ?? Profiles.core.all.ElementAt(6);
                Profile defaultProfile8 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == personas[7]);
                    }
                    return(false);
                })) ?? Profiles.core.all.ElementAt(7);

                float       xpos          = 1f;
                ProfileBox2 profileBox2_1 = new ProfileBox2(xpos, 1f, InputProfile.Get("MPPlayer1"), defaultProfile1, __instance, 0);

                profiles.Add(profileBox2_1);
                Level.Add((Thing)profileBox2_1);
                ProfileBox2 profileBox2_2 = new ProfileBox2(xpos + 119f, 1f, InputProfile.Get("MPPlayer2"), defaultProfile2, __instance, 1);

                profiles.Add(profileBox2_2);
                Level.Add((Thing)profileBox2_2);
                ProfileBox2 profileBox2_3 = new ProfileBox2(xpos + 238f, 1f, InputProfile.Get("MPPlayer3"), defaultProfile3, __instance, 2);

                profiles.Add(profileBox2_3);
                Level.Add((Thing)profileBox2_3);
                ProfileBox2 profileBox2_4 = new ProfileBox2(xpos, 62f, InputProfile.Get("MPPlayer4"), defaultProfile4, __instance, 3);

                profiles.Add(profileBox2_4);
                Level.Add((Thing)profileBox2_4);
                ProfileBox2 profileBox2_5 = new ProfileBox2(xpos + 238f, 62f, InputProfile.Get("MPPlayer5"), defaultProfile5, __instance, 4);

                profiles.Add(profileBox2_5);
                Level.Add((Thing)profileBox2_5);
                ProfileBox2 profileBox2_6 = new ProfileBox2(xpos, 121f, InputProfile.Get("MPPlayer6"), defaultProfile6, __instance, 5);

                profiles.Add(profileBox2_6);
                Level.Add((Thing)profileBox2_6);
                ProfileBox2 profileBox2_7 = new ProfileBox2(xpos + 119f, 121f, InputProfile.Get("MPPlayer7"), defaultProfile7, __instance, 6);

                profiles.Add(profileBox2_7);
                Level.Add((Thing)profileBox2_7);
                ProfileBox2 profileBox2_8 = new ProfileBox2(xpos + 238f, 121f, InputProfile.Get("MPPlayer8"), defaultProfile8, __instance, 7);

                profiles.Add(profileBox2_8);
                Level.Add((Thing)profileBox2_8);

                Saxaphone spicySax = new Saxaphone(160f, 100f);

                spicySax.infinite = true;
                Level.Add(spicySax);

                if (Network.isActive)
                {
                    __instance.PrepareForOnline();
                }
                else
                {
                    __instance.BuildPauseMenu(false);
                }
                font       = new BitmapFont("biosFont", 8, -1);
                font.scale = new Vec2(1f, 1f);
                buttons    = new SpriteMap("buttons", 14, 14, false);
                buttons.CenterOrigin();
                buttons.depth = (Depth)0.9f;
                Music.Play("CharacterSelect", true, 0.0f);
                beam = new TeamBeam(101f, 0.0f);
                Level.Add((Thing)beam);

                beam = new TeamBeam(219f, 0.0f);
                Level.Add((Thing)beam);
                TeamSelect2.UpdateModifierStatus();
                configGroup     = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
                multiplayerMenu = new UIMenu("@LWING@MATCH SETTINGS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                modifierMenu    = new UIMenu("MODIFIERS", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST  @QUACK@BACK", (InputProfile)null, false);
                levelSelectMenu = (UIMenu) new LevelSelectCompanionMenu(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, multiplayerMenu);
                foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier))
                {
                    if (unlock.unlocked)
                    {
                        modifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true);
                    }
                    else
                    {
                        modifierMenu.Add((UIComponent) new UIMenuItem("@TINYLOCK@LOCKED", (UIMenuAction)null, UIAlign.Center, Color.Red, false), true);
                    }
                }
                modifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                modifierMenu.Add((UIComponent) new UIMenuItem("OK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)modifierMenu, (UIComponent)multiplayerMenu), UIAlign.Center, new Color(), true), true);
                modifierMenu.Close();
                foreach (MatchSetting matchSetting in TeamSelect2.matchSettings)
                {
                    if (!(matchSetting.id == "workshopmaps") || Network.available)
                    {
                        multiplayerMenu.AddMatchSetting(matchSetting, false, true);
                    }
                }
                multiplayerMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                multiplayerMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)multiplayerMenu, (UIComponent)modifierMenu), UIAlign.Center, new Color(), false), true);
                multiplayerMenu.Add((UIComponent) new UICustomLevelMenu((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)multiplayerMenu, (UIComponent)levelSelectMenu), UIAlign.Center, new Color(), false), true);
                multiplayerMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                multiplayerMenu.Add((UIComponent) new UIMenuItem("OK", (UIMenuAction) new UIMenuActionCloseMenu(configGroup), UIAlign.Center, new Color(), true), true);
                multiplayerMenu.Close();
                configGroup.Add((UIComponent)multiplayerMenu, false);
                configGroup.Add((UIComponent)modifierMenu, false);
                configGroup.Add((UIComponent)levelSelectMenu, false);
                configGroup.Close();
                Level.Add((Thing)configGroup);
                playOnlineGroup      = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f);
                playOnlineMenu       = new UIMenu("@PLANET@PLAY ONLINE@PLANET@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                hostGameMenu         = new UIMenu("@LWING@CREATE GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                browseGamesMenu      = (UIMenu) new UIServerBrowser(playOnlineMenu, "SERVER BROWSER", Layer.HUD.camera.width, Layer.HUD.camera.height, 550f, -1f, "@DPAD@@SELECT@JOIN @SHOOT@REFRESH @QUACK@BACK", (InputProfile)null);
                miniHostGameMenu     = new UIMenu("@LWING@HOST GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                joinGameMenu         = new UIMenu("@LWING@FIND GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                filtersMenu          = new UIMenu("@LWING@FILTERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@SELECT@SELECT  @GRAB@TYPE", (InputProfile)null, false);
                filterModifierMenu   = new UIMenu("@LWING@FILTER MODIFIERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                matchmaker           = new UIMatchmakingBox(joinGameMenu, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f);
                hostGameSettingsMenu = new UIMenu("@LWING@SETTINGS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                hostGameModifierMenu = new UIMenu("@LWING@MODIFIERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST  @SELECT@SELECT", (InputProfile)null, false);
                if ((string)typeof(ModLoader).GetProperty("modHash", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null, null) != "nomods")
                {
                    playOnlineMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)playOnlineMenu, new UIMenuActionCloseMenuCallFunction.Function(__instance.OpenNoModsFindGame)), UIAlign.Center, new Color(), false), true);
                    playOnlineMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)playOnlineMenu, new UIMenuActionCloseMenuCallFunction.Function(__instance.OpenNoModsCreateGame)), UIAlign.Center, new Color(), false), true);
                }
                else
                {
                    playOnlineMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)joinGameMenu), UIAlign.Center, new Color(), false), true);
                    playOnlineMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)hostGameMenu), UIAlign.Center, new Color(), false), true);
                }
                playOnlineMenu.Add((UIComponent) new UIMenuItem("BROWSE GAMES", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)browseGamesMenu), UIAlign.Center, new Color(), false), true);
                playOnlineMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                playOnlineMenu.Add((UIComponent) new UIMenuItem("CANCEL", (UIMenuAction) new UIMenuActionCloseMenuCallFunction(playOnlineGroup, new UIMenuActionCloseMenuCallFunction.Function(__instance.ClosedOnline)), UIAlign.Center, new Color(), true), true);
                playOnlineMenu.Close();
                playOnlineGroup.Add((UIComponent)playOnlineMenu, false);
                foreach (MatchSetting onlineSetting in TeamSelect2.onlineSettings)
                {
                    if (!onlineSetting.filterOnly)
                    {
                        hostGameMenu.AddMatchSetting(onlineSetting, false, true);
                    }
                }
                hostGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                hostGameMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(playOnlineGroup, createGame), UIAlign.Center, new Color(), false), true);
                hostGameMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameMenu, (UIComponent)playOnlineMenu), UIAlign.Center, new Color(), true), true);
                hostGameMenu.Close();
                browseGamesMenu.Close();
                playOnlineGroup.Add((UIComponent)browseGamesMenu, false);
                playOnlineGroup.Add((UIComponent)hostGameMenu, false);
                miniHostGameMenu.AddMatchSetting(TeamSelect2.GetOnlineSetting("type"), false, true);
                miniHostGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                miniHostGameMenu.Add((UIComponent) new UIMenuItem("HOST GAME", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean((UIComponent)miniHostGameMenu, hostGame), UIAlign.Center, new Color(), false), true);
                miniHostGameMenu.Add((UIComponent) new UIMenuItem("CANCEL", (UIMenuAction) new UIMenuActionCloseMenu((UIComponent)miniHostGameMenu), UIAlign.Center, new Color(), true), true);
                miniHostGameMenu.Close();
                Level.Add((Thing)miniHostGameMenu);
                foreach (MatchSetting onlineSetting in TeamSelect2.onlineSettings)
                {
                    if (!onlineSetting.createOnly)
                    {
                        joinGameMenu.AddMatchSetting(onlineSetting, true, true);
                    }
                }
                joinGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                joinGameMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)joinGameMenu, (UIComponent)matchmaker), UIAlign.Center, new Color(), false), true);
                joinGameMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)joinGameMenu, (UIComponent)playOnlineMenu), UIAlign.Center, new Color(), true), true);
                joinGameMenu.Close();
                playOnlineGroup.Add((UIComponent)joinGameMenu, false);
                foreach (MatchSetting matchSetting in TeamSelect2.matchSettings)
                {
                    if (!(matchSetting.id == "workshopmaps") || Network.available)
                    {
                        filtersMenu.AddMatchSetting(matchSetting, true, true);
                    }
                }
                filtersMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                filtersMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filtersMenu, (UIComponent)filterModifierMenu), UIAlign.Center, new Color(), false), true);
                filtersMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                filtersMenu.Add((UIComponent) new UIMenuItem("|DGBLUE|CLEAR FILTERS", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(__instance.ClearFilters)), UIAlign.Center, new Color(), false), true);
                filtersMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filtersMenu, (UIComponent)joinGameMenu), UIAlign.Center, new Color(), true), true);
                filtersMenu.Close();
                playOnlineGroup.Add((UIComponent)filtersMenu, false);
                foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier))
                {
                    filterModifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), new FieldBinding((object)unlock, "filtered", 0.0f, 1f, 0.1f), (List <string>)null, false, false), true);
                }
                filterModifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                filterModifierMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filterModifierMenu, (UIComponent)filtersMenu), UIAlign.Center, new Color(), true), true);
                filterModifierMenu.Close();
                playOnlineGroup.Add((UIComponent)filterModifierMenu, false);
                foreach (MatchSetting matchSetting in TeamSelect2.matchSettings)
                {
                    if (!(matchSetting.id == "workshopmaps") || Network.available)
                    {
                        hostGameSettingsMenu.AddMatchSetting(matchSetting, false, true);
                    }
                }
                hostGameSettingsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                hostGameSettingsMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameSettingsMenu, (UIComponent)hostGameModifierMenu), UIAlign.Center, new Color(), false), true);
                hostGameSettingsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                hostGameSettingsMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameSettingsMenu, (UIComponent)hostGameMenu), UIAlign.Center, new Color(), true), true);
                hostGameSettingsMenu.Close();
                playOnlineGroup.Add((UIComponent)hostGameSettingsMenu, false);
                foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier))
                {
                    hostGameModifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true);
                }
                hostGameModifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true);
                hostGameModifierMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameModifierMenu, (UIComponent)hostGameSettingsMenu), UIAlign.Center, new Color(), true), true);
                hostGameModifierMenu.Close();
                playOnlineGroup.Add((UIComponent)hostGameModifierMenu, false);
                matchmaker.Close();
                playOnlineGroup.Add((UIComponent)matchmaker, false);
                playOnlineGroup.Close();
                Level.Add((Thing)playOnlineGroup);
                Graphics.fade = 0.0f;
                Layer l = new Layer("HUD2", -85, new Camera(), false, new Vec2());

                l.camera.width  /= 2f;
                l.camera.height /= 2f;
                Layer.Add(l);
                Layer hud = Layer.HUD;

                Layer.HUD          = l;
                Editor.gamepadMode = true;
                Layer.HUD          = hud;

                // Start of setting private fields
                teamselect2type.GetField("_littleFont", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, littleFont);
                teamselect2type.GetField("_countdownScreen", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, countdownScreen);
                teamselect2type.GetField("_countdown", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, countdown);
                teamselect2type.GetField("_profiles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, profiles);
                teamselect2type.GetField("_font", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, font);
                teamselect2type.GetField("_buttons", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, buttons);
                teamselect2type.GetField("_beam", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, beam);
                teamselect2type.GetField("_configGroup", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, configGroup);
                teamselect2type.GetField("_multiplayerMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, multiplayerMenu);
                teamselect2type.GetField("_modifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, modifierMenu);
                teamselect2type.GetField("_levelSelectMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, levelSelectMenu);
                teamselect2type.GetField("_playOnlineGroup", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, playOnlineGroup);
                teamselect2type.GetField("_playOnlineMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, playOnlineMenu);
                teamselect2type.GetField("_hostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameMenu);
                teamselect2type.GetField("_browseGamesMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, browseGamesMenu);
                teamselect2type.GetField("_miniHostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, miniHostGameMenu);
                teamselect2type.GetField("_joinGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, joinGameMenu);
                teamselect2type.GetField("_filtersMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, filtersMenu);
                teamselect2type.GetField("_filterModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, filterModifierMenu);
                teamselect2type.GetField("_matchmaker", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, matchmaker);
                teamselect2type.GetField("_hostGameSettingsMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameSettingsMenu);
                teamselect2type.GetField("_hostGameModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameModifierMenu);
                teamselect2type.GetField("_createGame", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, createGame);
                teamselect2type.GetField("_hostGame", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGame);
                // End of setting private fields

                if (DuckNetwork.ShowUserXPGain() || !Unlockables.HasPendingUnlocks())
                {
                    return(false);
                }
                MonoMain.pauseMenu = (UIComponent) new UIUnlockBox(Unlockables.GetPendingUnlocks().ToList <Unlockable>(), Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f);

                return(false);
            }
コード例 #18
0
ファイル: InputManager.cs プロジェクト: thismarvin/relatus
 /// <summary>
 /// Save an <see cref="InputProfile"/> for future reference.
 /// </summary>
 /// <param name="profile"> The input profile that should be saved.</param>
 public static void SaveProfile(InputProfile profile)
 {
     profiles.Register(profile.Name, profile);
 }
コード例 #19
0
            public static bool Prefix(DuckNetworkCore __instance)
            {
                __instance.profiles.Clear();
                for (int index = 0; index < 8; ++index)
                {
                    __instance.profiles.Add(new Profile("Netduck" + (index + 1).ToString(), InputProfile.GetVirtualInput(index), null, Persona.all.ElementAt(index), true, null)
                    {
                        networkIndex = (byte)index
                    });
                }

                return(false);
            }
コード例 #20
0
        public void Initialize()
        {
            Type               typea     = typeof(Persona);
            FieldInfo          info2     = typea.GetField("_personas", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
            List <DuckPersona> _personas = info2.GetValue(null) as List <DuckPersona>;

            List <Profile> _profilesList = new List <Profile>()
            {
                new Profile("Player1", InputProfile.Get("MPPlayer1"), Teams.Player1, Persona.Duck1, false, "PLAYER1"),
                new Profile("Player2", InputProfile.Get("MPPlayer2"), Teams.Player2, Persona.Duck2, false, "PLAYER2"),
                new Profile("Player3", InputProfile.Get("MPPlayer3"), Teams.Player3, Persona.Duck3, false, "PLAYER3"),
                new Profile("Player4", InputProfile.Get("MPPlayer4"), Teams.Player4, Persona.Duck4, false, "PLAYER4"),
                new Profile("Player5", InputProfile.Get("MPPlayer5"), Teams.core.teams[4], _personas[4], false, "PLAYER5"),
                new Profile("Player6", InputProfile.Get("MPPlayer6"), Teams.core.teams[5], _personas[5], false, "PLAYER6"),
                new Profile("Player7", InputProfile.Get("MPPlayer7"), Teams.core.teams[6], _personas[6], false, "PLAYER7"),
                new Profile("Player8", InputProfile.Get("MPPlayer8"), Teams.core.teams[7], _personas[7], false, "PLAYER8")
            };

            FieldInfo _profilesField = typeof(ProfilesCore).GetField("_profiles", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

            _profilesField.SetValue(profilecore, _profilesList);

            Profile.loading = true;
            string[]       files        = DuckFile.GetFiles(DuckFile.profileDirectory, "*.*");
            List <Profile> profileList1 = new List <Profile>();

            foreach (string path in files)
            {
                XDocument xdocument = DuckFile.LoadXDocument(path);
                if (xdocument != null)
                {
                    string  name = xdocument.Element("Profile").Element("Name").Value;
                    bool    flag = false;
                    Profile p    = _profilesList.FirstOrDefault <Profile>(pro => pro.name == name);
                    if (p == null || !Profiles.IsDefault(p))
                    {
                        p          = new Profile("", null, null, null, false, null);
                        p.fileName = path;
                        flag       = true;
                    }
                    IEnumerable <XElement> source = xdocument.Elements("Profile");
                    if (source != null)
                    {
                        foreach (XElement element1 in source.Elements <XElement>())
                        {
                            if (element1.Name.LocalName == "ID" && !Profiles.IsDefault(p))
                            {
                                p.SetID(element1.Value);
                            }
                            else if (element1.Name.LocalName == "Name")
                            {
                                p.name = element1.Value;
                            }
                            else if (element1.Name.LocalName == "Mood")
                            {
                                p.funslider = Convert.ToSingle(element1.Value);
                            }
                            else if (element1.Name.LocalName == "SteamID")
                            {
                                p.steamID = Convert.ToUInt64(element1.Value);
                                if ((long)p.steamID != 0L)
                                {
                                    profileList1.Add(p);
                                }
                            }
                            else if (element1.Name.LocalName == "LastKnownName")
                            {
                                p.lastKnownName = element1.Value;
                            }
                            else if (element1.Name.LocalName == "Stats")
                            {
                                p.stats.Deserialize(element1);
                            }
                            else if (element1.Name.LocalName == "Unlocks")
                            {
                                string[] strArray = element1.Value.Split('|');
                                p.unlocks = new List <string>(strArray);
                            }
                            else if (element1.Name.LocalName == "Tickets")
                            {
                                p.ticketCount = Convert.ToInt32(element1.Value);
                            }
                            else if (element1.Name.LocalName == "Mappings" && !MonoMain.defaultControls)
                            {
                                p.inputMappingOverrides.Clear();
                                foreach (XElement element2 in element1.Elements())
                                {
                                    if (element2.Name.LocalName == "InputMapping")
                                    {
                                        DeviceInputMapping deviceInputMapping = new DeviceInputMapping();
                                        deviceInputMapping.Deserialize(element2);
                                        p.inputMappingOverrides.Add(deviceInputMapping);
                                    }
                                }
                            }
                        }
                    }
                    if (flag)
                    {
                        _profilesList.Add(p);
                    }
                }
            }
            byte    localFlippers = Profile.CalculateLocalFlippers();
            Profile p1            = null;

            if (Steam.user != null && (long)Steam.user.id != 0L)
            {
                string str = Steam.user.id.ToString();
                foreach (Profile allCustomProfile in Profiles.allCustomProfiles)
                {
                    if ((long)allCustomProfile.steamID == (long)Steam.user.id && allCustomProfile.id == str && allCustomProfile.rawName == str)
                    {
                        p1 = allCustomProfile;
                        break;
                    }
                }
                if (p1 == null)
                {
                    p1         = new Profile(Steam.user.id.ToString(), null, null, null, false, Steam.user.id.ToString());
                    p1.steamID = Steam.user.id;
                    Profiles.Add(p1);
                    profilecore.Save(p1);
                }
            }
            if (p1 != null)
            {
                _profilesList.Remove(p1);
                _profilesList.Insert(8, p1);
                List <Profile> source       = new List <Profile>();
                List <Profile> profileList2 = new List <Profile>();
                foreach (Profile allCustomProfile in Profiles.allCustomProfiles)
                {
                    string str = allCustomProfile.steamID.ToString();
                    if ((long)allCustomProfile.steamID != 0L)
                    {
                        if (allCustomProfile.id == str && allCustomProfile.rawName == str)
                        {
                            source.Add(allCustomProfile);
                        }
                        else
                        {
                            profileList2.Add(allCustomProfile);
                        }
                    }
                }
                using (List <Profile> .Enumerator enumerator = profileList2.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Profile pro = enumerator.Current;
                        Profile p2  = source.FirstOrDefault <Profile>(x => (long)x.steamID == (long)pro.steamID);
                        if (p2 == null)
                        {
                            p2         = new Profile(pro.steamID.ToString(), null, null, null, false, pro.steamID.ToString());
                            p2.steamID = pro.steamID;
                            Profiles.Add(p2);
                        }
                        p2.stats = (ProfileStats)(p2.stats + pro.stats);
                        foreach (KeyValuePair <string, List <ChallengeSaveData> > keyValuePair in Challenges.saveData)
                        {
                            ChallengeSaveData        challengeSaveData1    = null;
                            List <ChallengeSaveData> challengeSaveDataList = new List <ChallengeSaveData>();
                            foreach (ChallengeSaveData challengeSaveData2 in keyValuePair.Value)
                            {
                                if (challengeSaveData2.profileID == pro.id || challengeSaveData2.profileID == p2.id)
                                {
                                    challengeSaveData2.profileID = p2.id;
                                    if (challengeSaveData1 == null)
                                    {
                                        challengeSaveData1 = challengeSaveData2;
                                    }
                                    else if (challengeSaveData2.trophy > challengeSaveData1.trophy)
                                    {
                                        challengeSaveDataList.Add(challengeSaveData1);
                                        challengeSaveData1 = challengeSaveData2;
                                    }
                                    else
                                    {
                                        challengeSaveDataList.Add(challengeSaveData2);
                                    }
                                }
                            }
                            foreach (ChallengeSaveData challengeSaveData2 in challengeSaveDataList)
                            {
                                string str = challengeSaveData2.profileID + "OBSOLETE";
                                challengeSaveData2.profileID = str;
                            }
                            if (challengeSaveData1 != null)
                            {
                                Challenges.Save(keyValuePair.Key);
                            }
                        }
                        _profilesList.Remove(pro);
                        DuckFile.Delete(pro.fileName);
                        profilecore.Save(p2);
                    }
                }
            }
            foreach (Profile profile in _profilesList)
            {
                profile.flippers    = localFlippers;
                profile.ticketCount = Challenges.GetTicketCount(profile);
                if (profile.ticketCount < 0)
                {
                    profile.ticketCount = 0;
                }
            }
            Profile.loading = false;
        }
コード例 #21
0
        public override void DrawInputSettings()
        {
            EditorGUILayout.BeginHorizontal();

            bool isDeviceActive = (InputProfile != null) && InputProfile.IsDeviceOn;

            EditorGUI.BeginDisabledGroup(isDeviceActive);

            GUIContent[] content = new GUIContent[inputProfiles.Count];
            for (int i = 0; i < inputProfiles.Count; i++)
            {
                content[i] = new GUIContent(inputProfiles[i].Attribute.ProfileName);
            }
            int tempSelection = EditorGUILayout.Popup(new GUIContent(INPUT), mocapProfileSelection, content);


            if (mocapProfileSelection != tempSelection || InputProfile == null)
            {
                mocapProfileSelection = tempSelection;

                InputProfile = Activator.CreateInstance(inputProfiles[mocapProfileSelection].Type) as InputProfile;
                InputProfile.FrameCaptured            += MocapProfile_SkeletonFrameCaptured;
                InputProfile.InputSkeletonTypeChanged += InputProfile_InputSkeletonTypeChanged;

                // Input Profile changed.
                inputProfileChanged();
            }

            EditorGUI.EndDisabledGroup();


            bool  toggleOn = false;
            Color temp     = GUI.color;

            if (InputProfile.IsDeviceOn)
            {
                GUI.color = Color.green;
                toggleOn  = GUILayout.Toggle(InputProfile.IsDeviceOn, ON, EditorStyles.miniButton, GUILayout.Width(40f));
            }
            else
            {
                GUI.color = Color.red;
                toggleOn  = GUILayout.Toggle(InputProfile.IsDeviceOn, OFF, EditorStyles.miniButton, GUILayout.Width(40f));
            }
            GUI.color = temp;

            if (toggleOn && !InputProfile.IsDeviceOn)
            {
                Debug.Log("Cinema Mocap: Starting your device...");
                InputProfile.TurnOnDevice();
                EditorCoroutine.start(WaitForSensorAvailable());
            }
            else if (!toggleOn && InputProfile.IsDeviceOn)
            {
                if (InputProfile != null)
                {
                    if (this.RecordingState != RecordingState.NotRecording)
                    {
                        StopRecording();
                    }
                    InputProfile.TurnOffDevice();
                }

                if (OutputProfile != null)
                {
                    OutputProfile.Reset();
                }
            }

            EditorGUILayout.EndHorizontal();

            InputProfile.DrawInputSettings();
        }
コード例 #22
0
            public static bool Prefix(ProfilesCore __instance)
            {
                if (__instance == null)
                {
                    throw new Exception("Instance was null, PANIC");
                }

                List <DuckPersona> personas = Persona.all as List <DuckPersona>;

                if (personas == null)
                {
                    throw new Exception("personas is null");
                }

                __instance._profiles = new List <Profile>()
                {
                    new Profile("Player1", InputProfile.Get("MPPlayer1"), Teams.Player1, Persona.Duck1, false, "PLAYER1"),
                    new Profile("Player2", InputProfile.Get("MPPlayer2"), Teams.Player2, Persona.Duck2, false, "PLAYER2"),
                    new Profile("Player3", InputProfile.Get("MPPlayer3"), Teams.Player3, Persona.Duck3, false, "PLAYER3"),
                    new Profile("Player4", InputProfile.Get("MPPlayer4"), Teams.Player4, Persona.Duck4, false, "PLAYER4"),
                    new Profile("Player5", InputProfile.Get("MPPlayer5"), Teams.core.teams[4], personas[4], false, "PLAYER5"),
                    new Profile("Player6", InputProfile.Get("MPPlayer6"), Teams.core.teams[5], personas[5], false, "PLAYER6"),
                    new Profile("Player7", InputProfile.Get("MPPlayer7"), Teams.core.teams[6], personas[6], false, "PLAYER7"),
                    new Profile("Player8", InputProfile.Get("MPPlayer8"), Teams.core.teams[7], personas[7], false, "PLAYER8")
                };

                Profile.loading = true;
                string[]       files        = DuckFile.GetFiles(DuckFile.profileDirectory, "*.*");
                List <Profile> profileList1 = new List <Profile>();

                foreach (string path in files)
                {
                    XDocument xdocument = DuckFile.LoadXDocument(path);
                    if (xdocument != null)
                    {
                        string  name = xdocument.Element((XName)"Profile").Element((XName)"Name").Value;
                        bool    flag = false;
                        Profile p    = __instance._profiles.FirstOrDefault <Profile>((Func <Profile, bool>)(pro => pro.name == name));
                        if (p == null || !Profiles.IsDefault(p))
                        {
                            p          = new Profile("", (InputProfile)null, (Team)null, (DuckPersona)null, false, (string)null);
                            p.fileName = path;
                            flag       = true;
                        }
                        IEnumerable <XElement> source = xdocument.Elements((XName)"Profile");
                        if (source != null)
                        {
                            foreach (XElement element1 in source.Elements <XElement>())
                            {
                                if (element1.Name.LocalName == "ID" && !Profiles.IsDefault(p))
                                {
                                    p.SetID(element1.Value);
                                }
                                else if (element1.Name.LocalName == "Name")
                                {
                                    p.name = element1.Value;
                                }
                                else if (element1.Name.LocalName == "Mood")
                                {
                                    p.funslider = Change.ToSingle((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "NS")
                                {
                                    p.numSandwiches = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "MF")
                                {
                                    p.milkFill = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "LML")
                                {
                                    p.littleManLevel = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "NLM")
                                {
                                    p.numLittleMen = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "LMB")
                                {
                                    p.littleManBucks = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "RSXP")
                                {
                                    p.roundsSinceXP = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "TimesMet")
                                {
                                    p.timesMetVincent = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "TimesMet2")
                                {
                                    p.timesMetVincentSale = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "TimesMet3")
                                {
                                    p.timesMetVincentSell = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "TimesMet4")
                                {
                                    p.timesMetVincentImport = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "TimeOfDay")
                                {
                                    p.timeOfDay = Change.ToSingle((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "CD")
                                {
                                    p.currentDay = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "XtraPoints")
                                {
                                    p.xp = Change.ToInt32((object)element1.Value);
                                }
                                else if (element1.Name.LocalName == "FurniPositions")
                                {
                                    p.furniturePositionData = BitBuffer.FromString(element1.Value);
                                }
                                else if (element1.Name.LocalName == "Fowner")
                                {
                                    p.furnitureOwnershipData = BitBuffer.FromString(element1.Value);
                                }
                                else if (element1.Name.LocalName == "SteamID")
                                {
                                    p.steamID = Change.ToUInt64((object)element1.Value);
                                    if ((long)p.steamID != 0L)
                                    {
                                        profileList1.Add(p);
                                    }
                                }
                                else if (element1.Name.LocalName == "LastKnownName")
                                {
                                    p.lastKnownName = element1.Value;
                                }
                                else if (element1.Name.LocalName == "Stats")
                                {
                                    p.stats.Deserialize(element1);
                                }
                                else if (element1.Name.LocalName == "Unlocks")
                                {
                                    string[] strArray = element1.Value.Split('|');
                                    p.unlocks = new List <string>((IEnumerable <string>)strArray);
                                }
                                else if (element1.Name.LocalName == "Tickets")
                                {
                                    p.ticketCount = Convert.ToInt32(element1.Value);
                                }
                                else if (element1.Name.LocalName == "Mappings" && !MonoMain.defaultControls)
                                {
                                    p.inputMappingOverrides.Clear();
                                    foreach (XElement element2 in element1.Elements())
                                    {
                                        if (element2.Name.LocalName == "InputMapping")
                                        {
                                            DeviceInputMapping deviceInputMapping = new DeviceInputMapping();
                                            deviceInputMapping.Deserialize(element2);
                                            p.inputMappingOverrides.Add(deviceInputMapping);
                                        }
                                    }
                                }
                            }
                        }
                        if (flag)
                        {
                            __instance._profiles.Add(p);
                        }
                    }
                }
                byte    localFlippers = Profile.CalculateLocalFlippers();
                Profile p1            = (Profile)null;

                if (Profiles.allCustomProfiles == null)
                {
                    throw new Exception("Custom Profiles null.");
                }

                if (Steam.user != null && (long)Steam.user.id != 0L)
                {
                    string str = Steam.user.id.ToString();
                    foreach (Profile allCustomProfile in Profiles.allCustomProfiles)
                    {
                        if ((long)allCustomProfile.steamID == (long)Steam.user.id && allCustomProfile.id == str && allCustomProfile.rawName == str)
                        {
                            p1 = allCustomProfile;
                            break;
                        }
                    }
                    if (p1 == null)
                    {
                        p1 = new Profile(Steam.user.id.ToString(), (InputProfile)null, (Team)null, (DuckPersona)null, false, Steam.user.id.ToString())
                        {
                            steamID = Steam.user.id
                        };
                        Profiles.Add(p1);
                        __instance.Save(p1);
                    }
                }
                if (p1 != null)
                {
                    __instance._profiles.Remove(p1);
                    __instance._profiles.Insert(8, p1);
                    List <Profile> source       = new List <Profile>();
                    List <Profile> profileList2 = new List <Profile>();
                    foreach (Profile allCustomProfile in Profiles.allCustomProfiles)
                    {
                        string str = allCustomProfile.steamID.ToString();
                        if ((long)allCustomProfile.steamID != 0L)
                        {
                            if (allCustomProfile.id == str && allCustomProfile.rawName == str)
                            {
                                source.Add(allCustomProfile);
                            }
                            else
                            {
                                profileList2.Add(allCustomProfile);
                            }
                        }
                    }
                    using (List <Profile> .Enumerator enumerator = profileList2.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Profile pro = enumerator.Current;
                            Profile p2  = source.FirstOrDefault <Profile>((Func <Profile, bool>)(x => (long)x.steamID == (long)pro.steamID));
                            if (p2 == null)
                            {
                                p2         = new Profile(pro.steamID.ToString(), (InputProfile)null, (Team)null, (DuckPersona)null, false, pro.steamID.ToString());
                                p2.steamID = pro.steamID;
                                Profiles.Add(p2);
                            }
                            p2.stats = (ProfileStats)((DataClass)p2.stats + (DataClass)pro.stats);
                            foreach (KeyValuePair <string, List <ChallengeSaveData> > keyValuePair in (MultiMap <string, ChallengeSaveData, List <ChallengeSaveData> >)Challenges.saveData)
                            {
                                ChallengeSaveData        challengeSaveData1    = (ChallengeSaveData)null;
                                List <ChallengeSaveData> challengeSaveDataList = new List <ChallengeSaveData>();
                                foreach (ChallengeSaveData challengeSaveData2 in keyValuePair.Value)
                                {
                                    if (challengeSaveData2.profileID == pro.id || challengeSaveData2.profileID == p2.id)
                                    {
                                        challengeSaveData2.profileID = p2.id;
                                        if (challengeSaveData1 == null)
                                        {
                                            challengeSaveData1 = challengeSaveData2;
                                        }
                                        else if (challengeSaveData2.trophy > challengeSaveData1.trophy)
                                        {
                                            challengeSaveDataList.Add(challengeSaveData1);
                                            challengeSaveData1 = challengeSaveData2;
                                        }
                                        else
                                        {
                                            challengeSaveDataList.Add(challengeSaveData2);
                                        }
                                    }
                                }
                                foreach (ChallengeSaveData challengeSaveData2 in challengeSaveDataList)
                                {
                                    string str = challengeSaveData2.profileID + "OBSOLETE";
                                    challengeSaveData2.profileID = str;
                                }
                                if (challengeSaveData1 != null)
                                {
                                    Challenges.Save(keyValuePair.Key);
                                }
                            }
                            __instance._profiles.Remove(pro);
                            DuckFile.Delete(pro.fileName);
                            __instance.Save(p2);
                        }
                    }
                }
                foreach (Profile profile in __instance._profiles)
                {
                    profile.flippers    = localFlippers;
                    profile.ticketCount = Challenges.GetTicketCount(profile);
                    if (profile.ticketCount < 0)
                    {
                        profile.ticketCount = 0;
                    }
                }
                Profile.loading = false;

                return(false);
            }
コード例 #23
0
        // We are hooking this because loads of stuff in Initialize is either private or internal so I'm adding stuff to the calls it does
        public static void UpdateModifierStatus()
        {
            // Extra stuff here - Very dangerous + slow. Need better method

            StackFrame frame  = new StackFrame(1);
            var        method = frame.GetMethod();
            var        type   = method.DeclaringType;
            var        name   = method.Name;

            if (name == "Initialize" && type == typeof(TeamSelect2))
            {
                List <DuckPersona> _personas      = typeof(Persona).GetField("_personas", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public).GetValue(null) as List <DuckPersona>;
                FieldInfo          _profilesField = typeof(TeamSelect2).GetField("_profiles", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
                dynamic            _profiles      = _profilesField.GetValue(Level.current as TeamSelect2);

                Profile defaultProfile5 = Profiles.all.FirstOrDefault(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == _personas[4]);
                    }
                    return(false);
                }) ?? Profiles.core.all.ElementAt(4);

                Profile defaultProfile6 = Profiles.all.FirstOrDefault(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == _personas[5]);
                    }
                    return(false);
                }) ?? Profiles.core.all.ElementAt(5);

                Profile defaultProfile7 = Profiles.all.FirstOrDefault(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == _personas[6]);
                    }
                    return(false);
                }) ?? Profiles.core.all.ElementAt(6);

                Profile defaultProfile8 = Profiles.all.FirstOrDefault(x =>
                {
                    if (x.team != null)
                    {
                        return(x.persona == _personas[7]);
                    }
                    return(false);
                }) ?? Profiles.core.all.ElementAt(7);
                float       xpos          = 1f;
                ProfileBox2 profileBox2_5 = new ProfileBox2(xpos, 180f, InputProfile.Get("MPPlayer5"), defaultProfile5, (TeamSelect2)Level.current, 4);
                _profiles.Add(profileBox2_5);
                Level.Add(profileBox2_5);
                ProfileBox2 profileBox2_6 = new ProfileBox2(xpos + 178f, 180f, InputProfile.Get("MPPlayer6"), defaultProfile6, (TeamSelect2)Level.current, 5);
                _profiles.Add(profileBox2_6);
                Level.Add(profileBox2_6);
                ProfileBox2 profileBox2_7 = new ProfileBox2(xpos, 270f, InputProfile.Get("MPPlayer7"), defaultProfile7, (TeamSelect2)Level.current, 6);
                _profiles.Add(profileBox2_7);
                Level.Add(profileBox2_7);
                ProfileBox2 profileBox2_8 = new ProfileBox2(xpos + 178f, 270f, InputProfile.Get("MPPlayer8"), defaultProfile8, (TeamSelect2)Level.current, 7);
                _profiles.Add(profileBox2_8);
                Level.Add(profileBox2_8);

                // Expand the view and tweak boxes
                Level.current.camera = new Camera(0f, 0f, -1f, (Graphics.height / 2f));
                Layer.HUD.camera     = new Camera(0f, 0f, -1f, (Graphics.height / 2f));

                if (Network.isActive)
                {
                    (Level.current as TeamSelect2).PrepareForOnline();
                }
            }

            // Normal stuff here

            Type      typea = typeof(TeamSelect2);
            FieldInfo info2 = typea.GetField("_modifierStatus", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
            Dictionary <string, bool> _modifierStatus = info2.GetValue(Level.current) as Dictionary <string, bool>;

            bool flag = false;

            foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier))
            {
                _modifierStatus[unlock.id] = false;
                if (unlock.enabled)
                {
                    flag = true;
                    _modifierStatus[unlock.id] = true;
                }
            }
            if (!Network.isActive || !Network.isServer || Steam.lobby == null)
            {
                return;
            }
            Steam.lobby.SetLobbyData("modifiers", flag ? "true" : "false");
        }
コード例 #24
0
        public void RecreateProfiles()
        {
            DuckNetworkCore DuckNetworkCore = DuckNetwork.core;

            DuckNetworkCore.profiles.Clear();
            for (int index = 0; index < 8; ++index)
            {
                DuckNetworkCore.profiles.Add(new Profile("Netduck" + (index + 1).ToString(), InputProfile.GetVirtualInput(index), null, Persona.all.ElementAt(index), true, null)
                {
                    networkIndex = (byte)index
                });
            }
        }
コード例 #25
0
 public void SetupDefaults(InputProfile sourceOfInputs, actionSetType type)
 {
     currentControllerType = type;
     Reset();
     if (type == actionSetType.controller || type == actionSetType.both)
     {
         throwAction.AddDefaultBinding(sourceOfInputs.throwButton);
         catchAction.AddDefaultBinding(sourceOfInputs.catchButton);
         jumpAction.AddDefaultBinding(sourceOfInputs.jumpButton);
         lockMovementAction.AddDefaultBinding(sourceOfInputs.lockMovementButton);
         resetAction.AddDefaultBinding(sourceOfInputs.resetButton);
         resetAction.AddDefaultBinding(InputControlType.Options);
         switchAction.AddDefaultBinding(sourceOfInputs.swapButton);
         up.AddDefaultBinding(sourceOfInputs.upButton);
         down.AddDefaultBinding(sourceOfInputs.downButton);
         left.AddDefaultBinding(sourceOfInputs.leftButton);
         right.AddDefaultBinding(sourceOfInputs.rightButton);
         altUp.AddDefaultBinding(sourceOfInputs.altUpButton);
         altDown.AddDefaultBinding(sourceOfInputs.altDownButton);
         altLeft.AddDefaultBinding(sourceOfInputs.altLeftButton);
         altRight.AddDefaultBinding(sourceOfInputs.altRightButton);
         confirmAction.AddDefaultBinding(sourceOfInputs.confirmButton);
         lockThrowAction.AddDefaultBinding(sourceOfInputs.lockThrowingButton);
     }
     if (type == actionSetType.keyboard || type == actionSetType.both)
     {
         throwAction.AddDefaultBinding(sourceOfInputs.throwKey);
         catchAction.AddDefaultBinding(sourceOfInputs.catchKey);
         jumpAction.AddDefaultBinding(sourceOfInputs.jumpKey);
         lockMovementAction.AddDefaultBinding(sourceOfInputs.lockMovementKey);
         resetAction.AddDefaultBinding(sourceOfInputs.resetKey);
         switchAction.AddDefaultBinding(sourceOfInputs.swapKey);
         up.AddDefaultBinding(sourceOfInputs.upKey);
         down.AddDefaultBinding(sourceOfInputs.downKey);
         left.AddDefaultBinding(sourceOfInputs.leftKey);
         right.AddDefaultBinding(sourceOfInputs.rightKey);
         altUp.AddDefaultBinding(sourceOfInputs.altUpKey);
         altDown.AddDefaultBinding(sourceOfInputs.altDownKey);
         altLeft.AddDefaultBinding(sourceOfInputs.altLeftKey);
         altRight.AddDefaultBinding(sourceOfInputs.altRightKey);
         confirmAction.AddDefaultBinding(sourceOfInputs.confirmKey);
         lockThrowAction.AddDefaultBinding(sourceOfInputs.lockThrowingKey);
     }
     if (type == actionSetType.P2KeyboardP1)
     {
         throwAction.AddDefaultBinding(sourceOfInputs.p1ThrowKey);
         catchAction.AddDefaultBinding(sourceOfInputs.p1CatchKey);
         jumpAction.AddDefaultBinding(sourceOfInputs.p1JumpKey);
         lockMovementAction.AddDefaultBinding(sourceOfInputs.p1LockMovementKey);
         resetAction.AddDefaultBinding(sourceOfInputs.p1ResetKey);
         switchAction.AddDefaultBinding(sourceOfInputs.p1SwapKey);
         up.AddDefaultBinding(sourceOfInputs.p1UpKey);
         down.AddDefaultBinding(sourceOfInputs.p1DownKey);
         left.AddDefaultBinding(sourceOfInputs.p1LeftKey);
         right.AddDefaultBinding(sourceOfInputs.p1RightKey);
         altUp.AddDefaultBinding(sourceOfInputs.p1AltUpKey);
         altDown.AddDefaultBinding(sourceOfInputs.p1AltDownKey);
         altLeft.AddDefaultBinding(sourceOfInputs.p1AltLeftKey);
         altRight.AddDefaultBinding(sourceOfInputs.p1AltRightKey);
         confirmAction.AddDefaultBinding(sourceOfInputs.p1ConfirmKey);
         lockThrowAction.AddDefaultBinding(sourceOfInputs.p1LockThrowingKey);
     }
     if (type == actionSetType.P2KeyboardP2)
     {
         throwAction.AddDefaultBinding(sourceOfInputs.p2ThrowKey);
         catchAction.AddDefaultBinding(sourceOfInputs.p2CatchKey);
         jumpAction.AddDefaultBinding(sourceOfInputs.p2JumpKey);
         lockMovementAction.AddDefaultBinding(sourceOfInputs.p2LockMovementKey);
         resetAction.AddDefaultBinding(sourceOfInputs.p2ResetKey);
         switchAction.AddDefaultBinding(sourceOfInputs.p2SwapKey);
         up.AddDefaultBinding(sourceOfInputs.p2UpKey);
         down.AddDefaultBinding(sourceOfInputs.p2DownKey);
         left.AddDefaultBinding(sourceOfInputs.p2LeftKey);
         right.AddDefaultBinding(sourceOfInputs.p2RightKey);
         altUp.AddDefaultBinding(sourceOfInputs.p2AltUpKey);
         altDown.AddDefaultBinding(sourceOfInputs.p2AltDownKey);
         altLeft.AddDefaultBinding(sourceOfInputs.p2AltLeftKey);
         altRight.AddDefaultBinding(sourceOfInputs.p2AltRightKey);
         confirmAction.AddDefaultBinding(sourceOfInputs.p2ConfirmKey);
         lockThrowAction.AddDefaultBinding(sourceOfInputs.p2LockThrowingKey);
     }
 }