Exemplo n.º 1
0
        protected override void OnEnable()
        {
            _lifeTime?.Release();

            GameLog.Log("GameFlowWindow : OnEnable");
            graph = null;

            base.OnEnable();

            _lifeTime.AddCleanUpAction(() => windows.Remove(this));

            if (!windows.Contains(this))
            {
                windows.Add(this);
            }

            MessageBroker.Default
            .Receive <UniGraphSaveMessage>()
            .Where(x => x.graph == _targetGraph)
            .Do(x => Save())
            .Subscribe()
            .AddTo(_lifeTime);

            MessageBroker.Default
            .Receive <UniGraphReloadMessage>()
            .Where(x => x.graph == _targetGraph)
            .Do(x => Save())
            .Do(x => Reload())
            .Subscribe()
            .AddTo(_lifeTime);

            Reload();
        }
Exemplo n.º 2
0
        private void InnerInitialize(
            IGraphData graphData,
            Action initializeAction = null,
            Action <List <ILifeTimeCommand> > initializeCommands = null,
            Action executeAction = null)
        {
            if (Application.isEditor && Application.isPlaying == false)
            {
                _lifeTime?.Release();
            }

            if (Application.isPlaying && _isInitialized)
            {
                return;
            }

            _onInitialize         = initializeAction;
            _onCommandsInitialize = initializeCommands;
            _onExecute            = executeAction;

            _lifeTime?.Release();

            base.Initialize(graphData);

            InitializeData(graphData);

            _isInitialized = Application.isPlaying;

            //initialize all node commands
            InitializeCommands();
            //initialize ports
            InitializePorts();
            //custom node initialization
            OnInitialize();
            //proxy initialization
            _onInitialize?.Invoke();

            LifeTime.AddCleanUpAction(() => { _isActive = false; });
        }
Exemplo n.º 3
0
        /// <summary>
        /// initialize property with target Addressable Asset
        /// </summary>
        /// <param name="addressable"></param>
        public void Initialize(TAddressable addressable)
        {
            lifeTimeDefinition = lifeTimeDefinition ?? new LifeTimeDefinition();
            progress           = progress ?? new FloatRecycleReactiveProperty();
            status             = status ?? new RecycleReactiveProperty <AsyncOperationStatus>();
            value = value ?? new RecycleReactiveProperty <TApi>();

            lifeTimeDefinition.Release();

            reference = addressable;

            lifeTimeDefinition.AddCleanUpAction(CleanUp);
        }
Exemplo n.º 4
0
        public async UniTask Initialize(IViewModel model, bool isViewOwner = false)
        {
            // save current state
            _isViewOwner = isViewOwner;

            //restart view lifetime
            _viewModelLifeTime.Release();
            _progressLifeTime.Release();

            //calls one per lifetime
            if (!_isInitialized.Value)
            {
                InitialSetup();
                OnAwake();
            }

            InitializeHandlers(model);

            BindLifeTimeActions(model);

            //custom initialization
            await OnInitialize(model);
        }
        protected override void OnEnable()
        {
            _lifeTime?.Release();

            GameLog.Log("GameFlowWindow : OnEnable");
            graph = null;

            base.OnEnable();

            _lifeTime.AddCleanUpAction(() => windows.Remove(this));
            if (!windows.Contains(this))
            {
                windows.Add(this);
            }

            Reload();
        }
Exemplo n.º 6
0
        public void Initialize(int portNodeId, NodeGraph portGraph)
        {
            this.nodeId = portNodeId;
            this.graph  = portGraph;

            connections ??= new List <PortConnection>();
            connections.ForEach(x => x.Initialize(portGraph));

            //initialize port lifetime
            lifeTimeDefinition ??= new LifeTimeDefinition();
            lifeTime = lifeTimeDefinition.LifeTime;
            lifeTimeDefinition.Release();

            //initialize port value
            portValue.Initialize(fieldName);
            //bind port value to port lifetime
            lifeTime.AddDispose(portValue);
        }
Exemplo n.º 7
0
        public void Initialize(INode data)
        {
            this.node   = data;
            this.nodeId = data.Id;

            connections = connections ?? new List <PortConnection>();
            connections.ForEach(x => x.Initialize(node.GraphData));

            //initialize port lifetime
            lifeTimeDefinition = lifeTimeDefinition ?? new LifeTimeDefinition();
            lifeTime           = lifeTimeDefinition.LifeTime;
            lifeTimeDefinition.Release();

            //initialize port value
            portValue.Initialize(fieldName);
            //bind port value to port lifetime
            lifeTime.AddDispose(portValue);
        }
Exemplo n.º 8
0
        public void Initialize(
            int id,
            IEnumerator enumerator,
            bool moveNextImmediately = false)
        {
            Release();

            lifeTimeDefinition.Release();

            IdValue        = id;
            rootEnumerator = enumerator;
            current        = enumerator;

            SetTaskState(RoutineState.Active);

            if (moveNextImmediately)
            {
                MoveNext();
            }
        }
Exemplo n.º 9
0
        public async UniTask Execute()
        {
            if (isActive.Value)
            {
                await OnAlreadyActive();
            }

            lifeTimeDefinition.Release();


            LifeTime.AddCleanUpAction(OnExit);
            LifeTime.AddCleanUpAction(() => isActive.Value      = false);
            LifeTime.AddCleanUpAction(() => isInitialized.Value = false);

            isActive.Value = true;

            await OnInitialize();

            await OnExecute();

            await OnPostExecute();
        }
Exemplo n.º 10
0
 protected override void OnDestroy()
 {
     _lifeTime.Release();
     base.OnDestroy();
 }
Exemplo n.º 11
0
 public void Disconnect() => _lifeTime.Release();
 public void Unload() => _atlasesLifetime.Release();
Exemplo n.º 13
0
 public void Reset() => _lifeTime?.Release();