/// <summary>
        /// Processes components and draws gizmos
        /// </summary>
        /// <param name="components"></param>
        public static void Show(List<Component> components)
        {
            _components = components;

            SystemManager.Instance.GizmoSignal.Connect(GizmosSlot);

            if (null == _gizmoTimer)
            {
                _gizmoTimer = new Timer(Duration, 1); // 3 seconds, single time
            }
            else
            {
                _gizmoTimer.Delay = Duration;
            }
            
            _gizmoTimer.Reset();
            _gizmoTimer.Start();
            _gizmoTimer.AddEventListener(Timer.COMPLETE, OnGizmoTimerComplete);
        }
示例#2
0
 public TextRotator()
 {
     _timer = new Timer {TickOnStart = true};
     _timer.Tick += TimerHandler;
 }
示例#3
0
        public void Initialize()
        {
            _timer = new Timer(0.5f, 1);

            TooltipShowHandler = new MulticastDelegate(this, TOOLTIP_SHOW);
            TooltipHideHandler = new MulticastDelegate(this, TOOLTIP_HIDE);

            /**
             * Sanity check
             * */
            //if (FadeInDuration + FadeOutDuration > MessageLifeTime)
            //    throw new TooltipManagerException(TooltipManagerException.LifetimeError);

            InitStage();

            MouseEventDispatcher.Instance.AddEventListener(MouseEvent.MOUSE_OVER, MouseOverHandler);
            if (ContinuousMode)
                MouseEventDispatcher.Instance.AddEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler);
            MouseEventDispatcher.Instance.AddEventListener(MouseEvent.MOUSE_OUT, MouseOutHandler);

#if TRIAL
            /* HACK CHECK */
            Acme acme = (Acme) Framework.GetComponent<Acme>(true);
            if (null == acme || !acme.gameObject.activeInHierarchy/*active*/ || !acme.enabled)
                return;
#endif
        }
示例#4
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");
            }
        }
示例#5
0
		override protected void TrackMouseDownHandler(Event e)
		{
			MouseEvent me = (MouseEvent) e;

			// which would push this enabled check into the child/skin components
			if (!Enabled)
				return;

			//Debug.Log("TrackMouseDownHandler: " + this);

			// Make sure we finish any running page animation before starting
			// a new one.
			//stopAnimation();
			
			// Cache original event location for use on later repeating events
			_trackPosition = Track.GlobalToLocal(me.GlobalPosition);
			
			// If the user shift-clicks on the track, then offset the event coordinates so 
			// that the thumb ends up centered under the mouse.
			if (me.Shift)
			{
				float thumbW = (null != Thumb) ? Thumb.Width /*Thumb.getLayoutBoundsWidth()*/ : 0;
				float thumbH = (null != Thumb) ? Thumb.Height /*Thumb.getLayoutBoundsHeight()*/ : 0;
				_trackPosition.X -= (thumbW / 2);
				_trackPosition.Y -= (thumbH / 2); 
			}

			float newScrollValue = PointToValue(_trackPosition.X, _trackPosition.Y);
			//Debug.Log("newScrollValue: " + newScrollValue);
			_trackScrollDown = (newScrollValue > Value);

			if (me.Shift)
			{
				//Debug.Log("slideDuration: " + GetStyle("slideDuration"));
				//Debug.Log("smoothScrolling: " + GetStyle("smoothScrolling"));

				// shift-click positions jumps to the clicked location instead
				// of incrementally paging
				float slideDuration = (float)GetStyle("slideDuration");
				float adjustedValue = NearestValidValue(newScrollValue, SnapInterval);
				if ((bool)GetStyle("smoothScrolling") && 
					slideDuration != 0 && 
					(Maximum - Minimum) != 0)
				{
					DispatchEvent(new FrameworkEvent(FrameworkEvent.CHANGE_START));
					//// Animate the shift-click operation
					//startAnimation(slideDuration * 
					//    (Math.abs(value - newScrollValue) / (maximum - minimum)),
					//    adjustedValue, deceleratingSineEaser);
					//animatingOnce = true;
				}
				else
				{
					SetValue(adjustedValue);
					DispatchEvent(new Event(Event.CHANGE));
				}
				
				return;
			}
			
			DispatchEvent(new FrameworkEvent(FrameworkEvent.CHANGE_START));
			// Assume we're repeating unless user releases 
			//animatingOnce = false;
			
			ChangeValueByPage(_trackScrollDown);
			
			_trackScrolling = true;

			// Add event handlers for drag and up events
			var sm = SystemEventDispatcher.Instance;
			sm.AddEventListener(MouseEvent.MOUSE_MOVE, TrackMouseMoveHandler, EventPhase.Capture | EventPhase.Target);
			sm.AddEventListener(MouseEvent.MOUSE_UP, TrackMouseUpHandler, EventPhase.Capture | EventPhase.Target);
			sm.AddEventListener(MouseEvent.MOUSE_LEAVE, TrackMouseUpHandler);

			if (null == _trackScrollTimer)
			{
				_trackScrollTimer = new Timer((float) GetStyle("repeatDelay"), 1);
				_trackScrollTimer.AddEventListener(Timer.TICK, 
												  TrackScrollTimerHandler);
			} 
			else
			{
				// Note that this behavior, resetting the initial delay, differs 
				// from Flex3 but is more consistent with general application
				// scrollbar behavior
				_trackScrollTimer.Delay = (float) GetStyle("repeatDelay");
				_trackScrollTimer.RepeatCount = 1;
			}
			_trackScrollTimer.Start();
		}
示例#6
0
 public FrameAnimator()
 {
     _timer = new Timer();
     _timer.Tick += OnTimerTick;
     _timer.Start();
 }
示例#7
0
 /**
  *  
  */
 private void StopTimer()
 {
     _autoRepeatTimer.Stop();
     _autoRepeatTimer = null;
 }
示例#8
0
 /**
  *  
  */
 private void StartTimer()
 {
     _autoRepeatTimer = new Timer((float)GetStyle("repeatDelay"));
     _autoRepeatTimer.AddEventListener(Timer.TICK, AutoRepeatTimerDelayHandler);
     _autoRepeatTimer.Start();
 }