Esempio n. 1
0
    private void OnEnable()
    {
        string str = PlayerPrefs.GetString(this.key);

        if (!string.IsNullOrEmpty(str))
        {
            UICheckbox component = base.GetComponent <UICheckbox>();
            if (component == null)
            {
                UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>();
                int          num    = 0;
                int          length = (int)componentsInChildren.Length;
                while (num < length)
                {
                    UICheckbox uICheckbox = componentsInChildren[num];
                    UIEventListener.Get(uICheckbox.gameObject).onClick -= new UIEventListener.VoidDelegate(this.Save);
                    uICheckbox.isChecked = uICheckbox.name == str;
                    Debug.Log(str);
                    UIEventListener.Get(uICheckbox.gameObject).onClick += new UIEventListener.VoidDelegate(this.Save);
                    num++;
                }
            }
            else
            {
                component.isChecked = str == "true";
            }
        }
    }
Esempio n. 2
0
    private void Save(GameObject go)
    {
        UICheckbox component = base.GetComponent <UICheckbox>();

        if (component == null)
        {
            UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>();
            int          num    = 0;
            int          length = (int)componentsInChildren.Length;
            while (num < length)
            {
                UICheckbox uICheckbox = componentsInChildren[num];
                if (!uICheckbox.isChecked)
                {
                    num++;
                }
                else
                {
                    PlayerPrefs.SetString(this.key, uICheckbox.name);
                    break;
                }
            }
        }
        else
        {
            PlayerPrefs.SetString(this.key, (!component.isChecked ? "false" : "true"));
        }
    }
Esempio n. 3
0
    private void OnEnable()
    {
        if (mList != null)
        {
            string @string = PlayerPrefs.GetString(key);
            if (!string.IsNullOrEmpty(@string))
            {
                mList.selection = @string;
            }
            return;
        }
        if (mCheck != null)
        {
            mCheck.isChecked = (PlayerPrefs.GetInt(key, 1) != 0);
            return;
        }
        string string2 = PlayerPrefs.GetString(key);

        UICheckbox[] componentsInChildren = GetComponentsInChildren <UICheckbox>(includeInactive: true);
        int          i = 0;

        for (int num = componentsInChildren.Length; i < num; i++)
        {
            UICheckbox uICheckbox = componentsInChildren[i];
            uICheckbox.isChecked = (uICheckbox.name == string2);
        }
    }
    private void SetAlpha(float a)
    {
        foreach (var w in _widgets)
        {
#if NGUI_2
            UICheckbox c = null;
            if (_checkboxes.TryGetValue(w, out c) && !c.isChecked)
            {
                w.alpha = 0;
            }
            else
            {
                w.alpha = a;
            }
#else
            UIToggle c = null;
            if (_toggles.TryGetValue(w, out c) && !c.value)
            {
                w.alpha = 0;
            }
            else
            {
                w.alpha = a;
            }
#endif
        }
    }
Esempio n. 5
0
            public CheckBoxDuplicate(GameObject parentPanel, UICheckbox source)
            {
                Object = NGUITools.AddChild(parentPanel, source.gameObject);
                foreach (var component in Object.GetComponents <Component>())
                {
                    switch (component)
                    {
                    case BoxCollider boxCollider:
                        Collider = boxCollider;
                        break;

                    case UICheckbox checkBox:
                        Checkbox = checkBox;
                        break;

                    case UIButton button:
                        Button = button;
                        break;

                    case UIButtonSound buttonSound:
                        ButtonSound = buttonSound;
                        break;
                    }
                }
            }
 public virtual void ChangeCheckedState(UICheckbox box, bool selected)
 {
     if (box != null)
     {
         box.isChecked = selected;
     }
 }
Esempio n. 7
0
    public void disClickedBtn()
    {
        if (PlayerPrefs.HasKey("card_sort"))
        {
            type_ = (EZCardSort.Type)(PlayerPrefs.GetInt("card_sort"));
        }
        switch (type_)
        {
        case EZCardSort.Type.Lv:
            btn_ = _lv;
            break;

        case EZCardSort.Type.Quality:
            btn_ = _qua;
            break;

        case EZCardSort.Type.MagicType:
            btn_ = _pro;
            break;

        case EZCardSort.Type.Attack:
            btn_ = _attack;
            break;

        case EZCardSort.Type.Speed:
            btn_ = _speed;
            break;

        case EZCardSort.Type.MaxHealth:
            btn_ = _hp;
            break;
        }
        btn_.isChecked = true;
    }
