Esempio n. 1
0
        public static void Execute(Dictionary <string, string> _params, ActionDelegate _onFinish)
        {
            string command = "";

            if (!_params.TryGetValue("command", out command))
            {
                Log.Error("Invoke", "need params command");
                return;
            }

            _onFinish();

            string path = _params["path"];

            foreach (string uuid in BlockMgr.ListWithPath(path))
            {
                Block block = BlockMgr.FindBlock(uuid);
                if (!block.action.Equals("Entry:OnCommandInvoke"))
                {
                    continue;
                }
                if (!block.param["command"].Equals(command))
                {
                    continue;
                }
                block.Execute();
            }
        }
Esempio n. 2
0
 void Start()
 {
     astro         = GameObject.FindObjectOfType <Player>();
     boss          = GameObject.FindObjectOfType <MazeMgr>();
     b_dude        = GameObject.FindObjectOfType <BlockMgr>();
     startPosition = transform.position;
     origStart     = transform.position;
 }
Esempio n. 3
0
 public void Init()
 {
     Physics.gravity = new Vector3(0, -30.0F, 0);
     uiMgr           = FindObjectOfType <UIMgr>();
     RegisterPlayer(FindObjectOfType <Player>());
     _blockMgr = FindObjectOfType <BlockMgr>();
     _fsm      = StateMachine <PlayState> .Initialize(this, PlayState.Ready);
 }
Esempio n. 4
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 5
0
    //private Transform chilledObject;

    //private Transform child;

    // Start is called before the first frame update
    void Start()
    {
        audioSource = GetComponent <AudioSource>();

        rb2 = GetComponent <Rigidbody2D>();

        fall.enabled = false;
        ctrl.enabled = false;

        timerObject = GameObject.Find("SingleTimer");
        timerScript = timerObject.GetComponent <SingleTimer>();


        countdownObject = GameObject.Find("Countdown");
        countdownScript = countdownObject.GetComponent <TimerControl>();

        createObject = GameObject.Find("SingleCreateBlock");


        createScript = createObject.GetComponent <SingleCreateBlock>();

        timerCheck = timerScript.TimerCount;

        if (timerCheck >= 0)
        {
            start = true;
        }
        else
        {
            fallBlock = GameObject.Find("FallBlock");


            blockMgr = fallBlock.GetComponent <BlockMgr>();



            standBy = true;
            start   = false;
        }

        blockWaiver = false;

        //chilledObject = transform.FindChild("RotationCenter");

        //foreach (Transform child in chilledObject)
        //{
        //    Debug.Log(child.name);
        //}
    }
Esempio n. 6
0
        //
        protected override void ComputePosition(int currentReDrawRequestId)
        {
            var availableWidth = _colWidth;
            var rowHeight      = _squareSized ? availableWidth: _rowHeight;
            var slotMgr        = new BlockMgr(_column);
            var takenSlots     = new List <Block>();

            for (int i = 0; i < _imgs.Count; i++)
            {
                if (currentReDrawRequestId < _redrawRequestId)
                {
                    return;
                }

                if (ImageDisplayModeHelper.IsPortrait(_imgs[i].ClippingRegion))
                {
                    takenSlots.Add(slotMgr.FindAvailableSlot(1));
                }
                else // square or landscape
                {
                    // check if we need more slots for landspace image
                    float imageRatio = 1f * _imgs[i].Original.Width / _imgs[i].Original.Height;
                    int   slotNeeded = MergeColumn ? (int)Math.Round(imageRatio, MidpointRounding.AwayFromZero) : 1;
                    takenSlots.Add(slotMgr.FindAvailableSlot(slotNeeded));
                }
            }

            // converting slots to specific position in grid
            for (int i = 0; i < takenSlots.Count; i++)
            {
                if (currentReDrawRequestId < _redrawRequestId)
                {
                    return;
                }

                Img   iw   = _imgs[i];
                Block slot = takenSlots[i];
                iw.ClippingRegion = new Rectangle
                {
                    X      = (slot.SlotIndex + 1) * _gutter + slot.SlotIndex * availableWidth,
                    Y      = (slot.LaneIndex + 1) * _gutter + slot.LaneIndex * rowHeight - _offsetY,
                    Width  = (slot.SlotNeeded - 1) * _gutter + slot.SlotNeeded * availableWidth,
                    Height = rowHeight
                };
            }

            _virtualHeight = (slotMgr.LaneCount * rowHeight) + (slotMgr.LaneCount - 1) * _gutter;
        }
Esempio n. 7
0
        public static Block[] List(string _path)
        {
            List <Block> blocks = new List <Block>();

            foreach (string uuid in BlockMgr.ListWithPath(_path))
            {
                Block block = BlockMgr.FindBlock(uuid);
                if (null == block)
                {
                    continue;
                }

                blocks.Add(block);
            }
            return(blocks.ToArray());
        }
Esempio n. 8
0
 public void RegisterBlock(Block b, BlockMgr blockMgr)
 {
     _block    = b;
     _blockMgr = blockMgr;
 }
Esempio n. 9
0
 private void preloadBlockManager()
 {
     this.LogTrace("preload Block manager...");
     BlockMgr.Preload();
 }
Esempio n. 10
0
 internal void RegesterBlockMgr(BlockMgr blockMgr)
 {
     _blockMgr = blockMgr;
 }