Exemple #1
0
 public FrameAnimator()
 {
     _timer = new Timer();
     _timer.Tick += OnTimerTick;
     _timer.Start();
 }
Exemple #2
0
        private void ProcessXml(string xml)
        {
            try
            {
                Configuration configuration = XmlSerializer<Configuration>.Deserialize(xml);

                if (null == configuration)
                {
                    _xmlState = XmlLoadingState.Error;
                    return;
                }

                _settings = configuration.Settings;

                if (configuration.Blocked)
                {
                    //Alert.Show("Blocked", "The application is being blocked");
                    _timer = new Timer(10, 1);
                    _timer.Complete += OnTimerComplete;
                    _timer.Start();
                }

                if (null != configuration.InfoMessage)
                {
                    var info = configuration.InfoMessage;

                    bool shouldShow = info.Mode == MessageMode.Both;
                    if (Application.isEditor)
                    {
                        shouldShow = shouldShow || info.Mode == MessageMode.Editor;
                    }
                    else
                    {
                        shouldShow = shouldShow || info.Mode == MessageMode.Build;
                    }

                    if (shouldShow)
                    {
                        Alert.Show(
                            delegate(string action)
                            {
                                switch (action)
                                {
                                    case "dismiss":
                                        // do nothing
                                        break;
                                    case "more":
                                        Application.OpenURL(info.Url);
                                        break;
                                    default:
                                        break;
                                }

                            },
                            new AlertOption(AlertOptionType.Title, info.Title),
                            new AlertOption(AlertOptionType.Message, info.Message),
                            new AlertOption(AlertOptionType.Button, new AlertButtonDescriptor("dismiss", "Dismiss", true)),
                            new AlertOption(AlertOptionType.Button, new AlertButtonDescriptor("more", "More..."))
                            );
                    }
                }

                if (null != configuration.Messages)
                {
                    if (configuration.Messages.Count != 0)
                    {
                        List<string> msgs = new List<string>(_texts);

                        if (!configuration.AppendMessages)
                        {
                            msgs = new List<string>();
                            //if (configuration.Messages.Count == 1)
                            //    msgs.Add(_texts[0]);
                        }

                        foreach (InfoMessage message in configuration.Messages)
                        {
                            //Debug.Log("* " + message.Message);
                            msgs.Add(message.Message);
                        }
                        _texts = msgs.ToArray();
                    }
                }

                /**
             * 2. Load logo
             * */

                var logo = configuration.LogoInfo;
                if (null == logo)
                {
                    _xmlState = XmlLoadingState.Error;
                    return;
                }

                _logoInEditor = logo.ShowInEditor;
                _logoInBuild = logo.ShowInBuild;

                if (Application.isEditor)
                {
                    if (!_logoInEditor)
                    {
                        _xmlState = XmlLoadingState.Finished;
                        return;
                    }
                }
                else
                {
                    if (!_logoInBuild)
                    {
                        _xmlState = XmlLoadingState.Finished;
                        return;
                    }
                }

                string logoUrl = logo.Url;

                if (string.IsNullOrEmpty(logoUrl))
                    return;

                _logoAlpha = Mathf.Clamp(logo.Alpha, 0, 1);
                _logoColor = new Color(1, 1, 1, _logoAlpha);
                _logoPlacement = logo.Placement;
                _logoInterval = Mathf.Max(logo.Duration, LogoFadeInInterval + LogoFadeOutInterval);

                if (logo.CacheBuster)
                    logoUrl += string.Format("?{0}", (DateTime.Now - new DateTime(1970, 1, 1)).Ticks);

                _request = new WWW(logoUrl);
                _xmlState = XmlLoadingState.LoadingLogo;
            }
            catch (Exception)
            {
                Debug.Log("Error loading data");
            }
        }
Exemple #3
0
 /**
  *  
  */
 private void StartTimer()
 {
     _autoRepeatTimer = new Timer((float)GetStyle("repeatDelay"));
     _autoRepeatTimer.AddEventListener(Timer.TICK, AutoRepeatTimerDelayHandler);
     _autoRepeatTimer.Start();
 }