Esempio n. 8
0
    CSUI_PlantGrid _createPlantGrid(FarmPlantLogic p)
    {
        CSUI_PlantGrid pg = Instantiate(m_PlantPart.m_PlantGridPrefab) as CSUI_PlantGrid;

        pg.transform.parent = m_PlantPart.m_Root.transform;
        CSUtils.ResetLoacalTransform(pg.transform);
        pg.m_Plant       = p;
        pg.OnDestroySelf = OnPlantGridDestroySelf;
        //ItemObject itemObj = ItemMgr.Instance.Get( pg.m_Plant.mInstanceId);
        //if (itemObj != null)
        //{
        string[] iconStr = ItemProto.Mgr.Instance.Get(pg.m_Plant.protoTypeId).icon;
        if (iconStr.Length != 0)
        {
            pg.IconSpriteName = iconStr[0];
        }
        else
        {
            pg.IconSpriteName = "";
        }
        //}
        m_PlantGrids.Add(pg);

        UICheckbox cb = pg.gameObject.GetComponent <UICheckbox>();

        cb.radioButtonRoot = m_PlantPart.m_Root.transform;
        cb.startsChecked   = false;

        return(pg);
    }
Esempio n. 9
0
    private void Save(GameObject go)
    {
        UICheckbox component = base.GetComponent <UICheckbox>();

        if (component != null)
        {
            PlayerPrefs.SetString(this.key, !component.isChecked ? "false" : "true");
        }
        else
        {
            UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>();
            int          index  = 0;
            int          length = componentsInChildren.Length;
            while (index < length)
            {
                UICheckbox checkbox2 = componentsInChildren[index];
                if (checkbox2.isChecked)
                {
                    PlayerPrefs.SetString(this.key, checkbox2.name);
                    break;
                }
                index++;
            }
        }
    }
	/// <summary>
	/// Cache the components and register a listener callback.
	/// </summary>

	void Awake ()
	{
		mList = GetComponent<UIPopupList>();
		mCheck = GetComponent<UICheckbox>();
		if (mList != null) mList.onSelectionChange += SaveSelection;
		if (mCheck != null) mCheck.onStateChange += SaveState;
	}
Esempio n. 11
0
 public static void SetCheckboxValue(UICheckbox obj, bool selected)
 {
     if (obj != null)
     {
         obj.isChecked = selected;
     }
 }
Esempio n. 12
0
 public static void HideCheckbox(UICheckbox obj)
 {
     if (obj != null)
     {
         obj.gameObject.Hide();
     }
 }
Esempio n. 13
0
 private void OnEnable()
 {
     if (this.mList != null)
     {
         string @string = PlayerPrefs.GetString(this.key);
         if (!string.IsNullOrEmpty(@string))
         {
             this.mList.selection = @string;
         }
         return;
     }
     if (this.mCheck != null)
     {
         this.mCheck.isChecked = (PlayerPrefs.GetInt(this.key, 1) != 0);
     }
     else
     {
         string       string2 = PlayerPrefs.GetString(this.key);
         UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>(true);
         int          i   = 0;
         int          num = componentsInChildren.Length;
         while (i < num)
         {
             UICheckbox uicheckbox = componentsInChildren[i];
             uicheckbox.isChecked = (uicheckbox.name == string2);
             i++;
         }
     }
 }
Esempio n. 14
0
    /// <summary>
    /// Load and set the state of the checkboxes.
    /// </summary>

    void OnEnable()
    {
        if (mList != null)
        {
            string s = PlayerPrefs.GetString(key);
            if (!string.IsNullOrEmpty(s))
            {
                mList.selection = s;
            }
            return;
        }

        if (mCheck != null)
        {
            mCheck.isChecked = (PlayerPrefs.GetInt(key, 1) != 0);
        }
        else
        {
            string       s          = PlayerPrefs.GetString(key);
            UICheckbox[] checkboxes = GetComponentsInChildren <UICheckbox>(true);

            for (int i = 0, imax = checkboxes.Length; i < imax; ++i)
            {
                UICheckbox ch = checkboxes[i];
                ch.isChecked = (ch.name == s);
            }
        }
    }
