Exemplo n.º 1
0
        public override void OnDisable()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }
            if (state.HasState(EntityState.Released))
            {
                return;
            }
            if (!state.HasState(EntityState.Enabled))
            {
                return;
            }
            state &= ~EntityState.Enabled;

            signals.Remove(this);

            ProcessingEntities.Default.Remove(this);
            ProcessingUpdate.Default.Remove(this);

            for (var i = 0; i < countBehaviors; i++)
            {
                behaviours[i].Enable(false);
            }
        }
Exemplo n.º 2
0
        private void OnDestroy()
        {
            countTicks      = 0;
            countTicksFixed = 0;
            countTicksLate  = 0;
            countBehaviors  = 0;

            foreach (var value in components.Values)
            {
                var disposable = value as IDisposable;

                if (disposable == null)
                {
                    continue;
                }
                disposable.Dispose();
            }

            if (!Toolbox.isQuittingOrChangingScene())
            {
                ProcessingEntities.Default.Remove(this);
                ProcessingUpdate.Default.Remove(this);
            }

            ticks.Clear();
            ticksFixed.Clear();
            ticksLate.Clear();

            behaviours.Clear();
            components.Clear();
        }
Exemplo n.º 3
0
        private void OnDestroy()
        {
            foreach (var value in components.Values)
            {
                var disposable = value as IDisposable;

                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }

            if (!Toolbox.isQuittingOrChangingScene())
            {
                ProcessingEntities.Default.Remove(this);
                ProcessingUpdate.Default.Remove(this);
            }


            var timers = ProcessingTimer.Default.allWorkingTimers.FindAll(t => ReferenceEquals(t.id, this));

            for (int i = 0; i < timers.Count; i++)
            {
                timers[i].Dispose();
            }

            components.Clear();
            componentsTagRecievers.Clear();
            componentsEnableRecieves.Clear();
        }
Exemplo n.º 4
0
        static internal void HandleChange(int id, int tag)
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }

            List <GroupBase> groups;

            if (groupsInclude.TryGetValue(tag, out groups))
            {
                var len = groups.Count;

                for (int i = 0; i < len; i++)
                {
                    groups[i].TagsChanged(id);
                }
            }

            if (groupsDeclude.TryGetValue(tag, out groups))
            {
                var len = groups.Count;
                for (int i = 0; i < len; i++)
                {
                    groups[i].TagsChanged(id);
                }
            }
        }
Exemplo n.º 5
0
        public override void OnDisable()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }
            if (state.HasState(EntityState.Released))
            {
                return;
            }
            if (!state.HasState(EntityState.Enabled))
            {
                return;
            }
            state &= ~EntityState.Enabled;

            signals.Remove(this);

            ProcessingUpdate.Default.Remove(this);
            ProcessingEntities.Default.Remove(this);

            var count = componentsEnableRecieves.Count;

            for (int i = 0; i < count; i++)
            {
                componentsEnableRecieves[i].Enable(false);
            }

            HandleDisable();
        }
Exemplo n.º 6
0
        private IEnumerator _ColorLine()
        {
            TMP_TextInfo textInfo = fieldInput.textComponent.textInfo;

            fieldInput.textComponent.ForceMeshUpdate();


            Color32[] newVertexColors;
            Color32   c0 = fieldInput.textComponent.color;

            fieldInput.textComponent.renderMode = TextRenderFlags.DontRender;
            yield return(new WaitForSeconds(0.1f));

            while (true)
            {
                int characterCount = textInfo.characterCount;

                // If No Characters then just yield and wait for some text to be added
                if (characterCount == 0)
                {
                    yield return(new WaitForSeconds(0.25f));

                    continue;
                }

                for (var i = 0; i < characterCount; i++)
                {
                    if (!textInfo.characterInfo[i].isVisible)
                    {
                        continue;
                    }
                    var materialIndex = textInfo.characterInfo[i].materialReferenceIndex;
                    newVertexColors = textInfo.meshInfo[materialIndex].colors32;
                    var vertexIndex = textInfo.characterInfo[i].vertexIndex;
                    if (i >= size.x && i <= size.y)
                    {
                        c0 = new Color32((byte)0, (byte)205, (byte)100, 255);
                    }
                    else
                    {
                        c0 = new Color32(255, 255, 255, 255);
                    }

                    newVertexColors[vertexIndex + 0] = c0;
                    newVertexColors[vertexIndex + 1] = c0;
                    newVertexColors[vertexIndex + 2] = c0;
                    newVertexColors[vertexIndex + 3] = c0;
                }

                fieldInput.textComponent.UpdateVertexData();
                if (Toolbox.isQuittingOrChangingScene())
                {
                    yield break;
                }
                yield return(new WaitForSeconds(Time.DeltaTime));
            }
        }
