Exemple #1
0
    // public void InitData(ChooseTableScreenController _chooseTableScreen){
    //  if(!isInstalled){
    //      chooseTableScreen = _chooseTableScreen;
    //      MiniGameDetail _gameDetail = DataManager.instance.miniGameData.currentMiniGameDetail;
    //      listRoom = new List<ChooseTable_PanelServerOptionInfo_Controller>();
    //      if(_gameDetail.roomData.listRoomServerDetail == null || _gameDetail.roomData.listRoomServerDetail.Count == 0){
    //          #if TEST
    //          Debug.LogError(">>> BUG Logic: listRoomServerDetail is NULL");
    //          #endif
    //          return;
    //      }
    //      for(int i = 0; i < _gameDetail.roomData.listRoomServerDetail.Count; i++){
    //          ChooseTable_PanelServerOptionInfo_Controller _roomInfo = ((GameObject) Instantiate (prefabRoomOption, myContent.transform, false)).GetComponent<ChooseTable_PanelServerOptionInfo_Controller> ();
    //          _roomInfo.InitData (this, _gameDetail.roomData.listRoomServerDetail[i]);
    //          if(_roomInfo.initDataError){
    //              Destroy(_roomInfo.gameObject);
    //              continue;
    //          }else{
    //              if(_gameDetail.roomData.currentRoomDetail.IsEqual(_gameDetail.roomData.listRoomServerDetail[i])){
    //                  currentRoom = _roomInfo;
    //                  currentRoom.SetFocus();
    //              }
    //          }
    //          listRoom.Add (_roomInfo);
    //          _roomInfo.transform.SetAsFirstSibling();
    //      }

    //      isInstalled = true;
    //  }
    // }

    public void InitData(ChooseTableScreenController _chooseTableScreen)
    {
        if (!isInstalled)
        {
            chooseTableScreen = _chooseTableScreen;
            MiniGameDetail _gameDetail = DataManager.instance.miniGameData.currentMiniGameDetail;
            listRoom = new List <ChooseTable_PanelServerOptionInfo_Controller>();

            for (int i = 0; i < _gameDetail.listServerDetail_Normal.Count; i++)
            {
                ChooseTable_PanelServerOptionInfo_Controller _roomInfo = ((GameObject)Instantiate(prefabRoomOption, myContent.transform, false)).GetComponent <ChooseTable_PanelServerOptionInfo_Controller> ();
                _roomInfo.InitData(this, _gameDetail.listServerDetail_Normal[i]);
                if (_roomInfo.initDataError)
                {
                    Destroy(_roomInfo.gameObject);
                    continue;
                }
                else
                {
                    if (_gameDetail.currentServerDetail.IsEqual(_gameDetail.listServerDetail_Normal[i]))
                    {
                        currentRoom = _roomInfo;
                        currentRoom.SetFocus();
                    }
                }
                listRoom.Add(_roomInfo);
                _roomInfo.transform.SetAsFirstSibling();
            }

            for (int i = 0; i < _gameDetail.listServerDetail_Error.Count; i++)
            {
                ChooseTable_PanelServerOptionInfo_Controller _roomInfo = ((GameObject)Instantiate(prefabRoomOption, myContent.transform, false)).GetComponent <ChooseTable_PanelServerOptionInfo_Controller> ();
                _roomInfo.InitData(this, _gameDetail.listServerDetail_Error[i]);
                if (_roomInfo.initDataError)
                {
                    Destroy(_roomInfo.gameObject);
                    continue;
                }
                else
                {
                    if (_gameDetail.currentServerDetail.IsEqual(_gameDetail.listServerDetail_Error[i]))
                    {
                        currentRoom = _roomInfo;
                        currentRoom.SetFocus();
                    }
                }
                listRoom.Add(_roomInfo);
                _roomInfo.transform.SetAsFirstSibling();
            }

            isInstalled = true;
        }
    }
Exemple #2
0
 public void OnChooseGame(IMiniGameInfo _gameInfo)
 {
     if (!canTouch)
     {
         return;
     }
     if (myCurrentState != MyState.ChooseGame)
     {
         return;
     }
             #if TEST
     Debug.Log("Chọn game: " + _gameInfo.gameType.ToString());
             #endif
     if (_gameInfo.gameType != IMiniGameInfo.Type.DragonTigerCasino &&
         _gameInfo.gameType != IMiniGameInfo.Type.Koprok)
     {
                     #if TEST
         Debug.LogError("Game chưa setup");
                     #endif
         PopupManager.Instance.CreateToast(MyLocalize.GetString("Global/CommingSoon"));
         return;
     }
     if (DataManager.instance.miniGameData.currentSubGameDetail != null)
     {
         if (DataManager.instance.miniGameData.currentSubGameDetail.gameType == _gameInfo.gameType)
         {
             return;
         }
     }
     currentSubGameDetail = DataManager.instance.miniGameData.GetMiniGameDetail(_gameInfo.gameType);
     if (currentSubGameDetail == null)
     {
                     #if TEST
         Debug.LogError("currentGameDetail is null");
                     #endif
         return;
     }
     if (NetworkGlobal.instance.instanceRealTime == null || !NetworkGlobal.instance.instanceRealTime.isRunning)
     {
         StartCoroutine(DoActionChooseServer());
     }
     else
     {
         if (CoreGameManager.instance.currentSceneManager.mySceneType == IMySceneManager.Type.SubGamePlayScene)
         {
             StartCoroutine(DoActionOpenAnotherGamePlay());
         }
         else
         {
             StartCoroutine(DoActionOpenPopupGamePlay());
         }
     }
 }
