Beispiel #1
0
        private static void SetNewTarget(int index)
        {
            if (s_currentIndex == index)
            {
                return;
            }

            s_currentIndex = index;
            OnTreeChanged?.Invoke(CurrentPlayer?.Tree);
        }
Beispiel #2
0
 private static void UpdatePlayers()
 {
     s_treePlayers  = new TreePlayer[1].Concat(TreePlayer.PlayersCache).ToArray();
     s_playersNames = s_treePlayers.Select(a => a == null ? "Empty" : a.FullName).ToArray();
     s_currentIndex = System.Array.IndexOf(s_playersNames, s_lastSelectedName);
     if (s_currentIndex < 0)
     {
         s_currentIndex = 0;
     }
     OnTreeChanged?.Invoke(CurrentPlayer?.Tree);
 }
Beispiel #3
0
        private static void PlaymodeChanged_Internal(bool isPlaymode)
        {
            if (isPlaymode != s_isPlaymode)
            {
                s_isPlaymode = isPlaymode;

                if (isPlaymode)
                {
                    UpdatePlayers();
                    BehaviourPlayer.OnInstancedOrDestroyed += UpdatePlayers;
                }
                else
                {
                    OnTreeChanged?.Invoke(null);
                    BehaviourPlayer.OnInstancedOrDestroyed -= UpdatePlayers;
                    s_playersNames = null;
                    s_treePlayers  = null;
                    s_currentIndex = 0;
                }
            }
        }
        public void AddBlock(AlgorithmBlockUI beforeBlock, IAlgorithmBlock newBlockData, bool isInside)
        {
            int index = _blocks.IndexOf(beforeBlock) + 1;

            AlgorithmBlockUI newBlock = CreateBlock(newBlockData);

            if (isInside)
            {
                if (beforeBlock.InnerBlock != null)
                {
                    newBlock.NextBlock = beforeBlock.InnerBlock;
                    beforeBlock.InnerBlock.MainPrevBlock = newBlock;
                }

                beforeBlock.InnerBlock = newBlock;
            }
            else
            {
                if (beforeBlock.NextBlock != null)
                {
                    newBlock.NextBlock = beforeBlock.NextBlock;
                    beforeBlock.NextBlock.MainPrevBlock = newBlock;
                }

                beforeBlock.NextBlock = newBlock;

                index = FindOutsidePosition(beforeBlock);
            }

            _blocks.Insert(index, newBlock);

            newBlock.MainPrevBlock     = beforeBlock;
            newBlock.IsInsidePrevBlock = isInside;
            newBlock.RefreshAnData();

            SetContentSiblings();

            RefreshTreeBlocksListeners();
            OnTreeChanged?.Invoke(_blocks);
        }
        private void ModelChanged()
        {
            OnTreeChanged?.Invoke();

            Reload();
        }