Ejemplo n.º 1
0
    public static void SendMessageJoinToMiniGame(IMiniGameInfo _gameInfo)
    {
        if (!_gameInfo.isSubGame)
        {
            Debug.LogError(">>> " + _gameInfo.gameType.ToString() + " không phải subgame");
            return;
        }

        switch (_gameInfo.gameType)
        {
        case IMiniGameInfo.Type.DragonTigerCasino:
            messageJoinToMiniGame = new MessageSending(CMD_REALTIME.C_MINIGAME_LONGHO_JOIN_GAME);
            break;

        case IMiniGameInfo.Type.Koprok:
            messageJoinToMiniGame = new MessageSending(CMD_REALTIME.C_MINIGAME_BAUCUA_JOIN_GAME);
            break;

        default:
            messageJoinToMiniGame = null;
            Debug.LogError(">>> Chưa setup API game " + _gameInfo.gameType.ToString());
            break;
        }
        if (messageJoinToMiniGame != null)
        {
            NetworkGlobal.instance.SendMessageRealTime(messageJoinToMiniGame);
        }
    }
Ejemplo n.º 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());
         }
     }
 }
Ejemplo n.º 3
0
 // Default comparer
 public int CompareTo(IMiniGameInfo _compareMiniGameInfo)
 {
     // A null value means that this object is greater.
     if (_compareMiniGameInfo == null)
     {
         return(1);
     }
     else
     {
         return(this.gameId.CompareTo(_compareMiniGameInfo.gameId));
     }
 }
Ejemplo n.º 4
0
 public void InitData()
 {
     listMiniGameDetail = new List <MiniGameDetail> ();
     for (int i = 0; i < CoreGameManager.instance.gameInfomation.listMiniGames.Count; i++)
     {
         IMiniGameInfo _info = CoreGameManager.instance.gameInfomation.listMiniGames[i];
         if (_info.canEnable)
         {
             AddNewGameDetail(_info.gameType);
         }
     }
     isInitialized = true;
 }
Ejemplo n.º 5
0
    /// <summary>
    /// Checks the update for new version.
    ///     - Check dữ liệu mới add thêm vào khi có biến check new version
    /// </summary>
    public void CheckWhenLogin()
    {
        // --- Check For Update New --- //
        if (listMiniGameDetail == null || listMiniGameDetail.Count == 0)
        {
            InitData();
        }
        else
        {
            for (int i = 0; i < CoreGameManager.instance.gameInfomation.listMiniGames.Count; i++)
            {
                IMiniGameInfo _info = CoreGameManager.instance.gameInfomation.listMiniGames[i];
                if (_info != null)
                {
                    if (_info.canEnable)
                    {
                        bool _canAddNew = true;
                        for (int j = 0; j < listMiniGameDetail.Count; j++)
                        {
                            if (_info.gameId == listMiniGameDetail[j].myInfo.gameId)
                            {
                                _canAddNew = false;
                                break;
                            }
                        }
                        if (_canAddNew)
                        {
                            AddNewGameDetail(_info.gameType);
                        }
                    }
                    else
                    {
                        for (int j = 0; j < listMiniGameDetail.Count; j++)
                        {
                            if (_info.gameId == listMiniGameDetail[j].myInfo.gameId)
                            {
                                listMiniGameDetail.RemoveAt(j);
                                break;
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < listMiniGameDetail.Count; i++)
            {
                listMiniGameDetail[i].CheckWhenLogin();
            }
        }
        // --------------------------- //
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Checks the update for new version.
 ///     - Check dữ liệu mới add thêm vào khi có biến check new version
 /// </summary>
 public void CheckWhenLogin()
 {
     // --- Check For Update New --- //
     if (listAchievementDetail == null)
     {
         listAchievementDetail = new List <AchievementDetail>();
     }
     for (int i = 0; i < CoreGameManager.instance.gameInfomation.listMiniGames.Count; i++)
     {
         IMiniGameInfo _info = CoreGameManager.instance.gameInfomation.listMiniGames[i];
         if (_info != null)
         {
             if (_info.canEnable)
             {
                 bool _canAddAchievement = true;
                 for (int j = 0; j < listAchievementDetail.Count; j++)
                 {
                     if (_info.gameType == listAchievementDetail[j].myGameInfo.gameType)
                     {
                         _canAddAchievement = false;
                         break;
                     }
                 }
                 if (_canAddAchievement)
                 {
                     AddNewAchievementDetail(_info.gameType);
                 }
             }
             else
             {
                 for (int j = 0; j < listAchievementDetail.Count; j++)
                 {
                     if (_info.gameType == listAchievementDetail[j].myGameInfo.gameType)
                     {
                         listAchievementDetail.RemoveAt(j);
                         break;
                     }
                 }
             }
         }
     }
     // --------------------------- //
 }
Ejemplo n.º 7
0
    public void InitData(IMiniGameInfo _myMiniGameInfo)
    {
        myMiniGameInfo = _myMiniGameInfo;
        gameId         = myMiniGameInfo.gameId;

        if (myMiniGameInfo.canEnable)
        {
            avatarGameUiEffect.effectFactor = 0f;
            avatarGameUiEffect.effectColor  = Color.white;
            glowUiEffect.effectFactor       = 0f;
            glowUiEffect.effectColor        = Color.white;
        }
        else
        {
            avatarGameUiEffect.effectFactor = 1f;
            avatarGameUiEffect.effectColor  = Color.gray;
            glowUiEffect.effectFactor       = 1f;
            glowUiEffect.effectColor        = Color.gray;
        }

        tmpCountChooseGameFailed = 0;
    }
Ejemplo n.º 8
0
    public void InitData()
    {
        if (!isInstalled)
        {
            IMiniGameInfo _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.AnimalRacing);
            animalRacing.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.HourseRacing);
            horseRacing.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.BattleOfLegend);
            battleOfLegend.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.BattleOfRobots);
            battleOfRobot.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.Baccarat);
            baccarat.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.Blackjack);
            blackjack.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.Poker);
            poker.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.ChineseChess);
            chineseChess.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.KingChess);
            kingChess.InitData(_miniGameInfo);

            _miniGameInfo = CoreGameManager.instance.gameInfomation.GetMiniGameInfo(IMiniGameInfo.Type.Uno);
            uno.InitData(_miniGameInfo);

            myScrollRect.horizontalNormalizedPosition = 0f;

            isInstalled = true;
        }
    }
Ejemplo n.º 9
0
 public void InitData(System.Action <IMiniGameInfo> _onSelected)
 {
     miniGameInfo = GameInformation.instance.GetMiniGameInfo(gameType);
     onSelected   = _onSelected;
 }