Exemple #3
0
 public bool IsContainMiniGame(MiniGameDetail _gameDetail)
 {
     if (_gameDetail.myInfo.isSubGame)
     {
         return(true);
     }
     if (listRoomDetail == null || listRoomDetail.Count == 0)
     {
         return(false);
     }
     for (int i = 0; i < listRoomDetail.Count; i++)
     {
         if (_gameDetail.myInfo.gameId == listRoomDetail[i].gameId)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #4
0
 public override void ResetData()
 {
     currentPanel         = null;
     currentSubGameDetail = null;
 }
Exemple #5
0
    public MiniGameDetail ShallowCopy()
    {
        MiniGameDetail other = (MiniGameDetail)this.MemberwiseClone();

        return(other);
    }
Exemple #6
0
    public void InitData(ChooseTableScreenController _chooseTableScreen, bool _createWithRealData = true)
    {
        if (!isInstalled)
        {
            chooseTableScreen = _chooseTableScreen;
            MiniGameDetail _gameDetail = DataManager.instance.miniGameData.currentMiniGameDetail;

            numTableDefault = _chooseTableScreen.numTableDefault;

            Vector2 _pos = myContent.offsetMin;
            _pos.x = 0f;
            myContent.offsetMin = _pos;

            if (listTable == null || listTable.Count == 0)
            {
                if (listTable == null)
                {
                    listTable = new List <ChooseTable_PanelTableOption_Controller> ();
                }

                GameObject _prefabTableOption = GetPrefabTableOptionInfo();
                for (int i = 0; i < numTableDefault; i++)
                {
                    ChooseTable_PanelTableOption_Controller _tableInfo = ((GameObject)Instantiate(_prefabTableOption, myContent.transform, false)).GetComponent <ChooseTable_PanelTableOption_Controller> ();
                    _tableInfo.InitData(chooseTableScreen, null);
                    listTable.Add(_tableInfo);
                }
            }
            if (!_createWithRealData)
            {
                Invoke("ResizeContent", 0.2f);
            }
            else
            {
                RoomDetail _roomDetail = null;
                if (_gameDetail.currentServerDetail != null)
                {
                    for (int i = 0; i < _gameDetail.currentServerDetail.listRoomDetail.Count; i++)
                    {
                        if (_gameDetail.currentServerDetail.listRoomDetail[i].gameId == _gameDetail.myInfo.gameId)
                        {
                            _roomDetail = _gameDetail.currentServerDetail.listRoomDetail[i];
                            break;
                        }
                    }
                }

                if (_roomDetail == null)
                {
                                        #if TEST
                    Debug.LogError("_roomDetail is null: " + _gameDetail.myInfo.gameType.ToString());
                                        #endif
                }

                if (_gameDetail.currentServerDetail == null || _roomDetail == null || _gameDetail.myInfo.versionFeature < _roomDetail.versionRoom)
                {
                    Invoke("ResizeContent", 0.2f);
                    isInstalled = true;
                    return;
                }
                if (_gameDetail.tableData != null && _gameDetail.tableData.listTableDetail.Count != 0)
                {
                    if (listTable.Count > _gameDetail.tableData.listTableDetail.Count)
                    {
                        for (int i = listTable.Count - 1; i >= _gameDetail.tableData.listTableDetail.Count; i--)
                        {
                            Destroy(listTable[i].gameObject);
                            listTable.RemoveAt(i);
                        }
                    }

                    GameObject _prefabTableOption = GetPrefabTableOptionInfo();
                    for (int i = 0; i < _gameDetail.tableData.listTableDetail.Count; i++)
                    {
                        if (i < listTable.Count)
                        {
                            listTable[i].InitData(chooseTableScreen, _gameDetail.tableData.listTableDetail [i]);
                        }
                        else
                        {
                            ChooseTable_PanelTableOption_Controller _tableInfo = ((GameObject)Instantiate(_prefabTableOption, myContent.transform, false)).GetComponent <ChooseTable_PanelTableOption_Controller> ();
                            _tableInfo.InitData(chooseTableScreen, _gameDetail.tableData.listTableDetail [i]);
                            listTable.Add(_tableInfo);
                        }
                    }
                }

                Invoke("ResizeContent", 0.2f);
            }


            isInstalled = true;
        }
    }