Esempio n. 15
0
 public void disClickedBtn()
 {
     if(PlayerPrefs.HasKey("card_sort")){
         type_ = (EZCardSort.Type)(PlayerPrefs.GetInt("card_sort"));
     }
     switch(type_){
         case EZCardSort.Type.Lv:
             btn_ = _lv;
             break;
         case EZCardSort.Type.Quality:
             btn_ = _qua;
             break;
         case EZCardSort.Type.MagicType:
             btn_ = _pro;
             break;
         case EZCardSort.Type.Attack:
             btn_ = _attack;
             break;
         case EZCardSort.Type.Speed:
             btn_ = _speed;
             break;
         case EZCardSort.Type.MaxHealth:
             btn_ = _hp;
             break;
     }
     btn_.isChecked = true;
 }
    /// <summary>
    /// Load and set the state of the checkboxes.
    /// </summary>
    private void OnEnable()
    {
        string s = PlayerPrefs.GetString(key);

        if (!string.IsNullOrEmpty(s))
        {
            UICheckbox c = GetComponent <UICheckbox>();

            if (c != null)
            {
                c.isChecked = (s == "true");
            }
            else
            {
                UICheckbox[] checkboxes = GetComponentsInChildren <UICheckbox>();

                for (int i = 0, imax = checkboxes.Length; i < imax; ++i)
                {
                    UICheckbox ch = checkboxes[i];
                    UIEventListener.Get(ch.gameObject).onClick -= Save;
                    ch.isChecked = (ch.name == s);
                    Debug.Log(s);
                    UIEventListener.Get(ch.gameObject).onClick += Save;
                }
            }
        }
    }
Esempio n. 17
0
    public void PopulateCannonsList()
    {
        // We have the activity.  Populate the grid with Cannons!!
        EntityFactory ef = EntityFactory.GetEF();

        if (ef == null)
        {
            return;
        }

        // Getting ItemCards from Playerdata to populate list based on item cards not the entity factory calalog
        GameObjectTracker go = GameObjectTracker.GetGOT();

        if (go == null)
        {
            return;
        }

        if (_CardSelectors == null)
        {
            return;
        }

        // keeping track of the list of cannon selection objects locally

        // the next object to temp strore data for the list
        CannonSelectionObject newCannon = null;


        // Grab the deck of cards from the player data
        allItemCards = go._PlayerData.CardDeck;

        int cannonItemCardIndex = 0;

        foreach (CannonItemCard canItem in allItemCards)
        {
            //Create cannon and assign the reference.
            newCannon = NGUITools.AddChild(_gridOfCannons.gameObject, _refPrefab.gameObject).GetComponent <CannonSelectionObject>();
            newCannon.MyCannonCard = canItem;

            //Set the checkbox root.
            UICheckbox cbox = newCannon.GetComponent <UICheckbox>();
            if (cbox)
            {
                cbox.radioButtonRoot = this.transform;
            }

            _gridOfCannons.Reposition();

            _CardSelectors.Add(newCannon);

            cannonItemCardIndex++;
        }

        //Is populated is true,
        isPopulated = true;

        //And list give the list to the activity manager so they can grab it.
        ActivityManager.Instance.CardSelectors = _CardSelectors;
    }
Esempio n. 18
0
 private void OnEnable()
 {
     if (this.mList != null)
     {
         string str = PlayerPrefs.GetString(this.key);
         if (!string.IsNullOrEmpty(str))
         {
             this.mList.selection = str;
         }
     }
     else if (this.mCheck != null)
     {
         this.mCheck.isChecked = PlayerPrefs.GetInt(this.key, 1) != 0;
     }
     else
     {
         string       str2 = PlayerPrefs.GetString(this.key);
         UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>(true);
         int          index  = 0;
         int          length = componentsInChildren.Length;
         while (index < length)
         {
             UICheckbox checkbox = componentsInChildren[index];
             checkbox.isChecked = checkbox.name == str2;
             index++;
         }
     }
 }
