Example #1
0
 // Token: 0x0600421C RID: 16924 RVA: 0x001661C4 File Offset: 0x001643C4
 private void InitMappings()
 {
     if (this.m_sectionTemplate)
     {
         this.m_sectionTemplate.gameObject.SetActive(true);
         foreach (InputMapCategory inputMapCategory in ReInput.mapping.UserAssignableMapCategories)
         {
             if (this.ControllerType == ControlMappingPanel.ControlType.Keyboard)
             {
                 KeyboardMap keyboardMapInstance = ReInput.mapping.GetKeyboardMapInstance(inputMapCategory.id, 0);
                 MouseMap    mouseMapInstance    = ReInput.mapping.GetMouseMapInstance(inputMapCategory.id, 0);
                 // We know this name from debugging, or we can dump it.
                 if (inputMapCategory.name == "QuickSlot")
                 {
                     // Loop through our 8 actions we added via ReWired and create the mapping objects for them.
                     for (int i = 0; i < 8; i++)
                     {
                         var aid = ReInput.mapping.GetActionId(string.Format("QS_Instant{0}", i + 12));
                         ElementAssignment elementAssignment = new ElementAssignment(KeyCode.None, ModifierKeyFlags.None, aid, Pole.Positive);
                         ActionElementMap  actionElementMap;
                         keyboardMapInstance.CreateElementMap(elementAssignment, out actionElementMap);
                         mouseMapInstance.CreateElementMap(elementAssignment, out actionElementMap);
                     }
                 }
                 this.InitSections(keyboardMapInstance);
                 this.InitSections(mouseMapInstance);
             }
             else if (this.m_lastJoystickController != null)
             {
                 JoystickMap joystickMapInstance = ReInput.mapping.GetJoystickMapInstance((Joystick)this.m_lastJoystickController, inputMapCategory.id, 0);
                 this.InitSections(joystickMapInstance);
             }
             else
             {
                 this.m_mappingInitialized = false;
             }
         }
         this.m_sectionTemplate.gameObject.SetActive(false);
     }
 }
        public static bool InitMappingsPrefix(ControlMappingPanel __instance, ref ControlMappingSection ___m_sectionTemplate, ref bool ___m_mappingInitialized, ref Controller ___m_lastJoystickController)
        {
            if (___m_sectionTemplate)
            {
                ___m_sectionTemplate.gameObject.SetActive(true);
                foreach (InputMapCategory inputMapCategory in ReInput.mapping.UserAssignableMapCategories)
                {
                    if (__instance.ControllerType == ControlMappingPanel.ControlType.Keyboard)
                    {
                        KeyboardMap keyboardMapInstance = ReInput.mapping.GetKeyboardMapInstance(inputMapCategory.id, 0);
                        MouseMap    mouseMapInstance    = ReInput.mapping.GetMouseMapInstance(inputMapCategory.id, 0);
                        // We know this name from debugging, or we can dump it.
                        Debug.Log("Extended Quickslots - InitMappingsPrefix() inputMapCategory = " + inputMapCategory.name);
                        if (inputMapCategory.name == "QuickSlot")
                        {
                            Debug.Log("ExtendedQuickslots - Mapping Quickslots ...");
                            // Loop through our 8 actions we added via ReWired and create the mapping objects for them.
                            for (int i = 0; i < ExtendedQuickslots.numSlots; i++)
                            {
                                Debug.Log("\tMapping " + string.Format("QS_Instant{0}", i + 12));
                                var aid = ReInput.mapping.GetActionId(string.Format("QS_Instant{0}", i + 12));
                                ElementAssignment elementAssignment = new ElementAssignment(KeyCode.None, ModifierKeyFlags.None, aid, Pole.Positive);
                                keyboardMapInstance.CreateElementMap(elementAssignment, out ActionElementMap actionElementMap);
                                mouseMapInstance.CreateElementMap(elementAssignment, out actionElementMap);
                            }
                        }
                        if (inputMapCategory.name == "Actions")
                        {
                            ElementAssignment elementAssignment;
                            int aid;

                            Debug.Log("\tMapping Sit emote");
                            aid = ReInput.mapping.GetActionId("Sit_Emote");
                            elementAssignment = new ElementAssignment(KeyCode.None, ModifierKeyFlags.None, aid, Pole.Positive);
                            keyboardMapInstance.CreateElementMap(elementAssignment, out ActionElementMap actionElementMap);
                            mouseMapInstance.CreateElementMap(elementAssignment, out actionElementMap);

                            Debug.Log("\tMapping Alternate Idle Emote");
                            aid = ReInput.mapping.GetActionId("Alternate_Idle_Emote");
                            elementAssignment = new ElementAssignment(KeyCode.None, ModifierKeyFlags.None, aid, Pole.Positive);
                            keyboardMapInstance.CreateElementMap(elementAssignment, out actionElementMap);
                            mouseMapInstance.CreateElementMap(elementAssignment, out actionElementMap);
                        }

                        ControlMappingPanel_InitSections(__instance, new object[] { keyboardMapInstance });
                        ControlMappingPanel_InitSections(__instance, new object[] { mouseMapInstance });
                    }
                    else if (___m_lastJoystickController != null)
                    {
                        JoystickMap joystickMapInstance = ReInput.mapping.GetJoystickMapInstance((Joystick)___m_lastJoystickController, inputMapCategory.id, 0);
                        ControlMappingPanel_InitSections(__instance, new object[] { joystickMapInstance });
                    }
                    else
                    {
                        ___m_mappingInitialized = false;
                    }
                }
                ___m_sectionTemplate.gameObject.SetActive(false);
            }
            return(false);
        }