Example #1
0
    void OnAddButtonAnimation()
    {
        string[] allPrefabList = AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets/Resources/UI/Prefabs" });
        for (int i = 0; i < allPrefabList.Length; ++i)
        {
            string     prefabPath = AssetDatabase.GUIDToAssetPath(allPrefabList[i]);
            GameObject obj        = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;
            GameObject instObj    = PrefabUtility.InstantiatePrefab(obj) as GameObject;

            foreach (Transform t in instObj.GetComponentsInChildren <Transform>(true))
            {
                Text _text = t.GetComponent <Text>();
                if (_text != null)
                {
                    Outline _outline = _text.GetComponent <Outline>();
                    if (_outline != null)
                    {
                        DestroyImmediate(_outline);
                        Shadow shadow = _text.GetComponent <Shadow>();
                        if (shadow != null)
                        {
                            continue;
                        }
                        Shadow _Shadow = _text.gameObject.AddComponent <Shadow>();
                        _Shadow.effectDistance = new UnityEngine.Vector2(3, -3);
                    }
                    OutLineGlow _OutLineGlow = _text.GetComponent <OutLineGlow>();
                    if (_OutLineGlow != null)
                    {
                        DestroyImmediate(_OutLineGlow);
                        Shadow shadow = _text.GetComponent <Shadow>();
                        if (shadow != null)
                        {
                            continue;
                        }
                        Shadow _Shadow = _text.gameObject.AddComponent <Shadow>();
                        _Shadow.effectDistance = new UnityEngine.Vector2(3, -3);
                    }
                }
            }
            PrefabUtility.ReplacePrefab(instObj, obj);
            Object.DestroyImmediate(instObj);
        }
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
Example #2
0
        public override void InitUIData()
        {
            base.InitUIData();
            //_inst = this;
            ObjectSelf.GetInstance().GetSettingData().GetLocalSettingData();//获取Config表的配置信息

            m_backBtn = selfTransform.FindChild("UI_BG_Top/UI_Btn_Back").GetComponent <Button>();
            m_backBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickBackBtn));

            m_Setting = selfTransform.FindChild("Setting").gameObject;
            m_Options = selfTransform.FindChild("Options").gameObject;

            m_SettingBtn = selfTransform.FindChild("UI_BG_Top/UI_Btn_Setting").GetComponent <Button>();
            m_SettingBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickSettingBtn));

            m_OptionsBtn = selfTransform.FindChild("UI_BG_Top/UI_Btn_Options").GetComponent <Button>();
            m_OptionsBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickOptionsBtn));

            m_SettingOutline = selfTransform.FindChild("UI_BG_Top/UI_Btn_Setting/Text").GetComponent <OutLineGlow>();
            m_OptionsOutline = selfTransform.FindChild("UI_BG_Top/UI_Btn_Options/Text").GetComponent <OutLineGlow>();

            m_SystemSetting = selfTransform.FindChild("UI_BG_Top/UI_Btn_Setting/Text").GetComponent <Text>();
            m_SystemOption  = selfTransform.FindChild("UI_BG_Top/UI_Btn_Options/Text").GetComponent <Text>();
        }