Esempio n. 19
0
    private void OnEnable()
    {
        string str = PlayerPrefs.GetString(this.key);

        if (!string.IsNullOrEmpty(str))
        {
            UICheckbox component = base.GetComponent <UICheckbox>();
            if (component != null)
            {
                component.isChecked = str == "true";
            }
            else
            {
                UICheckbox[] componentsInChildren = base.GetComponentsInChildren <UICheckbox>();
                int          index  = 0;
                int          length = componentsInChildren.Length;
                while (index < length)
                {
                    UICheckbox      checkbox2 = componentsInChildren[index];
                    UIEventListener listener1 = UIEventListener.Get(checkbox2.gameObject);
                    listener1.onClick   = (UIEventListener.VoidDelegate)Delegate.Remove(listener1.onClick, new UIEventListener.VoidDelegate(this.Save));
                    checkbox2.isChecked = checkbox2.name == str;
                    Debug.Log(str);
                    UIEventListener listener2 = UIEventListener.Get(checkbox2.gameObject);
                    listener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(listener2.onClick, new UIEventListener.VoidDelegate(this.Save));
                    index++;
                }
            }
        }
    }
Esempio n. 20
0
 public static void ShowCheckbox(UICheckbox obj)
 {
     if (obj != null)
     {
         obj.gameObject.Show();
     }
 }
Esempio n. 21
0
        private void OnDestroy()
        {
            UISlider textureQualitySlider = m_textureQualitySlider;

            textureQualitySlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(textureQualitySlider.onValueChange, new UISlider.OnValueChange(OnTextureQualitySliderChange));
            UISlider shadowQualitySlider = m_shadowQualitySlider;

            shadowQualitySlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(shadowQualitySlider.onValueChange, new UISlider.OnValueChange(OnShadowQualitySliderChange));
            UISlider terrainQualitySlider = m_terrainQualitySlider;

            terrainQualitySlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(terrainQualitySlider.onValueChange, new UISlider.OnValueChange(OnTerrainQualitySliderChange));
            UISlider shadowDistanceSlider = m_shadowDistanceSlider;

            shadowDistanceSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(shadowDistanceSlider.onValueChange, new UISlider.OnValueChange(OnShadowDistanceSliderChange));
            UISlider terrainDetailsSlider = m_terrainDetailsSlider;

            terrainDetailsSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(terrainDetailsSlider.onValueChange, new UISlider.OnValueChange(OnTerrainDetailsSliderChange));
            UISlider effectQualitySlider = m_effectQualitySlider;

            effectQualitySlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(effectQualitySlider.onValueChange, new UISlider.OnValueChange(OnEffectQualitySliderChange));
            UISlider viewDistanceSlider = m_viewDistanceSlider;

            viewDistanceSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(viewDistanceSlider.onValueChange, new UISlider.OnValueChange(OnViewDistanceSliderChange));
            UISlider animationQualitySlider = m_animationQualitySlider;

            animationQualitySlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(animationQualitySlider.onValueChange, new UISlider.OnValueChange(OnAnimationQualitySliderChange));
            UISlider filteringSlider = m_filteringSlider;

            filteringSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(filteringSlider.onValueChange, new UISlider.OnValueChange(OnFilteringSliderChange));
            UISlider framerateMaxSlider = m_framerateMaxSlider;

            framerateMaxSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(framerateMaxSlider.onValueChange, new UISlider.OnValueChange(OnFramerateMaxSliderChange));
            UISlider brightnessSlider = m_brightnessSlider;

            brightnessSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(brightnessSlider.onValueChange, new UISlider.OnValueChange(OnBrightnessSliderChange));
            UISlider gammaSlider = m_gammaSlider;

            gammaSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(gammaSlider.onValueChange, new UISlider.OnValueChange(OnGammaSliderChange));
            UICheckbox fullScreen = m_fullScreen;

            fullScreen.onStateChange = (UICheckbox.OnStateChange)Delegate.Remove(fullScreen.onStateChange, new UICheckbox.OnStateChange(OnFullScreenChange));
            UICheckbox verticalSync = m_verticalSync;

            verticalSync.onStateChange = (UICheckbox.OnStateChange)Delegate.Remove(verticalSync.onStateChange, new UICheckbox.OnStateChange(OnVSyncChange));
            UICheckbox hdr = m_hdr;

            hdr.onStateChange = (UICheckbox.OnStateChange)Delegate.Remove(hdr.onStateChange, new UICheckbox.OnStateChange(OnHDRChange));
            UICheckbox terrainShadows = m_terrainShadows;

            terrainShadows.onStateChange = (UICheckbox.OnStateChange)Delegate.Remove(terrainShadows.onStateChange, new UICheckbox.OnStateChange(OnTerrainShadowsChange));
            UISlider objectDetailsSlider = m_objectDetailsSlider;

            objectDetailsSlider.onValueChange = (UISlider.OnValueChange)Delegate.Remove(objectDetailsSlider.onValueChange, new UISlider.OnValueChange(OnObjectDetailsSliderChange));
            UIPopupList antialiasing = m_antialiasing;

            antialiasing.onSelectionChange = (UIPopupList.OnSelectionChange)Delegate.Remove(antialiasing.onSelectionChange, new UIPopupList.OnSelectionChange(OnAntialiasingChange));
            UIPopupList resolution = m_resolution;

            resolution.onSelectionChange = (UIPopupList.OnSelectionChange)Delegate.Remove(resolution.onSelectionChange, new UIPopupList.OnSelectionChange(OnResolutionChanged));
        }
