void InitData() { animalWin = AnimalRacing_GamePlay_Manager.instance.animalRacingData.currentResultData.animalWin; float _tmpS = 0; // long _tmpSa = 0; for (int i = 0; i < listAnimals.Count; i++) { listAnimals[i].InitData(AnimalRacing_GamePlay_Manager.instance.animalRacingData.currentResultData.listAnimalRunData[i]); if (i == (int)animalWin) { _tmpS = 0f; for (int j = 0; j < listAnimals[i].runData.Length; j++) { _tmpS += (((float)listAnimals[i].runData[j]) / 10f) * Time.fixedDeltaTime * stepRun; } } // _tmpSa = 0; // for(int j = 0; j < listAnimals[i].runData.Length; j++){ // _tmpSa += (((long) listAnimals[i].runData[j])); // } // Debug.LogError(">>> i = " + i + " -- " + _tmpSa); } raceController.InitData(_tmpS); }
public void SetDataHistory(AnimalRacing_AnimalController.AnimalType _animalType, short _scoreHistory, int _index) { if (listBetHistoryOptionDetail == null) { listBetHistoryOptionDetail = new List <AnimalRacing_Panel_BetHistoryOptionDetail_Controller>(); } AnimalRacing_Panel_BetHistoryOptionDetail_Controller _historyDetail = LeanPool.Spawn(optionPrefab, Vector3.zero, Quaternion.identity, myContent.transform).GetComponent <AnimalRacing_Panel_BetHistoryOptionDetail_Controller>(); AnimalRacing_AnimalInfo _animalInfo = null; for (int i = 0; i < AnimalRacing_GamePlay_Manager.instance.listAnimalInfo.Count; i++) { if (AnimalRacing_GamePlay_Manager.instance.listAnimalInfo[i].animalType == _animalType) { _animalInfo = AnimalRacing_GamePlay_Manager.instance.listAnimalInfo[i]; break; } } if (_animalInfo == null) { Debug.LogError(">>> _animalInfo is NULL"); return; } _historyDetail.InitData(_animalInfo.mySprite, _scoreHistory, (_index == 0 ? true : false)); listBetHistoryOptionDetail.Add(_historyDetail); }
// IEnumerator DoActionShowEffWinGold(Vector2 _startPoint, Vector2 _endPoint, int _numGold){ // Vector2 _newStartPoint = Vector2.zero; // for(int i = 0; i < _numGold; i++){ // _newStartPoint.x = Random.Range(_startPoint.x - 0.2f, _startPoint.x + 0.2f); // _newStartPoint.y = Random.Range(_startPoint.y - 0.2f, _startPoint.y + 0.2f); // GoldObjectController _gold = LeanPool.Spawn(goldObjectPrefab, _newStartPoint, Quaternion.identity).GetComponent<GoldObjectController>(); // effectPoolManager.AddObject(_gold); // _gold.InitData(AnimalRacing_GamePlay_Manager.instance.sortingLayerManager.sortingLayerInfo_GoldObject, 1f); // StartCoroutine(_gold.DoActionMoveAndSelfDestruction(_endPoint, 0.8f, LeanTweenType.easeInBack)); // if(_numGold > 1){ // yield return null; // } // } // } // IEnumerator DoActionShowPopupWinGold(Vector2 _pos, long _goldAdd){ // yield return Yielders.Get(1.1f); // PanelBonusGoldInGameController _tmpPanelGoldBonus = LeanPool.Spawn(panelBonusGoldPrefab.gameObject, _pos, Quaternion.identity, myCanvasGroup.transform).GetComponent<PanelBonusGoldInGameController>(); // effectPoolManager.AddObject(_tmpPanelGoldBonus); // _tmpPanelGoldBonus.transform.position = _pos; // _tmpPanelGoldBonus.Show(_goldAdd); // panelUserInGame.RefreshGoldInfo(); // if(AnimalRacing_GamePlay_Manager.instance.CanPlayMusicAndSfx()){ // MyAudioManager.instance.PlaySfx(GameInformation.instance.globalAudioInfo.sfx_Gold); // } // } // IEnumerator DoActionShowPopupWinGold(PanelPlayerInfoInGameController _panelPlayerInfo, Vector2 _pos, long _goldAdd){ // yield return Yielders.Get(0.6f); // PanelBonusGoldInGameController _tmpPanelGoldBonus = LeanPool.Spawn(panelBonusGoldPrefab.gameObject, _pos, Quaternion.identity, myCanvasGroup.transform).GetComponent<PanelBonusGoldInGameController>(); // effectPoolManager.AddObject(_tmpPanelGoldBonus); // _tmpPanelGoldBonus.transform.position = _pos; // _tmpPanelGoldBonus.Show(_goldAdd); // _panelPlayerInfo.RefreshGoldInfo(); // if(AnimalRacing_GamePlay_Manager.instance.CanPlayMusicAndSfx()){ // MyAudioManager.instance.PlaySfx(GameInformation.instance.globalAudioInfo.sfx_Gold); // } // } public void SetUpShadowTable(AnimalRacing_AnimalController.AnimalType _indexExcept, bool _active) { for (int i = 0; i < panelTableBet.listBetOption.Count; i++) { if (panelTableBet.listBetOption[i].animalType != _indexExcept) { panelTableBet.listBetOption[i].SetShadow(_active); } } }
IEnumerator DoActionHighlightIndexBet(AnimalRacing_AnimalController.AnimalType _index) { yield return(panelTableBet.listBetOption[(int)_index].Highlight()); }
public AnimalRacing_Result_Data(MessageReceiving _mess, AnimalRacingData _animalRacingData) { // byte result_index : vị trí về nhất (nếu -1 : lỗi server gold + không đọc tiếp) // byte[9][80] : data mô tả cách chạy của 9 animal cược // short[9] : 9 tỷ lệ cược mới // byte caseCheck // ***Xét trường hợp caseCheck // caseCheck=69 : không có ai đặt cược // caseCheck=-99: lỗi ServerGold // caseCheck=1 : xử lý tiền thành công ⟶ đọc tiếp // byte numberPlayer // for(numberPlayer){ // short sessionid // byte casePlayer // ***Xét trường hợp casePlayer // casePlayer=-55 : lỗi databasePlayer // casePlayer=-88 : lỗi không đủ tiền ⟶ đọc tiếp // long gold_Limit // long GOLD // casePlayer=1 : xử lý tiền thành công // long gold_Limit // long gold_Win // long goldAdd // long GOLD // int achievement : dựa vào ⟶ gold_Win // } animalWin = (AnimalRacing_AnimalController.AnimalType)_mess.readByte(); listAnimalRunData = new sbyte[9][]; for (int i = 0; i < 9; i++) { listAnimalRunData[i] = new sbyte[80]; // chạy 8s, 0.1s cập nhật 1 lần for (int j = 0; j < 80; j++) { listAnimalRunData[i][j] = _mess.readByte(); } } newListCurrentScore = new List <short>(); for (int i = 0; i < 9; i++) { newListCurrentScore.Add(_mess.readShort()); } newListGlobalBet = new List <long>(); for (int i = 0; i < 9; i++) { newListGlobalBet.Add(0); } newListMyBet = new List <long>(); for (int i = 0; i < 9; i++) { newListMyBet.Add(0); } listGoldUpdate = new List <GoldUpdateData>(); valueCheck = _mess.readByte(); switch (valueCheck) { case 1: // cập nhật thành công sbyte _numberPlayer = _mess.readByte(); GoldUpdateData _tmpGoldUpdate = null; for (int i = 0; i < _numberPlayer; i++) { _tmpGoldUpdate = new GoldUpdateData(_mess); listGoldUpdate.Add(_tmpGoldUpdate); } break; case 69: // không có ai đặt cược #if TEST Debug.Log(">>> Không có ai đặt cược"); #endif break; case -99: // lỗi ServerGold #if TEST Debug.Log(">>> Lỗi ServerGold"); #endif break; default: #if TEST Debug.Log(">>> Lỗi không xác định: " + valueCheck); #endif break; } nextTimeToShowResult = System.DateTime.Now.AddMilliseconds(_animalRacingData.duringTime); }