예제 #1
0
    public void ShowEffPlayerAddBet(short _chipIndex, sbyte _indexBet)
    {
        if (currentGameState != GameState.Bet)
        {
            return;
        }
        if (_chipIndex == -1)
        {
            Debug.LogError(">>> chipIndex = -1");
            return;
        }

        Vector2 _posStart = iconGoldHolder.position;
        Vector2 _posEnd   = listTableBet[_indexBet].transform.position;

        _posEnd.x = Random.Range(_posEnd.x - 0.2f, _posEnd.x + 0.2f);
        _posEnd.y = Random.Range(_posEnd.y - 0.2f, _posEnd.y + 0.2f);

        IChipInfo            _chipInfo = panelListChip.listChipDetail[_chipIndex].chipInfo;
        ChipObjectController _tmpChip  = LeanPool.Spawn(chipPrefab.gameObject, _posStart, Quaternion.identity).GetComponent <ChipObjectController>();

        effectPoolManager.AddObject(_tmpChip);
        _tmpChip.SetData(_chipInfo, sortingLayerManager.sortingLayerInfo_ChipObject, ratioScale);
        _tmpChip.SetUpMoveToTableBet(_posEnd);
        _tmpChip.RegisCallbackJustMoveFinished(_indexBet, (_i) => {
            MyAudioManager.instance.PlaySfx(myAudioInfo.sfx_Bet);
        });
    }
예제 #2
0
    public void SetUpPlayerAddBet(short _sessionid, short _chipIndex, sbyte _indexBet, long _GOLD)
    {
        if (!AnimalRacing_GamePlay_Manager.instance.CanShowPlayerAddBet())
        {
            return;
        }
        if (_chipIndex == -1)
        {
            Debug.LogError(">>> chipIndex = -1");
            return;
        }

        Vector3 _posStart = Vector3.zero;
        Vector3 _posEnd   = panelTableBet.listBetOption[_indexBet].imgAvatar.transform.position;

        _posEnd.x = Random.Range(_posEnd.x - 0.2f, _posEnd.x + 0.2f);
        _posEnd.y = Random.Range(_posEnd.y - 0.2f, _posEnd.y + 0.2f);

        bool _isError = true;

        if (_sessionid == DataManager.instance.userData.sessionId)
        {
            _posStart = panelUserInGame.userAvata.transform.position;

            panelUserInGame.RefreshGoldInfo();
            panelListChip.SetFocusChipAgain();

            _isError = false;
        }
        else
        {
            for (int i = 0; i < listOtherPlayerInfo.Count; i++)
            {
                if (listOtherPlayerInfo[i].data != null)
                {
                    if (listOtherPlayerInfo[i].data.sessionId == _sessionid)
                    {
                        _posStart = listOtherPlayerInfo[i].transform.position;
                        listOtherPlayerInfo[i].RefreshGoldInfo();
                        _isError = false;
                        break;
                    }
                }
            }
        }
        if (!_isError)
        {
            IChipInfo            _chipInfo = panelListChip.listChipDetail[_chipIndex].chipInfo;
            ChipObjectController _tmpChip  = LeanPool.Spawn(chipPrefab.gameObject, _posStart, Quaternion.identity).GetComponent <ChipObjectController>();
            effectPoolManager.AddObject(_tmpChip);
            _tmpChip.SetData(_chipInfo, AnimalRacing_GamePlay_Manager.instance.sortingLayerManager.sortingLayerInfo_ChipObject, 1f);
            _tmpChip.RegisCallbackJustMoveFinished(_indexBet, (_i) => {
                panelTableBet.listBetOption[_i].ShowGlow();
                if (AnimalRacing_GamePlay_Manager.instance.CanPlayMusicAndSfx())
                {
                    MyAudioManager.instance.PlaySfx(AnimalRacing_GamePlay_Manager.instance.myAudioInfo.sfx_Bet);
                }
            });
            _tmpChip.SetUpMoveToTableBet(_posEnd);
        }
    }