Esempio n. 22
0
 private byte[] ExportPermissions()
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         using (BinaryWriter writer = new BinaryWriter(memoryStream))
         {
             int           numberOfPermissions = 0;
             List <string> permissions         = new List <string>();
             for (int i = 1; i < checkboxContainer.ChildCount; i++)
             {
                 UICheckbox cb = (UICheckbox)checkboxContainer.children[i];
                 if (cb.Selected)
                 {
                     numberOfPermissions++;
                     permissions.Add(HEROsModNetwork.Group.PermissionList[i - 1].Key);
                 }
             }
             writer.Write(numberOfPermissions);
             foreach (var p in permissions)
             {
                 writer.Write(p);
             }
             writer.Close();
             memoryStream.Close();
             return(memoryStream.ToArray());
         }
     }
 }
Esempio n. 23
0
    /// <summary>
    /// Fade out or fade in the checkmark and notify the target of OnChecked event.
    /// </summary>

    void Set(bool state)
    {
        if (!mStarted)
        {
            mChecked      = state;
            startsChecked = state;
            if (checkSprite != null)
            {
                checkSprite.alpha = state ? 1f : 0f;
            }
        }
        else if (mChecked != state)
        {
            // Uncheck all other checkboxes
            if (radioButtonRoot != null && state)
            {
                UICheckbox[] cbs = radioButtonRoot.GetComponentsInChildren <UICheckbox>(true);

                for (int i = 0, imax = cbs.Length; i < imax; ++i)
                {
                    UICheckbox cb = cbs[i];
                    if (cb != this && cb.radioButtonRoot == radioButtonRoot)
                    {
                        cb.Set(false);
                    }
                }
            }

            // Remember the state
            mChecked = state;

            // Tween the color of the checkmark
            if (checkSprite != null)
            {
                TweenAlpha.Begin(checkSprite.gameObject, 0.15f, mChecked ? 1f : 0f);
            }

            current = this;

            // Notify the delegate
            if (onStateChange != null)
            {
                onStateChange(mChecked);
            }

            // Send out the event notification
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }
            current = null;

            // Play the checkmark animation
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
            }
        }
    }
Esempio n. 24
0
 // Use this for initialization
 void Start()
 {
     UICheckboxObject = checkbox.GetComponent<UICheckbox>();
     UISliderObject = slider.GetComponent<UISlider>();
     source = this.gameObject.GetComponent<AudioSource>();
     source.clip = musicToPlay;
     source.Play();
 }
Esempio n. 25
0
 public static bool GetCheckboxValue(UICheckbox obj)
 {
     if (obj != null)
     {
         return(obj.isChecked);
     }
     return(false);
 }
	private void OnEnable()
	{
		UICheckbox component = GetComponent<UICheckbox>();
		if (component != null)
		{
			OnActivate(component.isChecked);
		}
	}
Esempio n. 27
0
 void InitWnd()
 {
     this.m_CheckBox = this.GetComponent <UICheckbox>();
     if (null != this.m_CheckBox)
     {
         this.m_CheckBox.radioButtonRoot = transform.parent;
     }
 }
