Beispiel #1
0
    private void Awake()
    {
        ghostDestroyed    = false;
        readyForDeathTime = true;

        // Getting components of our block
        movement   = transform.GetComponent <Movement>();
        rotation   = transform.GetComponent <Rotation>();
        blockInput = GameObject.FindGameObjectWithTag(ConstVar.tag_controller).GetComponent <BlockInput>();

        // Reseting all variables in the beginning
        canFall        = true;
        canFastDrop    = true;
        canRotate      = true;
        canRight       = true;
        canLeft        = true;
        canGoVertical  = true;
        canGoVertical2 = true;

        canLeftHelper   = true;
        canRightHelper  = true;
        canRotateHelper = true;

        time = 0;

        rotationForBlock = 0;

        deathTime   = false;
        isBlockDead = false;
    }
Beispiel #2
0
        public static void Notify(object sender, GameEventArgs e)
        {
            switch (e.type)
            {
            case BLOCK_INPUT:
                BlockInput?.Invoke(sender, e);
                break;

            case UNBLOCK_INPUT:
                UnblockInput?.Invoke(sender, e);
                break;

            case BLOCK_HUD:
                BlockHUD?.Invoke(sender, e);
                break;

            case UNBLOCK_HUD:
                UnblockHUD?.Invoke(sender, e);
                break;

            case HIDE_HUD:
                HideHUD?.Invoke(sender, e);
                break;

            case SHOW_HUD:
                ShowHUD?.Invoke(sender, e);
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Use it for notify from EventTrigger Component. Requires to be component on GameObject!
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="e">Event arguments</param>
        public void Notify(string type)
        {
            switch (type)
            {
            case BLOCK_INPUT:
                BlockInput?.Invoke(null, new GameEventArgs(type));
                break;

            case UNBLOCK_INPUT:
                UnblockInput?.Invoke(null, new GameEventArgs(type));
                break;

            case BLOCK_HUD:
                BlockHUD?.Invoke(null, new GameEventArgs(type));
                break;

            case UNBLOCK_HUD:
                UnblockHUD?.Invoke(null, new GameEventArgs(type));
                break;

            case HIDE_HUD:
                HideHUD?.Invoke(null, new GameEventArgs(type));
                break;

            case SHOW_HUD:
                ShowHUD?.Invoke(null, new GameEventArgs(type));
                break;
            }
        }
    private void Awake()
    {
        blockInput = GameObject.FindGameObjectWithTag(ConstVar.tag_controller).GetComponent <BlockInput>();
        row1       = GameObject.Find("ROW_1");
        rowManager = row1.GetComponent <RowManager>();

        // Getting list of prefabs to randomly choose one that will be created
        listOfPrefabs = transform.GetComponent <ListOfPrefabs>();

        // Checking what type of game user has chosen, then we set block_falling_rate
        switch (ActiveGame.gameLevel)
        {
        case ActiveGame.difficulty.easy:
            block_falling_rate = 0.8f;
            block_death_rate   = 0.8f;
            break;

        case ActiveGame.difficulty.medium:
            block_falling_rate = 0.6f;
            block_death_rate   = 0.6f;
            break;

        case ActiveGame.difficulty.hard:
            block_falling_rate = 0.4f;
            block_death_rate   = 0.4f;
            break;
        }

        blocksNames[0] = "Cube.000";
        blocksNames[1] = "Cube.001";
        blocksNames[2] = "Cube.002";
        blocksNames[3] = "Cube.003";
    }
Beispiel #5
0
    public void MapSetting(int iMapIndex)//현재 맵 셋팅
    {
        GameManager.instance.StageIndex = iMapIndex;
        //현재 맵 인덱스 기반
        string Route = "Excel/MapData/" + Util.ConvertToInt(iMapIndex) + "/MapTable";
        //맵 테이블
        var MapTable = EXCEL.ExcelLoad.Read(Route);

        for (int i = 0; i < MapTable.Count; i++)
        {
            string    strClass  = Util.ConvertToString(MapTable[i][BLOCK_DATA.BLOCK_CLASS.ToString()]);
            string    strLinked = Util.ConvertToString(MapTable[i][BLOCK_DATA.BLOCK_LINKED_LIST.ToString()]);
            BlockData Node      = new BlockData(strClass, strLinked);
            m_BlockList.Add(Node);
        }

        //현재 맵 데이터 셋팅
        Debug.Log("MapSetting");
        int iMax = m_BlockList.Count;

        for (int i = 0; i < iMax; i++)
        {
            BlockInput Node = m_MiniMap.transform.GetChild(i).GetComponent <BlockInput>();
            Node.CallBackSetting(MapClassSetting);
            m_BlockInputList.Add(Node);
        }//미니맵 콜백
         //미니맵 콜백
    }
Beispiel #6
0
        private void tef_OnBloqueiaMouseTeclado(object sender, BloqueiaMouseTecladoEventArgs e)
        {
            WriteResp(string.Format("Bloqueia Mouse Teclado: {0}", e.Bloqueia));
#if !DEBUG
            BlockInput.Bloquear(e.Bloqueia);
#endif
            Bloqueado = e.Bloqueia;
        }
Beispiel #7
0
 public async Task Callback(BlockInput input)
 {
     using (var conn = CreateDbConnection())
     {
         var list = new List <dynamic>();
         foreach (var result in input.Results)
         {
             list.Add(new
             {
                 Response = JsonConvert.SerializeObject(result),
                 result.StatusCode,
                 result.ResponseTime,
                 RequestId = result.Identity,
                 input.Identity
             });
         }
         await conn.ExecuteAsync($"UPDATE requestqueue SET response = @Response, statuscode = @StatusCode, responsetime = @ResponseTime WHERE {LeftEscapeSql}identity{RightEscapeSql} = @Identity AND requestid = @RequestId", list);
         await Update(new Block { BlockId = input.BlockId, Exception = input.Exception, Identity = input.Identity, Status = string.IsNullOrWhiteSpace(input.Exception) ? BlockStatus.Success : BlockStatus.Failed });
     }
 }
Beispiel #8
0
        private void acBrECF1_OnPoucoPapel(object sender, EventArgs e)
        {
            try
            {
#if !DEBUG
                if (Bloqueado)
                {
                    BlockInput.Bloquear(!Bloqueado);
                }
#endif

                MessageBox.Show("ATENÇÃO. Detectada proximadade do fim da Bobina", "ACBrFrameowrk TEF Demo");
#if !DEBUG
                BlockInput.Bloquear(Bloqueado);
#endif
            }
            catch (Exception ex)
            {
                messageToolStripStatusLabel.Text     = "Exception";
                descriptionToolStripStatusLabel.Text = ex.Message;
            }
        }
Beispiel #9
0
 private void Awake()
 {
     // Getting block's component
     block      = transform.GetComponent <Block>();
     blockInput = GameObject.FindGameObjectWithTag(ConstVar.tag_controller).GetComponent <BlockInput>();
 }
Beispiel #10
0
        private void HandleBlock(BlockOutput block)
        {
            _runnings.Add(block.Identity);
            BlockInput blockinput = new BlockInput {
                Id = block.Id, Identity = block.Identity, Results = new List <RequestInput>()
            };

            try
            {
                if (block.Requests == null || block.Requests.Count == 0)
                {
                    return;
                }

                Parallel.ForEach(block.Requests, new ParallelOptions {
                    MaxDegreeOfParallelism = block.ThreadNum
                }, (dto) =>
                {
                    for (int i = 0; i < _options.RetryDownload; ++i)
                    {
                        var requestId = dto.Identity;
                        try
                        {
                            var response = _downloader.Download(dto.ToRequest());
                            lock (blockinput)
                            {
                                blockinput.Results.Add(new RequestInput {
                                    CycleTriedTimes = i, Content = response.Content, Identity = requestId, ResponseTime = DateTime.Now, StatusCode = (int)response.StatusCode, TargetUrl = response.TargetUrl
                                });
                            }
                            Log.Logger.Information($"Request {requestId} success.");
                            break;
                        }
                        catch (Exception e)
                        {
                            Log.Logger.Error($"Request {requestId} failed: {e}");
                            Thread.Sleep(300);
                        }
                    }

                    Thread.Sleep(block.Site.SleepTime);
                });
            }
            catch (Exception e)
            {
                blockinput.Exception = e.ToString();
            }
            finally
            {
                _runnings.Remove(block.Identity);

                var json = JsonConvert.SerializeObject(blockinput);
                for (int j = 0; j < _options.RertyPush; ++j)
                {
                    try
                    {
                        var request = new Request(_pushBlockinputUrl);
                        request.Method       = HttpMethod.Post;
                        request.Site         = _brokerSite;
                        request.Content      = json;
                        request.CompressMode = CompressMode.Lz4;
                        _downloader.Download(request);
                        Log.Logger.Information($"Push blockinput {block.Id}, identity {block.Identity} success.");
                        break;
                    }
                    catch (Exception e)
                    {
                        Log.Logger.Error($"Push blockinput failed: {e}.");
                    }
                }
            }
        }