static void AddButtonScale() { Object[] sObjs = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); foreach (Object sObj in sObjs) { if (sObj.name.Contains(".meta")) { continue; } GameObject sGo = sObj as GameObject; Button[] sGoChildTrans = sGo.transform.GetComponentsInChildren <Button>(true); Debug.Log(" AddButtonScale sGoChildTrans Count=" + sGoChildTrans.Length); if (sGoChildTrans.Length > 0) { foreach (Button childTran in sGoChildTrans) { ButtonScale bs = childTran.GetComponent <ButtonScale>(); if (!bs) { childTran.gameObject.AddComponent <ButtonScale>(); } } SerializedObject so = new SerializedObject(sObj); so.ApplyModifiedProperties(); } } Debug.Log(" AddButtonScale OK !!! "); AssetDatabase.SaveAssets(); }
// Use this for initialization void Start() { buttons = new List <GameObject>(); buttonScale = new ButtonScale(); lastScreenHeight = Screen.height; lastScreenWidth = Screen.width; buttonScale.Initialize(referenceButtonSize, referenceScreenSize, (int)mode); circSpawner.FitDistanceToScreenSize(buttonScale.referenceScreenSize); linSpawner.FitSpacingToScreenSize(buttonScale.referenceScreenSize); if (revealSettings.revealOnStart) { SpawnButtons(); } }
public override void OnInspectorGUI() { EditorGUIUtility.labelWidth = 100f; EditorGUILayout.Space(); ButtonScale mScale = target as ButtonScale; Transform tweenTarget = EditorGUILayout.ObjectField("Tween Target", mScale.tweenTarget, typeof(Transform), true) as Transform; if (mScale.tweenTarget != tweenTarget) { mScale.tweenTarget = tweenTarget; } DrawHover(); DrawPressed(); }
private void DrawPressed() { //EditorGUIUtility.labelWidth = 120f; ButtonScale mScale = target as ButtonScale; bool showPressed = EditorGUILayout.Toggle("Show Pressed", mScale.showPressed); if (mScale.showPressed != showPressed) { mScale.showPressed = showPressed; } if (mScale.showPressed) { if (EditorTools.DrawHeader("Pressed")) { EditorTools.BeginContents(); GUILayout.BeginVertical(); //EditorGUIUtility.labelWidth = 100f; GUILayout.Space(4f); Vector3 pressed = EditorGUILayout.Vector3Field("Scale", mScale.pressed); if (mScale.pressed != pressed) { mScale.pressed = pressed; } GUILayout.Space(4f); float pressedDuration = EditorGUILayout.FloatField("Duration", mScale.pressedDuration); if (mScale.pressedDuration != pressedDuration) { mScale.pressedDuration = pressedDuration; } GUILayout.Space(4f); GUILayout.EndVertical(); EditorTools.EndContents(); } } }
private void DrawHover() { ButtonScale mScale = target as ButtonScale; bool showHover = EditorGUILayout.Toggle("Show Hover", mScale.showHover); if (mScale.showHover != showHover) { mScale.showHover = showHover; } if (mScale.showHover) { if (EditorTools.DrawHeader("Hover")) { EditorTools.BeginContents(); GUILayout.BeginVertical(); //EditorGUIUtility.labelWidth = 100f; GUILayout.Space(4f); Vector3 hover = EditorGUILayout.Vector3Field("Scale", mScale.hover); if (mScale.hover != hover) { mScale.hover = hover; } GUILayout.Space(4f); float hoverDuration = EditorGUILayout.FloatField("Duration", mScale.hoverDuration); if (mScale.hoverDuration != hoverDuration) { mScale.hoverDuration = hoverDuration; } GUILayout.Space(4f); GUILayout.EndVertical(); EditorTools.EndContents(); } } }
/// <summary> /// The size of the Button. Defaults to 'Small'. /// </summary> public virtual TBuilder Scale(ButtonScale scale) { this.ToComponent().Scale = scale; return(this as TBuilder); }
/// <summary> /// Method to change the scale of the button. See scale for allowed configurations. /// </summary> /// <param name="scale">The scale to change to.</param> protected virtual void SetScale(ButtonScale scale) { this.Call("setScale", scale.ToString().ToLowerInvariant()); }
public void _Init() { if (Lock_4 == null) { Lock_4 = Lock_4_obj.GetComponent <ButtonScale>(); Lock_8 = Lock_8_obj.GetComponent <ButtonScale>(); Lock_12 = Lock_12_obj.GetComponent <ButtonScale>(); } LevelViewbs levelView = null; GameObject name = null; string levelName = ""; for (int idx = 0; idx < BattleMgr.Instance.Genlevel.Count; idx++) { if (idx > 0) { return; } switch (idx) { case 0: name = commonBack_obj; break; case 1: name = eliteBack_obj; break; case 2: name = epicBack_obj; break; } ChapterDic.Add(new List <GameObject>()); for (int idx1 = 0; idx1 < BattleMgr.Instance.Genlevel[idx].Count; idx1++) { string chapter = string.Format("level_{0}", ((idx + 1) * 100 + (idx1 + 1))); ChapterDic[idx].Add(name.transform.Find(chapter).gameObject); for (int idx2 = 0; idx2 < BattleMgr.Instance.Genlevel[idx][idx1].GenStage.Count; idx2++) { levelName = string.Format("stage_{0}", BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].LevelID); string level = String.Concat(name.name, "/", chapter, "/level/", levelName); levelView = commonBack_obj.transform.parent.transform.Find(level).GetComponent <LevelViewbs>(); levelView.isZeki = BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].isZeki; levelView.Init(); Genlevel.Add(BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].LevelID, levelView); if (BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].StarCount != 0 || (idx == 0 && idx1 == 0 && idx2 == 0)) { Genlevel[BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].LevelID].CloseBtn.enabled = true; if (idx2 + 1 < BattleMgr.Instance.Genlevel[idx][idx1].GenStage.Count) { switch (idx) { case 0: if (BattleMgr.Instance.NowLevelId >= 10301) { break; } BattleMgr.Instance.NowLevelId = BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2 + 1].LevelID; elite_tog.interactable = true; break; case 1: BattleMgr.Instance.EliteLevelId = BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2 + 1].LevelID; epic_tog.interactable = true; break; case 2: BattleMgr.Instance.EpicLevelId = BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2 + 1].LevelID; break; } } else { if (idx1 + 1 >= BattleMgr.Instance.Genlevel[idx].Count) { break; } ; if (BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage.Count == 0) { break; } switch (idx) { case 0: for (int i = 0; i < BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage.Count; i++) { BattleMgr.Instance.NowLevelId = BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage[0].LevelID; if (BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage[i].StarCount != 0) { BattleMgr.Instance.NowLevelId = BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage[i].LevelID; } } break; case 1: BattleMgr.Instance.EliteLevelId = BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage[0].LevelID; break; case 2: BattleMgr.Instance.EpicLevelId = BattleMgr.Instance.Genlevel[idx][idx1 + 1].GenStage[0].LevelID; break; } } ChapterDic[idx][idx1].SetActive(true); // battleName = ChapterDic[idx][idx1].transform.Find("battleName").gameObject; } else { Genlevel[BattleMgr.Instance.Genlevel[idx][idx1].GenStage[idx2].LevelID].CloseBtn.enabled = false; } } } } }
/// <summary> /// Method to change the scale of the button. See scale for allowed configurations. /// </summary> /// <param name="scale">The scale to change to.</param> protected virtual void SetScale(ButtonScale scale) { this.Call("setScale", scale.ToString().ToLowerInvariant()); }