Esempio n. 1
0
        private void Awake()
        {
            if (_cmCurve == null)
            {
                GameObject go = GameObject.Find(ConfigFilename);
                if (go == null)
                {
#if UNITY_EDITOR
                    go = (GameObject)Resources.Load(ConfigFilename).ExtInstantiate();
#else
                    ResObj resource = ResService.GetResource(ConfigFilename);
                    if (resource != null)
                    {
                        go = (GameObject)resource.Content.ExtInstantiate();
                        ResService.UnloadResource(resource);
                    }
#endif
                    if (null != go)
                    {
                        ExtObject.ExtDontDestroyOnLoad(go);
                    }
                }

                if (go != null)
                {
                    go.name  = ConfigFilename;
                    _cmCurve = go.ExtGetComponent <UICurveCfg>();
                    _cmAudio = go.ExtGetComponent <UIAudioCfg>();
                }
            }

            _cacheTf       = transform;
            _originalScale = _cacheTf.localScale;
        }
        private void Awake()
        {
            if (ApplyButtonClickCurve)
            {
                GameObject go = GameObject.Find(ConfigFilename);
                if (go == null)
                {
#if UNITY_EDITOR
                    go = (GameObject)Resources.Load(ConfigFilename).ExtInstantiate();
#else
                    ResObj resource = ResService.GetResource(ConfigFilename);
                    if (resource != null)
                    {
                        go = (GameObject)resource.Content.ExtInstantiate();
                        ResService.UnloadResource(resource);
                    }
#endif
                    if (null != go)
                    {
                        ExtObject.ExtDontDestroyOnLoad(go);
                    }
                }

                if (go != null)
                {
                    go.name = ConfigFilename;
                    UICurveCfg cfg = go.ExtGetComponent <UICurveCfg>();
                    _curve = cfg.GetCurve("Normal");
                }
            }
            //
            if (_curve != null)
            {
                Keyframe lastKf = _curve[_curve.length - 1];
                _lastKeyTime = lastKf.time;
            }
            _cacheTf       = transform;
            _originalScale = _cacheTf.localScale;
        }