Ejemplo n.º 1
0
        protected void ApplyNewStates()
        {
            foreach (var newState in _newStates)
            {
                var existingNum = GetStateIndex(_touchStates, newState.id);
                if (existingNum >= 0)
                {
                    _touchStates[existingNum] = newState;
                }
                else
                {
                    _touchStates.Add(newState);
                    _touchBegan.Dispatch(newState);
                }
            }

            if (_touchStates.Count == _newStates.Count)
            {
                return;
            }

            for (int i = _touchStates.Count - 1; i >= 0; i--)
            {
                var curState    = _touchStates[i];
                var existingNum = GetStateIndex(_newStates, curState.id);
                if (existingNum < 0)
                {
                    _touchStates.RemoveAt(i);
                    _touchEnded.Dispatch(curState);
                }
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            isDrawPhase = false;

            if (FlashResources.isPlatformReloadingEnabled)
            {
                FlashResources.reloadPendingResources();
            }

            if (_shaderDirty)
            {
                sceneBatch.shader = shader;
                debugBatch.shader = shader;

                _shaderDirty = false;
            }

            if (_resourceDirty)
            {
                UpdateContent();
                _resourceDirty = false;
            }

            isDrawPhase = true;

            debugBatch.Begin(GetGlobalMatrix());
            root.Draw();
            drawEvent.Dispatch();
            debugBatch.renderQueue = sceneBatch.renderQueue + 1;
            debugBatch.End();

            isDrawPhase = false;
        }
Ejemplo n.º 3
0
        public void OnGUI()
        {
            eventName = EditorGUILayout.TextField("Event Name", eventName);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Event Type", GUILayout.Width(145));
            eventTypeIndex = EditorGUILayout.Popup(eventTypeIndex, MyEventType.typeList.ToArray());
            EditorGUILayout.EndHorizontal();

            DrawValueProperty(typeIndex);

            if (GUILayout.Button("Send Event"))
            {
                var    eventData = TypeUtils.ChangeType(value, MyPreferredType.Find(typeIndex));
                string eventKey  = MyEventType.typeList[eventTypeIndex];
                string eventType = MyEventType.typeDict[eventKey];

                if (string.Equals("Default", eventType))
                {
                    EventSender.SendGlobalEvent(eventName, eventData);
                }
                else
                {
                    EventSender.Dispatch(eventType, eventName, eventData);
                }
            }
        }
Ejemplo n.º 4
0
        void FixedUpdate()
        {
            isDrawPhase = false;

            if (Application.isPlaying)
            {
                input.DoUpdate();
                touchController.DoUpdate();
                updateEvent.Dispatch();
            }
        }
Ejemplo n.º 5
0
        private void HandleUpdate()
        {
            if (_enterFrameEvent != null)
            {
                _enterFrameEvent.Dispatch(this);
            }

            if (_animation != null && _animation.isActive)
            {
                _animation.DoStep();
            }
        }