private void onInputButtonSetLoaded(string path, InputButtonGroupDefinition groupDefinition)
        {
            bool flag = false;

            if (RightContainer != null && doesGroupDefinitionMatchDataModel(groupDefinition))
            {
                if (shouldUseButtonOverrides(groupDefinition))
                {
                    for (int i = 0; i < groupDefinition.InputButtonDefinitions.Length; i++)
                    {
                        bool flag2 = false;
                        InputButtonDefinition currentButtonDefinition = GetCurrentButtonDefinition(i);
                        if (currentButtonDefinition != groupDefinition.InputButtonDefinitions[i])
                        {
                            setUpButton(groupDefinition.InputButtonDefinitions[i], i);
                            flag2 = true;
                        }
                        if (groupDefinition.ButtonStateOverrides != null && groupDefinition.ButtonStateOverrides.Length > i && groupDefinition.ButtonStateOverrides[i] != TrayInputButton.ButtonState.None)
                        {
                            if (flag2)
                            {
                                pendingButtonStateOverrides[i] = groupDefinition.ButtonStateOverrides[i];
                            }
                            else
                            {
                                trayInputButtonGroup.Buttons[i].SetState(groupDefinition.ButtonStateOverrides[i]);
                            }
                            flag2 = true;
                        }
                        if (!flag2 && currentButtonDefinition != null)
                        {
                            setButtonToDefault(i);
                        }
                        restartButtonComponents(trayInputButtonGroup.Buttons[i]);
                    }
                }
                else
                {
                    flag = true;
                    if (replaceButtonsCoroutine != null && !replaceButtonsCoroutine.Disposed)
                    {
                        replaceButtonsCoroutine.Stop();
                    }
                    replaceButtonsCoroutine = CoroutineRunner.Start(replaceButtons(groupDefinition), this, "");
                }
            }
            if (!flag)
            {
                Service.Get <EventDispatcher>().DispatchEvent(default(ControlsScreenEvents.ControlLayoutLoadComplete));
            }
        }
        private IEnumerator replaceButtons(InputButtonGroupDefinition newButtonGroupDefinition)
        {
            AssetRequest <TrayInputButtonGroup> assetRequest = Content.LoadAsync(newButtonGroupDefinition.TemplateContentKey);

            yield return(assetRequest);

            if (!(RightContainer == null))
            {
                if (RightContainer.childCount > 0)
                {
                    clearChildren(RightContainer);
                }
                yield return(new WaitForEndOfFrame());

                currentGroupDefinition = newButtonGroupDefinition;
                overrideDefinitions.Clear();
                trayInputButtonGroup = newButtonGroupDefinition.Create(assetRequest.Asset, RightContainer);
                Service.Get <EventDispatcher>().DispatchEvent(default(ControlsScreenEvents.ControlLayoutLoadComplete));
            }
        }
 private bool shouldUseButtonOverrides(InputButtonGroupDefinition groupDefinition)
 {
     if (currentGroupDefinition != null && currentGroupDefinition.TemplateContentKey.Key == groupDefinition.TemplateContentKey.Key)
     {
         for (int i = 0; i < groupDefinition.InputButtonDefinitions.Length; i++)
         {
             InputButtonDefinition inputButtonDefinition = groupDefinition.InputButtonDefinitions[i];
             if (overrideDefinitions.ContainsKey(i))
             {
                 if (overrideDefinitions[i] == inputButtonDefinition)
                 {
                     return(true);
                 }
             }
             else if (currentGroupDefinition.InputButtonDefinitions.Length > i && currentGroupDefinition.InputButtonDefinitions[i] == inputButtonDefinition)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        private bool doesGroupDefinitionMatchDataModel(InputButtonGroupDefinition groupDefinition)
        {
            InputButtonGroupContentKey key = controlsScreenData.ButtonGroupContentKey ?? InputButtonsContentKey;

            return(AssetContentKey.GetAssetName(key).ToLower() == groupDefinition.name.ToLower());
        }