Exemplo n.º 1
0
 public void SetButtonActive()
 {
     if (!buttonDisabled)
     {
         //reset all other buttons in the group
         if (oneButtonActiveInGroup)
         {
             foreach (Transform t in transform.parent)
             {
                 if (t.gameObject.GetInstanceID() != gameObject.GetInstanceID())
                 {
                     ButtonAppearance b = t.GetComponent <ButtonAppearance>();
                     if (b != null)
                     {
                         b.ResetButton();
                     }
                 }
             }
         }
         //"unpress" the button
         if (activeState && resetOnSecondClick)
         {
             Debug.Log("resetting button: " + activeState + " " + resetOnSecondClick);
             ResetButton();
         }
         else
         {
             Debug.Log("setting button Active");
             changeSprite(activeSprite);
             activeState = true;
         }
     }
 }
Exemplo n.º 2
0
    private void Start()
    {
        controlsUI = transform.GetComponentInParent <ControlsUIManager>();
        source     = transform.GetComponent <AudioSource>();
        appearance = transform.GetComponent <ButtonAppearance>();

        //disable the white selection frame
        EnableOrDisableFrame(false);
    }
 public static DotvvmControl GetContents(
     [DefaultValue(null)] ValueOrBinding <string> text,
     [DefaultValue(null)] ITemplate contentTemplate,
     ICommandBinding click,
     [DefaultValue(ButtonAppearance.Neutral)] ButtonAppearance appearance
     )
 {
     return(new HtmlGenericControl("fluent-button")
            .WithAttribute("appearance", appearance.ToString().ToLower())
            .WithProperty(Events.ClickProperty, click)
            .WithInnerTextOrContent(text, contentTemplate));
 }
Exemplo n.º 4
0
        public static void ChangeButtonAppearance(Button button, ButtonAppearance buttonAppearance)
        {
            switch (buttonAppearance)
            {
            case ButtonAppearance.kDisabled:
                //button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFA1A1"));
                button.Content = button.Content.ToString().Replace("Disable", "Enable");
                button.Content = button.Content.ToString().Replace("Stop", "Start");
                break;

            case ButtonAppearance.kEnabled:
                //button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFAAFFA1"));
                button.Content = button.Content.ToString().Replace("Enable", "Disable");
                button.Content = button.Content.ToString().Replace("Start", "Stop");
                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
    override protected Action Command()
    {
        return(delegate
        {
            if (cell == null || cellContainer == null)
            {
                Debug.Log("need a cell and container here");
            }
            else
            {
                foreach (Transform child in cellContainer.GetComponent <Transform>())
                {
                    child.gameObject.SetActive(false);
                }
                cell.SetActive(true);
            }

            foreach (Transform cur in transform.parent)
            {
                ButtonAppearance appearance = cur.gameObject.GetComponent <ButtonAppearance>();
                if (appearance != null)
                {
                    appearance.ResetButton();
                }
                else
                {
                    cur.gameObject.GetComponent <BoxCollider>().enabled = true;
                }
            }

            ButtonAppearance myAppearance = GetComponent <ButtonAppearance>();
            if (myAppearance != null)
            {
                myAppearance.SetButtonActive();
            }
            else
            {
                GetComponent <BoxCollider>().enabled = false;
            }
        });
    }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     m_gatherMaterialButtonAppearance = m_GatherMaterialButton.GetComponent <ButtonAppearance>();
     m_gainExperienceButtonAppearance = m_GainExperienceButton.GetComponent <ButtonAppearance>();
 }