示例#1
0
    public static void HoldActiveStateOnGroup(String oldGroup)
    {
        if (ButtonGroupState.activeButtonList.ContainsKey(oldGroup) && oldGroup != ButtonGroupState.ActiveGroup)
        {
            ButtonGroupState.UpdatePointerPropertyForGroup(oldGroup);
            UIButton component = ButtonGroupState.activeButtonList[oldGroup].GetComponent <UIButton>();
            if (component.state != UIButtonColor.State.Hover)
            {
                component.SetState(UIButtonColor.State.Hover, true);
            }
            Singleton <PointerManager> .Instance.AttachPointerToGameObject(ButtonGroupState.activeButtonList[oldGroup]);

            Singleton <PointerManager> .Instance.SetPointerBlinkAt(ButtonGroupState.activeButtonList[oldGroup], true);

            ButtonGroupState.UpdatePointerPropertyForGroup(ButtonGroupState.activeGroup);
        }
    }
示例#2
0
    private static void ActiveGroupChanged(String newGroupName)
    {
        if (newGroupName == ButtonGroupState.activeGroup)
        {
            return;
        }
        if (newGroupName == String.Empty)
        {
            Singleton <HelpDialog> .Instance.HideDialog();

            return;
        }
        String text = ButtonGroupState.activeGroup;

        ButtonGroupState.UpdatePointerPropertyForGroup(newGroupName);
        if (ButtonGroupState.secondaryGroup.Contains(newGroupName))
        {
            ButtonGroupState.secondaryGroup.Remove(newGroupName);
        }
        if (UICamera.selectedObject && !String.IsNullOrEmpty(text) && UICamera.selectedObject.GetComponent <UIKeyNavigation>() && UICamera.selectedObject.GetComponent <UIKeyNavigation>().enabled&& UICamera.selectedObject.GetComponent <ButtonGroupState>().GroupName == text)
        {
            if (ButtonGroupState.activeButtonList.ContainsKey(text) && ButtonGroupState.activeButtonList[text] != UICamera.selectedObject && ButtonGroupState.activeButtonList[text] != (UnityEngine.Object)null)
            {
                Singleton <PointerManager> .Instance.RemovePointerFromGameObject(ButtonGroupState.activeButtonList[text]);
            }
            if (ButtonGroupState.ButtonGroupList[text].Contains(UICamera.selectedObject))
            {
                ButtonGroupState.activeButtonList[text] = UICamera.selectedObject;
            }
        }
        if (ButtonGroupState.ButtonGroupList.ContainsKey(text))
        {
            foreach (GameObject gameObject in ButtonGroupState.ButtonGroupList[text])
            {
                gameObject.GetComponent <UIButton>().SetState(UIButtonColor.State.Normal, true);
                gameObject.GetComponent <BoxCollider>().enabled     = false;
                gameObject.GetComponent <UIButton>().enabled        = false;
                gameObject.GetComponent <UIKeyNavigation>().enabled = false;
            }
        }
        if (ButtonGroupState.scrollButtonList.ContainsKey(text))
        {
            ButtonGroupState.scrollButtonList[text].SetScrollButtonEnable(false);
        }
        if (ButtonGroupState.ButtonGroupList.ContainsKey(newGroupName))
        {
            foreach (GameObject gameObject2 in ButtonGroupState.ButtonGroupList[newGroupName])
            {
                UIKeyNavigation component = gameObject2.GetComponent <UIKeyNavigation>();
                if (component && component.startsSelected && !ButtonGroupState.activeButtonList.ContainsKey(newGroupName))
                {
                    ButtonGroupState.activeButtonList[newGroupName] = gameObject2;
                }
                gameObject2.GetComponent <BoxCollider>().enabled     = true;
                gameObject2.GetComponent <UIButton>().enabled        = true;
                gameObject2.GetComponent <UIKeyNavigation>().enabled = true;
            }
        }
        if (ButtonGroupState.scrollButtonList.ContainsKey(newGroupName))
        {
            ButtonGroupState.scrollButtonList[newGroupName].SetScrollButtonEnable(true);
        }
        if (!ButtonGroupState.activeButtonList.ContainsKey(newGroupName) || ButtonGroupState.activeButtonList[newGroupName] == (UnityEngine.Object)null)
        {
            if (ButtonGroupState.ButtonGroupList.ContainsKey(newGroupName))
            {
                if (ButtonGroupState.ButtonGroupList[newGroupName].Count == 0)
                {
                    ButtonGroupState.activeButtonList[newGroupName] = (GameObject)null;
                }
                else
                {
                    ButtonGroupState.activeButtonList[newGroupName] = ButtonGroupState.ButtonGroupList[newGroupName][0];
                }
            }
            else
            {
                ButtonGroupState.activeButtonList[newGroupName] = (GameObject)null;
            }
        }
        ButtonGroupState.allTarget   = false;
        ButtonGroupState.activeGroup = newGroupName;
        PersistenSingleton <UIManager> .Instance.CurrentButtonGroup = newGroupName;
        ButtonGroupState.ActiveButton     = ButtonGroupState.activeButtonList[newGroupName];
        ButtonGroupState.prevActiveButton = ((!ButtonGroupState.activeButtonList.ContainsKey(text)) ? PersistenSingleton <UIManager> .Instance.gameObject : ButtonGroupState.activeButtonList[text]);
        ButtonGroupState.prevActiveGroup  = text;
        if (ButtonGroupState.activeButtonList.ContainsKey(text))
        {
            Singleton <PointerManager> .Instance.SetPointerBlinkAt(ButtonGroupState.ActiveButton, false);

            Singleton <PointerManager> .Instance.RemovePointerFromGameObject(ButtonGroupState.activeButtonList[text]);
        }
    }