Exemplo n.º 7
0
//TODO: refactor

        public override void OnDisable()
        {
            if (Toolbox.isQuittingOrChangingScene() || state.released ||
                !state.enabled)
            {
                return;
            }

            state.enabled  = false;
            state.disabled = true;
            ProcessingEntities.Default.CheckGroups(id, false);

            var len = compositionNoTags.Count;
            int i;

            for (i = 0; i < len; i++)
            {
                Behavior.behaviors[compositionNoTags[i]].RemoveElement(id);
            }


            len = compositions != null ? compositions.Count : -1;

            for (i = 0; i < len; i++)
            {
                var composition = compositions[i];
                if (composition.changed || !composition.Contain(tags))
                {
                    continue;
                }
                composition.changed = true;
                var l = composition.ids.Count;
                for (var j = 0; j < l; j++)
                {
                    Behavior.behaviors[composition.ids[j]].RemoveElement(id);
                }

                l = composition.delegates.Count;
                for (var j = 0; j < l; j++)
                {
                    composition.delegates[j](false);
                }
            }


            if (ProcessingSignals.TryRemoveGlobal(this))
            {
                signals?.Remove(this);
            }


            ProcessingUpdate.Default.Remove(this);

            HandleDisable();
        }
Exemplo n.º 8
0
 public void HandleTagsChanged()
 {
     if (Toolbox.isQuittingOrChangingScene())
     {
         return;
     }
     ProcessingEntities.Default.Changed(this);
     for (var i = 0; i < countBehaviors; i++)
     {
         behaviours[i].OnTagsChanged();
     }
 }
Exemplo n.º 9
0
        protected void OnDestroy()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }
            prevID.Push(id);


            ProcessingEntities.Default.CheckGroups(id, false);

            var len = compositionNoTags.Count;
            int i;

            for (i = 0; i < len; i++)
            {
                Behavior.behaviors[compositionNoTags[i]].RemoveElement(id);
            }


            len = compositions != null ? compositions.Count : -1;

            for (i = 0; i < len; i++)
            {
                var composition = compositions[i];

                var l = composition.ids.Count;
                for (var j = 0; j < l; j++)
                {
                    Behavior.behaviors[composition.ids[j]].RemoveElement(id);
                }

                composition.delegates.Clear();
            }


            if (ProcessingSignals.TryRemoveGlobal(this))
            {
                signals?.Remove(this);
            }


            ProcessingUpdate.Default.Remove(this);


            compositionNoTags.Clear();
            compositions.Clear();
            tags?.Clear();
            signals?.Dispose();
            signals = null;
        }
Exemplo n.º 10
0
        public void HandleTagsChanged()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }
            ProcessingEntities.Default.Changed(this);

            var amount = componentsTagRecievers.Count;

            for (int i = 0; i < amount; i++)
            {
                componentsTagRecievers[i].OnTagsChanged();
            }
        }
Exemplo n.º 11
0
        private void OnDisable()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }


            Toolbox.Get <ProcessingUpdate>().Remove(this);


            fieldInput.text = string.Empty;
            fieldInput.onSubmit.RemoveListener(AddToConsole);
            fieldInput.onValueChanged.RemoveListener(ChangeText);
            if (EventSystem.current != null)
            {
                EventSystem.current.SetSelectedGameObject(null);
            }
        }
Exemplo n.º 12
0
        public virtual void OnDisable()
        {
            if (Toolbox.isQuittingOrChangingScene() || !state.enabled)
            {
                return;
            }

            state.enabled = false;


            if (ProcessingSignals.TryRemoveGlobal(this))
            {
                signals?.Remove(this);
            }


            ProcessingUpdate.Default.Remove(this);

            HandleDisable();
        }
Exemplo n.º 13
0
        private void OnDestroy()
        {
            foreach (var value in components.Values)
            {
                var disposable = value as IDisposable;

                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }

            if (!Toolbox.isQuittingOrChangingScene())
            {
                ProcessingEntities.Default.Remove(this);
                ProcessingUpdate.Default.Remove(this);
            }


            behaviours.Clear();
            components.Clear();

            countBehaviors = 0;
        }
Exemplo n.º 14
0
        void HandleTagsChanged()
        {
            if (Toolbox.isQuittingOrChangingScene())
            {
                return;
            }
            if (state.disabled)
            {
                return;
            }

            var len = compositions != null ? compositions.Count : 0;

            for (var i = 0; i < len; i++)
            {
                var composition = compositions[i];

                if (composition.Contain(tags))
                {
                    //  Debug.Log(composition.changed + "_" + composition);
                    if (composition.changed)
                    {
                        continue;
                    }

                    var count = composition.ids.Count;
                    composition.changed = true;
                    for (var j = 0; j < count; j++)
                    {
                        Behavior.behaviors[composition.ids[j]].AddElement(id);
                    }

                    var l = composition.delegates.Count;
                    for (var j = 0; j < l; j++)
                    {
                        composition.delegates[j](true);
                    }
                }
                else
                {
                    if (!composition.changed)
                    {
                        continue;
                    }
                    composition.changed = false;
                    var count = composition.ids.Count;
                    for (var j = 0; j < count; j++)
                    {
                        Behavior.behaviors[composition.ids[j]].RemoveElement(id);
                    }

                    var l = composition.delegates.Count;
                    for (var j = 0; j < l; j++)
                    {
                        composition.delegates[j](false);
                    }
                }
            }

            var groups = ProcessingEntities.Default.GroupsBase;

            len = ProcessingEntities.Default.groupCount;


            for (var i = 0; i < len; i++)
            {
                groups[i].ChangeTags(id);
            }

            groups = ProcessingEntities.Default.GroupsActors;
            len    = ProcessingEntities.Default.groupCountActors;
            for (var i = 0; i < len; i++)
            {
                groups[i].ChangeTags(id);
            }
        }