Exemple #1
0
        public override void OnGetGameInfo(ISFSObject gameInfo)
        {
            YxDebug.Log("-----------游戏开始--------------");
            var gdata = App.GetGameData <FishGameData>();

            gdata.GameState                = YxGameState.Run;
            State_                         = State.Normal;
            GameOdds.GainRatio             = GameOdds.GainRatios[(int)(BSSetting.GameDifficult_.Val)];
            GameOdds.GainRatioConditFactor = GameOdds.GainRatioConditFactors[(int)(BSSetting.ArenaType_.Val)];
            StartCoroutine(_Coro_MainProcess());
            Pool_GameObj.Init();
            var evtMainProcessStartGame = gdata.EvtMainProcessStartGame;

            if (evtMainProcessStartGame != null)
            {
                evtMainProcessStartGame();
            }
            App.GetGameData <FishGameData>().Msgrate = gameInfo.GetInt(FishRequestKey.Msgrate);
            GameSystemUI.Init(gameInfo);
            PlayersBatterys.Init(gameInfo);
            var self = PlayersBatterys.UserSelf;

            Operation.UserSelf = self;
            if (self.Idx >= PlayersBatterys.Count / 2)
            {
                RotatePond(180);
            }

            FishGenerator.Init(gameInfo);
            StartCoroutine(_Coro_DelayInitGame());
        }
Exemple #2
0
    //void OnDestroy()
    //{
    //    ArcIO.Close();
    //}

    /// <summary>
    /// 开始游戏
    /// </summary>
    public void StartGame()
    {
        if (State_ != State.Idle)
        {
            return;
        }
        State_ = State.Normal;


        //初始化所有玩家
        Transform  prefabPlayerCreatorTs = Prefab_PlayerCreatorSet[(int)BSSetting.GunLayoutType_.Val].transform;
        GameObject playersParent         = new GameObject("Players");

        playersParent.transform.parent        = transform;
        playersParent.transform.localPosition = Vector3.zero;
        Players = new Player[Defines.NumPlayer];

        foreach (Transform t in prefabPlayerCreatorTs)
        {
            PlayerCreator pc   = t.GetComponent <PlayerCreator>();
            Player        pNew = pc.CreatePlayer();
            pNew.transform.parent = playersParent.transform;

            Players[pNew.Idx] = pNew;
            mPControllerIDToPlayerID[pNew.CtrllerIdx] = pNew.Idx;
        }

        //打开所有按键
        mDisableAllPlayerKey  = false;
        mDisableBackGroundKey = false;
        //延时检查
        //StartCoroutine(_Coro_CheckRemainRunTime());

        //StartCoroutine(_Coro_DeleteNullFishInScene());

        //难度调节
        if (BSSetting.Dat_RemoteDiffucltFactor.Val != 0)
        {
            GameOdds.DifficultFactor = (float)(BSSetting.Dat_RemoteDiffucltFactor.Val + 1);
        }

        GameOdds.GainRatio             = GameOdds.GainRatios[(int)(BSSetting.GameDifficult_.Val)];
        GameOdds.GainRatioConditFactor = GameOdds.GainRatioConditFactors[(int)(BSSetting.ArenaType_.Val)];
        //ScenePrelude pl = ScenePreludeMgr.DoPrelude();

        StartCoroutine("_Coro_MainProcess");

        Pool_GameObj.Init();

        if (BSSetting.IsNeedPrintCodeAtGameStart.Val)
        {
            EnterPrintCode();
        }

        //SceneBGMgr.NewBG();

        if (EvtMainProcess_StartGame != null)
        {
            EvtMainProcess_StartGame();
        }
    }