Exemple #1
0
        public void OnPointerClick(PointerEventData eventData)
        {
            //todo: background outline
            if (eventData.button == PointerEventData.InputButton.Right && !eventData.dragging && !InToolbox && CanBeCloned(null))
            {
                BlockView newBlock = BlocklyUI.WorkspaceView.CloneBlockView(this, XY + BlockViewSettings.Get().BumpAwayOffset);
                newBlock.InitIDs();
                TrackerAsset.Instance.setVar("block_type", Block.Type);
                TrackerAsset.Instance.setVar("action", "duplicate");
                TrackerAsset.Instance.setVar("new_block_id", GameManager.Instance.GetBlockId(newBlock.Block));
                TrackerAsset.Instance.GameObject.Interacted(GameManager.Instance.GetBlockId(Block));

                TrackerAsset.Instance.setVar("block_type", Block.Type);
                TrackerAsset.Instance.setVar("action", "create_clone");

                XmlNode dom  = Xml.BlockToDomWithXY(newBlock.Block, false);
                string  text = UBlockly.Xml.DomToText(dom);
                text = GameManager.Instance.ChangeCodeIDs(text);

                TrackerAsset.Instance.setVar("code", "\r\n" + text);
                TrackerAsset.Instance.GameObject.Interacted(GameManager.Instance.GetBlockId(newBlock.Block));
            }
        }