Esempio n. 28
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.SetPadding(6);
            int width  = 350;
            int height = 340;

            mainPanel.Left.Set(-40f - width, 1f);
            mainPanel.Top.Set(-110f - height, 1f);
            mainPanel.Width.Set(width, 0f);
            mainPanel.Height.Set(height, 0f);
            mainPanel.BackgroundColor = new Color(173, 94, 171);
            Append(mainPanel);

            UIText text = new UIText("Backgrounds:", 0.85f);

            text.Top.Set(12f, 0f);
            text.Left.Set(12f, 0f);
            mainPanel.Append(text);

            int nextSurfaceBgStyle     = (int)typeof(SurfaceBgStyleLoader).GetField("nextSurfaceBgStyle", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
            int nextUndergroundBgStyle = (int)typeof(UgBgStyleLoader).GetField("nextUgBgStyle", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
            int nextBackground         = (int)typeof(BackgroundTextureLoader).GetField("nextBackground", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);

            int top = 12;

            top += 20;
            quickChangeCheckbox = new UICheckbox("Quick Change", "Bypass background fade");
            quickChangeCheckbox.Top.Set(top, 0f);
            mainPanel.Append(quickChangeCheckbox);

            top += 30;
            surfaceBgStyleDataProperty = new UIIntRangedDataValue("SurfaceBgStyle:", -1, -1, nextSurfaceBgStyle - 1, true, true);
            UIElement uiRange = new UIRange <int>(surfaceBgStyleDataProperty);

            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            undergroundBgStyleDataProperty = new UIIntRangedDataValue("UgBgStyle:", -1, -1, nextUndergroundBgStyle - 1, true, true);
            uiRange = new UIRange <int>(undergroundBgStyleDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            undergroundTextureDataProperties = new UIIntRangedDataValue[7];
            for (int i = 0; i < 7; i++)
            {
                top += 30;
                // TODO: Show names of Mod added Styles and slots
                undergroundTextureDataProperties[i] = new UIIntRangedDataValue($"Ug Texture {i}:", -1, -1, nextBackground - 1, true, true);
                uiRange = new UIRange <int>(undergroundTextureDataProperties[i]);
                uiRange.Top.Set(top, 0f);
                uiRange.Width.Set(0, 1f);
                mainPanel.Append(uiRange);
            }
        }
Esempio n. 29
0
 private void Set(bool state)
 {
     if (!mStarted)
     {
         mChecked      = state;
         startsChecked = state;
         if (checkSprite != null)
         {
             checkSprite.alpha = ((!state) ? 0f : 1f);
         }
     }
     else
     {
         if (mChecked == state)
         {
             return;
         }
         if (radioButtonRoot != null && state)
         {
             UICheckbox[] componentsInChildren = radioButtonRoot.GetComponentsInChildren <UICheckbox>(includeInactive: true);
             int          i = 0;
             for (int num = componentsInChildren.Length; i < num; i++)
             {
                 UICheckbox uICheckbox = componentsInChildren[i];
                 if (uICheckbox != this && uICheckbox.radioButtonRoot == radioButtonRoot)
                 {
                     uICheckbox.Set(state: false);
                 }
             }
         }
         mChecked = state;
         if (checkSprite != null)
         {
             if (instantTween)
             {
                 checkSprite.alpha = ((!mChecked) ? 0f : 1f);
             }
             else
             {
                 TweenAlpha.Begin(checkSprite.gameObject, 0.15f, (!mChecked) ? 0f : 1f);
             }
         }
         current = this;
         if (onStateChange != null)
         {
             onStateChange(mChecked);
         }
         if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
         {
             eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
         }
         current = null;
         if (checkAnimation != null)
         {
             ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
         }
     }
 }
Esempio n. 30
0
    void OnEnable()
    {
        UICheckbox cbox = GetComponent <UICheckbox>();

        if (cbox != null)
        {
            cbox.isChecked = cbox.startsChecked;
        }
    }
Esempio n. 31
0
    void OnEnable()
    {
        UICheckbox chk = GetComponent <UICheckbox>();

        if (chk != null)
        {
            OnActivate(chk.isChecked);
        }
    }
Esempio n. 32
0
 void Start()
 {
     currentObj = GetComponent <UICheckbox>();
     if (currentObj != null)
     {
         //currentObj.functionName = "OnActivate";
         //currentObj.eventReceiver = gameObject;
     }
 }
Esempio n. 33
0
    private void Set(bool state)
    {
        if (!mStarted)
        {
            mChecked      = state;
            startsChecked = state;
            if (checkSprite != null)
            {
                checkSprite.alpha = !state ? 0f : 1f;
            }
        }
        else if (mChecked != state)
        {
            if (radioButtonRoot != null && state)
            {
                var componentsInChildren = radioButtonRoot.GetComponentsInChildren <UICheckbox>(true);
                var index  = 0;
                var length = componentsInChildren.Length;
                while (index < length)
                {
                    var checkbox = componentsInChildren[index];
                    if (checkbox != this && checkbox.radioButtonRoot == radioButtonRoot)
                    {
                        checkbox.Set(false);
                    }

                    index++;
                }
            }

            mChecked = state;
            if (checkSprite != null)
            {
                if (instantTween)
                {
                    checkSprite.alpha = !mChecked ? 0f : 1f;
                }
                else
                {
                    TweenAlpha.Begin(checkSprite.gameObject, 0.15f, !mChecked ? 0f : 1f);
                }
            }

            current = this;
            onStateChange?.Invoke(mChecked);
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }

            current = null;
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, !state ? Direction.Reverse : Direction.Forward);
            }
        }
    }
    void OnEnable()
    {
        checkbox = GetComponent<UICheckbox>();
        checkboxLocalScale = new Vector3 (size.x * scaleRatito, size.y * scaleRatito, 1);

        BoxCollider boxCollider = gameObject.AddComponent<BoxCollider>();
        boxCollider.size = checkboxLocalScale;
        CheckboxCheckmark.transform.localScale = checkboxLocalScale * 1.1f;
        CheckboxBackground.transform.localScale = checkboxLocalScale;
        Bg.transform.localScale = checkboxLocalScale;
    }
Esempio n. 35
0
    /// <summary>
    /// Fade out or fade in the checkmark and notify the target of OnChecked event.
    /// </summary>
    void Set(bool state)
    {
        if (mChecked != state)
        {
            // Uncheck all other checkboxes
            if (option && state)
            {
                UICheckbox[] cbs = mTrans.parent.GetComponentsInChildren<UICheckbox>();
                foreach (UICheckbox cb in cbs) if (cb != this) cb.Set(false);
            }

            // Remember the state
            mChecked = state;

            // Tween the color of the checkmark
            if (checkSprite != null)
            {
                Color c = checkSprite.color;
                c.a = mChecked ? 1f : 0f;
                TweenColor.Begin(checkSprite.gameObject, 0.2f, c);
            }

            // Send out the event notification
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                current = this;
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }

            // Play the checkmark animation
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
            }
        }
    }
Esempio n. 36
0
    /// <summary>
    /// Fade out or fade in the checkmark and notify the target of OnChecked event.
    /// </summary>
    void Set(bool state)
    {
        if (!mStarted)
        {
            mChecked = state;
            startsChecked = state;
            if (checkSprite != null) checkSprite.alpha = state ? 1f : 0f;
            if (checkLabel != null) checkLabel.alpha = state ? 1f : 0f;
        }
        else if (mChecked != state)
        {
            // Uncheck all other checkboxes
            if (radioButtonRoot != null && state)
            {
                UICheckbox[] cbs = radioButtonRoot.GetComponentsInChildren<UICheckbox>(true);

                for (int i = 0, imax = cbs.Length; i < imax; ++i)
                {
                    UICheckbox cb = cbs[i];
                    if (cb != this && cb.radioButtonRoot == radioButtonRoot) cb.Set(false);
                }
            }

            // Remember the state
            mChecked = state;

            // Tween the color of the checkmark
            if (checkSprite != null)
            {
                if (instantTween)
                {
                    checkSprite.alpha = mChecked ? 1f : 0f;
                }
                else
                {
                    TweenAlpha.Begin(checkSprite.gameObject, 0.15f, mChecked ? 1f : 0f);
                }
            }
            if (checkLabel != null)
            {
                if (instantTween)
                {
                    checkLabel.alpha = mChecked ? 1f : 0f;
                }
                else
                {
                    TweenAlpha.Begin(checkLabel.gameObject, 0.15f, mChecked ? 1f : 0f);
                }
            }

            current = this;

            // Notify the delegate
            if (onStateChange != null) onStateChange(mChecked);

            // Send out the event notification
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }
            current = null;

            // Play the checkmark animation
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
            }
        }
    }
Esempio n. 37
0
	// Use this for initialization
	void Start () {
        checkbox = this.gameObject.GetComponent<UICheckbox>();
        result = checkbox.isChecked;
	}
Esempio n. 38
0
 void Awake()
 {
     checkbox = GetComponent<UICheckbox>();
     checkboxLabel = GetComponentInChildren<UILabel>();
 }
Esempio n. 39
0
 /// <summary>
 /// Override to initialize the tooltip message. Remember base.InitializeOnAwake();
 /// </summary>
 protected virtual void Initialize() {
     checkbox = gameObject.GetSafeMonoBehaviour<UICheckbox>();
     checkbox.onStateChange += OnCheckboxStateChange;
 }
Esempio n. 40
0
 // Use this for initialization
 void Start()
 {
     _checkBox=gameObject.GetComponentInChildren<UICheckbox>();
     _buttonScle=gameObject.GetComponentInChildren<UIButtonScale>();
     _buttonSound=gameObject.GetComponentInChildren<UIButtonSound>();
 }
Esempio n. 41
0
 public override void Awake()
 {
     base.Awake();
     _checkBox = gameObject.GetComponent<UICheckbox>();
 }
Esempio n. 42
0
 private void Set(bool state)
 {
     if (!this.mStarted)
     {
         this.mChecked = state;
         this.startsChecked = state;
         if (this.checkSprite != null)
         {
             this.checkSprite.alpha = (!state ? 0f : 1f);
         }
     }
     else if (this.mChecked != state)
     {
         if (this.radioButtonRoot != null && state)
         {
             UICheckbox[] componentsInChildren = this.radioButtonRoot.GetComponentsInChildren<UICheckbox>(true);
             int num = 0;
             int length = (int)componentsInChildren.Length;
             while (num < length)
             {
                 UICheckbox uICheckbox = componentsInChildren[num];
                 if (uICheckbox != this && uICheckbox.radioButtonRoot == this.radioButtonRoot)
                 {
                     uICheckbox.Set(false);
                 }
                 num++;
             }
         }
         this.mChecked = state;
         if (this.checkSprite != null)
         {
             Color color = this.checkSprite.color;
             color.a = (!this.mChecked ? 0f : 1f);
             TweenColor.Begin(this.checkSprite.gameObject, 0.2f, color);
         }
         if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName))
         {
             UICheckbox.current = this;
             this.eventReceiver.SendMessage(this.functionName, this.mChecked, SendMessageOptions.DontRequireReceiver);
         }
         if (this.checkAnimation != null)
         {
             ActiveAnimation.Play(this.checkAnimation, (!state ? Direction.Reverse : Direction.Forward));
         }
     }
 }
Esempio n. 43
0
    /// <summary>
    /// Fade out or fade in the checkmark and notify the target of OnChecked event.
    /// </summary>
    void Set(bool state)
    {
        if (!mStarted)
        {
            startsChecked = state;
        }
        else if (mChecked != state)
        {
            // Uncheck all other checkboxes
            if (radioButtonRoot != null && state)
            {
                UICheckbox[] cbs = radioButtonRoot.GetComponentsInChildren<UICheckbox>();

                for (int i = 0, imax = cbs.Length; i < imax; ++i)
                {
                    UICheckbox cb = cbs[i];
                    if (cb != this && cb.radioButtonRoot == radioButtonRoot) cb.Set(false);
                }
            }

            // Remember the state
            mChecked = state;

            // Tween the color of the checkmark
            if (checkSprite != null)
            {
                Color c = checkSprite.color;
                c.a = mChecked ? 1f : 0f;
                TweenColor.Begin(checkSprite.gameObject, 0.2f, c);
            }

            // Send out the event notification
            if (eventReceiver != null && !string.IsNullOrEmpty(functionName))
            {
                current = this;
                eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver);
            }

            // Play the checkmark animation
            if (checkAnimation != null)
            {
                ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse);
            }
        }
    }
Esempio n. 44
0
	// Use this for initialization
	void Start ()
	{
		checkbox = this.gameObject.GetComponent<UICheckbox>();
	}